text
stringlengths 0
2.2M
|
---|
};
|
for (int i = 0; i < numElementsInArray (appleGenres); ++i)
|
if (tag == appleGenres[i])
|
return true;
|
return false;
|
}
|
static String read (InputStream& input, const uint32 length)
|
{
|
MemoryBlock mb;
|
input.skipNextBytes (4);
|
input.readIntoMemoryBlock (mb, (ssize_t) length - 4);
|
StringArray tagsArray;
|
auto* data = static_cast<const char*> (mb.getData());
|
auto* dataEnd = data + mb.getSize();
|
while (data < dataEnd)
|
{
|
bool isGenre = false;
|
if (isValidTag (data))
|
{
|
auto tag = String (CharPointer_UTF8 (data), CharPointer_UTF8 (dataEnd));
|
isGenre = isAppleGenre (tag);
|
tagsArray.add (tag);
|
}
|
data += isGenre ? 118 : 50;
|
if (data < dataEnd && data[0] == 0)
|
{
|
if (data + 52 < dataEnd && isValidTag (data + 50)) data += 50;
|
else if (data + 120 < dataEnd && isValidTag (data + 118)) data += 118;
|
else if (data + 170 < dataEnd && isValidTag (data + 168)) data += 168;
|
}
|
}
|
return tagsArray.joinIntoString (";");
|
}
|
}
|
//==============================================================================
|
namespace MarkChunk
|
{
|
static bool metaDataContainsZeroIdentifiers (const StringPairArray& values)
|
{
|
// (zero cue identifiers are valid for WAV but not for AIFF)
|
const String cueString ("Cue");
|
const String noteString ("CueNote");
|
const String identifierString ("Identifier");
|
for (auto& key : values.getAllKeys())
|
{
|
if (key.startsWith (noteString))
|
continue; // zero identifier IS valid in a COMT chunk
|
if (key.startsWith (cueString) && key.contains (identifierString))
|
if (values.getValue (key, "-1").getIntValue() == 0)
|
return true;
|
}
|
return false;
|
}
|
static void create (MemoryBlock& block, const StringPairArray& values)
|
{
|
auto numCues = values.getValue ("NumCuePoints", "0").getIntValue();
|
if (numCues > 0)
|
{
|
MemoryOutputStream out (block, false);
|
out.writeShortBigEndian ((short) numCues);
|
auto numCueLabels = values.getValue ("NumCueLabels", "0").getIntValue();
|
auto idOffset = metaDataContainsZeroIdentifiers (values) ? 1 : 0; // can't have zero IDs in AIFF
|
#if JUCE_DEBUG
|
Array<int> identifiers;
|
#endif
|
for (int i = 0; i < numCues; ++i)
|
{
|
auto prefixCue = "Cue" + String (i);
|
auto identifier = idOffset + values.getValue (prefixCue + "Identifier", "1").getIntValue();
|
#if JUCE_DEBUG
|
jassert (! identifiers.contains (identifier));
|
identifiers.add (identifier);
|
#endif
|
auto offset = values.getValue (prefixCue + "Offset", "0").getIntValue();
|
auto label = "CueLabel" + String (i);
|
for (int labelIndex = 0; labelIndex < numCueLabels; ++labelIndex)
|
{
|
auto prefixLabel = "CueLabel" + String (labelIndex);
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.