Also added enums for S3M/IT/XM flags.
return false;
}
seek(4);
- writeString(d->tag.title(), 26);
+ writeString(d->tag.title(), 25);
+ writeByte(0);
seek(2, Current);
seek(instrumentOffset + 32);
if(i < lines.size())
- writeString(lines[i], 26);
+ writeString(lines[i], 25);
else
- writeString(String::null, 26);
+ writeString(String::null, 25);
+ writeByte(0);
}
for(ushort i = 0; i < sampleCount; ++ i)
seek(sampleOffset + 20);
if((i + instrumentCount) < lines.size())
- writeString(lines[i + instrumentCount], 26);
+ writeString(lines[i + instrumentCount], 25);
else
- writeString(String::null, 26);
+ writeString(String::null, 25);
+ writeByte(0);
}
// write rest as message:
for(uint i = instrumentCount + sampleCount; i < lines.size(); ++ i)
messageLines.append(lines[i]);
ByteVector message = messageLines.toString("\r").data(String::Latin1);
+ if(message.size() > 8000)
+ message.resize(8000);
+
ushort special = 0;
ushort messageLength = 0;
ulong messageOffset = 0;
if(order == 255) break;
if(order != 254) ++ realLength;
}
- d->properties.setTableLength(realLength);
+ d->properties.setLengthInPatterns(realLength);
StringList comment;
// Note: I found files that have nil characters somewhere
READ_BYTE_AS(sampleFlags);
READ_BYTE_AS(sampleVolume);
READ_STRING_AS(sampleName, 26);
+ /*
READ_BYTE_AS(sampleCvt);
READ_BYTE_AS(samplePanning);
READ_U32L_AS(sampleLength);
READ_BYTE_AS(vibratoDepth);
READ_BYTE_AS(vibratoRate);
READ_BYTE_AS(vibratoType);
+ */
comment.append(sampleName);
}
- if(comment.size() > 0 && message.size() > 0)
- d->tag.setComment(comment.toString("\n") + "\n" + message);
- else if(comment.size() > 0)
- d->tag.setComment(comment.toString("\n"));
- else
- d->tag.setComment(message);
+ if(message.size() > 0)
+ comment.append(message);
+ d->tag.setComment(comment.toString("\n"));
d->tag.setTrackerName("Impulse Tracker");
}
public:
PropertiesPrivate() :
channels(0),
- tableLength(0),
- stereo(false),
+ lengthInPatterns(0),
instrumentCount(0),
sampleCount(0),
patternCount(0),
}
int channels;
- ushort tableLength;
- bool stereo;
+ ushort lengthInPatterns;
ushort instrumentCount;
ushort sampleCount;
ushort patternCount;
return d->channels;
}
-ushort IT::Properties::tableLength() const
+ushort IT::Properties::lengthInPatterns() const
{
- return d->tableLength;
+ return d->lengthInPatterns;
}
bool IT::Properties::stereo() const
{
- return d->stereo;
+ return d->flags & F_STEREO;
}
ushort IT::Properties::instrumentCount() const
d->channels = channels;
}
-void IT::Properties::setTableLength(ushort tableLength)
+void IT::Properties::setLengthInPatterns(ushort lengthInPatterns)
{
- d->tableLength = tableLength;
-}
-
-void IT::Properties::setStereo(bool stereo)
-{
- d->stereo = stereo;
+ d->lengthInPatterns = lengthInPatterns;
}
void IT::Properties::setInstrumentCount(ushort instrumentCount) {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
+ /*! Flag bits. */
+ enum {
+ F_STEREO = 1,
+ F_VOL0_MIX_OPT = 2,
+ F_INSTRUMENTS = 4,
+ F_LINEAR_SLIDES = 8,
+ F_OLD_EFFECTS = 16,
+ F_LINK_EFFECT = 32,
+ F_MIDI_PITCH_CTRL = 64,
+ F_EMBEDDED_MIDI_CONF = 128
+ };
+
+ /*! Special bits. */
+ enum {
+ S_MESSAGE = 1,
+ S_EMBEDDED_MIDI_CONF = 8
+ };
+
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int sampleRate() const;
int channels() const;
- ushort tableLength() const;
+ ushort lengthInPatterns() const;
bool stereo() const;
ushort instrumentCount() const;
ushort sampleCount() const;
protected:
void setChannels(int channels);
- void setTableLength(ushort tableLength);
- void setStereo(bool stereo);
+ void setLengthInPatterns(ushort lengthInPatterns);
void setInstrumentCount(ushort instrumentCount);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
comment.append(instrumentName);
}
- READ_BYTE(d->properties.setTableLength);
+ READ_BYTE(d->properties.setLengthInPatterns);
d->tag.setComment(comment.toString("\n"));
}
PropertiesPrivate() :
channels(0),
instrumentCount(0),
- tableLength(0)
+ lengthInPatterns(0)
{
}
int channels;
uint instrumentCount;
- uchar tableLength;
+ uchar lengthInPatterns;
};
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
return d->instrumentCount;
}
-uchar Mod::Properties::tableLength() const
+uchar Mod::Properties::lengthInPatterns() const
{
- return d->tableLength;
+ return d->lengthInPatterns;
}
void Mod::Properties::setChannels(int channels)
d->instrumentCount = instrumentCount;
}
-void Mod::Properties::setTableLength(uchar tableLength)
+void Mod::Properties::setLengthInPatterns(uchar lengthInPatterns)
{
- d->tableLength = tableLength;
+ d->lengthInPatterns = lengthInPatterns;
}
int sampleRate() const;
int channels() const;
- uint instrumentCount() const;
- uchar tableLength() const;
+ uint instrumentCount() const;
+ uchar lengthInPatterns() const;
protected:
void setChannels(int channels);
void setInstrumentCount(uint sampleCount);
- void setTableLength(uchar tableLength);
+ void setLengthInPatterns(uchar lengthInPatterns);
private:
Properties(const Properties&);
if(order == 255) break;
if(order != 254) ++ realLength;
}
- d->properties.setTableLength(realLength);
+ d->properties.setLengthInPatterns(realLength);
seek(channels, Current);
{
public:
PropertiesPrivate() :
- tableLength(0),
+ lengthInPatterns(0),
channels(0),
stereo(false),
sampleCount(0),
{
}
- ushort tableLength;
+ ushort lengthInPatterns;
int channels;
bool stereo;
ushort sampleCount;
return d->channels;
}
-ushort S3M::Properties::tableLength() const
+ushort S3M::Properties::lengthInPatterns() const
{
- return d->tableLength;
+ return d->lengthInPatterns;
}
bool S3M::Properties::stereo() const
return d->bpmSpeed;
}
-void S3M::Properties::setTableLength(ushort tableLength)
+void S3M::Properties::setLengthInPatterns(ushort lengthInPatterns)
{
- d->tableLength = tableLength;
+ d->lengthInPatterns = lengthInPatterns;
}
void S3M::Properties::setChannels(int channels)
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
+ /*! Flag bits. */
+ enum {
+ F_ST2_VIBRATO = 1,
+ F_ST2_TEMPO = 2,
+ F_AMIGA_SLIDES = 4,
+ F_VOL0_MIX_OPT = 8,
+ F_AMIGA_LIMITS = 16,
+ F_ENABLE_FILTER = 32,
+ F_CUSTOM_DATA = 128
+ };
+
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int sampleRate() const;
int channels() const;
- ushort tableLength() const;
+ ushort lengthInPatterns() const;
bool stereo() const;
ushort sampleCount() const;
ushort patternCount() const;
uchar bpmSpeed() const;
protected:
- void setTableLength(ushort tableLength);
void setChannels(int channels);
+ void setLengthInPatterns (ushort lengthInPatterns);
void setStereo (bool stereo);
void setSampleCount (ushort sampleCount);
void setPatternCount (ushort patternCount);
{
if(sampleHeaderSize > 4U)
{
- ulong length = 0;
- if(!readU32L(length))
+ ulong sampleLength = 0;
+ if(!readU32L(sampleLength))
return false;
- offset += length;
+ offset += sampleLength;
seek(std::min(sampleHeaderSize, 14UL), Current);
if(sampleHeaderSize > 18U)
READ_U32L_AS(headerSize);
READ_ASSERT(headerSize >= 4);
- ushort tableLength = 0;
+ ushort length = 0;
ushort restartPosition = 0;
ushort channels = 0;
ushort patternCount = 0;
ushort bpmSpeed = 0;
StructReader header;
- header.u16L(tableLength)
+ header.u16L(length)
.u16L(restartPosition)
.u16L(channels)
.u16L(patternCount)
READ_ASSERT(count == size);
- d->properties.setTableLength(tableLength);
+ d->properties.setLengthInPatterns(length);
d->properties.setRestartPosition(restartPosition);
d->properties.setChannels(channels);
d->properties.setPatternCount(patternCount);
for(ushort j = 0; j < sampleCount; ++ j)
{
- ulong length = 0;
- ulong loopStart = 0;
- ulong loopLength = 0;
- uchar volume = 0;
- uchar finetune = 0;
- uchar sampleType = 0;
- uchar panning = 0;
- uchar noteNumber = 0;
- uchar compression = 0;
+ ulong sampleLength = 0;
+ ulong loopStart = 0;
+ ulong loopLength = 0;
+ uchar volume = 0;
+ uchar finetune = 0;
+ uchar sampleType = 0;
+ uchar panning = 0;
+ uchar noteNumber = 0;
+ uchar compression = 0;
String sampleName;
StructReader sample;
- sample.u32L(length)
+ sample.u32L(sampleLength)
.u32L(loopStart)
.u32L(loopLength)
.byte(volume)
// skip unhandeled header proportion:
seek(sampleHeaderSize - count, Current);
- offset += length;
+ offset += sampleLength;
sampleNames.append(sampleName);
}
}
{
public:
PropertiesPrivate() :
- tableLength(0),
+ lengthInPatterns(0),
channels(0),
version(0),
restartPosition(0),
{
}
- ushort tableLength;
+ ushort lengthInPatterns;
int channels;
ushort version;
ushort restartPosition;
return d->channels;
}
-ushort XM::Properties::tableLength() const
+ushort XM::Properties::lengthInPatterns() const
{
- return d->tableLength;
+ return d->lengthInPatterns;
}
ushort XM::Properties::version() const
return d->bpmSpeed;
}
-void XM::Properties::setTableLength(ushort tableLength)
+void XM::Properties::setLengthInPatterns(ushort lengthInPatterns)
{
- d->tableLength = tableLength;
+ d->lengthInPatterns = lengthInPatterns;
}
void XM::Properties::setChannels(int channels)
class Properties : public AudioProperties {
friend class File;
public:
+ /*! Flag bits. */
+ enum {
+ F_AMIGA_FREQ = 1
+ };
+
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int sampleRate() const;
int channels() const;
- ushort tableLength() const;
- ushort version() const;
- ushort restartPosition() const;
- ushort patternCount() const;
- ushort instrumentCount() const;
- uint sampleCount() const;
- ushort flags() const;
- ushort tempo() const;
- ushort bpmSpeed() const;
+ ushort lengthInPatterns() const;
+ ushort version() const;
+ ushort restartPosition() const;
+ ushort patternCount() const;
+ ushort instrumentCount() const;
+ uint sampleCount() const;
+ ushort flags() const;
+ ushort tempo() const;
+ ushort bpmSpeed() const;
protected:
void setChannels(int channels);
- void setTableLength(ushort tableLength);
+ void setLengthInPatterns(ushort lengthInPatterns);
void setVersion(ushort version);
void setRestartPosition(ushort restartPosition);
void setPatternCount(ushort patternCount);
CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
CPPUNIT_ASSERT_EQUAL(8, p->channels());
CPPUNIT_ASSERT_EQUAL(31U, p->instrumentCount());
- CPPUNIT_ASSERT_EQUAL((uchar)1, p->tableLength());
+ CPPUNIT_ASSERT_EQUAL((uchar)1, p->lengthInPatterns());
CPPUNIT_ASSERT_EQUAL(title, t->title());
CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
CPPUNIT_ASSERT_EQUAL(String::null, t->album());
CPPUNIT_ASSERT_EQUAL( 0, p->bitrate());
CPPUNIT_ASSERT_EQUAL( 0, p->sampleRate());
CPPUNIT_ASSERT_EQUAL(16, p->channels());
- CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 0, p->tableLength());
+ CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 0, p->lengthInPatterns());
CPPUNIT_ASSERT_EQUAL(false, p->stereo());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 5, p->sampleCount());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->patternCount());
CPPUNIT_ASSERT_EQUAL(0, p->bitrate());
CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
CPPUNIT_ASSERT_EQUAL(8, p->channels());
- CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->tableLength());
+ CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->lengthInPatterns());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 0, p->version());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 0 , p->restartPosition());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->patternCount());
CPPUNIT_ASSERT_EQUAL(0, p->bitrate());
CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
CPPUNIT_ASSERT_EQUAL(8, p->channels());
- CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->tableLength());
+ CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->lengthInPatterns());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort)260, p->version());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 0, p->restartPosition());
CPPUNIT_ASSERT_EQUAL((TagLib::ushort) 1, p->patternCount());