If transfer completes quickly, do not hang waiting for it to achieve
reading state. Also add some comments indicating what we're doing.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Based on the C++11 code by Joel Yliluoma / bisqwit, which in turn is
based on information from NX-Engine. I have also taken the liberty of
bundling the required wavetable bank and PixTone drums. Contrary to the
documentation provided with the code, my version of dou_1006.zip, as
downloaded over a decade ago, had the wavetable bank at offset 635,816
bytes into the file, not 1,115,748 bytes. Possibly a difference of
having applied the translation patch? My copy is the original version,
so I had to use a real resource parser to locate the waveforms.
The player will obey the configured sample rate, loop count, and fade
time for synthesizers, and also obey Repeat One to play indefinitely.
The code should be quite robust to minor abuses, though I can't imagine
how well it would hold up to random bad files, other than playing
outright garbage.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Remove shell script that was modifying the import path of a framework,
as we are no longer using libvorbis like that.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This should fix some potential initialization errors it may have had
before, but this doesn't fix the broken Sound Canvas VA plugin. Roland
says it's supposed to be broken on macOS 12+ and/or Apple silicon
anyway, so I guess there's no dodging that.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Tag reading can read cue sheets as either a single NSString, or an
NSArray of NSStrings, so handle either case.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
There has been an API in GME to detect tracks ending for quite some time
now, and this just adds a little bit to the existing comment, which
previously noted that there was no way to detect if a track had ended,
which may have been true several major versions of GME long past.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The output has been assigning twice as many samples as it was supposed
to ever since commit 8d851e5bda, which
ended up generating the correct 1024 samples (2048 per GME parameter),
but assigned 2048 to the AudioChunk, which resulted in over-reading the
audio buffer, and thankfully not crashing, but instead causing an awful
sound distortion effect as random memory contents were played as PCM
audio.
Fixes#320
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Allow .mp3 and such to fall back to the FFmpeg container handler, in
case there are chapters in a renamed file.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The input isn't supposed to close its own sources, as it did not open
them itself, and they should be cleaned up automatically when they are
released to zero reference count.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Let the FFmpeg decoder handle RIFF files, if they happen to be named
.mp3 and not something like .wav.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The SID builder needs a static initializer, otherwise multiple instances
created simultaneously, such as during populating info on adding a lot
of tracks, will race and crash the player.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The subdirectory parser, the CUEsheet reader, and the legacy XML
playlist reader were missing grants for Sandbox access.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Buffer up to 5 milliseconds of audio, or at minimum 1024 samples, each
call. Also pre-allocate the buffer, rather than using a stack buffer.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This is an unnecessary step, and results in the offset being off by the
duration of the first pre-read block. This is incorrect.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The Vorbis, Opus, MAD MPEG, and especially the FFmpeg inputs needed to
have their metadata update intervals severely reduced, to reduce CPU
usage, especially on files with lots of tags. Interval reduced to only
once per second.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
It already supported reading the CUESHEET metadata block, but I managed
to break reading and processing CUESHEET Vorbis comments, which broke
CUE tagging, as well as files that didn't have both tags.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The local and seekable file scanner could crash on bad MPEG files if
they failed to decode any frames and broke due to either end of file or
other unrecoverable errors, due to a division by zero error attempting
to calculate the file bitrate. Now correctly return error state if this
occurs, bailing early.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This should be more correct, especially considering that the library can
handle 32 bit files now.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Apparently, the decoder is capable of returning zero length frames
without having hit the end of the stream.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
- Updated libFLAC to the latest Git commit, post 1.3.4.
- Updated libid3tag to 0.16.1.
- Updated libopus to the latest Git commit.
- Updated my FFmpeg libfdk-aac patch. Previously was overwriting
memory when it was supposed to be skipping samples.
Also added debug versions of several of the libraries, and changed
the library extractor script to unpack the debug libraries over the
release set to add the particular matching debug versions when
building a debug build.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Due to a change designed to stop playback when the end of the file is
reached, which should not be checked for unseekable files, which are
web streams that only stop when the connection drops, or when the user
stops playback manually.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The reader was previously returning a failure state on open if the read
completed and fit entirely into the read buffer, which broke most remote
M3U or PLS playlists.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The declarations for the translation were missing from the project files
so that it wasn't being used. Also added the missing strings to the
files that were already added to the translation.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The input chain could hang up indefinitely, and MAD decoder didn't
indicate end of file properly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
readAudio now returns an AudioChunk object directly, and all inputs have
been changed to accomodate this. Also, input and converter processing
have been altered to better work with this.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Most projects needed to be changed to enable C or Objective C modules.
Hopefully, this improves debugging.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
The input file has already been opened for decoding by an earlier step
in the testing process, reuse the decoder from that. Spares a decoder
open cycle on all embedded cuesheet supporting formats.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This redesign completely changes how tags are stored in memory. Now all
arbitrary tag names are supported, where possible. Some extra work will
be needed to support arbitrary tags with TagLib, such as replacing it
with a different library.
Translation pending for a couple of strings.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Matroska files use the "TITLE" field for the album when there are
chapters. Also, Matroska container uses shorter gain field names for
album and track gain, differentiating them by either being global or
specific to each chapter.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Enable playback of video file extensions. Like other video formats
handled by the FFmpeg decoder, video streams are dropped in decode and
only the first audio stream is played.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Use tag string encoding guessing for tag decoding, just in case there
are invalid files with non-standard encoded strings inside the tags, or
if there are streams with such tags. We don't want any crashes.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>