Commit Graph

3693 Commits (1ef7853488545c1e90a2f1c793a2fd2565f03433)

Author SHA1 Message Date
Christopher Snowhill 0ba766023e Playlist/Time: Simplify font initialization
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>
2022-06-03 16:46:37 -07:00
Christopher Snowhill eaa73bc52f [Threading] Queue expensive actions outside audio
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>
2022-05-30 23:59:42 -07:00
Christopher Snowhill 4a0b337936 [Resampler] Change pffft_double project import
Change import from folder reference to group, like I originally
intended.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-30 22:31:49 -07:00
Christopher Snowhill 05f17ea950 [Menu] Add Stop after Selection to context menu
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>
2022-05-30 22:23:02 -07:00
Christopher Snowhill aabd9431f1 [Visualization] Gate registered observers
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>
2022-05-30 21:38:29 -07:00
Christopher Snowhill 94057cf467 Updated VGMStream to r1745-22-gf696beb0
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-30 18:26:34 -07:00
Christopher Snowhill bea896cca5 [Resampler] Switch r8brain back to PFFFT double
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>
2022-05-30 18:24:37 -07:00
Christopher Snowhill 50342891af [Convolver] Normalize HRTF impulse when resampling
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>
2022-05-30 01:39:12 -07:00
Christopher Snowhill 7e0b7f2008 [Resampler] Update r8brain with proper commit
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>
2022-05-30 01:37:11 -07:00
Christopher Snowhill 8c2df13f3b [Visualization] Disable visualization if no Metal
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>
2022-05-30 00:15:49 -07:00
Christopher Snowhill 539a8c79eb [Visualization] Remove default Metal device option
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>
2022-05-28 19:32:26 -07:00
Christopher Snowhill ec18d0b260 [Visualization] Fix crash with frequency mode
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>
2022-05-28 18:31:09 -07:00
Christopher Snowhill 6b381f3d08 [Visualization] Remove OpenGL fallback
The OpenGL fallback was causing division by zero errors on Intel Macs
running macOS High Sierra.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-28 18:23:15 -07:00
Christopher Snowhill 5e5b2e4071 [Visualization] Add micro bias to cylinder scale
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>
2022-05-27 04:33:07 -07:00
Christopher Snowhill 0cc7e61434 [Resampler] Remove another bad block of code
Oops, I missed some code when fixing it up.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-27 04:09:51 -07:00
Christopher Snowhill f89f1dad5a Change comment to be more correct
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-27 04:06:17 -07:00
Christopher Snowhill 527976197a [Resampler] Oops, made an error with multiply
The function I added only works for non-interleaved real/imaginary pairs
and not the interleaved setup that r8brain expects. Fix that by removing
the multiply implementation and using the original one.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-27 04:01:49 -07:00
Christopher Snowhill 381e52178c [Resampler] Change FFT to use Accelerate framework
The used fork of r8brain now uses the Accelerate vDSP FFT functions for
resampling, which should provide a slight speedup, or significant for
large sample ratios.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-27 03:40:14 -07:00
Christopher Snowhill 4d25b41462 GME Plugin: Silence a type truncation warning
Adding a cast here silences a warning from passing a long to a function
accepting an int. It doesn't really matter here anyway, as the long in
question is hard coded to initialize to a fixed sample rate. Even when
sample rate configuration is eventually added, this will still be hard
capped to well within the range of 32-bit integers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:11:07 -07:00
Christopher Snowhill 872816f056 VGM Decoder: Change logic of dictionary creation
Metadata logic code should be using this dictionaryWithDictionary method
so that the resulting dictionary is actually immutable, like it claims
to be, rather than simply casting it. Safety coding, all that jazz. Not
really a major issue, just feels right.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:09:39 -07:00
Christopher Snowhill 8cf37cadf3 Unicode metadata: Change most logic to use guesser
Most file formats the player supports may or may not have UTF-8 safe
strings in their metadata. This should not be assumed to be UTF-8, and
when it is assumed, it results in nil NSString objects, which results in
inline initializers crashing due to uncaught exceptions.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:07:55 -07:00
Christopher Snowhill f7dc6beda1 Plugin utilities: Moved encoding guesser to header
Moved the string encoding guesser/converter to the Plugin.h header, so
it may be accessible from any plugin. I may make it a global member of
something eventually, but a static inline for such a simple function
should be fine for now.

This function facilitates converting arbitrary 8 bit encoded strings to
Unicode NSString objects. It should be used anywhere that UTF-8 is
expected, but not necessarily guaranteed, and where other 8-bit
encodings may also be supplied by a user's files.

Not using this setup for string inputs has already led to failed UTF-8
decoding resulting in nil NSStrings being passed to the inline array or
dictionary initializers, which results in crashes due to uncaught
exceptions.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-24 01:05:43 -07:00
Christopher Snowhill 4b2cf22800 [Visualization] Use OpenGL on legacy systems
On legacy OSes, and legacy GPUs, it should use OpenGL and not Metal,
otherwise there could be horrible performance, or even crashes.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-23 17:21:13 -07:00
Christopher Snowhill c59d4d0215 [Visualization] Tear down window vis when not open
When the visualization window is not open, it should not continue to run
the scene until the app is quit. Apparently, the windowed mode is really
slow on old Intel machines, too. Full screening it is enough to bodge
the entire system session until the machine is remotely rebooted.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 18:39:32 -07:00
Christopher Snowhill 84eadd1f33 [Visualization] Use forced 3D mode in window
Windowed style should always use the perspective camera mode.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 17:45:51 -07:00
Christopher Snowhill 438634d6df [Visualization]: Change peaks to float on top
Change the peak sphere positions so they float on top of the bottom or
the bars, instead of clipping into them.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 17:25:21 -07:00
Christopher Snowhill f4712ad219 [Visualization]: Add Spectrum window
Add a dedicated spectrum visualization window, and add the necessary
hooks to start its event timer if playback is already running when it is
first opened.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 17:24:35 -07:00
Christopher Snowhill e2d7ebdec5 [Visualization] Enable anti-aliasing
Enable 8x multisampled anti-aliasing, to improve the appearance of the
spectrum on non-Retina/HiDPI displays. It can't really hurt on HiDPI,
either. Hopefully this won't cause it to use a whole load of GPU
resources, more than is reasonable.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 16:32:57 -07:00
Christopher Snowhill 79ac1e0dd6 [Visualization] Adjust Spectrum scene parameters
Disable color fringing and motion blurring, which were causing artifacts
with the transparent background.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 16:31:34 -07:00
Christopher Snowhill b99bc67bac
Merge pull request #256 from losnoco/nevack/spectrum-camera-mode-angles
[Visualizer] Adjust 2d projection camera angles.
2022-05-22 16:28:18 -07:00
Dzmitry Neviadomski a58b11dc90 [Visualizer] Adjust 2d projection camera angles. 2022-05-23 02:12:25 +03:00
Christopher Snowhill 4f1ea02359 README: Add directions for Git hooks path
Since we use a non-default path in the repository to store shared hooks,
it needs to be configured on a freshly cloned repository before it can
be usable.

Yeah, I forgot to follow my own directions before working on the project
for quite some time. The error crept in at the following commit:

2aa3ddd545 - Icon replacement, and team ID

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 16:12:12 -07:00
Christopher Snowhill 25906d1b2b Project file: Remove team ID that leaked in
I accidentally forgot to enable my hooks after cloning on a new macOS
installation.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 16:10:51 -07:00
Christopher Snowhill 4035ca861f Spectrum Visualizer: Add customization options
Add options to the Appearance preferences page to allow changing the
spectrum's projection between a 2D-like one and 3D perspective, and add
options to change the bar and peak dot colors.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 15:26:27 -07:00
Christopher Snowhill fce0e129a5 Spectrum Visualization: Replaced spectrum view
Introduced a brand new spectrum view based on SceneKit, with a scene
created by @kddlb and then altered by me to add the peak spheres. This
new scene should be lighter on display resources, even though it's fully
3D instead of a vector 2D scene done in Cocoa drawing primitives.

Co-authored-by: Kevin Lopez Brante <kevin@kddlb.cl>
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-22 00:03:52 -07:00
Christopher Snowhill bf54c45242 Info.plist: Updated with new file types
Updated with new file types added by VGMStream.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-02 15:00:39 -07:00
Christopher Snowhill ace62005db Updated VGMStream to r1745-4-g9ef1030d
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-02 14:58:25 -07:00
Christopher Snowhill 2aa3ddd545 Icon: Replace icon with a newly rendered design
Icon has now been replaced with a newly rendered design, and code
changed accordingly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-02 14:35:09 -07:00
Christopher Snowhill 5a47021f6d MAD Input: Fix gapless decoding of FFmpeg files
FFmpeg processed files may also contain the LAME tag magic of 'Lavf' or
'Lavc', not just 'LAME'. Missed this when I was maintaining the FFmpeg
code that handles this, or at least adding iTunes support to it.

Fixes #250 again.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-25 13:19:12 -07:00
Christopher Snowhill 2995f67c56 Updated VGMStream to r1721-52-g4eb40f00
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-21 14:29:41 -07:00
Christopher Snowhill 6a9b37f91e Info.plist: Update bundle properties
Update includes turning on system generated icons for all file types,
as well as adding several new file types from VGMStream that I missed
the last time around. Also includes some new fields that Xcode added in.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-21 14:24:05 -07:00
Christopher Snowhill 136200e963 Info.plist generator: Update with default icons
Update the Info.plist generator to emit file type definitions which use
system generated icons in place of the legacy icons in the app bundle.
Also include the new LSHandlerRank field. And also add a definition for
the scripting definition, which I accidentally added to the Info.plist
manually when I fixed scripting.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-21 14:22:43 -07:00
Christopher Snowhill c6c76c696d FFmpeg Input: Change Monkey's Audio description
Apparently, Info.plist, as generated by Xcode, is perfectly fine with
raw apostrophes in the source code, and doesn't require it to be an XML
entity.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-21 14:20:35 -07:00
Christopher Snowhill 94f915b892 VGMStream Input: Fix subsong files dumping tracks
Fixed an issue with individual files that reference single subsongs
inadvertently dumping all tracks in the referenced bank to the playlist,
instead of only adding the one bookmark or txtp file. Now it matches the
behavior of foobar2000.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-20 01:50:44 -07:00
Christopher Snowhill d1c6950ec6 MAD Input: Further gapless decoding and seek fixes
This time, a two-fer. First, ensure that file start seeking still skips
over the Xing/LAME header packet properly. Then, ensure that decoding
the last desired packet of the file does not indicate having decoded
more sample data than desired, which may have caused errors when
resuming playback position on restart and then smoothly transitioning to
the next track.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 23:56:17 -07:00
Christopher Snowhill 54f6702fb2 Updated VGMStream to r1721-48-g9d47eded
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 23:29:21 -07:00
Christopher Snowhill 299cc5a406 MAD Input: Possible further fix for seeking
This is a possible fix for another gap issue I experienced, and may be
exposed by seeking from the start of the file without decoding first.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 23:19:52 -07:00
Christopher Snowhill 36d2d7b7e0 MAD Input: Fixed gapless handling on file start
This error was caused by the necessary fix of the previous commit, only
it caused something completely different. Due to the fact that MP3 is
included in the list of formats supported for embedded CUE Sheets, the
open stage performs a seek to the file start after opening the file,
even if there is no sheet embedded. And the resulting seek was supposed
to be a null operation, since the file was already at the start. But, as
a result, this reset the start skip counter to zero, and because the
offset wasn't backwards, but to the same position, it didn't reset the
skip counter to the start of track delay. So, as a result, start of
track delay wasn't being removed, introducing a gap. Now, this change
bypasses the seek function altogether if seeking would do nothing from
the current playback position. Whew.

Fixes #250 and MP3 gaplessness in general, surprised I didn't notice
this sooner myself, but I guess I didn't bother to verify whether my
change would break anything. Whoops.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-19 22:57:21 -07:00
Christopher Snowhill 2ed463034f MAD Input: Fix seeking backwards and in general
A backwards comparison led to seeking forward doing a full seek up from
the file start, and seeking backwards being a non-functional operation,
so the file would just continue playing as if there were no seek.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-04-01 19:34:54 -07:00
Christopher Snowhill 69ebce32c0 Revert "VGMStream Input: Remove downmixing, add layout"
This reverts commit 0d4ee4c901.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-21 16:34:49 -07:00