mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
IT: support channels property
This commit is contained in:
parent
4b44f25048
commit
d1cb8ae09d
@ -176,6 +176,23 @@ void IT::File::read(bool)
|
||||
}
|
||||
*/
|
||||
|
||||
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
|
||||
|
@ -28,6 +28,7 @@ class IT::Properties::PropertiesPrivate
|
||||
{
|
||||
public:
|
||||
PropertiesPrivate() :
|
||||
channels(0),
|
||||
tableLength(0),
|
||||
stereo(false),
|
||||
instrumentCount(0),
|
||||
@ -41,11 +42,12 @@ public:
|
||||
mixVolume(0),
|
||||
tempo(0),
|
||||
bpmSpeed(0),
|
||||
panningSeparation(0),
|
||||
pitchWheelDepth(0)
|
||||
panningSeparation(0),
|
||||
pitchWheelDepth(0)
|
||||
{
|
||||
}
|
||||
|
||||
int channels;
|
||||
ushort tableLength;
|
||||
bool stereo;
|
||||
ushort instrumentCount;
|
||||
@ -91,7 +93,7 @@ int IT::Properties::sampleRate() const
|
||||
|
||||
int IT::Properties::channels() const
|
||||
{
|
||||
return d->stereo ? 2 : 1;
|
||||
return d->channels;
|
||||
}
|
||||
|
||||
ushort IT::Properties::tableLength() const
|
||||
@ -169,6 +171,11 @@ uchar IT::Properties::pitchWheelDepth() const
|
||||
return d->pitchWheelDepth;
|
||||
}
|
||||
|
||||
void IT::Properties::setChannels(int channels)
|
||||
{
|
||||
d->channels = channels;
|
||||
}
|
||||
|
||||
void IT::Properties::setTableLength(ushort tableLength)
|
||||
{
|
||||
d->tableLength = tableLength;
|
||||
|
@ -51,13 +51,14 @@ namespace TagLib {
|
||||
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);
|
||||
|
@ -34,9 +34,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
int channels;
|
||||
uint instrumentCount;
|
||||
uint tableLength;
|
||||
int channels;
|
||||
uint instrumentCount;
|
||||
uchar tableLength;
|
||||
};
|
||||
|
||||
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
|
||||
@ -75,7 +75,7 @@ uint Mod::Properties::instrumentCount() const
|
||||
return d->instrumentCount;
|
||||
}
|
||||
|
||||
uint Mod::Properties::tableLength() const
|
||||
uchar Mod::Properties::tableLength() const
|
||||
{
|
||||
return d->tableLength;
|
||||
}
|
||||
@ -90,7 +90,7 @@ void Mod::Properties::setInstrumentCount(uint instrumentCount)
|
||||
d->instrumentCount = instrumentCount;
|
||||
}
|
||||
|
||||
void Mod::Properties::setTableLength(uint tableLength)
|
||||
void Mod::Properties::setTableLength(uchar tableLength)
|
||||
{
|
||||
d->tableLength = tableLength;
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ namespace TagLib {
|
||||
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&);
|
||||
|
@ -93,7 +93,7 @@ private:
|
||||
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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user