|
|
|
@@ -300,32 +300,29 @@ namespace WavFileHelpers |
|
|
|
MemoryBlock data;
|
|
|
|
const int numLoops = jmin (64, values.getValue ("NumSampleLoops", "0").getIntValue());
|
|
|
|
|
|
|
|
if (numLoops > 0)
|
|
|
|
{
|
|
|
|
data.setSize (roundUpSize (sizeof (SMPLChunk) + (size_t) (numLoops - 1) * sizeof (SampleLoop)), true);
|
|
|
|
data.setSize (roundUpSize (sizeof (SMPLChunk) + (size_t) (jmax (0, numLoops - 1)) * sizeof (SampleLoop)), true);
|
|
|
|
|
|
|
|
SMPLChunk* const s = static_cast<SMPLChunk*> (data.getData());
|
|
|
|
auto s = static_cast<SMPLChunk*> (data.getData());
|
|
|
|
|
|
|
|
s->manufacturer = getValue (values, "Manufacturer", "0");
|
|
|
|
s->product = getValue (values, "Product", "0");
|
|
|
|
s->samplePeriod = getValue (values, "SamplePeriod", "0");
|
|
|
|
s->midiUnityNote = getValue (values, "MidiUnityNote", "60");
|
|
|
|
s->midiPitchFraction = getValue (values, "MidiPitchFraction", "0");
|
|
|
|
s->smpteFormat = getValue (values, "SmpteFormat", "0");
|
|
|
|
s->smpteOffset = getValue (values, "SmpteOffset", "0");
|
|
|
|
s->numSampleLoops = ByteOrder::swapIfBigEndian ((uint32) numLoops);
|
|
|
|
s->samplerData = getValue (values, "SamplerData", "0");
|
|
|
|
s->manufacturer = getValue (values, "Manufacturer", "0");
|
|
|
|
s->product = getValue (values, "Product", "0");
|
|
|
|
s->samplePeriod = getValue (values, "SamplePeriod", "0");
|
|
|
|
s->midiUnityNote = getValue (values, "MidiUnityNote", "60");
|
|
|
|
s->midiPitchFraction = getValue (values, "MidiPitchFraction", "0");
|
|
|
|
s->smpteFormat = getValue (values, "SmpteFormat", "0");
|
|
|
|
s->smpteOffset = getValue (values, "SmpteOffset", "0");
|
|
|
|
s->numSampleLoops = ByteOrder::swapIfBigEndian ((uint32) numLoops);
|
|
|
|
s->samplerData = getValue (values, "SamplerData", "0");
|
|
|
|
|
|
|
|
for (int i = 0; i < numLoops; ++i)
|
|
|
|
{
|
|
|
|
SampleLoop& loop = s->loops[i];
|
|
|
|
loop.identifier = getValue (values, i, "Identifier", "0");
|
|
|
|
loop.type = getValue (values, i, "Type", "0");
|
|
|
|
loop.start = getValue (values, i, "Start", "0");
|
|
|
|
loop.end = getValue (values, i, "End", "0");
|
|
|
|
loop.fraction = getValue (values, i, "Fraction", "0");
|
|
|
|
loop.playCount = getValue (values, i, "PlayCount", "0");
|
|
|
|
}
|
|
|
|
for (int i = 0; i < numLoops; ++i)
|
|
|
|
{
|
|
|
|
auto& loop = s->loops[i];
|
|
|
|
loop.identifier = getValue (values, i, "Identifier", "0");
|
|
|
|
loop.type = getValue (values, i, "Type", "0");
|
|
|
|
loop.start = getValue (values, i, "Start", "0");
|
|
|
|
loop.end = getValue (values, i, "End", "0");
|
|
|
|
loop.fraction = getValue (values, i, "Fraction", "0");
|
|
|
|
loop.playCount = getValue (values, i, "PlayCount", "0");
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|