summaryrefslogtreecommitdiff
path: root/Userland/Applets/Audio
AgeCommit message (Collapse)Author
2022-08-14Base: Launch AudioServer at session start-upLucas CHOLLET
2022-07-19LibAudio: Rename ConnectionFromClient to ConnectionToServerkleines Filmröllchen
The automatic nomenclature change for IPC sockets got this one wrong.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-21LibAudio+Userland: Use new audio queue in client-server communicationkleines Filmröllchen
Previously, we were sending Buffers to the server whenever we had new audio data for it. This meant that for every audio enqueue action, we needed to create a new shared memory anonymous buffer, send that buffer's file descriptor over IPC (+recfd on the other side) and then map the buffer into the audio server's memory to be able to play it. This was fine for sending large chunks of audio data, like when playing existing audio files. However, in the future we want to move to real-time audio in some applications like Piano. This means that the size of buffers that are sent need to be very small, as just the size of a buffer itself is part of the audio latency. If we were to try real-time audio with the existing system, we would run into problems really quickly. Dealing with a continuous stream of new anonymous files like the current audio system is rather expensive, as we need Kernel help in multiple places. Additionally, every enqueue incurs an IPC call, which are not optimized for >1000 calls/second (which would be needed for real-time audio with buffer sizes of ~40 samples). So a fundamental change in how we handle audio sending in userspace is necessary. This commit moves the audio sending system onto a shared single producer circular queue (SSPCQ) (introduced with one of the previous commits). This queue is intended to live in shared memory and be accessed by multiple processes at the same time. It was specifically written to support the audio sending case, so e.g. it only supports a single producer (the audio client). Now, audio sending follows these general steps: - The audio client connects to the audio server. - The audio client creates a SSPCQ in shared memory. - The audio client sends the SSPCQ's file descriptor to the audio server with the set_buffer() IPC call. - The audio server receives the SSPCQ and maps it. - The audio client signals start of playback with start_playback(). - At the same time: - The audio client writes its audio data into the shared-memory queue. - The audio server reads audio data from the shared-memory queue(s). Both sides have additional before-queue/after-queue buffers, depending on the exact application. - Pausing playback is just an IPC call, nothing happens to the buffer except that the server stops reading from it until playback is resumed. - Muting has nothing to do with whether audio data is read or not. - When the connection closes, the queues are unmapped on both sides. This should already improve audio playback performance in a bunch of places. Implementation & commit notes: - Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept for WavLoader, see previous commit message. - Most intra-process audio data passing is done with FixedArray<Sample> or Vector<Sample>. - Improvements to most audio-enqueuing applications. (If necessary I can try to extract some of the aplay improvements.) - New APIs on LibAudio/ClientConnection which allows non-realtime applications to enqueue audio in big chunks like before. - Removal of status APIs from the audio server connection for information that can be directly obtained from the shared queue. - Split the pause playback API into two APIs with more intuitive names. I know this is a large commit, and you can kinda tell from the commit message. It's basically impossible to break this up without hacks, so please forgive me. These are some of the best changes to the audio subsystem and I hope that that makes up for this :yaktangle: commit. :yakring:
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-06AK+Userland: Rename Array::front/back to first/lastSam Atkins
This is the name that is used for every other collection type so let's be consistent.
2022-03-04LibGfx: Rename Color::from_rgba() => Color::from_argb()Andreas Kling
This matches the rename of RGBA32 to ARGB32. It also makes more sense when you see it used with 32-bit hexadecimal literals: Before: Color::from_rgba(0xaarrggbb) After: Color::from_argb(0xaarrggbb)
2022-02-25Userland: Rename IPC ClientConnection => ConnectionFromClientItamar
This was done with CLion's automatic rename feature and with: find . -name ClientConnection.h | rename 's/ClientConnection\.h/ConnectionFromClient.h/' find . -name ClientConnection.cpp | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25Applets: Update Audio applet FrameShape and adjust dimensionsthankyouverycool
Uses the new Window FrameShape. Fixes margins for erroneously elided CheckBoxes. Demystifies the numbers used to calculate the slider window rect.
2022-02-13Userland/Applets: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-11LibConfig: Rename pledge_domains(String) => pledge_domain(String)Vitaly Dyachkov
pledge_domains() that takes only one String argument was specifically added as a shortcut for pledging a single domain. So, it makes sense to use singular here.
2022-01-28Applets/Audio: Use Array for the volume level bitmapskleines Filmröllchen
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2022-01-14Everywhere: Use my new serenityos.org e-mail :^)kleines Filmröllchen
2022-01-11Applets/Audio: Propagate errors by extracting out GUI initializationcreator1creeper1
This commit extracts out the GUI initialization in AudioWidget into the new try_initialize_graphical_elements function. This function is now able to use try_set_main_widget instead of set_main_widget. It's only called by the fallible try_create method.
2022-01-03Applets/Audio: Propagate errors using custom try_createcreator1creeper1
We now move-construct the bitmaps into the AudioWidget.
2022-01-03Applets/Audio: Propagate errors with try_set_main_widgetcreator1creeper1
Use try_set_main_widget instead of set_main_widget.
2021-12-24Everywhere: Refactor 'muted' to 'main_mix_muted' in all AudioConnectionsElyse
The 'muted' methods referred to the 'main mix muted' but it wasn't really clear from the name. This change will be useful because in the next commit, a 'self muted' state will be added to each audio client connection.
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-24Applets/Audio: Remove unveiling /tmp/portal/configRalf Donau
2021-11-24Applets/Audio: Port to LibMain :^)Andreas Kling
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-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-09-22LibGUI: Rename CallOnChange => AllowCallback and implement elsewherethankyouverycool
This is a helpful option to prevent unwanted side effects, distinguish between user and programmatic input, etc. Sliders and SpinBoxes were implementing it idiosyncratically, so let's generalize the API and give Buttons and TextEditors the same ability.
2021-09-19AudioApplet: Refactor window resizingDavid Isaksson
2021-09-19AudioApplet: Get values from AudioServer instead of the config fileDavid Isaksson
2021-09-19AudioApplet: Make sure to set the internal volume on slider changeDavid Isaksson
This fixes the issue that the percent label doesn't update.
2021-09-19AudioApplet: Round the volume to the nearest integerDavid Isaksson
2021-09-19AudioApplet: Update the volume slider on update from audio serverDavid Isaksson
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-04AudioApplet: Fix initial mute stateKarol Kosek
During conversion from Core::ConfigFile to LibConfig in c646efaf49e2d79d7cbcabb561c62977f2f084d3, the requested key name has been changed from 'Mute' to 'Muted', resulting in using always the default value.
2021-08-31AudioApplet: Fix applet positioning bugJoe Bentley
Currently when clicking the percentage toggle, there is a delay in moving the applet window position. This is because after the applet is resized, the applet area is repositioned asynchronously. This takes advantage of the new AppletAreaRectChange event to reposition the slider window when necessary.
2021-08-27AudioApplet: Remove `wpath` and `cpath` priviligesMustafa Quraish
2021-08-27AudioApplet: Use LibConfig instead of Core::ConfigFileMustafa Quraish
No longer need to store `RefPtr<Core::ConfigFile>` :^)
2021-08-22Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to opennetworkException
This patch brings the ConfigFile helpers for opening lib, app and system configs more inline with the regular ConfigFile::open functions.
2021-08-22Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writingnetworkException
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-18Userland+LibGUI: Make Margins arguments match CSS orderingsin-ack
Previously the argument order for Margins was (left, top, right, bottom). To make it more familiar and closer to how CSS does it, the argument order is now (top, right, bottom, left).
2021-08-17AudioApplet: Persist settings and respect audio server settingskleines Filmröllchen
The audio applet uses the user configuration file "AudioApplet.ini" to persist its settings, currently only whether the audio percentage should be shown. Since the audio server now may have specific settings when it starts, the audio applet respects them by reading these same settings once when it starts. Therefore, the audio server settings are not immediately overridden by the audio applet defaults, as was the case before this change. A minor change was done to the way that the audio volume is calculated; doubles are now used.
2021-08-04AudioWidget: Proper volume changes when scrolling on the widgetkleines Filmröllchen
Because setting the slider's value in the mousewheel handler will cause the volume logarithm logic and the volume setting to happen anyways, we don't need to do it in the mousewheel handler again. By just moving the slider up and down with the scroll wheel, we mimic normal SliderWidget behavior that doesn't exhibit the multiple previous bugs.
2021-08-01Applets: Remove unused header includesBrian Gianforcaro
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
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-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-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-04WindowServer+LibGUI: Rename WindowType::MenuApplet => AppletAndreas Kling
2021-04-04Userland: Rename *.MenuApplet => *.AppletAndreas Kling
These are no longer displayed in the menu, so it doesn't make sense to call them menu applets. :^)