summaryrefslogtreecommitdiff
path: root/Applications/Piano
AgeCommit message (Collapse)Author
2020-10-06Piano: Use new format functions.asynts
2020-09-08Refactor: Replace usages of FixedArray with Array.asynts
2020-08-27Meta: Force semi-colon after MAKE_AK_NONXXXABLE()Ben Wiederhake
Before, we had about these occurrence counts: COPY: 13 without, 33 with MOVE: 12 without, 28 with Clearly, 'with' was the preferred way. However, this introduced double-semicolons all over the place, and caused some warnings to trigger. This patch *forces* the usage of a semi-colon when calling the macro, by removing the semi-colon within the macro. (And thus also gets rid of the double-semicolon.)
2020-08-17Piano: Uninitialized member variables in RollWidet, found by CoverityBrian Gianforcaro
This seem like they wouldn't cause any problems in reality, but it's nice to fix them to avoid any future misuse.
2020-08-01Applications: Stop setting initial window locationPeter Elliott
This will let the WindowManager choose the location of the window
2020-07-16LibWeb: Require parent window argument for MessageBoxTom
Since the vast majority of message boxes should be modal, require the parent window to be passed in, which can be nullptr for the rare case that they don't. By it being the first argument, the default arguments also don't need to be explicitly stated in most cases, and it encourages passing in a parent window handle. Fix up several message boxes that should have been modal.
2020-07-16LibGUI: Add parent window argument to FilePicker functionsTom
Since FilePicker almost always should be modal, add the parent window as mandatory first argument.
2020-07-11Piano: Fix cliping of bottom notes when scrolling in RollWidgetPeter Elliott
fixes #2577
2020-07-11Piano: Handle octave slider jumps of greater than 1Peter Elliott
The previous slider handler relied on the new value being 1 different than the previous. fixes #1163.
2020-07-07Piano: Make menu bar consistent with other appsNico Weber
"Help" should be after "Edit". The "Quit" menu item should be at the end of the app menu, and after a separator.
2020-07-04LibGUI: Turn GUI::Application::the() into a pointerAndreas Kling
During app teardown, the Application object may be destroyed before something else, and so having Application::the() return a reference was obscuring the truth about its lifetime. This patch makes the API more honest by returning a pointer. While this makes call sites look a bit more sketchy, do note that the global Application pointer only becomes null during app teardown.
2020-07-04LibGUI: Make GUI::Application a Core::ObjectAndreas Kling
Having this on the stack makes whole-program teardown iffy. Turning it into a Core::Object allows anyone who needs it to extends its lifetime.
2020-06-18Piano: Expose multi-track functionalityWilliam McPherson
This commit adds some actions for creating and cycling through tracks. set_octave_and_ensure_note_change() was refactored to allow switching tracks to implement the same behaviour. KnobsWidget is getting pretty bad.
2020-06-18Piano: Allow multiple tracks internallyWilliam McPherson
This commit adds multi-track functionality without exposing it to the user. All I really did was rename AudioEngine to Track and allow more than one Track in TrackManager. A lot of the changes are just changing widgets to take a TrackManager and use current_track(). The TrackManager creates Tracks and gives them a read-only reference to the global time value. When the TrackManager wants to fill a sample in the buffer (in fill_buffer()), it calls fill_sample() on each Track. The delay code is slightly different - a Track will fill its m_delay_buffer with the sample it just created rather than the most recent sample in the buffer (which used to be the same thing). TrackManager manages the current octave. Other than those few things, this is a pretty basic separation of concerns.
2020-06-10LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSizeAndreas Kling
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much better visual clue about what type of metric is being used.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-12LibGUI: Include keyboard modifier state with button on_click callsAndreas Kling
This will allow you us to implement special behavior when Ctrl+clicking a button.
2020-04-21LibGUI: Make MenuBar a Core::ObjectAndreas Kling
This makes it show up in Inspector with all the menus inside it. :^)
2020-04-15Piano: Use NumericLimits<T>Andreas Kling
2020-04-04LibGUI: Add MenuBar::add_menu(name)Andreas Kling
This allows us to construct menus in a more natural way: auto& file_menu = menubar->add_menu("File"); file_menu.add_action(...); Instead of the old way: auto file_menu = GUI::Menu::construct(); file_menu->add_action(...); menubar->add_menu(file_menu);
2020-03-19Applications: Remove G prefixes from commentsTibor Nagy
2020-03-04LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clientsAndreas Kling
2020-03-04LibGUI: Use set_layout<LayoutType>() in lots of client codeAndreas Kling
2020-03-03LibGUI: Remove Button& parameter from Button::on_click hookAndreas Kling
There was but a single user of this parameter and it's a bit tedious to write it out every time, so let's get rid of it.
2020-02-27Piano: New timing system and zoomable piano rollWilliam McPherson
This patch allows roll notes to be of different sizes. This necessitates a new internal representation of time. BPM and time signatures are mostly implemented but not exposed. Roll notes are now sample-accurate and the grid is aligned to 60 BPM 4/4. The roll is divided by the time signature raised to some power of 2, giving the musical divisions of (in the case of 4/4) 16, 32, 64 etc. Before, our timing was derived from the buffer size and we relied on that to implement delay. Delay has been rewritten to be sample-granular. It's now exposed as the proper "divisions of a beat". Something to be wary of is that the last buffer in the loop is also used for the start of the next loop. In other words, we loop mid-buffer. This means we write WAVs with a tiny bit of silence due to breaking the loop after filling half a buffer. The data structure for the roll is an array of SinglyLinkedLists of RollNotes. Separating by pitch (via the array layout) makes insertion much simpler and faster. Using sorted lists (and thus SinglyLinkedListIterators) to do lookups is very quick as you know the sample of the next note and can just compare it to the current sample. I implemented this with HashMaps and the cost of lookups was abysmal. I also tried a single SinglyLinkedList and the insertion code got even more complicated than it already is.
2020-02-25AK: Make Queue use size_t for its sizeAndreas Kling
2020-02-25AK: Make Vector use size_t for its size and capacityAndreas Kling
2020-02-23LibGUI: Add helper for constructing new TabWidget tabsAndreas Kling
This patch adds the following convenience helper: auto tab_widget = GUI::TabWidget::construct(); auto my_widget = tab_widget->add_tab<GUI::Widget>("My tab", ...); The above is equivalent to: auto tab_widget = GUI::TabWidget::construct(); auto my_widget = GUI::Widget::construct(...); tab_widget->add_widget("My tab", my_widget);
2020-02-23LibGUI: Make GUI::Frame have the 2px sunken container look by defaultAndreas Kling
The overwhelming majority of GUI::Frame users set the same appearance, so let's just make it the default.
2020-02-23Userspace: Use Core::Object::add() when building interfacesAndreas Kling
2020-02-16Piano: Set step property for ADSR slidersTibor Nagy
2020-02-16LibGUI: Add forwarding headerAndreas Kling
This patch adds <LibGUI/Forward.h> and uses it a bunch. It also dragged various header dependency reduction changes into it.
2020-02-15LibGUI: Reduce menu-related header dependenciesAndreas Kling
2020-02-10LibAudio/Piano: Replace floats with doublesWilliam McPherson
We should default to double-precision so that clients can make the choice to use float or double.
2020-02-10Piano: Draw stereo wavesWilliam McPherson
Draw two waves in different colors.
2020-02-10Piano: Try to be more stereo-orientedWilliam McPherson
2020-02-10Piano: Add nice scale factor to WaveWidgetWilliam McPherson
2020-02-10Piano: Ensure WaveWidget paints in-boundsWilliam McPherson
Letting GUI::Frame::paint_event() cover up your mistakes is tacky :P
2020-02-10Piano: Put reset() with other settersWilliam McPherson
2020-02-10Piano: Add samplerWilliam McPherson
This commit adds basic support for importing, viewing and playing WAV samples at different pitches. Naming issues: - We are using the Sample struct from Music.h, but also the Sample struct from LibAudio (Audio::Sample). This is a little confusing. set_recorded_sample() finds the peak sample and then divides all the samples by that peak to get a guaranteed min/max of -1/1. This is nice because our other waves are also bound between these values and we can just do the same stuff. This is why we're using Audio::Sample, because it uses floats, whereas Music.h's Sample uses i16s. It's a little annoying that we have to use a mixture of floats and doubles though. For playback at lower frequencies, we're calculating in-between samples, rather than just playing samples multiple times. Basically, you get the current sample and add the difference between the current sample and the next sample multiplied by the distance from the current sample. This is like drawing the hypotenuse of a right-angled triangle.
2020-02-06LibGUI: Remove leading G from filenamesAndreas Kling
2020-02-06Piano: Add export actionWilliam McPherson
This is a pretty rudimentary WAV export function for Piano.
2020-02-06Piano: Fix roll playback at startupWilliam McPherson
This is not a bug currently, since the first column immediately starts playing at startup and leaves no time for the user to put notes in it. However, this is needed for exporting.
2020-02-06Piano: Move piano roll internals to AudioEngineWilliam McPherson
The piano roll data definitely belongs in AudioEngine along with the note and time data. Now RollWidget only has GUI information, much like the other widgets. Note that this commit exacerbates issue #1158 which is caused by RollWidget::paint_event().
2020-02-06LibAudio: Remove leading A from filenamesAndreas Kling
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling
2020-02-06LibGUI: Rename {H,V}BoxLayout => {Horizontal,Vertical}BoxLayoutAndreas Kling
2020-02-06LibGUI: Add HorizontalSlider and VerticalSlider convenience classesAndreas Kling
2020-02-06LibGfx: Prefer using Gfx::Bitmap::load_from_file instead of load_png()Andreas Kling
Code that just wants to open a Gfx::Bitmap from a file should not be calling the PNG codec directly.
2020-02-06LibGfx: Unpublish Gfx::Point from global namespaceAndreas Kling