The converter doesn't just require an output format call, it also
requires this input format change callback to actually signal it to
reopen the converter process with a new format setup.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Move the DSPs to the output node, so they don't get closed and reopened
across each file. Also restructure the output handler to buffer a little
on its own, to account for track switch activity.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Buffers were being treated as empty before they were actually processed,
due to races between the current node's end of stream marker and
actually feeding the output buffer.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This required some minor workarounds to deal with the play time counting
that works toward play count reporting.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Seeking should clear the buffers completely now, and will be nearly
instant, depending on how fast the input can decode.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Seeking now mutes properly, and will not leave the audio muted across
other operations. Audio output changes should also mute and destroy the
buffers of the input chain, so that the audio resets properly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Check all audio chain elements for allocation failures, and also dispose
of all of the previous handles in reverse order, including nulling the
final node handle so the output does not attempt to poll for audio while
the chain is being rebuilt.
Also set up output node to handle the new null finalNode state, and
return an empty chunk to the caller.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
We should not be processing a potential playback restart when the chain
is being torn down for shutdown.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Fixes timestamps in several cases where they were being processed
incorrectly, which was causing some chunked audio files to mis-report
timestamps into the past or the future, which caused the seekbar to jump
around in an unpredictable way.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Visualization now buffers in the audio output pipeline, and uses a
container system to delay multiple buffer chains from emitting
visualization data over top of each other. This should stabilize
display output significantly, while introducing minimal lag before
DSP configuration changes take effect.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Audio Chunks now have full timestamp accounting, including DSP playback
speed ratio for the one DSP that can change play ratio, Rubber Band.
Inputs which support looping and actually reporting the absolute play
position now do so.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The last of the built-in processors is now in the threaded processing
chain, and all DSPs are marked high priority and with short buffers.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This class can more flexibly process and emit varying chunk sizes than
the previous code could, solving the problem of wide tempo changes.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
I will implement the more complex setup of providing options for
most of the configuration that Rubber Band provides, at a later
date, when I feel like creating a complex configuration dialog
for it, and asking for help translating every option and setting.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Implements a simple speed control using a resampler
designed for real time changes. A rubberband speed
control will be implemented at a later date.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This reverts usage of the AVFoundation output to use
the previous lower latency CoreAudio output, and
paves the way for a change I am cooking up soon.
Fixes several issues with playback and seeking latency.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This new method should cause all stops to default to immediate stoppage,
and only stops that occur after an end of track signal should indicate
to play out the entire buffer.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Sample rate changes will now occur on exact sample boundaries, like they
are supposed to. Also, FreeSurround accounts for its output latency.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Stop output when requested, except on natural completion of the last
track in the play queue. Also fix deadlocks with stopping and
restarting.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The output now uses AVSampleBufferAudioRenderer to play all formats, and
uses that to resample. It also supports Spatial Audio on macOS 12.0 or
newer. Note that there are some outstanding bugs with Spatial Audio
support. Namely that it appears to be limited to only 192 kHz at mono or
stereo, or 352800 Hz at surround configurations. This breaks DSD64
playback at stereo formats, as well as possibly other things. This is
entirely an Apple bug. I have reported it to Apple with reference code
FB10441301 for reference, in case anyone else wants to complain that it
isn't fixed.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Add play count data collection, including first seen times for every
file first added to the playlist. Data is indexed by album, artist, and
title, or by filename, whichever matches first. Add interfaces to
AppleScript automation definition as well.
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>
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>