mirror of
https://github.com/taglib/taglib.git
synced 2025-11-16 22:52:57 -05:00
converted tabs to spaces
This commit is contained in:
@ -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"));
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user