Commit Graph

3084 Commits (014f136b7e3b54864583b50cc9771551ba4a99ef)

Author SHA1 Message Date
Christopher Snowhill 014f136b7e Visualization: Protect against out of bounds read
The analyzer was reading out of bounds, so guard against that.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-06 03:51:25 -08:00
Christopher Snowhill 26966c46a2 Cog Audio: Sanitize search paths
Remove references to previously used libraries from search paths.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-06 03:50:01 -08:00
Christopher Snowhill 6741151423 Highly Complete / USF: Enable HLE again
Enable HLE processing for USF playback, based on previous commit filling
out the HLE operations list. It should be safe to enable it again now.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 20:44:41 -08:00
Christopher Snowhill d570cf346d Highly Complete / USF: Preliminary overload HLE
Include preliminary overload effect for MP3 and CBFD HLE operations,
based on a pull request from upstream. This should make the HLE pretty
much sound for general use once again.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 20:43:41 -08:00
Christopher Snowhill 5622e92899 Resampler: Fix gapless output
The resampler wasn't being given enough room to flush its final output,
so a function was added to determine the current output latency, and
more sample data is requested, allowing the full output flush to occur.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 20:40:18 -08:00
Christopher Snowhill 6dccaa4d7f Fixes starting playback on short files
These two changes fix playback issues with either starting in the middle
of the playlist on a really short file terminating immediately instead
of queueing more files (InputNode.m), and issues with starting playback
at all on the end of a playlist on a short file. (OutputCoreAudio.m)

Fixes #246

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 15:53:47 -08:00
Christopher Snowhill 7c5cec1eb7 Amend r8bstate definition with extra safety
Just in case anything using the implementation ever needs to request
less sample data than would be returned by the resampler, it should be
able to return a remainder and keep extra remaining samples, if any.
However, the way Cog currently uses it, it would not be likely to run
into this scenario.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-05 15:23:21 -08:00
Christopher Snowhill ed0f7d81ab Various fixes for R8Brain resampler wrapper
Fixes to the resampler wrapper, such that it will survive some close
encounters with the edge of the buffer, if necessary. Also so it will
obey the buffer size limit for the output buffer.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 20:44:36 -08:00
Christopher Snowhill e1fa8d1e9b Clarified my hopefully not too stupid position
Sorry about that, everyone. I didn't mean to make it look like I
was freezing out my audience by assuming a portion of them support
the every move of their government.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 18:52:03 -08:00
Christopher Snowhill 18121a0a5a Forked R8Brain repository
The lineage of this library was not as obvious to me as it should have
been, considering the country of origin. While the developer has not
publicly stated their position on the invasion of Ukraine, they seem to
be in the anti-vaccine camp, which is disappointing to say the least.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 18:08:26 -08:00
Christopher Snowhill fe4af170ef Add R8Brain to the credits and readme
Added the R8Brain notice to the credits html document, and added a link
to the Github repository to the README.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 14:19:27 -08:00
Christopher Snowhill c9ed4bc678 Rename a variable to be more correct
This rename is more in line with what R8Brain does in its example code.
No actual behavioral changes to the code, however.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 14:18:23 -08:00
Christopher Snowhill 7f7e17a410 Correct capitalization of WavPack in codec info
Report the correct codec name for WavPack files. An info refresh will be
needed for it to take effect on existing playlist entries.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 02:08:55 -08:00
Christopher Snowhill 777ab28d6a Replaced libsoxr with r8brain free source
Replaced the free SoX resampler with the r8brain resampler source, which
is also free.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-03-04 02:07:38 -08:00
Christopher Snowhill c8d8e759bc Add autoreleasepool to cache thread
The cache thread should have an autoreleasepool around the release loop,
because it will be freeing Objective C objects periodically.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 23:30:18 -08:00
Christopher Snowhill da4630f4c5 Add a metadata loader cache
Promote the Plugin Controller source file to Objective-C++, and add a
simple data cache that holds on to requests for up to 5 seconds after
their last access, for preventing spammed requests from hitting files
over and over. This is apparently really relevant to the CUESheet reader
and its embedded CUESheet handling, as that tends to reread the same
file over and over as it populates the playlist with tracks. The nested
reader can also lead to repeated reading even on files without CUESheets
embedded.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 23:24:32 -08:00
Christopher Snowhill b3247578ed MAD Decoder: Comment out unused variable
A variable wasn't being used, except in debug builds. Comment out its
use and only skip over the field in the LAME header.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 20:52:35 -08:00
Christopher Snowhill 1dffaae990 Tweak libsoxr for Apple Silicon again
This should improve performance slightly again, as there were some ARM
code paths that weren't being enabled for ARM64.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 20:51:30 -08:00
Christopher Snowhill a978dfbf5a MAD Decoder: Fix MP3 decoding crash
There was a stupid bug in the previous commit I made, which caused local
or seekable MP3 files to crash the player on decode. This fixes that, by
checking that a packet has actually been decoded before touching the
packet info structures. Dumb, dumb, dumb error on my part.

Fixes #244

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 04:26:12 -08:00
Christopher Snowhill ca3dec4497 MAD Decoder: Support changing format
Support the weird scenario of format changes mid-stream. Probably
highly unlikely, and likely to break things if it does occur, but
whatever, it might actually happen in some weird file.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:43:54 -08:00
Christopher Snowhill 53209485c0 MAD Decoder: Correctly prepare buffer after free
The current buffer size argument is used to determine if a buffer should
be allocated on the next run. Just in case something reuses the same
decoder instance.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:38:17 -08:00
Christopher Snowhill 6b53a87784 Clean up a couple of warning notices on this file
There were several warnings due to the capitalization of the header
paths, and due to unused functions that are only required by the text
CUESheet parser, and we're only using the CUESheet generator, which has
been heavily modified to emit NSString output rather than a file on
disk.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:11:50 -08:00
Christopher Snowhill 0f10543566 Improve spam formatting string in two ways
For one thing, improve it so that if the tracknumber field is present,
but zero, it doesn't show the number sign in the spam. For the second,
only show the track artist field if it differs from the album artist.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:10:27 -08:00
Christopher Snowhill 2c0f04bbeb Possibly improve MAD sample conversion speed
No idea if this brings a noticeable improvement, but it probably makes
better sense to only do the division step one time instead of doing it
twice interleaved when processing stereo files, which are the most
common scenario anyway.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:08:55 -08:00
Christopher Snowhill 51e9648865 Improve libsoxr setup
Replace libsoxr dylib with a static library, and also build the two
architectures separately, to allow for platform-specific optimizations
to be employed for both. This also reduces the size of the CogAudio
framework by a few hundred kilobytes, as we eliminate unused code paths
better this way.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-26 01:07:20 -08:00
Christopher Snowhill 19556cc630 Brought back the MAD plugin from death
Now Cog supports freeformat MP3 once again. The plugin has been extended
to include sample accurate seeking, accurate length probing of files
missing headers, and iTunes gapless info reading using libid3tag.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-24 17:51:10 -08:00
Christopher Snowhill 1da6cf2557 Deduplicate artwork using hashes
Artwork deduplication should be done with hashes, not by full data
comparison. This should be a lot faster loading artwork from files now,
especially if the playlist already contains a lot of unique artwork.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-22 23:10:02 -08:00
Christopher Snowhill 9a2ac6ae5a When starting playback, start shuffle at selection
If starting playback from a given playlist entry, or selection, then
start shuffle mode from that track. Otherwise, start shuffle from the
beginning of the shuffle list.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 22:01:01 -08:00
Christopher Snowhill b6330279ce Start playback on first shuffle item in shuffle
When in shuffle mode, start playback on the first item in the shuffle
list, rather than the selection, or the start of the playlist.

Fixes #241

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 21:53:41 -08:00
Christopher Snowhill b63a076e21 Add more automation commands and properties
Added commands to control playback: play, pause, stop, previous, next.
Also added a spam property to PlaylistEntry, to return the formatted
spam string for the playlist entry, which is currently limited to the
playing item.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 21:52:09 -08:00
Christopher Snowhill 9614ec6e98 Add option to quit on natural stop
When the option is enabled, and playback comes to a completion, the
player will quit on its own.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 20:55:42 -08:00
Christopher Snowhill f9040dd1d3 Fixed Mini Window appearing topmost on startup
This stupid setLevel default was something suggested when making a
window a drag target, and I was observing a setLevel for a window
control, not for a window itself. I should not have set that in the
first place.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 20:31:35 -08:00
Christopher Snowhill 763f4c8cd5 Shrink the time field on macOS 10.13 and older
Since 10.13 doesn't want to observe the auto sizing attribute of the
field properly, gotta use the tiny font size that the field is already
configured to use.

Should fix #243

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 16:51:46 -08:00
Christopher Snowhill 9fd85f6670 Updated VGMStream to r1702-76-g00bdb165
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 16:44:18 -08:00
Christopher Snowhill d70e1da126 Updated libFLAC to version 1.3.4
Updated the FLAC library to what is the official release of 1.3.4,
although I already had all the commits from that version prior to this
update.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-21 16:43:36 -08:00
Christopher Snowhill 90ed02302e Fix FFmpeg handling odd WMA files, at least
This small change brings the decoding more in line with what ffplay
does, and allows, for example, John McLaughlin.wma to play without
interruption from the stream warnings throughout the file.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-20 03:14:30 -08:00
Christopher Snowhill b995030aec Bring back scripting automation
This fixes #126 and brings back basic automation support. The basic
currentEntry object will return an object that can enumerate the track
metadata or the file URL of the currently playing track. More automation
suggestions are welcome, including playlist manipulation, or playback
control.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-20 01:53:25 -08:00
Christopher Snowhill 81f5adfb5c Fix Info.plist having bare apostrophes
Xcode touched the Info.plist and fixed these, and I changed the file
type association definitions to print the correct thing in the future.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-20 01:51:11 -08:00
Christopher Snowhill 1b48459eaa Track number column should also sort by disc
Apparently, the sort descriptors are going by data members of the array,
not by the column identifiers, or their textual contents.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-18 02:23:15 -08:00
Christopher Snowhill 60a4266840 Fix sorting of playlist
Unfortunately, the track number column will always bug out and pop the
indicator back over to the Album Artist column. No way around it. The
control is just buggy like that.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-18 01:57:19 -08:00
Christopher Snowhill 0902703ee1 Playlist: Fix sorting by the track number column
Should now properly sort by album artist, album, then disc/track number.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-17 17:07:47 -08:00
Christopher Snowhill 5c3050c0d3 Playlist loader store: Adopt more correct method
This is a more correct method of identifying the supported classes to
coalesce into unique pointers through the storage array. I completely
forgot about this method, oops.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-17 03:01:34 -08:00
Christopher Snowhill 2a27435f7e Dictionary merge: Correctly drop empty data tags
This allows for TagLib to handle artwork reading where the file built-in
readers fail, such as the FFmpeg reader, which would require parsing the
stream data for artwork packets, a really wacky convention to have.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-17 03:00:35 -08:00
Christopher Snowhill 007ec3696d SQLite Store: Properly read strings into memory
Strings read from the database were not being stashed in the memory
store, which caused things like blank tags instead of correct metadata.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-17 02:58:57 -08:00
Christopher Snowhill 4f5e4eca36 Fix visualization for variable audio block sizes
IN A.D. 2101, WAR WAS BEGINNING. *boom*

Yeah, this was a dumb bug, I didn't realize that AUAudioUnit would just
arbitrarily ignore my configured block size and request a different one.

The AirPods Pro will just request 480 instead of the 512 I ask for, so
let's instead support variable block sizes, and only take up to the last
4096 samples of the chunk fed to the output device.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 21:54:55 -08:00
Christopher Snowhill 5611d08df1 Reduce memory usage of adding tracks
Significantly reduce the memory footprint of adding tracks to the
playlist, by coalescing the NSString and NSData objects in the info
dictionaries as they are being loaded in the background, into a common
data set which will then be discarded when the whole job is completed.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 21:38:43 -08:00
Christopher Snowhill d30746bffa Extend deduplication to loading artwork on open
When adding tracks, deduplicate their artwork when loading to memory.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 17:06:13 -08:00
Christopher Snowhill 3de43b55a7 Significantly reduce memory usage all around
Added a string dictionary for deduplication of metadata, and actually
initialize both it and the art dictionary on startup, so they actually
work like they should.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 16:57:47 -08:00
Christopher Snowhill c242d53200 Resume on restart: Only seek into seekable files
This allows streams to be resumed from the beginning when restarting.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 13:22:53 -08:00
Christopher Snowhill 7f3bf052ca Update supported file name extensions for art
Art read from external files supports more formats than previously
listed here. Amend the list accordingly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 01:56:34 -08:00