diff options
Diffstat (limited to 'taglib/it')
-rw-r--r-- | taglib/it/itfile.cpp | 29 | ||||
-rw-r--r-- | taglib/it/itproperties.cpp | 21 | ||||
-rw-r--r-- | taglib/it/itproperties.h | 23 |
3 files changed, 44 insertions, 29 deletions
diff --git a/taglib/it/itfile.cpp b/taglib/it/itfile.cpp index 09ff077d..ed175c85 100644 --- a/taglib/it/itfile.cpp +++ b/taglib/it/itfile.cpp @@ -78,7 +78,8 @@ bool IT::File::save() return false; } seek(4); - writeString(d->tag.title(), 26); + writeString(d->tag.title(), 25); + writeByte(0); seek(2, Current); @@ -103,9 +104,10 @@ bool IT::File::save() 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) @@ -118,9 +120,10 @@ bool IT::File::save() 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: @@ -128,6 +131,9 @@ bool IT::File::save() 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; @@ -249,7 +255,7 @@ void IT::File::read(bool) 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 @@ -290,6 +296,7 @@ void IT::File::read(bool) 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); @@ -303,15 +310,13 @@ void IT::File::read(bool) 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"); } diff --git a/taglib/it/itproperties.cpp b/taglib/it/itproperties.cpp index ce9cefaa..7d181d57 100644 --- a/taglib/it/itproperties.cpp +++ b/taglib/it/itproperties.cpp @@ -29,8 +29,7 @@ class IT::Properties::PropertiesPrivate public: PropertiesPrivate() : channels(0), - tableLength(0), - stereo(false), + lengthInPatterns(0), instrumentCount(0), sampleCount(0), patternCount(0), @@ -48,8 +47,7 @@ public: } int channels; - ushort tableLength; - bool stereo; + ushort lengthInPatterns; ushort instrumentCount; ushort sampleCount; ushort patternCount; @@ -96,14 +94,14 @@ int IT::Properties::channels() const 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 @@ -176,14 +174,9 @@ void IT::Properties::setChannels(int channels) 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) { diff --git a/taglib/it/itproperties.h b/taglib/it/itproperties.h index 5e60ec58..632b87a8 100644 --- a/taglib/it/itproperties.h +++ b/taglib/it/itproperties.h @@ -30,6 +30,24 @@ namespace TagLib { 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(); @@ -38,7 +56,7 @@ namespace TagLib { int sampleRate() const; int channels() const; - ushort tableLength() const; + ushort lengthInPatterns() const; bool stereo() const; ushort instrumentCount() const; ushort sampleCount() const; @@ -57,8 +75,7 @@ namespace TagLib { 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); |