text
stringlengths 0
2.2M
|
---|
if (ver != 0 && ver != (int) 0xa2805140)
|
break;
|
}
|
else if (type == chunkName ("COMM"))
|
{
|
hasGotType = true;
|
numChannels = (unsigned int) input->readShortBigEndian();
|
lengthInSamples = input->readIntBigEndian();
|
bitsPerSample = (unsigned int) input->readShortBigEndian();
|
bytesPerFrame = (int) ((numChannels * bitsPerSample) >> 3);
|
unsigned char sampleRateBytes[10];
|
input->read (sampleRateBytes, 10);
|
const int byte0 = sampleRateBytes[0];
|
if ((byte0 & 0x80) != 0
|
|| byte0 <= 0x3F || byte0 > 0x40
|
|| (byte0 == 0x40 && sampleRateBytes[1] > 0x1C))
|
break;
|
auto sampRate = ByteOrder::bigEndianInt (sampleRateBytes + 2);
|
sampRate >>= (16414 - ByteOrder::bigEndianShort (sampleRateBytes));
|
sampleRate = (int) sampRate;
|
if (length <= 18)
|
{
|
// some types don't have a chunk large enough to include a compression
|
// type, so assume it's just big-endian pcm
|
littleEndian = false;
|
}
|
else
|
{
|
auto compType = input->readInt();
|
if (compType == chunkName ("NONE") || compType == chunkName ("twos"))
|
{
|
littleEndian = false;
|
}
|
else if (compType == chunkName ("sowt"))
|
{
|
littleEndian = true;
|
}
|
else if (compType == chunkName ("fl32") || compType == chunkName ("FL32"))
|
{
|
littleEndian = false;
|
usesFloatingPointData = true;
|
}
|
else
|
{
|
sampleRate = 0;
|
break;
|
}
|
}
|
}
|
else if (type == chunkName ("SSND"))
|
{
|
hasGotData = true;
|
auto offset = input->readIntBigEndian();
|
dataChunkStart = input->getPosition() + 4 + offset;
|
lengthInSamples = (bytesPerFrame > 0) ? jmin (lengthInSamples, ((int64) length) / (int64) bytesPerFrame) : 0;
|
}
|
else if (type == chunkName ("MARK"))
|
{
|
auto numCues = (uint16) input->readShortBigEndian();
|
// these two are always the same for AIFF-read files
|
metadataValuesMap.emplace ("NumCuePoints", String (numCues));
|
metadataValuesMap.emplace ("NumCueLabels", String (numCues));
|
for (uint16 i = 0; i < numCues; ++i)
|
{
|
auto identifier = (uint16) input->readShortBigEndian();
|
auto offset = (uint32) input->readIntBigEndian();
|
auto stringLength = (uint8) input->readByte();
|
MemoryBlock textBlock;
|
input->readIntoMemoryBlock (textBlock, stringLength);
|
// if the stringLength is even then read one more byte as the
|
// string needs to be an even number of bytes INCLUDING the
|
// leading length character in the pascal string
|
if ((stringLength & 1) == 0)
|
input->readByte();
|
auto prefixCue = "Cue" + String (i);
|
metadataValuesMap.emplace (prefixCue + "Identifier", String (identifier));
|
metadataValuesMap.emplace (prefixCue + "Offset", String (offset));
|
auto prefixLabel = "CueLabel" + String (i);
|
metadataValuesMap.emplace (prefixLabel + "Identifier", String (identifier));
|
metadataValuesMap.emplace (prefixLabel + "Text", textBlock.toString());
|
}
|
}
|
else if (type == chunkName ("COMT"))
|
{
|
auto numNotes = (uint16) input->readShortBigEndian();
|
metadataValuesMap.emplace ("NumCueNotes", String (numNotes));
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.