This resulted in horrible things, the generic N to N upmixer was leaving
unmapped channels as uninitialized memory. This fixes horrible things
happening for people with interfaces with more channels than the source
file, frequently when the source file is stereo, or if the file is mono
and a center channel is present.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
_mm_malloc and _mm_free are apparently based on intrinsic functions,
and only exist on Intel or older macOS targets. So removing them in
favor of posix_memalign.
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>
The ChunkList wasn't clearing the remover entered flag when the chain
was empty. Now it does, so it will shut down correctly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Code ordering was wrong, it was writing the output samples repeatedly
for each input speaker, now it will only write them once.
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>
The volume should have been twice what it was, because I got this scale
wrong. The correct scale for Accelerate inverse FFT is 1/4 per sample,
not 1/8 like I accidentally misread while rewriting a convolver for the
umpteenth time from scratch.
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>
Flush the resampler when the source file terminates, so that it outputs
delayed samples properly. This fixes gapless decoding of resampled
files.
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>
7.0 downmix was passing parameters to cblas_scopy backwards, and WAV
files report "host" endian, not "native".
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This should fix some coding issues, and also fix some potential memory
leaks in the file verifier, assuming it didn't already release the
files it was pulling the stats from.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The filter wasn't properly freeing its FFT setup state, and also was
unnecessarily null checking the pointers before passing them to the
aligned free function, which already does null checking.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Implement the ability to configure and select an HRIR preset to use with
the HRIR filter, or remove the preset. It will validate the file's
usefulness before setting it for the player to use.
Also, fixed back center channel filtering for 7.0 format audio.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This is needed for HeSuVi no-echo impulses, which are only one channel
per input channel, and mapping uses symmetrical mirroring of the input
set to create the surround effect, since there's no side-to-side delay
in these impulses.
This new virtualizer uses the Accelerate framework to process samples.
I've bundled a HeSuVi impulse for now, and will add an option to select
an impulse in the future. It will validate the selection before sending
it to the actual filter, which outright fails if it receives invalid
input. Impulses will be supported in any arbitrary format that Cog
supports, but let's not go too hog wild, it requires HeSuVi 14 channel
presets.