Rewrite some of the output and a lot of the downmixer to use Accelerate
framework instead of dumb for loops.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Add safety check to check if a device is actually alive when enumerating
it, and also add nil pointer checks for the device name before trying to
CFRelease it. Fixes a rare crash on device add/remove cycle, such as
Bluetooth headphones.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
These two changes fix playback issues with either starting in the middle
of the playlist on a really short file terminating immediately instead
of queueing more files (InputNode.m), and issues with starting playback
at all on the end of a playlist on a short file. (OutputCoreAudio.m)
Fixes#246
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
IN A.D. 2101, WAR WAS BEGINNING. *boom*
Yeah, this was a dumb bug, I didn't realize that AUAudioUnit would just
arbitrarily ignore my configured block size and request a different one.
The AirPods Pro will just request 480 instead of the 512 I ask for, so
let's instead support variable block sizes, and only take up to the last
4096 samples of the chunk fed to the output device.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
A bad sample scanner and cleaner will point out in the log whenever a
bad sample, such as infinity, or Not a Number, or even huge values over
±2.0, in case some piece of code, or a decoder, or even a bad file, has
taken over the output.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The quality of the equalizer dialog is now up to par with what we had
before, minus all the crashes.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Borrowing some DFT code from deadbeef, this implements a simple spectrum
visualization into the main toolbar of the app.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Now the output is restarted on the current file at the current position
if the output format has changed. This should resolve the issue finally.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This was buggy as hell, and resulted in errors. Now the user should
restart playback if they change output device formats.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Sample format can now change dynamically at play time, and the player
will resample it as necessary, extrapolating edges between changes to
reduce the potential for gaps.
Currently supported formats for this:
- FLAC
- Ogg Vorbis
- Any format supported by FFmpeg, such as MP3 or AAC
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
By applying copious amounts of autorelease pools, memory is freed in a
timely manner. Prior to this, buffer objects were freed, but not being
released, and thus accumulating in memory indefinitely, as the original
threads and functions had autorelease pools that scoped the entire
thread, rather than individual function blocks that utilized the new
buffering system. This fixes memory growth caused by playback.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This implements the basic output and mixing support for channel config
bits, optionally set by the input plugin.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Rewrite attempt number two. Now using array lists of audio chunks, with
each chunk having its format and optionally losslessness stashed along
with it. This replaces the old virtual ring buffer method. As a result
of this, the HRIR toggle now works instantaneously.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
After all this rewriting, down or upmixing the audio is now handled with
the lowest latency possible, meaning that toggling the HRIR option now
takes effect immediately.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This seals up a major memory leak of the playback state whenever a chain
is released on stop or on manual track change. CogAudioMulti was
retaining the input node due to its listeners, and InputNode was not
releasing the listeners when asked to stop running. This is fixed now.
Fixes#221
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The thread wait on shutdown had the potential to lock up waiting for the
thread to shut down. Now it should at least spam the semaphores, so that
the thread should progress to shutdown a lot quicker.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Add a safety fix for pausing and shutting down, so that we don't call
into AUAudioUnit's stopHardware function unless the stream has already
been started by the output.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Reduce the timing at which an end of file notification is sent to the
main thread from 16384 bytes to 8192 bytes. This may help with playback
of a lot of really small files, and skipping tracks.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>