summaryrefslogtreecommitdiff
path: root/Userland/Applications/Piano
AgeCommit message (Collapse)Author
2021-12-30Everywhere: Use 'increase_slider_by()' method from AbstractSliderElyse
This method help us to avoid repeating the pattern 'set_value(value() + delta)'.
2021-12-20Piano: Make `Key_Space` shortcut to toggle playbackJunior Rantila
2021-12-11Piano: Add track controls to the player widgetJose Flores
Adds the ability to add a track and cycle through the tracks from player widget. Also displays the current track being played or edited in a dropdown that allows for quick track selection.
2021-11-28LibAudio: New error propagation API in Loader and Bufferkleines Filmröllchen
Previously, a libc-like out-of-line error information was used in the loader and its plugins. Now, all functions that may fail to do their job return some sort of Result. The universally-used error type ist the new LoaderError, which can contain information about the general error category (such as file format, I/O, unimplemented features), an error description, and location information, such as file index or sample index. Additionally, the loader plugins try to do as little work as possible in their constructors. Right after being constructed, a user should call initialize() and check the errors returned from there. (This is done transparently by Loader itself.) If a constructor caused an error, the call to initialize should check and return it immediately. This opportunity was used to rework a lot of the internal error propagation in both loader classes, especially FlacLoader. Therefore, a couple of other refactorings may have sneaked in as well. The adoption of LibAudio users is minimal. Piano's adoption is not important, as the code will receive major refactoring in the near future anyways. SoundPlayer's adoption is also less important, as changes to refactor it are in the works as well. aplay's adoption is the best and may serve as an example for other users. It also includes new buffering behavior. Buffer also gets some attention, making it OOM-safe and thereby also propagating its errors to the user.
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-23LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCoreAndreas Kling
With this change, System::foo() becomes Core::System::foo(). Since LibCore builds on other systems than SerenityOS, we now have to make sure that wrappers work with just a standard C library underneath.
2021-11-22Everywhere: Use Application::construct() with Main::Arguments directlyMustafa Quraish
Use the updated API everywhere we are currently manually passing in `arguments.argc` and `arguments.argv`.
2021-11-22Piano: Port to LibMainPascal Puffke
2021-11-22Piano: Move to LibDSP's Classic synthesizerkleines Filmröllchen
Almost all synthesizer code in Piano is removed in favor of the LibDSP reimplementation. This causes some issues that mainly have to do with the way Piano currently handles talking to LibDSP. Additionally, the sampler is gone for now and will be reintroduced with future work.
2021-11-21Piano: Use default sample rate in absence of audio deviceJelle Raaijmakers
2021-11-16Piano: Create controller widgets for processor parameterskleines Filmröllchen
These widgets attach to a processor parameter and keep the two sides in sync. They will become very useful for smart processor interfaces.
2021-11-15Piano: Always show Processor parameter valueskleines Filmröllchen
The processor parameter values are displayed with two decimal places by default. However, when these values become very large and exceed about 7 text symbols, the text is too long to fit the label and it'll simply not show up. This commit fixes that by disabling the decimal place for such large values, which allows us to show values up to 9,999,999, be it only at integer precision.
2021-11-15Audio: Fix code smells and issues found by static analysiskleines Filmröllchen
This fixes all current code smells, bugs and issues reported by SonarCloud static analysis. Other issues are almost exclusively false positives. This makes much code clearer, and some minor benefits in performance or bug evasion may be gained.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-08LibAudio: Rename Audio::Frame -> Audio::SampleDavid Isaksson
"Frame" is an MPEG term, which is not only unintuitive but also overloaded with different meaning by other codecs (e.g. FLAC). Therefore, use the standard term Sample for the central audio structure. The class is also extracted to its own file, because it's becoming quite large. Bundling these two changes means not distributing similar modifications (changing names and paths) across commits. Co-authored-by: kleines Filmröllchen <malu.bertsch@gmail.com>
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-02LibDSP+Piano: Fix visibility of Object-derivative constructorsBen Wiederhake
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult. This commit is separate from the other Applications/Libraries changes because it required additional adaption of the code. Note that the old code did precisely what these changes try to prevent: Create and handle a ref-counted object with a refcount of zero.
2021-11-02Applications: Fix visibility of Object-derivative constructorsBen Wiederhake
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult.
2021-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-10-27Piano: Fix typo in Copyright headerBen Wiederhake
This was introduced in 74f1f2b5e2ed9b06f7dc5c4a247c8512c8b3ec32. I have no idea why the checker script didn't pick it up. Bash bug maybe?
2021-10-01Userland: Fix typosNico Weber
2021-09-12Audio: Change how volume workskleines Filmröllchen
Across the entire audio system, audio now works in 0-1 terms instead of 0-100 as before. Therefore, volume is now a double instead of an int. The master volume of the AudioServer changes smoothly through a FadingProperty, preventing clicks. Finally, volume computations are done with logarithmic scaling, which is more natural for the human ear. Note that this could be 4-5 different commits, but as they change each other's code all the time, it makes no sense to split them up.
2021-09-04Piano: Format slider values when initially setMusab Kılıç
2021-09-03Piano: Draw note names on top of notesMusab Kılıç
2021-09-03AK: Rename create<T> => make_ref_counted<T>Andreas Kling
And also try_create<T> => try_make_ref_counted<T>. A global "create" was a bit much. The new name matches make<T> better, which we've used for making single-owner objects since forever.
2021-08-31Piano: Use LibDSP to implement delaykleines Filmröllchen
This is the first step in transitioning Piano to a full LibDSP backend. For now, the delay effect is replaced with a (mostly identical) implementation in LibDSP. The new ProcessorParameterSlider attaches to a LibDSP::Processor's range parameter (LibDSP::ProcessorRangeParameter) and changes it automatically. It also has the ability to update an external GUI::Label. This is used for the three delay parameters and it will become useful for auto-generating UI for Processors.
2021-08-31Piano: Add velocity and pitch supportkleines Filmröllchen
As Piano will later move to the RollNote defintions of LibDSP, it's a good idea to already insert velocity and pitch support, even though it's currently not used.
2021-08-27Userland: Two low-sample rate fixeskleines Filmröllchen
1) The Sound Player visualizer couldn't deal with small sample buffers, which occur on low sample rates. Now, it simply doesn't update its buffer, meaning the display is broken on low sample rates. I'm not too familiar with the visualizer to figure out a proper fix for now, but this mitigates the issue (and "normal" sample rates still work). 2) Piano wouldn't buffer enough samples for small sample rates, so the sample count per buffer is now increased to 2^12, introducing minor amounts of (acceptable) lag.
2021-08-27Userland+LibAudio: Make audio applications support dynamic sample ratekleines Filmröllchen
All audio applications (aplay, Piano, Sound Player) respect the ability of the system to have theoretically any sample rate. Therefore, they resample their own audio into the system sample rate. LibAudio previously had its loaders resample their own audio, even though they expose their sample rate. This is now changed. The loaders output audio data in their file's sample rate, which the user has to query and resample appropriately. Resampling code from Buffer, WavLoader and FlacLoader is removed. Note that these applications only check the sample rate at startup, which is reasonable (the user has to restart applications when changing the sample rate). Fully dynamic adaptation could both lead to errors and will require another IPC interface. This seems to be enough for now.
2021-08-18Userland+LibGUI: Add shorthand versions of the Margins constructorsin-ack
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same margin on all edges, for example. The constructors follow CSS' style of specifying margins. The added constructors are: - Margins(int all): Sets the same margin on all edges. - Margins(int vertical, int horizontal): Sets the first argument to top and bottom margins, and the second argument to left and right margins. - Margins(int top, int vertical, int bottom): Sets the first argument to the top margin, the second argument to the left and right margins, and the third argument to the bottom margin.
2021-08-01Applications: Remove unused header includesBrian Gianforcaro
2021-07-31Piano: Add menus before showing the windowLuK1337
Otherwise, space is reserved but menus aren't shown.
2021-07-21Userland: Add GUI::Window::add_menu() and use it everywhereAndreas Kling
Applications previously had to create a GUI::Menubar object, add menus to it, and then call GUI::Window::set_menubar(). This patch introduces GUI::Window::add_menu() which creates the menubar automatically and adds items to it. Application code becomes slightly simpler as a result. :^)
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-14Piano: Add Play/Pause, Forward and Back buttonsJJ Roberts-White
Piano now has a toolbar allowing the playback to be paused, or to be stepped forward or back a note.
2021-07-05Piano: Use AudioServer instead of /dev/audio for audiokleines Filmröllchen
Piano is an old application that predates AudioServer. For this reason, it was architected to directly talk to the soundcard via the /dev/audio device. This caused multiple problems including simultaneous playback issues, no ability to change volume/mute for Piano and more. This change moves Piano to use AudioServer like any well-behaved audio application :^) The track processing and IPC communication is moved to the main thread because IPC doesn't like multi-threading. For this, the new AudioPlayerLoop class is utilized that should evolve into the DSP->AudioServer interface in the future. Because Piano's CPU utilization has gotten so low (about 3-6%), the UI update loop is switched back to render at exactly 60fps. This is an important commit on the road to #6528.
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-06-15AK: Add support for removing SinglyLinkedList nodes during iterationIdan Horowitz
This commit also fixes the now-broken usage of SinglyLinkedList::remove in the Piano application.
2021-05-23LibIPC: Remove unnecessary IPC::ServerConnection::handshake()Andreas Kling
This is no longer used by any of our IPC pairs.
2021-05-22Userland: Rename LibThread => LibThreadingAndreas Kling
Also rename the "LibThread" namespace to "Threading"
2021-05-21Applications: Use titlecase and distinct underlined characters in menusMax Wipfli
This changes (context) menus across the system to conform to titlecase capitalization and to not underline the same character twice (for accessing actions with Alt).
2021-05-21Userland: Change typedef to using directiveLenny Maiorani
Problem: - `typedef`s are read backwards making it confusing. - `using` statements can be used in template aliases. - `using` provides similarity to most other C++ syntax. - C++ core guidelines say to prefer `using` over `typedef`: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using Solution: - Switch these where appropriate.
2021-05-17Piano: Use the return key emoji in the key labelsGrant Yap
The new way labels are stored unfortunately makes it *slightly* less convenient to update the lists of white key and black key labels.
2021-05-13Userland: Tighten a *lot* of pledges! :^)Andreas Kling
Since applications using Core::EventLoop no longer need to create a socket in /tmp/rpc/, and also don't need to listen for incoming connections on this socket, we can remove a whole bunch of pledges!
2021-05-12Everywhere: Add Alt shortcuts to remaining top-level menusLinus Groh
Not sure why some menus did have one and others didn't, even in the same application - now they all do. :^) I added character shortcuts to some menu actions as well.
2021-05-12LibCore+Everywhere: Move OpenMode out of IODeviceAli Mohammad Pur
...and make it an enum class so people don't omit "OpenMode".
2021-05-03LibGUI: Rename ScrollableWidget => AbstractScrollableWidgetAndreas Kling
2021-05-02LibGfx: Unify Rect, Point, and SizeMatthew Olsson
This commit unifies methods and method/param names between the above classes, as well as adds [[nodiscard]] and ALWAYS_INLINE where appropriate. It also renamed the various move_by methods to translate_by, as that more closely matches the transformation terminology.