text
stringlengths
0
2.2M
auto labelIdentifier = idOffset + values.getValue (prefixLabel + "Identifier", "1").getIntValue();
if (labelIdentifier == identifier)
{
label = values.getValue (prefixLabel + "Text", label);
break;
}
}
out.writeShortBigEndian ((short) identifier);
out.writeIntBigEndian (offset);
auto labelLength = jmin ((size_t) 254, label.getNumBytesAsUTF8()); // seems to need null terminator even though it's a pstring
out.writeByte (static_cast<char> (labelLength + 1));
out.write (label.toUTF8(), labelLength);
out.writeByte (0);
if ((out.getDataSize() & 1) != 0)
out.writeByte (0);
}
}
}
}
//==============================================================================
namespace COMTChunk
{
static void create (MemoryBlock& block, const StringPairArray& values)
{
auto numNotes = values.getValue ("NumCueNotes", "0").getIntValue();
if (numNotes > 0)
{
MemoryOutputStream out (block, false);
out.writeShortBigEndian ((short) numNotes);
for (int i = 0; i < numNotes; ++i)
{
auto prefix = "CueNote" + String (i);
out.writeIntBigEndian (values.getValue (prefix + "TimeStamp", "0").getIntValue());
out.writeShortBigEndian ((short) values.getValue (prefix + "Identifier", "0").getIntValue());
auto comment = values.getValue (prefix + "Text", String());
auto commentLength = jmin (comment.getNumBytesAsUTF8(), (size_t) 65534);
out.writeShortBigEndian (static_cast<short> (commentLength + 1));
out.write (comment.toUTF8(), commentLength);
out.writeByte (0);
if ((out.getDataSize() & 1) != 0)
out.writeByte (0);
}
}
}
}
}
//==============================================================================
class AiffAudioFormatReader : public AudioFormatReader
{
public:
AiffAudioFormatReader (InputStream* in)
: AudioFormatReader (in, aiffFormatName)
{
using namespace AiffFileHelpers;
std::map<String, String> metadataValuesMap;
for (int i = 0; i != metadataValues.size(); ++i)
{
metadataValuesMap.emplace (metadataValues.getAllKeys().getReference (i),
metadataValues.getAllValues().getReference (i));
}
// If this fails, there were duplicate keys in the metadata
jassert ((size_t) metadataValuesMap.size() == (size_t) metadataValues.size());
if (input->readInt() == chunkName ("FORM"))
{
auto len = input->readIntBigEndian();
auto end = input->getPosition() + len;
auto nextType = input->readInt();
if (nextType == chunkName ("AIFF") || nextType == chunkName ("AIFC"))
{
bool hasGotVer = false;
bool hasGotData = false;
bool hasGotType = false;
while (input->getPosition() < end)
{
auto type = input->readInt();
auto length = (uint32) input->readIntBigEndian();
auto chunkEnd = input->getPosition() + length;
if (type == chunkName ("FVER"))
{
hasGotVer = true;
auto ver = input->readIntBigEndian();