The legacy 2D visualizer now supports customizable bar and peak dot
colors, and renders a grid and labels in the windowed mode.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Constrain observer events to the exact context requested, and remove
them with the same context specified.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Only uninitialize the equalizer if sound output was successfully started
and the equalizer AudioUnit was successfully ininitialized.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
String and art adder functions now perform type checks, in case of
memory errors that somehow result in classes changing type. Which in
itself is a strange thing to happen.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Restructure the add string or art functions so they don't take a pointer
to a pointer, which may have caused issues when receiving a nil string
from the caller. Instead, take a plain pointer, and return the object,
returning the ID of the object to a pointer to an int64_t.
Also change several prototypes and functions to use _Nonnull or
_Nullable where appropriate.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Optimization level bugs now affect Apple Silicon release builds, so
reduce optimization level there as well.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
When leaving the workgroup, clear the token, as the join call requires
the token to be uninitialized.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Errors should stop all attempts to further use the audio thread priority
code, so there won't be debug breakpoints called on older OSes.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The properties function should not be dereferencing an invalid index
into the layer codec name array if layer is not set to 1 through 3. This
could happen if, for instance, an MP3 file has an invalid ID3v2 tag.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This condition would underflow when skipping a bunch of samples on the
start of playback, or otherwise seeking, and could cause an unsigned
underflow, which would cause the subsequent vDSP_vflt32 to overread into
the MAD sample buffer and crash.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
As the decimator has shown to be twice as loud as it should be, the
volume should be reduced by half when converting DSD to PCM with it.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Pure downsampling is slower, but may or may not be more accurate. Though
probably not worth it. It did help me realize a minor error, though.
The decimator's volume is twice as loud as it should be.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This prevents crashes where inputs were not returning either properties
or metadata blocks and the file open cache was attempting to cache the
resulting nil pointer as if it were valid. Also prevent the metadata
redundant string coalescing from processing nil objects as well, in case
it's used that way somewhere else.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The symbol uploads on archive are useless unless they're uploaded with
the API key set correctly in the script.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Submodule projects are sometimes out of my control, so I shouldn't have
to deal with team identifiers in projects that don't affect my build
process in any meaningful way. The only way to deal with this would be
to fork and modify every project I touch that contains this stuff. No.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Set baseline real-time priority for audio threads even on old macOS,
since that API is available there. Only set it once, and do not attempt
again if it fails, only once per thread.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
I'm not sure about macOS Ventura, but stable releases of macOS, at
least on Intel, require that threads joining Audio Interval
workgroups already be set to run as real-time before joining. Not
doing this results in an uncaught exception and a crash.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Now it allocates audio workgroups per thread, using work slices like the
Apple documentation describes for asynchronous threads.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Add an extra condition to the visibility check, which is similar to the
previous version of this check, which now guards against the window it
is hosted in not being visible.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
On Big Sur or newer, it is possible to join the audio threads to the
same OS workgroup as the audio output device, improving response.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
For legacy systems that do not support Metal. The Metal SceneKit view
does work on even 10.13.6, if a Metal GPU is present in the system.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Update all project files with new upgrade version number, and add the
dead code stripping option. Don't touch MASShortcut because it's not my
project.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
When visualizer windows are created, but not actually visible, stop the
update timer, to save processing, especially if the vis is enabled in
one or the other main/mini windows.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Replace overlap-add vDSP/Accelerate implementation with a faster PFFFT
overlap-save implementation, using fewer FFT steps as well.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
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>
Apparently this simpler API already existed on a minimum of 10.11 for
creating a system font with monospaced digits.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Use delayed dispatching on expensive operations which occur every time
the "heard" track end happens, and when audio metadata is changed by a
stream, so that they are inserted into the main thread queue after the
invoking callback returns control execution back to the audio thread.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Since the existing code already supports setting any arbitrary track as
a stopping point, add a menu interface to toggle Stop After for any
track in the playlist. Stop After will be removed from the given track
after it has been played. Stop After will not be remembered on disk.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Gate registering observers behind a check variable in the object state,
which will be zero initialized by the Objective-C runtime, and will
prevent the class from erroneously unregistering observers without them
being registered in the first place. Apparently, services cannot be
unregistered if they were never registered first, or else an exception
will be thrown upon attempting to unregister them. This fixes a crash on
startup in the now several times running failure to work properly on
legacy Macs without Metal graphics, now that the new visualization
system has been implemented.
It's probably not worth bringing back the previous Core Graphics based
visualizer method anyway, as on those same legacy machines, it was
causing out of control CPU usage by WindowServer. At least on modern
Macs, any amount of 60fps UI updating will cause WindowServer to use
about 45% of a core, regardless of how many apps are drawing that much
at once.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Apparently, PFFFT double is much faster than vDSP, and I didn't even
notice. Thanks to Aleksey Vaneev for testing this properly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
When resampling the impulse according to the playback rate, it becomes
necessary to normalize the resulting impulse by the inverse of the
sample ratio, as resampling adds more or less loudness by virtue of
interpolating samples.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This will be proper at least unless I get this commit merged upstream.
Squashed the changes to a single commit, and removed extraneous
whitespace that crept into the code.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
If the system has no working Metal devices, disable the visualization.
The legacy visualization was also too slow for said systems to handle
reasonably anyway, so I guess it's safe to say that they shouldn't have
to handle any visualizers at all. At least have working audio playback,
of course, since that is the primary function of the application. Too
bad that the OpenGL renderers don't work on my scene, it would be nice
to have a fallback there. GL 4.1 crashes on an M1, and both GL 4.1 and
3.2 crash with SIGFPE division by zero error on Intel Macs without Metal
devices. Meh.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Remove the default Metal device option, as it can return nil on systems
where it won't be expected to work.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The frequency mode, apparently the default, doesn't like that the code
was setting the width of the spectrum data to 11 instead of the default
1000. This was causing it to overwrite freed memory when the spectrum
started processing audio.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The OpenGL fallback was causing division by zero errors on Intel Macs
running macOS High Sierra.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Apparently, old macOS wants to divide something by the scale size, so
setting it to zero causes division by zero errors? Let's set it to a
really small number instead.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>