converted tabs to spaces

This commit is contained in:
Mathias Panzenböck 2011-06-14 01:09:55 +02:00
parent f6dbd32ed3
commit 54e9656474
20 changed files with 844 additions and 842 deletions

2
.gitignore vendored
View File

@ -9,6 +9,8 @@ CMakeFiles/
*.sln
*.suo
*.user
.*
*~
/CMakeCache.txt
/Doxyfile
/config.h

View File

@ -34,34 +34,34 @@ static const uchar AUTOVIB_IT_TO_XM[] = {0, 3, 1, 4, 2, 0, 0, 0};
class IT::File::FilePrivate
{
public:
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: tag(), properties(propertiesStyle)
{
}
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: tag(), properties(propertiesStyle)
{
}
Mod::Tag tag;
IT::Properties properties;
Mod::Tag tag;
IT::Properties properties;
};
IT::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(file),
d(new FilePrivate(propertiesStyle))
Mod::File(file),
d(new FilePrivate(propertiesStyle))
{
read(readProperties);
read(readProperties);
}
IT::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(stream),
d(new FilePrivate(propertiesStyle))
Mod::File(stream),
d(new FilePrivate(propertiesStyle))
{
read(readProperties);
read(readProperties);
}
IT::File::~File()
{
delete d;
delete d;
}
Mod::Tag *IT::File::tag() const
@ -76,110 +76,110 @@ IT::Properties *IT::File::audioProperties() const
bool IT::File::save()
{
seek(4);
writeString(d->tag.title(), 26);
// TODO: write comment as instrument and sample names
seek(4);
writeString(d->tag.title(), 26);
// TODO: write comment as instrument and sample names
return true;
}
void IT::File::read(bool)
{
if(!isOpen())
return;
if(!isOpen())
return;
seek(0);
READ_ASSERT(readBlock(4) == "IMPM");
READ_STRING(d->tag.setTitle, 26);
seek(0);
READ_ASSERT(readBlock(4) == "IMPM");
READ_STRING(d->tag.setTitle, 26);
seek(2, Current);
seek(2, Current);
READ_U16L_AS(length);
READ_U16L_AS(instrumentCount);
READ_U16L_AS(sampleCount);
d->properties.setSampleLength(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.setFlags);
READ_U16L_AS(length);
READ_U16L_AS(instrumentCount);
READ_U16L_AS(sampleCount);
d->properties.setSampleLength(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.setFlags);
READ_U16L_AS(special);
READ_U16L_AS(special);
d->properties.setSpecial(special);
READ_U16L(d->properties.setBaseVolume);
d->properties.setSpecial(special);
READ_U16L(d->properties.setBaseVolume);
seek(1, Current);
seek(1, Current);
READ_BYTE(d->properties.setTempo);
READ_BYTE(d->properties.setBpmSpeed);
READ_BYTE(d->properties.setTempo);
READ_BYTE(d->properties.setBpmSpeed);
StringList comment;
StringList comment;
for(ushort i = 0; i < instrumentCount; ++ i)
{
seek(192 + length + (i << 2));
READ_U32L_AS(instrumentOffset);
seek(instrumentOffset);
for(ushort i = 0; i < instrumentCount; ++ i)
{
seek(192 + length + (i << 2));
READ_U32L_AS(instrumentOffset);
seek(instrumentOffset);
ByteVector instrumentMagic = readBlock(4);
// TODO: find out if it can really be both here and not just IMPI
READ_ASSERT(instrumentMagic == "IMPS" || instrumentMagic == "IMPI");
ByteVector instrumentMagic = readBlock(4);
// TODO: find out if it can really be both here and not just IMPI
READ_ASSERT(instrumentMagic == "IMPS" || instrumentMagic == "IMPI");
READ_STRING_AS(dosFileName, 13);
READ_STRING_AS(dosFileName, 13);
seek(15, Current);
seek(15, Current);
READ_STRING_AS(instrumentName, 26);
comment.append(instrumentName);
}
for(ushort i = 0; i < sampleCount; ++ i)
{
seek(192 + length + (instrumentCount << 2) + (i << 2));
READ_U32L_AS(sampleOffset);
seek(sampleOffset);
READ_STRING_AS(instrumentName, 26);
comment.append(instrumentName);
}
for(ushort i = 0; i < sampleCount; ++ i)
{
seek(192 + length + (instrumentCount << 2) + (i << 2));
READ_U32L_AS(sampleOffset);
seek(sampleOffset);
ByteVector sampleMagic = readBlock(4);
// TODO: find out if it can really be both here and not just IMPS
READ_ASSERT(sampleMagic == "IMPS" || sampleMagic == "IMPI");
ByteVector sampleMagic = readBlock(4);
// TODO: find out if it can really be both here and not just IMPS
READ_ASSERT(sampleMagic == "IMPS" || sampleMagic == "IMPI");
READ_STRING_AS(dosFileName, 13);
READ_BYTE_AS(globalVolume);
READ_BYTE_AS(sampleFlags);
READ_BYTE_AS(sampleValume);
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(sustainLoopStart);
READ_U32L_AS(sustainLoopEnd);
READ_U32L_AS(sampleDataOffset);
READ_BYTE_AS(vibratoRate);
READ_BYTE_AS(vibratoDepth);
READ_BYTE_AS(vibratoSweep);
READ_BYTE_AS(vibratoType);
READ_STRING_AS(dosFileName, 13);
READ_BYTE_AS(globalVolume);
READ_BYTE_AS(sampleFlags);
READ_BYTE_AS(sampleValume);
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(sustainLoopStart);
READ_U32L_AS(sustainLoopEnd);
READ_U32L_AS(sampleDataOffset);
READ_BYTE_AS(vibratoRate);
READ_BYTE_AS(vibratoDepth);
READ_BYTE_AS(vibratoSweep);
READ_BYTE_AS(vibratoType);
if(c4speed == 0)
{
c4speed = 8363;
}
else if(c4speed < 256)
{
c4speed = 256;
}
vibratoDepth = vibratoDepth & 0x7F;
vibratoSweep = (vibratoSweep + 3) >> 2;
vibratoType = AUTOVIB_IT_TO_XM[vibratoType & 0x07];
if(c4speed == 0)
{
c4speed = 8363;
}
else if(c4speed < 256)
{
c4speed = 256;
}
vibratoDepth = vibratoDepth & 0x7F;
vibratoSweep = (vibratoSweep + 3) >> 2;
vibratoType = AUTOVIB_IT_TO_XM[vibratoType & 0x07];
comment.append(sampleName);
}
comment.append(sampleName);
}
d->tag.setComment(comment.toString("\n"));
d->tag.setComment(comment.toString("\n"));
}

View File

@ -33,59 +33,59 @@
namespace TagLib {
namespace IT {
namespace IT {
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a Impulse Tracker file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a Impulse Tracker file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a Impulse Tracker file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stram, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a Impulse Tracker file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stram, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
/*!
* Destroys this instance of the File.
*/
virtual ~File();
Mod::Tag *tag() const;
Mod::Tag *tag() const;
/*!
* Returns the IT::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
IT::Properties *audioProperties() const;
/*!
* Returns the IT::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
IT::Properties *audioProperties() const;
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Impulse Tracker tags is not supported.
*/
bool save();
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Impulse Tracker tags is not supported.
*/
bool save();
private:
File(const File &);
File &operator=(const File &);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

View File

@ -27,182 +27,182 @@ using namespace IT;
class IT::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
sampleLength(0),
stereo(false),
instrumentCount(0),
sampleCount(0),
patternCount(0),
version(0),
cmwt(0),
flags(0),
special(0),
baseVolume(0),
tempo(0),
bpmSpeed(0)
{
}
PropertiesPrivate() :
sampleLength(0),
stereo(false),
instrumentCount(0),
sampleCount(0),
patternCount(0),
version(0),
cmwt(0),
flags(0),
special(0),
baseVolume(0),
tempo(0),
bpmSpeed(0)
{
}
ushort sampleLength;
bool stereo;
ushort instrumentCount;
ushort sampleCount;
ushort patternCount;
ushort version;
ushort cmwt;
ushort flags;
ushort special;
int baseVolume;
uchar tempo;
uchar bpmSpeed;
ushort sampleLength;
bool stereo;
ushort instrumentCount;
ushort sampleCount;
ushort patternCount;
ushort version;
ushort cmwt;
ushort flags;
ushort special;
int baseVolume;
uchar tempo;
uchar bpmSpeed;
};
IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
{
}
IT::Properties::~Properties()
{
delete d;
delete d;
}
int IT::Properties::length() const
{
return 0;
return 0;
}
int IT::Properties::bitrate() const
{
return 0;
return 0;
}
int IT::Properties::sampleRate() const
{
return 0;
return 0;
}
int IT::Properties::channels() const
{
return d->stereo ? 2 : 1;
return d->stereo ? 2 : 1;
}
ushort IT::Properties::sampleLength() const
{
return d->sampleLength;
return d->sampleLength;
}
bool IT::Properties::stereo() const
{
return d->stereo;
return d->stereo;
}
ushort IT::Properties::instrumentCount() const
{
return d->instrumentCount;
return d->instrumentCount;
}
ushort IT::Properties::sampleCount() const
{
return d->sampleCount;
return d->sampleCount;
}
ushort IT::Properties::patternCount() const
{
return d->patternCount;
return d->patternCount;
}
ushort IT::Properties::version() const
{
return d->version;
return d->version;
}
ushort IT::Properties::cmwt() const
{
return d->cmwt;
return d->cmwt;
}
ushort IT::Properties::flags() const
{
return d->flags;
return d->flags;
}
ushort IT::Properties::special() const
{
return d->special;
return d->special;
}
int IT::Properties::baseVolume() const
{
return d->baseVolume;
return d->baseVolume;
}
uchar IT::Properties::tempo() const
{
return d->tempo;
return d->tempo;
}
uchar IT::Properties::bpmSpeed() const
{
return d->bpmSpeed;
return d->bpmSpeed;
}
void IT::Properties::setSampleLength(ushort sampleLength)
{
d->sampleLength = sampleLength;
d->sampleLength = sampleLength;
}
void IT::Properties::setStereo(bool stereo)
{
d->stereo = stereo;
d->stereo = stereo;
}
void IT::Properties::setInstrumentCount(ushort instrumentCount) {
d->instrumentCount = instrumentCount;
d->instrumentCount = instrumentCount;
}
void IT::Properties::setSampleCount(ushort sampleCount)
{
d->sampleCount = sampleCount;
d->sampleCount = sampleCount;
}
void IT::Properties::setPatternCount(ushort patternCount)
{
d->patternCount = patternCount;
d->patternCount = patternCount;
}
void IT::Properties::setFlags(ushort flags)
{
d->flags = flags;
d->flags = flags;
}
void IT::Properties::setSpecial(ushort special)
{
d->special = special;
d->special = special;
}
void IT::Properties::setCmwt(ushort cmwt)
{
d->cmwt = cmwt;
d->cmwt = cmwt;
}
void IT::Properties::setVersion(ushort version)
{
d->version = version;
d->version = version;
}
void IT::Properties::setBaseVolume(int baseVolume)
{
d->baseVolume = baseVolume;
d->baseVolume = baseVolume;
}
void IT::Properties::setTempo(uchar tempo)
{
d->tempo = tempo;
d->tempo = tempo;
}
void IT::Properties::setBpmSpeed(uchar bpmSpeed)
{
d->bpmSpeed = bpmSpeed;
d->bpmSpeed = bpmSpeed;
}

View File

@ -26,54 +26,54 @@
#include "audioproperties.h"
namespace TagLib {
namespace IT {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
namespace IT {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
ushort sampleLength() 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 sampleLength() 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;
protected:
void setSampleLength(ushort sampleLength);
void setStereo(bool stereo);
protected:
void setSampleLength(ushort sampleLength);
void setStereo(bool stereo);
void setInstrumentCount(ushort instrumentCount);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
void setFlags (ushort flags);
void setSpecial (ushort special);
void setCmwt (ushort cmwt);
void setVersion (ushort version);
void setBaseVolume (int baseVolume);
void setTempo (uchar tempo);
void setBpmSpeed (uchar bpmSpeed);
void setInstrumentCount(ushort instrumentCount);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
void setFlags (ushort flags);
void setSpecial (ushort special);
void setCmwt (ushort cmwt);
void setVersion (ushort version);
void setBaseVolume (int baseVolume);
void setTempo (uchar tempo);
void setBpmSpeed (uchar bpmSpeed);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

View File

@ -34,45 +34,45 @@ Mod::File::File(IOStream *stream) : TagLib::File(stream)
void Mod::File::writeString(const String &s, ulong size)
{
ByteVector data(s.data(String::Latin1));
data.resize(size, 0);
writeBlock(data);
ByteVector data(s.data(String::Latin1));
data.resize(size, 0);
writeBlock(data);
}
bool Mod::File::readString(String &s, ulong size)
{
ByteVector data(readBlock(size));
if(data.size() < size) return false;
int index = data.find((char) 0);
if(index > -1)
{
data.resize(index);
}
data.replace((char) 0xff, ' ');
ByteVector data(readBlock(size));
if(data.size() < size) return false;
int index = data.find((char) 0);
if(index > -1)
{
data.resize(index);
}
data.replace((char) 0xff, ' ');
s = data;
return true;
s = data;
return true;
}
bool Mod::File::readByte(uchar &byte)
{
ByteVector data(readBlock(1));
if(data.size() < 1) return false;
byte = data[0];
return true;
ByteVector data(readBlock(1));
if(data.size() < 1) return false;
byte = data[0];
return true;
}
bool Mod::File::readU16L(ushort &number)
{
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(false);
return true;
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(false);
return true;
}
bool Mod::File::readU32L(ulong &number) {
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(false);
return true;
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(false);
return true;
}

View File

@ -28,19 +28,19 @@
#include "taglib_export.h"
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT File : public TagLib::File {
protected:
File(FileName file);
File(IOStream *stream);
namespace Mod {
class TAGLIB_EXPORT File : public TagLib::File {
protected:
File(FileName file);
File(IOStream *stream);
void writeString(const String &s, ulong size);
bool readString(String &s, ulong size);
bool readByte(uchar &byte);
bool readU16L(ushort &number);
bool readU32L(ulong &number);
};
}
void writeString(const String &s, ulong size);
bool readString(String &s, ulong size);
bool readByte(uchar &byte);
bool readU16L(ushort &number);
bool readU32L(ulong &number);
};
}
}
#endif

View File

@ -24,40 +24,40 @@
// some helper-macros only used internally by (s3m|it|xm)file.cpp
#define READ_ASSERT(cond) \
if(!(cond)) \
{ \
setValid(false); \
return; \
}
if(!(cond)) \
{ \
setValid(false); \
return; \
}
#define READ(setter,type,read) \
{ \
type number; \
READ_ASSERT(read(number)); \
setter(number); \
}
{ \
type number; \
READ_ASSERT(read(number)); \
setter(number); \
}
#define READ_BYTE(setter) READ(setter,uchar,readByte)
#define READ_U16L(setter) READ(setter,ushort,readU16L)
#define READ_U32L(setter) READ(setter,ulong,readU32L)
#define READ_STRING(setter,size) \
{ \
String s; \
READ_ASSERT(readString(s, size)); \
setter(s); \
}
{ \
String s; \
READ_ASSERT(readString(s, size)); \
setter(s); \
}
#define READ_AS(type,name,read) \
type name = 0; \
READ_ASSERT(read(name));
type name = 0; \
READ_ASSERT(read(name));
#define READ_BYTE_AS(name) READ_AS(uchar,name,readByte)
#define READ_U16L_AS(name) READ_AS(ushort,name,readU16L)
#define READ_U32L_AS(name) READ_AS(ulong,name,readU32L)
#define READ_STRING_AS(name,size) \
String name; \
READ_ASSERT(readString(name, size));
String name; \
READ_ASSERT(readString(name, size));
#endif

View File

@ -27,60 +27,60 @@ using namespace Mod;
class Mod::Tag::TagPrivate
{
public:
TagPrivate() {}
TagPrivate() {}
String title;
String comment;
String title;
String comment;
};
Mod::Tag::Tag() : TagLib::Tag()
{
d = new TagPrivate;
d = new TagPrivate;
}
Mod::Tag::~Tag()
{
delete d;
delete d;
}
String Mod::Tag::title() const
{
return d->title;
return d->title;
}
String Mod::Tag::artist() const
{
return String::null;
return String::null;
}
String Mod::Tag::album() const
{
return String::null;
return String::null;
}
String Mod::Tag::comment() const
{
return d->comment;
return d->comment;
}
String Mod::Tag::genre() const
{
return String::null;
return String::null;
}
uint Mod::Tag::year() const
{
return 0;
return 0;
}
uint Mod::Tag::track() const
{
return 0;
return 0;
}
void Mod::Tag::setTitle(const String &title)
{
d->title = title;
d->title = title;
}
void Mod::Tag::setArtist(const String &)
@ -93,7 +93,7 @@ void Mod::Tag::setAlbum(const String &)
void Mod::Tag::setComment(const String &comment)
{
d->comment = comment;
d->comment = comment;
}
void Mod::Tag::setGenre(const String &)

View File

@ -25,36 +25,36 @@
#include "tag.h"
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT Tag : public TagLib::Tag {
public:
Tag();
virtual ~Tag();
namespace Mod {
class TAGLIB_EXPORT Tag : public TagLib::Tag {
public:
Tag();
virtual ~Tag();
String title() const;
String artist() const;
String album() const;
String comment() const;
String genre() const;
uint year() const;
uint track() const;
String title() const;
String artist() const;
String album() const;
String comment() const;
String genre() const;
uint year() const;
uint track() const;
void setTitle (const String &title);
void setArtist (const String &artist);
void setAlbum (const String &album);
void setComment(const String &comment);
void setGenre (const String &genre);
void setYear (uint year);
void setTrack(uint track);
void setTitle (const String &title);
void setArtist (const String &artist);
void setAlbum (const String &album);
void setComment(const String &comment);
void setGenre (const String &genre);
void setYear (uint year);
void setTrack(uint track);
private:
Tag(const Tag &);
Tag &operator=(const Tag &);
private:
Tag(const Tag &);
Tag &operator=(const Tag &);
class TagPrivate;
TagPrivate *d;
};
}
class TagPrivate;
TagPrivate *d;
};
}
}
#endif

View File

@ -29,34 +29,34 @@ using namespace S3M;
class S3M::File::FilePrivate
{
public:
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: properties(propertiesStyle)
{
}
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: properties(propertiesStyle)
{
}
Mod::Tag tag;
S3M::Properties properties;
Mod::Tag tag;
S3M::Properties properties;
};
S3M::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(file)
{
d = new FilePrivate(propertiesStyle);
read(readProperties);
d = new FilePrivate(propertiesStyle);
read(readProperties);
}
S3M::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(stream)
{
d = new FilePrivate(propertiesStyle);
read(readProperties);
d = new FilePrivate(propertiesStyle);
read(readProperties);
}
S3M::File::~File()
{
delete d;
delete d;
}
Mod::Tag *S3M::File::tag() const
@ -71,91 +71,91 @@ S3M::Properties *S3M::File::audioProperties() const
bool S3M::File::save()
{
// note: if title starts with "Extended Module: "
// the file would look like an .xm file
seek(0);
writeString(d->tag.title(), 28);
// TODO: write comment as sample names
// note: if title starts with "Extended Module: "
// the file would look like an .xm file
seek(0);
writeString(d->tag.title(), 28);
// TODO: write comment as sample names
return true;
}
void S3M::File::read(bool)
{
if(!isOpen())
return;
if(!isOpen())
return;
READ_STRING(d->tag.setTitle, 28);
READ_BYTE_AS(mark);
READ_BYTE_AS(type);
READ_STRING(d->tag.setTitle, 28);
READ_BYTE_AS(mark);
READ_BYTE_AS(type);
READ_ASSERT(mark == 0x1A && type == 0x10);
READ_ASSERT(mark == 0x1A && type == 0x10);
seek(32);
seek(32);
READ_U16L_AS(length);
READ_U16L_AS(sampleCount);
READ_U16L_AS(length);
READ_U16L_AS(sampleCount);
d->properties.setSampleLength(length);
d->properties.setSampleCount(sampleCount);
d->properties.setSampleLength(length);
d->properties.setSampleCount(sampleCount);
READ_U16L(d->properties.setPatternCount);
READ_U16L(d->properties.setFlags);
READ_U16L(d->properties.setVersion);
READ_U16L(d->properties.setSamplesType);
READ_U16L(d->properties.setPatternCount);
READ_U16L(d->properties.setFlags);
READ_U16L(d->properties.setVersion);
READ_U16L(d->properties.setSamplesType);
READ_ASSERT(readBlock(4) == "SCRM");
READ_ASSERT(readBlock(4) == "SCRM");
READ_BYTE_AS(baseVolume);
d->properties.setBaseVolume(baseVolume << 1);
READ_BYTE_AS(baseVolume);
d->properties.setBaseVolume(baseVolume << 1);
READ_BYTE(d->properties.setTempo);
READ_BYTE(d->properties.setBpmSpeed);
READ_BYTE(d->properties.setTempo);
READ_BYTE(d->properties.setBpmSpeed);
READ_BYTE_AS(stereo);
d->properties.setStereo((stereo & 0x80) != 0);
READ_BYTE(d->properties.setUltraClick);
READ_BYTE_AS(stereo);
d->properties.setStereo((stereo & 0x80) != 0);
READ_BYTE(d->properties.setUltraClick);
READ_BYTE_AS(usePanningValues);
d->properties.setUsePanningValues(usePanningValues == 0xFC);
READ_BYTE_AS(usePanningValues);
d->properties.setUsePanningValues(usePanningValues == 0xFC);
seek(10, Current);
seek(10, Current);
int channels = 0;
for(int i = 0; i < 32; ++ i)
{
READ_BYTE_AS(terminator);
if (terminator != 0xff) ++ channels;
}
d->properties.setChannels(channels);
int channels = 0;
for(int i = 0; i < 32; ++ i)
{
READ_BYTE_AS(terminator);
if (terminator != 0xff) ++ channels;
}
d->properties.setChannels(channels);
seek(channels, Current);
seek(channels, Current);
StringList comment;
for(ushort i = 0; i < sampleCount; ++ i)
{
seek(96 + length + (i << 1));
StringList comment;
for(ushort i = 0; i < sampleCount; ++ i)
{
seek(96 + length + (i << 1));
READ_U16L_AS(instrumentOffset);
seek(instrumentOffset << 4);
READ_U16L_AS(instrumentOffset);
seek(instrumentOffset << 4);
READ_BYTE_AS(sampleType);
READ_STRING_AS(dosFileName, 13);
READ_U16L_AS(sampleOffset);
READ_U32L_AS(sampleLength);
READ_U32L_AS(repeatStart);
READ_U32L_AS(repeatStop);
READ_BYTE_AS(sampleVolume);
READ_BYTE_AS(sampleType);
READ_STRING_AS(dosFileName, 13);
READ_U16L_AS(sampleOffset);
READ_U32L_AS(sampleLength);
READ_U32L_AS(repeatStart);
READ_U32L_AS(repeatStop);
READ_BYTE_AS(sampleVolume);
seek(2, Current);
seek(2, Current);
READ_BYTE_AS(sampleFlags);
READ_U32L_AS(baseFrequency);
READ_BYTE_AS(sampleFlags);
READ_U32L_AS(baseFrequency);
seek(12, Current);
seek(12, Current);
READ_STRING_AS(sampleName, 28);
comment.append(sampleName);
}
READ_STRING_AS(sampleName, 28);
comment.append(sampleName);
}
d->tag.setComment(comment.toString("\n"));
d->tag.setComment(comment.toString("\n"));
}

View File

@ -33,59 +33,59 @@
namespace TagLib {
namespace S3M {
namespace S3M {
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a ScreamTracker III file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a ScreamTracker III file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a ScreamTracker III file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a ScreamTracker III file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
/*!
* Destroys this instance of the File.
*/
virtual ~File();
Mod::Tag *tag() const;
Mod::Tag *tag() const;
/*!
* Returns the S3M::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
S3M::Properties *audioProperties() const;
/*!
* Returns the S3M::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
S3M::Properties *audioProperties() const;
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving ScreamTracker III tags is not supported.
*/
bool save();
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving ScreamTracker III tags is not supported.
*/
bool save();
private:
File(const File &);
File &operator=(const File &);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

View File

@ -27,188 +27,188 @@ using namespace S3M;
class S3M::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
sampleLength(0),
channels(0),
stereo(0),
sampleCount(0),
patternCount(0),
flags(0),
version(0),
samplesType(0),
baseVolume(0),
tempo(0),
bpmSpeed(0),
ultraClick(0),
usePanningValues(false) {}
ushort sampleLength;
int channels;
bool stereo;
ushort sampleCount;
ushort patternCount;
ushort flags;
ushort version;
ushort samplesType;
int baseVolume;
uchar tempo;
uchar bpmSpeed;
uchar ultraClick;
bool usePanningValues;
PropertiesPrivate() :
sampleLength(0),
channels(0),
stereo(0),
sampleCount(0),
patternCount(0),
flags(0),
version(0),
samplesType(0),
baseVolume(0),
tempo(0),
bpmSpeed(0),
ultraClick(0),
usePanningValues(false) {}
ushort sampleLength;
int channels;
bool stereo;
ushort sampleCount;
ushort patternCount;
ushort flags;
ushort version;
ushort samplesType;
int baseVolume;
uchar tempo;
uchar bpmSpeed;
uchar ultraClick;
bool usePanningValues;
};
S3M::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
{
}
S3M::Properties::~Properties()
{
delete d;
delete d;
}
int S3M::Properties::length() const
{
return 0;
return 0;
}
int S3M::Properties::bitrate() const
{
return 0;
return 0;
}
int S3M::Properties::sampleRate() const
{
return 0;
return 0;
}
int S3M::Properties::channels() const
{
return d->channels;
return d->channels;
}
ushort S3M::Properties::sampleLength() const
{
return d->sampleLength;
return d->sampleLength;
}
bool S3M::Properties::stereo() const
{
return d->stereo;
return d->stereo;
}
ushort S3M::Properties::sampleCount() const
{
return d->sampleCount;
return d->sampleCount;
}
ushort S3M::Properties::patternCount() const
{
return d->patternCount;
return d->patternCount;
}
ushort S3M::Properties::flags() const
{
return d->flags;
return d->flags;
}
ushort S3M::Properties::version() const
{
return d->version;
return d->version;
}
ushort S3M::Properties::samplesType() const
{
return d->samplesType;
return d->samplesType;
}
int S3M::Properties::baseVolume() const
{
return d->baseVolume;
return d->baseVolume;
}
uchar S3M::Properties::tempo() const
{
return d->tempo;
return d->tempo;
}
uchar S3M::Properties::bpmSpeed() const
{
return d->bpmSpeed;
return d->bpmSpeed;
}
uchar S3M::Properties::ultraClick() const
{
return d->ultraClick;
return d->ultraClick;
}
bool S3M::Properties::usePanningValues() const
{
return d->usePanningValues;
return d->usePanningValues;
}
void S3M::Properties::setSampleLength(ushort sampleLength)
{
d->sampleLength = sampleLength;
d->sampleLength = sampleLength;
}
void S3M::Properties::setChannels(int channels)
{
d->channels = channels;
d->channels = channels;
}
void S3M::Properties::setStereo(bool stereo)
{
d->stereo = stereo;
d->stereo = stereo;
}
void S3M::Properties::setSampleCount(ushort sampleCount)
{
d->sampleCount = sampleCount;
d->sampleCount = sampleCount;
}
void S3M::Properties::setPatternCount(ushort patternCount)
{
d->patternCount = patternCount;
d->patternCount = patternCount;
}
void S3M::Properties::setFlags(ushort flags)
{
d->flags = flags;
d->flags = flags;
}
void S3M::Properties::setVersion(ushort version)
{
d->version = version;
d->version = version;
}
void S3M::Properties::setSamplesType(ushort samplesType)
{
d->samplesType = samplesType;
d->samplesType = samplesType;
}
void S3M::Properties::setBaseVolume(int baseVolume)
{
d->baseVolume = baseVolume;
d->baseVolume = baseVolume;
}
void S3M::Properties::setTempo(uchar tempo)
{
d->tempo = tempo;
d->tempo = tempo;
}
void S3M::Properties::setBpmSpeed(uchar bpmSpeed)
{
d->bpmSpeed = bpmSpeed;
d->bpmSpeed = bpmSpeed;
}
void S3M::Properties::setUltraClick(uchar ultraClick)
{
d->ultraClick = ultraClick;
d->ultraClick = ultraClick;
}
void S3M::Properties::setUsePanningValues(bool usePanningValues)
{
d->usePanningValues = usePanningValues;
d->usePanningValues = usePanningValues;
}

View File

@ -26,55 +26,55 @@
#include "audioproperties.h"
namespace TagLib {
namespace S3M {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
namespace S3M {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
ushort sampleLength() const;
bool stereo() const;
ushort sampleCount() const;
ushort patternCount() const;
ushort flags() const;
ushort version() const;
ushort samplesType() const;
int baseVolume() const;
uchar tempo() const;
uchar bpmSpeed() const;
uchar ultraClick() const;
bool usePanningValues() const;
ushort sampleLength() const;
bool stereo() const;
ushort sampleCount() const;
ushort patternCount() const;
ushort flags() const;
ushort version() const;
ushort samplesType() const;
int baseVolume() const;
uchar tempo() const;
uchar bpmSpeed() const;
uchar ultraClick() const;
bool usePanningValues() const;
protected:
void setSampleLength(ushort sampleLength);
void setChannels(int channels);
protected:
void setSampleLength(ushort sampleLength);
void setChannels(int channels);
void setStereo (bool stereo);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
void setFlags (ushort flags);
void setVersion (ushort version);
void setSamplesType (ushort samplesType);
void setBaseVolume (int baseVolume);
void setTempo (uchar tempo);
void setBpmSpeed (uchar bpmSpeed);
void setUltraClick (uchar ultraClick);
void setUsePanningValues(bool usePanningValues);
void setStereo (bool stereo);
void setSampleCount (ushort sampleCount);
void setPatternCount(ushort patternCount);
void setFlags (ushort flags);
void setVersion (ushort version);
void setSamplesType (ushort samplesType);
void setBaseVolume (int baseVolume);
void setTempo (uchar tempo);
void setBpmSpeed (uchar bpmSpeed);
void setUltraClick (uchar ultraClick);
void setUsePanningValues(bool usePanningValues);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

View File

@ -31,34 +31,34 @@ using namespace XM;
class XM::File::FilePrivate
{
public:
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: tag(), properties(propertiesStyle)
{
}
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: tag(), properties(propertiesStyle)
{
}
XM::Tag tag;
XM::Properties properties;
XM::Tag tag;
XM::Properties properties;
};
XM::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(file),
d(new FilePrivate(propertiesStyle))
d(new FilePrivate(propertiesStyle))
{
read(readProperties);
read(readProperties);
}
XM::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::File(stream),
d(new FilePrivate(propertiesStyle))
d(new FilePrivate(propertiesStyle))
{
read(readProperties);
read(readProperties);
}
XM::File::~File()
{
delete d;
delete d;
}
XM::Tag *XM::File::tag() const
@ -73,123 +73,123 @@ XM::Properties *XM::File::audioProperties() const
bool XM::File::save()
{
seek(17);
writeString(d->tag.title(), 20);
seek(1, Current);
writeString(d->tag.trackerName(), 20);
// TODO: write comment as instrument and sample names
seek(17);
writeString(d->tag.title(), 20);
seek(1, Current);
writeString(d->tag.trackerName(), 20);
// TODO: write comment as instrument and sample names
return true;
}
void XM::File::read(bool)
{
if(!isOpen())
return;
if(!isOpen())
return;
READ_ASSERT(readBlock(17) == "Extended Module: ");
READ_ASSERT(readBlock(17) == "Extended Module: ");
READ_STRING(d->tag.setTitle, 20);
READ_BYTE_AS(mark);
READ_ASSERT(mark == 0x1A);
READ_STRING(d->tag.setTrackerName, 20);
READ_U16L(d->properties.setVersion);
READ_U32L_AS(headerSize);
READ_U16L(d->properties.setSampleLength);
READ_U16L(d->properties.setRestartPosition);
READ_U16L(d->properties.setChannels);
READ_U16L_AS(patternCount);
d->properties.setPatternCount(patternCount);
READ_U16L_AS(instrumentCount);
d->properties.setInstrumentCount(instrumentCount);
READ_U16L(d->properties.setFlags);
READ_U16L(d->properties.setTempo);
READ_U16L(d->properties.setBpmSpeed);
READ_STRING(d->tag.setTitle, 20);
READ_BYTE_AS(mark);
READ_ASSERT(mark == 0x1A);
READ_STRING(d->tag.setTrackerName, 20);
READ_U16L(d->properties.setVersion);
READ_U32L_AS(headerSize);
READ_U16L(d->properties.setSampleLength);
READ_U16L(d->properties.setRestartPosition);
READ_U16L(d->properties.setChannels);
READ_U16L_AS(patternCount);
d->properties.setPatternCount(patternCount);
READ_U16L_AS(instrumentCount);
d->properties.setInstrumentCount(instrumentCount);
READ_U16L(d->properties.setFlags);
READ_U16L(d->properties.setTempo);
READ_U16L(d->properties.setBpmSpeed);
seek(60 + headerSize);
for(ushort i = 0; i < patternCount; ++ i)
{
READ_U32L_AS(patternHeaderLength);
READ_BYTE_AS(patternType);
READ_U16L_AS(rowCount);
READ_U16L_AS(patternDataSize);
seek(60 + headerSize);
for(ushort i = 0; i < patternCount; ++ i)
{
READ_U32L_AS(patternHeaderLength);
READ_BYTE_AS(patternType);
READ_U16L_AS(rowCount);
READ_U16L_AS(patternDataSize);
seek(patternHeaderLength - (4+1+2+2) + patternDataSize, Current);
}
StringList intrumentNames;
StringList sampleNames;
for(ushort i = 0; i < instrumentCount; ++ i)
{
long pos = tell();
READ_U32L_AS(instrumentSize);
seek(patternHeaderLength - (4+1+2+2) + patternDataSize, Current);
}
StringList intrumentNames;
StringList sampleNames;
for(ushort i = 0; i < instrumentCount; ++ i)
{
long pos = tell();
READ_U32L_AS(instrumentSize);
String instrumentName;
uchar instrumentType = 0;
ushort sampleCount = 0;
if(instrumentSize > 4)
{
if(!readString(instrumentName, std::min(22UL, instrumentSize-4)))
{
setValid(false);
return;
}
String instrumentName;
uchar instrumentType = 0;
ushort sampleCount = 0;
if(instrumentSize > 4)
{
if(!readString(instrumentName, std::min(22UL, instrumentSize-4)))
{
setValid(false);
return;
}
if(instrumentSize >= (4+22+1))
{
if(!readByte(instrumentType))
{
setValid(false);
return;
}
if(instrumentSize >= (4+22+1))
{
if(!readByte(instrumentType))
{
setValid(false);
return;
}
if (instrumentSize >= (4+22+1+2))
{
if(!readU16L(sampleCount))
{
setValid(false);
return;
}
}
}
}
if (instrumentSize >= (4+22+1+2))
{
if(!readU16L(sampleCount))
{
setValid(false);
return;
}
}
}
}
ulong sumSampleLength = 0;
ulong sampleHeaderSize = 0;
if (sampleCount > 0)
{
if(!readU32L(sampleHeaderSize))
{
setValid(false);
return;
}
ulong sumSampleLength = 0;
ulong sampleHeaderSize = 0;
if (sampleCount > 0)
{
if(!readU32L(sampleHeaderSize))
{
setValid(false);
return;
}
seek(pos + instrumentSize);
seek(pos + instrumentSize);
long sampleheaderPos = tell();
for (ushort j = 0; j < sampleCount; ++ j)
{
seek(sampleheaderPos + sampleHeaderSize * j);
READ_U32L_AS(length);
READ_U32L_AS(loopStart);
READ_U32L_AS(loopLength);
READ_BYTE_AS(volume);
READ_BYTE_AS(finetune);
READ_BYTE_AS(sampleType);
READ_BYTE_AS(panning);
READ_BYTE_AS(noteNumber);
READ_BYTE_AS(compression);
READ_STRING_AS(sampleName, 22);
sumSampleLength += length;
sampleNames.append(sampleName);
}
}
intrumentNames.append(instrumentName);
seek(pos + instrumentSize + sampleHeaderSize * sampleCount + sumSampleLength);
}
long sampleheaderPos = tell();
for (ushort j = 0; j < sampleCount; ++ j)
{
seek(sampleheaderPos + sampleHeaderSize * j);
READ_U32L_AS(length);
READ_U32L_AS(loopStart);
READ_U32L_AS(loopLength);
READ_BYTE_AS(volume);
READ_BYTE_AS(finetune);
READ_BYTE_AS(sampleType);
READ_BYTE_AS(panning);
READ_BYTE_AS(noteNumber);
READ_BYTE_AS(compression);
READ_STRING_AS(sampleName, 22);
sumSampleLength += length;
sampleNames.append(sampleName);
}
}
intrumentNames.append(instrumentName);
seek(pos + instrumentSize + sampleHeaderSize * sampleCount + sumSampleLength);
}
d->tag.setComment(intrumentNames.toString("\n") + "\n" + sampleNames.toString("\n"));
d->tag.setComment(intrumentNames.toString("\n") + "\n" + sampleNames.toString("\n"));
}

View File

@ -33,59 +33,59 @@
namespace TagLib {
namespace XM {
namespace XM {
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a Extended Module file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
class TAGLIB_EXPORT File : public Mod::File {
public:
/*!
* Contructs a Extended Module file from \a file. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a Extended Module file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Contructs a Extended Module file from \a stream. If \a readProperties
* is true the file's audio properties will also be read using
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
/*!
* Destroys this instance of the File.
*/
virtual ~File();
XM::Tag *tag() const;
XM::Tag *tag() const;
/*!
* Returns the XM::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
XM::Properties *audioProperties() const;
/*!
* Returns the XM::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
XM::Properties *audioProperties() const;
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Extended Module tags is not supported.
*/
bool save();
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Extended Module tags is not supported.
*/
bool save();
private:
File(const File &);
File &operator=(const File &);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

View File

@ -27,142 +27,142 @@ using namespace XM;
class XM::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
sampleLength(0),
channels(0),
version(0),
restartPosition(0),
patternCount(0),
instrumentCount(0),
flags(0),
tempo(0),
bpmSpeed(0)
{
}
ushort sampleLength;
int channels;
ushort version;
ushort restartPosition;
ushort patternCount;
ushort instrumentCount;
ushort flags;
ushort tempo;
ushort bpmSpeed;
PropertiesPrivate() :
sampleLength(0),
channels(0),
version(0),
restartPosition(0),
patternCount(0),
instrumentCount(0),
flags(0),
tempo(0),
bpmSpeed(0)
{
}
ushort sampleLength;
int channels;
ushort version;
ushort restartPosition;
ushort patternCount;
ushort instrumentCount;
ushort flags;
ushort tempo;
ushort bpmSpeed;
};
XM::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
AudioProperties(propertiesStyle),
d(new PropertiesPrivate)
{
}
}
XM::Properties::~Properties()
{
delete d;
delete d;
}
int XM::Properties::length() const
{
return 0;
return 0;
}
int XM::Properties::bitrate() const
{
return 0;
return 0;
}
int XM::Properties::sampleRate() const
{
return 0;
return 0;
}
int XM::Properties::channels() const
{
return d->channels;
return d->channels;
}
ushort XM::Properties::sampleLength() const
{
return d->sampleLength;
return d->sampleLength;
}
ushort XM::Properties::version() const
{
return d->version;
return d->version;
}
ushort XM::Properties::restartPosition() const
{
return d->restartPosition;
return d->restartPosition;
}
ushort XM::Properties::patternCount() const
{
return d->patternCount;
return d->patternCount;
}
ushort XM::Properties::instrumentCount() const
{
return d->instrumentCount;
return d->instrumentCount;
}
ushort XM::Properties::flags() const
{
return d->flags;
return d->flags;
}
ushort XM::Properties::tempo() const
{
return d->tempo;
return d->tempo;
}
ushort XM::Properties::bpmSpeed() const
{
return d->bpmSpeed;
return d->bpmSpeed;
}
void XM::Properties::setSampleLength(int sampleLength)
{
d->sampleLength = sampleLength;
d->sampleLength = sampleLength;
}
void XM::Properties::setChannels(int channels)
{
d->channels = channels;
d->channels = channels;
}
void XM::Properties::setVersion(ushort version)
{
d->version = version;
d->version = version;
}
void XM::Properties::setRestartPosition(ushort restartPosition)
{
d->restartPosition = restartPosition;
d->restartPosition = restartPosition;
}
void XM::Properties::setPatternCount(ushort patternCount)
{
d->patternCount = patternCount;
d->patternCount = patternCount;
}
void XM::Properties::setInstrumentCount(ushort instrumentCount)
{
d->instrumentCount = instrumentCount;
d->instrumentCount = instrumentCount;
}
void XM::Properties::setFlags(ushort flags)
{
d->flags = flags;
d->flags = flags;
}
void XM::Properties::setTempo(ushort tempo)
{
d->tempo = tempo;
d->tempo = tempo;
}
void XM::Properties::setBpmSpeed(ushort bpmSpeed)
{
d->bpmSpeed = bpmSpeed;
d->bpmSpeed = bpmSpeed;
}

View File

@ -27,47 +27,47 @@
#include "audioproperties.h"
namespace TagLib {
namespace XM {
class Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
namespace XM {
class Properties : public AudioProperties {
friend class File;
public:
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
ushort sampleLength() const;
ushort version() const;
ushort restartPosition() const;
ushort patternCount() const;
ushort instrumentCount() const;
ushort flags() const;
ushort tempo() const;
ushort bpmSpeed() const;
ushort sampleLength() const;
ushort version() const;
ushort restartPosition() const;
ushort patternCount() const;
ushort instrumentCount() const;
ushort flags() const;
ushort tempo() const;
ushort bpmSpeed() const;
protected:
void setSampleLength(int sampleLength);
void setChannels(int channels);
protected:
void setSampleLength(int sampleLength);
void setChannels(int channels);
void setVersion(ushort version);
void setRestartPosition(ushort restartPosition);
void setPatternCount(ushort patternCount);
void setInstrumentCount(ushort instrumentCount);
void setFlags(ushort flags);
void setTempo(ushort tempo);
void setBpmSpeed(ushort bpmSpeed);
void setVersion(ushort version);
void setRestartPosition(ushort restartPosition);
void setPatternCount(ushort patternCount);
void setInstrumentCount(ushort instrumentCount);
void setFlags(ushort flags);
void setTempo(ushort tempo);
void setBpmSpeed(ushort bpmSpeed);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

View File

@ -27,66 +27,66 @@ using namespace XM;
class XM::Tag::TagPrivate
{
public:
TagPrivate() {}
TagPrivate() {}
String title;
String comment;
String trackerName;
String title;
String comment;
String trackerName;
};
XM::Tag::Tag() : TagLib::Tag()
{
d = new TagPrivate;
d = new TagPrivate;
}
XM::Tag::~Tag()
{
delete d;
delete d;
}
String XM::Tag::title() const
{
return d->title;
return d->title;
}
String XM::Tag::artist() const
{
return String::null;
return String::null;
}
String XM::Tag::album() const
{
return String::null;
return String::null;
}
String XM::Tag::comment() const
{
return d->comment;
return d->comment;
}
String XM::Tag::genre() const
{
return String::null;
return String::null;
}
uint XM::Tag::year() const
{
return 0;
return 0;
}
uint XM::Tag::track() const
{
return 0;
return 0;
}
String XM::Tag::trackerName() const
{
return d->trackerName;
return d->trackerName;
}
void XM::Tag::setTitle(const String &title)
{
d->title = title;
d->title = title;
}
void XM::Tag::setArtist(const String &)
@ -99,7 +99,7 @@ void XM::Tag::setAlbum(const String &)
void XM::Tag::setComment(const String &comment)
{
d->comment = comment;
d->comment = comment;
}
void XM::Tag::setGenre(const String &)
@ -116,5 +116,5 @@ void XM::Tag::setTrack(uint)
void XM::Tag::setTrackerName(const String &trackerName)
{
d->trackerName = trackerName;
d->trackerName = trackerName;
}

View File

@ -25,38 +25,38 @@
#include "modtag.h"
namespace TagLib {
namespace XM {
class Tag : public TagLib::Tag {
public:
Tag();
virtual ~Tag();
namespace XM {
class Tag : public TagLib::Tag {
public:
Tag();
virtual ~Tag();
String title() const;
String artist() const;
String album() const;
String comment() const;
String genre() const;
uint year() const;
uint track() const;
String trackerName() const;
String title() const;
String artist() const;
String album() const;
String comment() const;
String genre() const;
uint year() const;
uint track() const;
String trackerName() const;
void setTitle (const String &title);
void setArtist (const String &artist);
void setAlbum (const String &album);
void setComment(const String &comment);
void setGenre (const String &genre);
void setYear (uint year);
void setTrack(uint track);
void setTrackerName(const String &trackerName);
void setTitle (const String &title);
void setArtist (const String &artist);
void setAlbum (const String &album);
void setComment(const String &comment);
void setGenre (const String &genre);
void setYear (uint year);
void setTrack(uint track);
void setTrackerName(const String &trackerName);
private:
Tag(const Tag &);
Tag &operator=(const Tag &);
private:
Tag(const Tag &);
Tag &operator=(const Tag &);
class TagPrivate;
TagPrivate *d;
};
}
class TagPrivate;
TagPrivate *d;
};
}
}
#endif