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

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