Commit Graph

336 Commits (cad09b891282d27bbd963198fbdebf9ef4129c57)

Author SHA1 Message Date
Christopher Snowhill cad09b8912 CUE Reader: Fix enumerating sheets and tag reading
The reader should have been skipping the properties of CUE sheets when
reading the referenced data for the inner files.

Fixes #235

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-13 12:18:58 -08:00
Christopher Snowhill 7ef583340d Equalizer: Replace dialog with custom job
New custom equalizer dialog, painstakingly hand assembled.
2022-02-13 11:05:32 -08:00
Christopher Snowhill 417687600b Implement visualization support and a spectrum
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>
2022-02-12 23:04:03 -08:00
Christopher Snowhill 6d09b72c1d Dynamic info now pushes to the correct track
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 07:29:02 -08:00
Christopher Snowhill c39b7ee96a Converter: Smarter, if less portable, endian swap
For big endian sample formats, endianness can be swapped using Clang
specific byte swap functions, which are present in all supported
versions of Xcode.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 00:38:08 -08:00
Christopher Snowhill 5f68131437 Converter: One minor change to double to float
Use Accelerate for this, too.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-12 00:03:25 -08:00
Christopher Snowhill 6b148fef11 Channel Mixer: Rewrite upmixing, changed HRIR
Simple upmixing algorithms now use Accelerate framework functions
instead of complex loops, and the HRIR filter now supports forcing
stereo output to any channel output configuration that has at least
front stereo speakers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 23:51:41 -08:00
Christopher Snowhill 3711999112 Cog Audio: Allocate maximum needed audio memory
The chunk could be any format, up to floating point double samples, and
up to 18 channels.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 13:50:26 -08:00
Christopher Snowhill 7f8c19799d Fix a very serious error resampling short files
Files that are so short that they need both pre- and post-extrapolation
at the same time.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 07:10:31 -08:00
Christopher Snowhill 0b33fe6dea Don't count output buffering for queue hold
This would count the output duration for every file buffered, rather
than only once.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 06:50:58 -08:00
Christopher Snowhill 69c4cb3c16 Minor change to remove unnecessary mutable objects
These are no longer being manipulated, so remove their mutable state.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-11 05:59:44 -08:00
Christopher Snowhill 39dcb88728 FFmpeg input: Support reading metadata
Where TagLib is not being employed, use FFmpeg to read tags where
possible. This allows reading tags from files like IFF. It reads it
through properties, otherwise allowing tag readers to function like
usual.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 15:29:13 -08:00
Christopher Snowhill 5ff1f95481 Add decoder open error indicator
When decoder is redirected to the internal silence decoder, show an icon
on the playlist indicating a playback error.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 02:15:48 -08:00
Christopher Snowhill df63726128 Track properties take priority over metadata read from tag readers
This allows inputs to override things with self-read tags and such, such
as ReplayGain tags.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-09 21:26:17 -08:00
Christopher Snowhill b1a98139cb Cog Audio: Fix generic upmixer mode
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>
2022-02-09 15:16:19 -08:00
Christopher Snowhill 0012d1b17e Implement dynamic metadata reading for streams
Supported by FFmpeg, FLAC, Ogg Vorbis, and Opus.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-09 13:44:50 -08:00
Christopher Snowhill cdf27e4786 CogDecoderMulti: Reset file even if not seekable
HTTP Reader now supports limited seeking backwards even in streams, so
seek back to file start for repeated file tests, since there are at
least a few inputs that all claim to support things like Ogg containers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-09 13:44:04 -08:00
Christopher Snowhill 7cea254f4c Implement framework for dynamic metadata updates
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-08 21:21:53 -08:00
Christopher Snowhill 0763b28f38 HRIR Filter: Replace deprecated Intel-only code
_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>
2022-02-08 00:13:41 -08:00
Christopher Snowhill f4f4f80f64 Restart playback on device or output format change
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>
2022-02-07 22:44:56 -08:00
Christopher Snowhill 728c44242c Do not reset output sample rate automatically
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>
2022-02-07 22:02:17 -08:00
Christopher Snowhill 477feaab1d Now properly supports sample format changing
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>
2022-02-07 19:18:45 -08:00
Christopher Snowhill 91da112e35 Cog Audio: Fix potential hang on stop
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>
2022-02-07 15:31:57 -08:00
Christopher Snowhill 08da31f96c Cog Audio: Fix generic downmix to stereo
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>
2022-02-07 04:17:53 -08:00
Christopher Snowhill acb1dd75d3 Cog Audio: Fix memory leaks with new buffering
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>
2022-02-07 04:06:36 -08:00
Christopher Snowhill 1ef8df675f Cog Audio: Implement support for channel config
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>
2022-02-07 01:10:05 -08:00
Christopher Snowhill b0b1446aa7 HRIR Filter: Corrected scale math, fixing volume
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>
2022-02-06 21:53:42 -08:00
Christopher Snowhill 7bf4c4445d Remove old, now unused code 2022-02-06 21:50:23 -08:00
Christopher Snowhill 85c7073649 Reformat my own source code with clang-format
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-06 21:49:27 -08:00
Christopher Snowhill 62edb39761 Cog Audio: Major rewrite of audio buffering
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>
2022-02-06 03:08:34 -08:00
Christopher Snowhill 0131f7c925 Revert "Core Audio output: Rewrote major portions"
This reverts commit 637ea4efe1.
2022-02-05 04:14:03 -08:00
Christopher Snowhill 4cdca2f5f8 Converter: Fix DSD gaplessness
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-05 04:03:40 -08:00
Christopher Snowhill 637ea4efe1 Core Audio output: Rewrote major portions
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>
2022-02-05 03:45:02 -08:00
Christopher Snowhill 3069a81d85 HDCD Decoder: Adjust gain stepping algorithm
This is a fixed point implementation identical to Microsoft's original
algorithm. Or at least I assume it's Microsoft's. It was actually
adapted from hdcd_decode.exe, which was adapted from somewhere else.
It's entirely in fixed point math now, so it's fairly deterministic.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-04 21:52:20 -08:00
Christopher Snowhill 39cc33cac4 Converter: Remove no longer necessary includes
These were only needed when I wasn't using Accelerate framework.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-04 19:53:17 -08:00
Christopher Snowhill d6760c823a HRIR Filter: Change resampler to use soxr oneshot
This should use the oneshot method, which takes care of flushing for us.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 22:54:27 -08:00
Christopher Snowhill 002be384ff Cog Audio: Terminate queueing when stopping
The end of input queueing, which can go nuts when there are a lot of
short files, should be terminated when the user asks the player to stop.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 22:48:25 -08:00
Christopher Snowhill 074e4115dd sox resampler: Perform post file flush
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>
2022-02-01 22:47:11 -08:00
Christopher Snowhill 587be93f21 Cog Audio: Fix runpath search path for libsoxr
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 19:44:48 -08:00
Christopher Snowhill 0e6350116b libsoxr: Fix import path
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 19:28:28 -08:00
Christopher Snowhill d4990de7f3 Adopt the sox resampler instead of RetroArch
Removing RetroArch code from my project.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 18:55:39 -08:00
Christopher Snowhill 78e960a9e4 Revert "Ring Buffer: Replace virtual buffers"
This reverts commit 476c88973b.
2022-02-01 18:45:12 -08:00
Christopher Snowhill 641f6390c5 HRIR Filter: Quality of life improvements
The memory allocation is now nicer, and only allocates what is needed.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 15:28:24 -08:00
Christopher Snowhill 61a30c959c Bundled resources: Use NSBundle interface
These methods should use NSBundle, rather than CF* C functions

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-01 14:40:02 -08:00
Christopher Snowhill 808710b881 Volume Control: Fix linear 100% range control
Range is now linear on 100%, like it should be.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-01-30 00:18:07 -08:00
Christopher Snowhill 476c88973b Ring Buffer: Replace virtual buffers
Replace individual virtual buffers with large _mm_malloc blocks at a
time, then dole out chunks of those buffers as the nodes need them.
Should reduce memory contention a little bit.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-01-29 21:32:59 -08:00
Christopher Snowhill 9e5a70c9ae Cog Audio: Dealt with a major retain cycle leak
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>
2022-01-29 21:31:19 -08:00
Christopher Snowhill 85fd3836c0 Debug logging: Added logging of playback and tags
Added a logging method that indicates starting playback of a given URL,
and added a debug build only logging of every metadata load event.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-01-29 16:34:43 -08:00
Christopher Snowhill d239b58ab1 HRIR Filter: Fix 7.0 downmix and WAV files
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>
2022-01-27 23:02:04 -08:00
Christopher Snowhill cc2b27d43f Core Audio output: Potential shutdown fix
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>
2022-01-27 00:09:40 -08:00