Repository navigation
gen~ data from WAV resources - #136
Open
pingdynasty wants to merge 7 commits into
Open
pingdynasty wants to merge 7 commits into
pingdynasty wants to merge 7 commits into
Conversation
…mples With all=true the loop ran getNumberOfSamples() (frames) times, so createFloatArray() filled only the first 1/channels of the interleaved buffer for multichannel files.
- Copy all channels: allocate the interleaved buffer with sysmem_newptr(), which genlib_data_release() frees with sysmem_freeptr(), instead of FloatArray::create() (new[]). - Zero on resize again, except for data loaded from a resource; plain gen~ data is cleared on reset as before. - Report a declared size that differs from the WAV file with debugMessage(): the overlapping frames and channels are kept.
WavFileTest: header, per-channel and interleaved reads. GenDataResourceTest: gen~ Data::reset() filled from a WAV file through the native resource loader, declared size longer and mono, size-mismatch messages, plain data zeroed on reset.
WAV stores 8-bit samples as unsigned with 128 as zero; they were read as int8_t, so 128 became -1.0 and the waveform was inverted and offset. Test added to WavFileTest.
Native tests compile every source in Build/Source, so generated Gen/Faust/Heavy sources left by an earlier patch build were linked into each unit test (duplicate symbols with GenDataResourceTest, which includes genlib.cpp).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loads WAV resources into gen~
data: adataobject named after a resource is filled from the WAV file. Based on #115 (its two commits are kept as they are), with fixes and tests on top.From #115
genlib_obtain_reference_from_string()loads the named resource;genlib_obtain_data_from_reference()fills the data object from a valid WAV fileWavFile::read(channel, output, all)andWavFile::createFloatArray()for interleaved readsFixes on top
WavFile::read(all=true)read one channel's worth of samples, so stereo files filled only half the buffersysmem_newptr(), matching thesysmem_freeptr()ingenlib_data_release()(it wasnew[]fromFloatArray::create())genlib_data_resize()zeroing every data object; now only data loaded from a resource is kept, and plain gen~ data is cleared on reset as beforedebugMessage()(data frames / WAV frames 6 4,data channels / WAV channels 1 2); overlapping frames and channels are kept, the rest is zeroedWavFiledecoded 8-bit PCM as signed; WAV stores 8-bit samples unsigned (128 = 0)make testsstarts from a clean build directory: generated Gen/Faust/Heavy sources left inBuild/Sourcewere linked into every unit testTests
WavFileTest: header, per-channel and interleaved reads, 16-bit stereo, 8-bit unsigned, mono floatGenDataResourceTest: gen~Data::reset()through the native resource loader (reads files), stereo loaded exactly and kept across reset, declared longer, declared mono, size messages, plain data zeroed on reset. Fails on the Loading resources in gen~ #115 code as-is.Verification
make checkpasses (all unit tests; ARM, web + webtest and native for each test patch), also on a dirty build directoryNote: every gen~
dataand delay line looks up a resource with its own name at startup, so a resource that happens to share a data object's name is loaded into it.