fixed mod property names and added unit test for xm

This commit is contained in:
Mathias Panzenböck
2011-06-18 03:31:49 +02:00
parent fe356c31b4
commit 5ad69f6f2a
18 changed files with 257 additions and 146 deletions

View File

@ -78,8 +78,6 @@ bool Mod::File::save()
return false;
}
seek(0);
// Even though the spec says the title is padded with space
// common tracker padd with '\0', so why shouldn't I?
writeString(d->tag.title(), 20);
// TODO: write comment as instrument names
return true;
@ -148,7 +146,8 @@ void Mod::File::read(bool)
for(int i = 0; i < instruments; ++ i)
{
READ_STRING_AS(instrumentName, 22);
READ_U16B_AS(instrumentLength);
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(sampleLength);
READ_BYTE_AS(fineTuneByte);
int fineTune = fineTuneByte & 0xF;
@ -157,16 +156,17 @@ void Mod::File::read(bool)
READ_BYTE_AS(volume);
if(volume > 64) volume = 64;
// volume in decibels: 20 * log10(volume / 64)
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(repeatStart);
// (int)repatStart << 1;
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(repatLength);
// (int)repatLength << 1;
comment.append(instrumentName);
}
READ_BYTE(d->properties.setPatternCount);
READ_BYTE(d->properties.setTableLength);
d->tag.setComment(comment.toString("\n"));
}

View File

@ -30,13 +30,13 @@ public:
PropertiesPrivate() :
channels(0),
instrumentCount(0),
patternCount(0)
tableLength(0)
{
}
int channels;
uint instrumentCount;
uint patternCount;
uint tableLength;
};
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
@ -75,9 +75,9 @@ uint Mod::Properties::instrumentCount() const
return d->instrumentCount;
}
uint Mod::Properties::patternCount() const
uint Mod::Properties::tableLength() const
{
return d->patternCount;
return d->tableLength;
}
void Mod::Properties::setChannels(int channels)
@ -90,7 +90,7 @@ void Mod::Properties::setInstrumentCount(uint instrumentCount)
d->instrumentCount = instrumentCount;
}
void Mod::Properties::setPatternCount(uint patternCount)
void Mod::Properties::setTableLength(uint tableLength)
{
d->patternCount = patternCount;
d->tableLength = tableLength;
}

View File

@ -39,13 +39,13 @@ namespace TagLib {
int channels() const;
uint instrumentCount() const;
uint patternCount() const;
uint tableLength() const;
protected:
void setChannels(int channels);
void setInstrumentCount(uint sampleCount);
void setPatternCount(uint patternCount);
void setTableLength(uint tableLength);
private:
Properties(const Properties&);