summaryrefslogtreecommitdiff
path: root/Userland/aplay.cpp
AgeCommit message (Collapse)Author
2020-12-02Applications+Userland: Switch to new Audio::Loader APIJulian Offenhäuser
2020-10-15Userland: Add --loop option for aplaynooga
A tiny feature, useful when listening to your favorite song.
2020-08-06Userland: Use Core::ArgsParser for 'aplay'Linus Groh
2020-02-10LibAudio/aplay: Handle WAV header errors properlyWilliam McPherson
We shouldn't just ASSERT() if the header parse fails. This was crashing Piano completely.
2020-02-06LibAudio: Remove leading A from filenamesAndreas Kling
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling
2020-02-06LibAudio: Put all classes in the Audio namespace and remove leading AAndreas Kling
2020-02-02LibCore: Put all classes in the Core namespace and remove the leading CAndreas Kling
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-10-19aplay: Fixed incomplete playback of filesTill Mayer
aplay used to quit as soon as the last enqueue of new buffer data was sucessful. Because the connection closes as soon as the application quits, samples were still in the buffer of the ASBufferQueue as playback was halted.
2019-09-22LibCore: Make CObject reference-countedAndreas Kling
Okay, I've spent a whole day on this now, and it finally kinda works! With this patch, CObject and all of its derived classes are reference counted instead of tree-owned. The previous, Qt-like model was nice and familiar, but ultimately also outdated and difficult to reason about. CObject-derived types should now be stored in RefPtr/NonnullRefPtr and each class can be constructed using the forwarding construct() helper: auto widget = GWidget::construct(parent_widget); Note that construct() simply forwards all arguments to an existing constructor. It is inserted into each class by the C_OBJECT macro, see CObject.h to understand how that works. CObject::delete_later() disappears in this patch, as there is no longer a single logical owner of a CObject.
2019-07-28aplay: s/Sample/Progress/ in the output. It's all in the details!Andreas Kling
2019-07-28LibAudio+aplay: Make the aplay output look a little funner.Andreas Kling
Show some information about the file we're playing, and display how many samples we've played out of how many total. This might be a bit buggy as I haven't tested it with many different files, but it's a start. :^)
2019-07-28AudioServer: Add a buffer queue so we can buffer some sound.Andreas Kling
The idea here is to keep a small number of sample buffers queued in the AudioServer so we don't get caught without something to play.
2019-07-27Audio: Make ABuffer sit on top of a SharedBuffer.Andreas Kling
This allows us to carry the same buffer all the way from the WAV loader to the AudioServer mixer. This alleviates some of the stutter, but there's still a noticeable skip when switching buffers. We're gonna need to do better. :^)
2019-07-27Audio: Make basic streaming WAV playback work.Andreas Kling
I had to solve a bunch of things simultaneously to make this work. Refactor AWavLoader to be a streaming loader rather than a one-shot one. The constructor parses the header, and if everything looks good, you can repeatedly ask the AWavLoader for sample buffers until it runs out. Also send a message from AudioServer when a buffer has finished playing. That allows us to implement a blocking variant of play(). Use all of this in aplay to play WAV files chunk-at-a-time. This is definitely not perfect and it's a little glitchy and skippy, but I think it's a step in the right direction.
2019-07-17Port LibGUI to use CIPCClientSideConnectionRobin Burchell
As a consequence, move to use an explicit handshake() method rather than calling virtuals from the constructor. This seemed to not bother AClientConnection, but LibGUI crashes (rightfully) because of it.
2019-07-17Work on AudioServerRobin Burchell
The center of this is now an ABuffer class in LibAudio. ABuffer contains ASample, which has two channels (left/right) in floating point for mixing purposes, in 44100hz. This means that the loaders (AWavLoader in this case) needs to do some manipulation to get things in the right format, but that we don't need to care after format loading is done. While we're at it, do some correctness fixes. PCM data is unsigned if it's 8 bit, but 16 bit is signed. And /dev/audio also wants signed 16 bit audio, so give it what it wants. On top of this, AudioServer now accepts requests to play a buffer. The IPC mechanism here is pretty much a 1:1 copy-paste from LibGUI/WindowServer. It can be generalized more in the future, but for now I want to get AudioServer working decently first :) Additionally, add a little "aplay" tool to load and play a WAV file. It will break with large WAVs (run out of memory, heh...) but it's a start. Future work needs to make AudioServer block buffer submission from clients until it has played the buffer they are requesting to play.