aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Panzenböck <grosser.meister.morti@gmx.net>2011-06-20 00:43:42 +0200
committerMathias Panzenböck <grosser.meister.morti@gmx.net>2011-06-20 00:43:42 +0200
commit4b754b1bc6190b493195a9bb798fa89dea440662 (patch)
tree58c503006d4a17ba5a67b3b0bca71a555d8957a1
parentb3d44394bf176f46ad96b071f039f0b10f934d3a (diff)
more correct IT parsing and property naming
-rw-r--r--taglib/it/itfile.cpp52
-rw-r--r--taglib/it/itproperties.cpp62
-rw-r--r--taglib/it/itproperties.h36
3 files changed, 102 insertions, 48 deletions
diff --git a/taglib/it/itfile.cpp b/taglib/it/itfile.cpp
index 244a452c..2dc63968 100644
--- a/taglib/it/itfile.cpp
+++ b/taglib/it/itfile.cpp
@@ -140,27 +140,43 @@ void IT::File::read(bool)
READ_U16L_AS(length);
READ_U16L_AS(instrumentCount);
READ_U16L_AS(sampleCount);
-
+
d->properties.setTableLength(length);
d->properties.setInstrumentCount(instrumentCount);
d->properties.setSampleCount(sampleCount);
READ_U16L(d->properties.setPatternCount);
READ_U16L(d->properties.setVersion);
- READ_U16L(d->properties.setCmwt);
+ READ_U16L(d->properties.setCompatibleVersion);
READ_U16L(d->properties.setFlags);
-
READ_U16L_AS(special);
-
d->properties.setSpecial(special);
- READ_U16L(d->properties.setBaseVolume);
-
- seek(1, Current);
-
- READ_BYTE(d->properties.setTempo);
+ READ_U16L(d->properties.setGlobalVolume);
+ READ_U16L(d->properties.setMixVolume);
READ_BYTE(d->properties.setBpmSpeed);
+ READ_BYTE(d->properties.setTempo);
+ READ_BYTE(d->properties.setPanningSeparation);
+ READ_BYTE(d->properties.setPitchWheelDepth);
+
+ /*
+ * While the message would be a sorta comment tag, I don't
+ * see any IT files in the wild that use this or set the
+ * offset/length to a correct value.
+ *
+ * In all files I found where the message bit was set the
+ * offset was either 0 or a ridiculous high value and the
+ * length wasn't much better.
+ *
+ if(special & 0x1)
+ {
+ READ_U16L_AS(messageLength);
+ READ_U32L_AS(messageOffset);
+ seek(messageOffset);
+ READ_STRING_AS(message, messageLength);
+ debug("Message: \""+message+"\"");
+ }
+ */
StringList comment;
-
for(ushort i = 0; i < instrumentCount; ++ i)
{
seek(192L + length + ((long)i << 2));
@@ -189,26 +205,22 @@ void IT::File::read(bool)
READ_ASSERT(sampleMagic == "IMPS");
READ_STRING_AS(dosFileName, 13);
- // TODO: When cmwt < 0x200 (old format) there are different
- // (non-string) fileds, but they have the same cumulative
- // size. Because I don't save these fields to anything
- // (yet) it does not matter.
READ_BYTE_AS(globalVolume);
READ_BYTE_AS(sampleFlags);
- READ_BYTE_AS(sampleValume);
+ READ_BYTE_AS(sampleVolume);
READ_STRING_AS(sampleName, 26);
READ_BYTE_AS(sampleCvt);
READ_BYTE_AS(samplePanning);
READ_U32L_AS(sampleLength);
- READ_U32L_AS(repeatStart);
- READ_U32L_AS(repeatStop);
- READ_U32L_AS(c4speed);
+ READ_U32L_AS(loopStart);
+ READ_U32L_AS(loopStop);
+ READ_U32L_AS(c5speed);
READ_U32L_AS(sustainLoopStart);
READ_U32L_AS(sustainLoopEnd);
READ_U32L_AS(sampleDataOffset);
- READ_BYTE_AS(vibratoRate);
+ READ_BYTE_AS(vibratoSpeed);
READ_BYTE_AS(vibratoDepth);
- READ_BYTE_AS(vibratoSweep);
+ READ_BYTE_AS(vibratoRate);
READ_BYTE_AS(vibratoType);
comment.append(sampleName);
diff --git a/taglib/it/itproperties.cpp b/taglib/it/itproperties.cpp
index 565184a3..d74779c8 100644
--- a/taglib/it/itproperties.cpp
+++ b/taglib/it/itproperties.cpp
@@ -34,12 +34,15 @@ public:
sampleCount(0),
patternCount(0),
version(0),
- cmwt(0),
+ compatibleVersion(0),
flags(0),
special(0),
- baseVolume(0),
+ globalVolume(0),
+ mixVolume(0),
tempo(0),
- bpmSpeed(0)
+ bpmSpeed(0),
+ panningSeparation(0),
+ pitchWheelDepth(0)
{
}
@@ -49,12 +52,15 @@ public:
ushort sampleCount;
ushort patternCount;
ushort version;
- ushort cmwt;
+ ushort compatibleVersion;
ushort flags;
ushort special;
- int baseVolume;
+ ushort globalVolume;
+ ushort mixVolume;
uchar tempo;
uchar bpmSpeed;
+ uchar panningSeparation;
+ uchar pitchWheelDepth;
};
IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
@@ -118,9 +124,9 @@ ushort IT::Properties::version() const
return d->version;
}
-ushort IT::Properties::cmwt() const
+ushort IT::Properties::compatibleVersion() const
{
- return d->cmwt;
+ return d->compatibleVersion;
}
ushort IT::Properties::flags() const
@@ -133,9 +139,14 @@ ushort IT::Properties::special() const
return d->special;
}
-int IT::Properties::baseVolume() const
+ushort IT::Properties::globalVolume() const
{
- return d->baseVolume;
+ return d->globalVolume;
+}
+
+ushort IT::Properties::mixVolume() const
+{
+ return d->mixVolume;
}
uchar IT::Properties::tempo() const
@@ -148,6 +159,16 @@ uchar IT::Properties::bpmSpeed() const
return d->bpmSpeed;
}
+uchar IT::Properties::panningSeparation() const
+{
+ return d->panningSeparation;
+}
+
+uchar IT::Properties::pitchWheelDepth() const
+{
+ return d->pitchWheelDepth;
+}
+
void IT::Properties::setTableLength(ushort tableLength)
{
d->tableLength = tableLength;
@@ -182,9 +203,9 @@ void IT::Properties::setSpecial(ushort special)
d->special = special;
}
-void IT::Properties::setCmwt(ushort cmwt)
+void IT::Properties::setCompatibleVersion(ushort compatibleVersion)
{
- d->cmwt = cmwt;
+ d->compatibleVersion = compatibleVersion;
}
void IT::Properties::setVersion(ushort version)
@@ -192,9 +213,14 @@ void IT::Properties::setVersion(ushort version)
d->version = version;
}
-void IT::Properties::setBaseVolume(int baseVolume)
+void IT::Properties::setGlobalVolume(ushort globalVolume)
{
- d->baseVolume = baseVolume;
+ d->globalVolume = globalVolume;
+}
+
+void IT::Properties::setMixVolume(ushort mixVolume)
+{
+ d->mixVolume = mixVolume;
}
void IT::Properties::setTempo(uchar tempo)
@@ -206,3 +232,13 @@ void IT::Properties::setBpmSpeed(uchar bpmSpeed)
{
d->bpmSpeed = bpmSpeed;
}
+
+void IT::Properties::setPanningSeparation(uchar panningSeparation)
+{
+ d->panningSeparation = panningSeparation;
+}
+
+void IT::Properties::setPitchWheelDepth(uchar pitchWheelDepth)
+{
+ d->pitchWheelDepth = pitchWheelDepth;
+}
diff --git a/taglib/it/itproperties.h b/taglib/it/itproperties.h
index 3a72e05d..dfcf3a62 100644
--- a/taglib/it/itproperties.h
+++ b/taglib/it/itproperties.h
@@ -38,18 +38,21 @@ namespace TagLib {
int sampleRate() const;
int channels() const;
- ushort tableLength() const;
- bool stereo() const;
- ushort instrumentCount() const;
- ushort sampleCount() const;
- ushort patternCount() const;
- ushort version() const;
- ushort cmwt() const;
- ushort flags() const;
- ushort special() const;
- int baseVolume() const;
- uchar tempo() const;
- uchar bpmSpeed() const;
+ ushort tableLength() const;
+ bool stereo() const;
+ ushort instrumentCount() const;
+ ushort sampleCount() const;
+ ushort patternCount() const;
+ ushort version() const;
+ ushort compatibleVersion() const;
+ ushort flags() const;
+ ushort special() const;
+ ushort globalVolume() const;
+ ushort mixVolume() const;
+ uchar tempo() const;
+ uchar bpmSpeed() const;
+ uchar panningSeparation() const;
+ uchar pitchWheelDepth() const;
protected:
void setTableLength(ushort tableLength);
@@ -58,13 +61,16 @@ namespace TagLib {
void setInstrumentCount(ushort instrumentCount);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
+ void setVersion (ushort version);
+ void setCompatibleVersion(ushort compatibleVersion);
void setFlags (ushort flags);
void setSpecial (ushort special);
- void setCmwt (ushort cmwt);
- void setVersion (ushort version);
- void setBaseVolume (int baseVolume);
+ void setGlobalVolume(ushort globalVolume);
+ void setMixVolume (ushort mixVolume);
void setTempo (uchar tempo);
void setBpmSpeed (uchar bpmSpeed);
+ void setPanningSeparation(uchar panningSeparation);
+ void setPitchWheelDepth (uchar pitchWheelDepth);
private:
Properties(const Properties&);