}
*/
+ seek(64);
+
+ ByteVector pannings = readBlock(64);
+ ByteVector volumes = readBlock(64);
+ READ_ASSERT(pannings.size() == 64 && volumes.size() == 64);
+ int channels = 0;
+ for(int i = 0; i < 64; ++ i)
+ {
+ // Strictly speaking an IT file has always 64 channels, but
+ // I don't count disabled and muted channels.
+ // But this always gives 64 channels for all my files anyway.
+ // Strangely VLC does report other values. I wonder how VLC
+ // gets it's values.
+ if(pannings[i] < 128 && volumes[i] > 0) ++ channels;
+ }
+ d->properties.setChannels(channels);
+
StringList comment;
// Note: I found files that have nil characters somewhere
// in the instrument/sample names and more characters
{
public:
PropertiesPrivate() :
+ channels(0),
tableLength(0),
stereo(false),
instrumentCount(0),
mixVolume(0),
tempo(0),
bpmSpeed(0),
- panningSeparation(0),
- pitchWheelDepth(0)
+ panningSeparation(0),
+ pitchWheelDepth(0)
{
}
+ int channels;
ushort tableLength;
bool stereo;
ushort instrumentCount;
int IT::Properties::channels() const
{
- return d->stereo ? 2 : 1;
+ return d->channels;
}
ushort IT::Properties::tableLength() const
return d->pitchWheelDepth;
}
+void IT::Properties::setChannels(int channels)
+{
+ d->channels = channels;
+}
+
void IT::Properties::setTableLength(ushort tableLength)
{
d->tableLength = tableLength;
ushort mixVolume() const;
uchar tempo() const;
uchar bpmSpeed() const;
- uchar panningSeparation() const;
- uchar pitchWheelDepth() const;
+ uchar panningSeparation() const;
+ uchar pitchWheelDepth() const;
protected:
+ void setChannels(int channels);
+
void setTableLength(ushort tableLength);
void setStereo(bool stereo);
-
void setInstrumentCount(ushort instrumentCount);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
{
}
- int channels;
- uint instrumentCount;
- uint tableLength;
+ int channels;
+ uint instrumentCount;
+ uchar tableLength;
};
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
return d->instrumentCount;
}
-uint Mod::Properties::tableLength() const
+uchar Mod::Properties::tableLength() const
{
return d->tableLength;
}
d->instrumentCount = instrumentCount;
}
-void Mod::Properties::setTableLength(uint tableLength)
+void Mod::Properties::setTableLength(uchar tableLength)
{
d->tableLength = tableLength;
}
int sampleRate() const;
int channels() const;
- uint instrumentCount() const;
- uint tableLength() const;
+ uint instrumentCount() const;
+ uchar tableLength() const;
protected:
void setChannels(int channels);
void setInstrumentCount(uint sampleCount);
- void setTableLength(uint tableLength);
+ void setTableLength(uchar tableLength);
private:
Properties(const Properties&);
CPPUNIT_ASSERT_EQUAL(0, p->sampleRate());
CPPUNIT_ASSERT_EQUAL(8, p->channels());
CPPUNIT_ASSERT_EQUAL(31U, p->instrumentCount());
- CPPUNIT_ASSERT_EQUAL(1U, p->tableLength());
+ CPPUNIT_ASSERT_EQUAL((uchar)1, p->tableLength());
CPPUNIT_ASSERT_EQUAL(title, t->title());
CPPUNIT_ASSERT_EQUAL(String::null, t->artist());
CPPUNIT_ASSERT_EQUAL(String::null, t->album());