mirror of
https://github.com/taglib/taglib.git
synced 2025-07-22 15:04:24 -04:00
refactored for ABI compat and write support of some tags of s3m/it/xm files
tags that can be written: * s3m: title * it: title * xm: title, trackerName
This commit is contained in:
@ -21,147 +21,165 @@
|
||||
|
||||
#include "tstringlist.h"
|
||||
#include "itfile.h"
|
||||
#include "modfileprivate.h"
|
||||
|
||||
namespace TagLib {
|
||||
using namespace TagLib;
|
||||
using namespace IT;
|
||||
|
||||
namespace IT {
|
||||
// Just copied this array from some example code.
|
||||
// I think this might be unneccesarry and only needed if
|
||||
// you convert IT to XM to keep your mod player more simple.
|
||||
static const uchar AUTOVIB_IT_TO_XM[] = {0, 3, 1, 4, 2, 0, 0, 0};
|
||||
|
||||
uint8_t AUTOVIB_IT_TO_XM[] = {0, 3, 1, 4, 2, 0, 0, 0};
|
||||
class IT::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
: tag(), properties(propertiesStyle)
|
||||
{
|
||||
}
|
||||
|
||||
File::File(FileName file, bool readProperties,
|
||||
AudioProperties::ReadStyle propertiesStyle) :
|
||||
Mod::File(file), m_tag(0), m_properties(0) {
|
||||
read(readProperties, propertiesStyle);
|
||||
Mod::Tag tag;
|
||||
IT::Properties properties;
|
||||
};
|
||||
|
||||
IT::File::File(FileName file, bool readProperties,
|
||||
AudioProperties::ReadStyle propertiesStyle) :
|
||||
Mod::File(file),
|
||||
d(new FilePrivate(propertiesStyle))
|
||||
{
|
||||
read(readProperties);
|
||||
}
|
||||
|
||||
File::~File() {
|
||||
delete m_tag;
|
||||
delete m_properties;
|
||||
IT::File::File(IOStream *stream, bool readProperties,
|
||||
AudioProperties::ReadStyle propertiesStyle) :
|
||||
Mod::File(stream),
|
||||
d(new FilePrivate(propertiesStyle))
|
||||
{
|
||||
read(readProperties);
|
||||
}
|
||||
|
||||
Mod::Tag *File::tag() const {
|
||||
return m_tag;
|
||||
IT::File::~File()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
IT::Properties *File::audioProperties() const {
|
||||
return m_properties;
|
||||
Mod::Tag *IT::File::tag() const
|
||||
{
|
||||
return &d->tag;
|
||||
}
|
||||
|
||||
bool File::save() {
|
||||
return false;
|
||||
IT::Properties *IT::File::audioProperties() const
|
||||
{
|
||||
return &d->properties;
|
||||
}
|
||||
|
||||
void File::read(bool, AudioProperties::ReadStyle propertiesStyle) {
|
||||
delete m_tag;
|
||||
delete m_properties;
|
||||
bool IT::File::save()
|
||||
{
|
||||
seek(4);
|
||||
writeString(d->tag.title(), 26);
|
||||
// TODO: write comment as instrument and sample names
|
||||
return true;
|
||||
}
|
||||
|
||||
m_tag = new Mod::Tag();
|
||||
m_properties = new IT::Properties(propertiesStyle);
|
||||
|
||||
if (!isOpen())
|
||||
void IT::File::read(bool)
|
||||
{
|
||||
if(!isOpen())
|
||||
return;
|
||||
|
||||
try {
|
||||
ByteVector mod_id(readBytes(4UL));
|
||||
if (mod_id != "IMPM") {
|
||||
throw Mod::ReadError();
|
||||
}
|
||||
seek(0);
|
||||
READ_ASSERT(readBlock(4) == "IMPM");
|
||||
READ_STRING(d->tag.setTitle, 26);
|
||||
|
||||
m_tag->setTitle(readString(26));
|
||||
seek(2, Current);
|
||||
seek(2, Current);
|
||||
|
||||
uint16_t length = readU16L();
|
||||
uint16_t instrumentCount = readU16L();
|
||||
uint16_t sampleCount = readU16L();
|
||||
READ_U16L_AS(length);
|
||||
READ_U16L_AS(instrumentCount);
|
||||
READ_U16L_AS(sampleCount);
|
||||
|
||||
m_properties->setSampleLength(length);
|
||||
m_properties->setInstrumentCount(instrumentCount);
|
||||
m_properties->setSampleCount(sampleCount);
|
||||
m_properties->setPatternCount(readU16L());
|
||||
m_properties->setVersion(readU16L());
|
||||
m_properties->setCmwt(readU16L());
|
||||
m_properties->setFlags(readU16L());
|
||||
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);
|
||||
|
||||
uint16_t special = readU16L();
|
||||
READ_U16L_AS(special);
|
||||
|
||||
m_properties->setSpecial(special);
|
||||
m_properties->setBaseVolume(readU16L());
|
||||
d->properties.setSpecial(special);
|
||||
READ_U16L(d->properties.setBaseVolume);
|
||||
|
||||
seek(1, Current);
|
||||
seek(1, Current);
|
||||
|
||||
m_properties->setTempo(readByte());
|
||||
m_properties->setBpmSpeed(readByte());
|
||||
READ_BYTE(d->properties.setTempo);
|
||||
READ_BYTE(d->properties.setBpmSpeed);
|
||||
|
||||
StringList comment;
|
||||
StringList comment;
|
||||
|
||||
for (uint16_t i = 0; i < instrumentCount; ++ i) {
|
||||
seek(192 + length + (i << 2));
|
||||
uint32_t instrumentOffset = readU32L();
|
||||
seek(instrumentOffset);
|
||||
for(ushort i = 0; i < instrumentCount; ++ i)
|
||||
{
|
||||
seek(192 + length + (i << 2));
|
||||
READ_U32L_AS(instrumentOffset);
|
||||
seek(instrumentOffset);
|
||||
|
||||
ByteVector instrumentMagic = readBytes(4);
|
||||
if (instrumentMagic != "IMPS" && instrumentMagic != "IMPI") {
|
||||
throw Mod::ReadError();
|
||||
}
|
||||
ByteVector instrumentMagic = readBlock(4);
|
||||
// TODO: find out if it can really be both here and not just IMPI
|
||||
READ_ASSERT(instrumentMagic == "IMPS" || instrumentMagic == "IMPI");
|
||||
|
||||
String dosFileName = readString(13);
|
||||
READ_STRING_AS(dosFileName, 13);
|
||||
|
||||
seek(15, Current);
|
||||
seek(15, Current);
|
||||
|
||||
String instrumentName = readString(26);
|
||||
|
||||
comment.append(instrumentName);
|
||||
}
|
||||
READ_STRING_AS(instrumentName, 26);
|
||||
comment.append(instrumentName);
|
||||
}
|
||||
|
||||
for (uint16_t i = 0; i < sampleCount; ++ i) {
|
||||
seek(192 + length + (instrumentCount << 2) + (i << 2));
|
||||
uint32_t sampleOffset = readU32L();
|
||||
seek(sampleOffset);
|
||||
for(ushort i = 0; i < sampleCount; ++ i)
|
||||
{
|
||||
seek(192 + length + (instrumentCount << 2) + (i << 2));
|
||||
READ_U32L_AS(sampleOffset);
|
||||
|
||||
seek(sampleOffset);
|
||||
|
||||
ByteVector sampleMagic = readBytes(4);
|
||||
if (sampleMagic != "IMPS" && sampleMagic != "IMPI") {
|
||||
throw Mod::ReadError();
|
||||
}
|
||||
ByteVector sampleMagic = readBlock(4);
|
||||
// TODO: find out if it can really be both here and not just IMPS
|
||||
READ_ASSERT(sampleMagic == "IMPS" || sampleMagic == "IMPI");
|
||||
|
||||
String dosFileName = readString(13);
|
||||
uint8_t globalVolume = readByte();
|
||||
uint8_t sampleFlags = readByte();
|
||||
uint8_t sampleValume = readByte();
|
||||
String sampleName = readString(26);
|
||||
uint8_t sampleCvt = readByte();
|
||||
uint8_t samplePanning = readByte();
|
||||
uint32_t sampleLength = readU32L();
|
||||
uint32_t repeatStart = readU32L();
|
||||
uint32_t repeatStop = readU32L();
|
||||
uint32_t c4speed = readU32L();
|
||||
uint32_t sustainLoopStart = readU32L();
|
||||
uint32_t sustainLoopEnd = readU32L();
|
||||
uint32_t sampleDataOffset = readU32L();
|
||||
uint8_t vibratoRate = readByte();
|
||||
uint8_t vibratoDepth = readByte();
|
||||
uint8_t vibratoSweep = readByte();
|
||||
uint8_t vibratoType = readByte();
|
||||
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;
|
||||
}
|
||||
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];
|
||||
vibratoDepth = vibratoDepth & 0x7F;
|
||||
vibratoSweep = (vibratoSweep + 3) >> 2;
|
||||
vibratoType = AUTOVIB_IT_TO_XM[vibratoType & 0x07];
|
||||
|
||||
comment.append(sampleName);
|
||||
}
|
||||
comment.append(sampleName);
|
||||
}
|
||||
|
||||
m_tag->setComment(comment.toString("\n"));
|
||||
}
|
||||
catch (const Mod::ReadError&) {
|
||||
setValid(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
d->tag.setComment(comment.toString("\n"));
|
||||
}
|
||||
|
@ -42,22 +42,31 @@ namespace TagLib {
|
||||
* is true the file's audio properties will also be read using
|
||||
* \a propertiesStyle. If false, \a propertiesStyle is ignored.
|
||||
*/
|
||||
explicit File(FileName file, bool readProperties = true,
|
||||
AudioProperties::ReadStyle propertiesStyle =
|
||||
AudioProperties::Average);
|
||||
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);
|
||||
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
|
||||
virtual 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.
|
||||
*/
|
||||
virtual IT::Properties *audioProperties() const;
|
||||
IT::Properties *audioProperties() const;
|
||||
|
||||
/*!
|
||||
* Save the file.
|
||||
@ -65,17 +74,16 @@ namespace TagLib {
|
||||
*
|
||||
* \note Saving Impulse Tracker tags is not supported.
|
||||
*/
|
||||
virtual bool save();
|
||||
|
||||
void read(bool readProperties,
|
||||
AudioProperties::ReadStyle propertiesStyle);
|
||||
bool save();
|
||||
|
||||
private:
|
||||
File(const File &);
|
||||
File &operator=(const File &);
|
||||
|
||||
Mod::Tag *m_tag;
|
||||
IT::Properties *m_properties;
|
||||
void read(bool readProperties);
|
||||
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2011 by Mathias Panzenböck
|
||||
email : grosser.meister.morti@gmx.net
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "itfiletyperesolver.h"
|
||||
#include "itfile.h"
|
||||
|
||||
TagLib::File *ITFileTypeResolver::createFile(
|
||||
TagLib::FileName fileName,
|
||||
bool readProperties,
|
||||
TagLib::AudioProperties::ReadStyle propertiesStyle) const {
|
||||
TagLib::IT::File *f = new TagLib::IT::File(fileName, readProperties, propertiesStyle);
|
||||
if (f->isValid()) {
|
||||
return f;
|
||||
}
|
||||
else {
|
||||
delete f;
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2011 by Mathias Panzenböck
|
||||
email : grosser.meister.morti@gmx.net
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_ITFILETYPERESOLVER_H
|
||||
#define TAGLIB_ITFILETYPERESOLVER_H
|
||||
|
||||
#include "fileref.h"
|
||||
#include "taglib_export.h"
|
||||
|
||||
class TAGLIB_EXPORT ITFileTypeResolver : public TagLib::FileRef::FileTypeResolver {
|
||||
TagLib::File *createFile(TagLib::FileName fileName,
|
||||
bool readAudioProperties,
|
||||
TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const;
|
||||
~ITFileTypeResolver() {}
|
||||
};
|
||||
|
||||
#endif
|
208
taglib/it/itproperties.cpp
Normal file
208
taglib/it/itproperties.cpp
Normal file
@ -0,0 +1,208 @@
|
||||
/***************************************************************************
|
||||
copyright :(C) 2011 by Mathias Panzenböck
|
||||
email : grosser.meister.morti@gmx.net
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "itproperties.h"
|
||||
|
||||
using namespace TagLib;
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
IT::Properties::~Properties()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
int IT::Properties::length() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::sampleRate() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IT::Properties::channels() const
|
||||
{
|
||||
return d->stereo ? 2 : 1;
|
||||
}
|
||||
|
||||
ushort IT::Properties::sampleLength() const
|
||||
{
|
||||
return d->sampleLength;
|
||||
}
|
||||
|
||||
bool IT::Properties::stereo() const
|
||||
{
|
||||
return d->stereo;
|
||||
}
|
||||
|
||||
ushort IT::Properties::instrumentCount() const
|
||||
{
|
||||
return d->instrumentCount;
|
||||
}
|
||||
|
||||
ushort IT::Properties::sampleCount() const
|
||||
{
|
||||
return d->sampleCount;
|
||||
}
|
||||
|
||||
ushort IT::Properties::patternCount() const
|
||||
{
|
||||
return d->patternCount;
|
||||
}
|
||||
|
||||
ushort IT::Properties::version() const
|
||||
{
|
||||
return d->version;
|
||||
}
|
||||
|
||||
ushort IT::Properties::cmwt() const
|
||||
{
|
||||
return d->cmwt;
|
||||
}
|
||||
|
||||
ushort IT::Properties::flags() const
|
||||
{
|
||||
return d->flags;
|
||||
}
|
||||
|
||||
ushort IT::Properties::special() const
|
||||
{
|
||||
return d->special;
|
||||
}
|
||||
|
||||
int IT::Properties::baseVolume() const
|
||||
{
|
||||
return d->baseVolume;
|
||||
}
|
||||
|
||||
uchar IT::Properties::tempo() const
|
||||
{
|
||||
return d->tempo;
|
||||
}
|
||||
|
||||
uchar IT::Properties::bpmSpeed() const
|
||||
{
|
||||
return d->bpmSpeed;
|
||||
}
|
||||
|
||||
void IT::Properties::setSampleLength(ushort sampleLength)
|
||||
{
|
||||
d->sampleLength = sampleLength;
|
||||
}
|
||||
|
||||
void IT::Properties::setStereo(bool stereo)
|
||||
{
|
||||
d->stereo = stereo;
|
||||
}
|
||||
|
||||
void IT::Properties::setInstrumentCount(ushort instrumentCount) {
|
||||
d->instrumentCount = instrumentCount;
|
||||
}
|
||||
|
||||
void IT::Properties::setSampleCount(ushort sampleCount)
|
||||
{
|
||||
d->sampleCount = sampleCount;
|
||||
}
|
||||
|
||||
void IT::Properties::setPatternCount(ushort patternCount)
|
||||
{
|
||||
d->patternCount = patternCount;
|
||||
}
|
||||
|
||||
void IT::Properties::setFlags(ushort flags)
|
||||
{
|
||||
d->flags = flags;
|
||||
}
|
||||
|
||||
void IT::Properties::setSpecial(ushort special)
|
||||
{
|
||||
d->special = special;
|
||||
}
|
||||
|
||||
void IT::Properties::setCmwt(ushort cmwt)
|
||||
{
|
||||
d->cmwt = cmwt;
|
||||
}
|
||||
|
||||
void IT::Properties::setVersion(ushort version)
|
||||
{
|
||||
d->version = version;
|
||||
}
|
||||
|
||||
void IT::Properties::setBaseVolume(int baseVolume)
|
||||
{
|
||||
d->baseVolume = baseVolume;
|
||||
}
|
||||
|
||||
void IT::Properties::setTempo(uchar tempo)
|
||||
{
|
||||
d->tempo = tempo;
|
||||
}
|
||||
|
||||
void IT::Properties::setBpmSpeed(uchar bpmSpeed)
|
||||
{
|
||||
d->bpmSpeed = bpmSpeed;
|
||||
}
|
@ -22,8 +22,7 @@
|
||||
#ifndef TAGLIB_ITPROPERTIES_H
|
||||
#define TAGLIB_ITPROPERTIES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "taglib.h"
|
||||
#include "audioproperties.h"
|
||||
|
||||
namespace TagLib {
|
||||
@ -31,69 +30,48 @@ namespace TagLib {
|
||||
class TAGLIB_EXPORT Properties : public AudioProperties {
|
||||
friend class File;
|
||||
public:
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle) :
|
||||
AudioProperties(propertiesStyle),
|
||||
m_sampleLength(0),
|
||||
m_stereo(false),
|
||||
m_instrumentCount(0),
|
||||
m_sampleCount(0),
|
||||
m_patternCount(0),
|
||||
m_version(0),
|
||||
m_cmwt(0),
|
||||
m_flags(0),
|
||||
m_special(0),
|
||||
m_baseVolume(0),
|
||||
m_tempo(0),
|
||||
m_bpmSpeed(0) {}
|
||||
Properties(AudioProperties::ReadStyle propertiesStyle);
|
||||
virtual ~Properties();
|
||||
|
||||
int length() const { return 0; }
|
||||
int bitrate() const { return 0; }
|
||||
int sampleRate() const { return 0; }
|
||||
int channels() const { return m_stereo ? 2 : 1; }
|
||||
int length() const;
|
||||
int bitrate() const;
|
||||
int sampleRate() const;
|
||||
int channels() const;
|
||||
|
||||
uint16_t sampleLength() const { return m_sampleLength; }
|
||||
bool stereo() const { return m_stereo; }
|
||||
uint16_t instrumentCount() const { return m_instrumentCount; }
|
||||
uint16_t sampleCount() const { return m_sampleCount; }
|
||||
uint16_t patternCount() const { return m_patternCount; }
|
||||
uint16_t version() const { return m_version; }
|
||||
uint16_t cmwt() const { return m_cmwt; }
|
||||
uint16_t flags() const { return m_flags; }
|
||||
uint16_t special() const { return m_special; }
|
||||
int baseVolume() const { return m_baseVolume; }
|
||||
uint8_t tempo() const { return m_tempo; }
|
||||
uint8_t bpmSpeed() const { return m_bpmSpeed; }
|
||||
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(uint16_t sampleLength) { m_sampleLength = sampleLength; }
|
||||
void setStereo(bool stereo) { m_stereo = stereo; }
|
||||
void setSampleLength(ushort sampleLength);
|
||||
void setStereo(bool stereo);
|
||||
|
||||
void setInstrumentCount (uint16_t instrumentCount) {
|
||||
m_instrumentCount = instrumentCount;
|
||||
}
|
||||
void setSampleCount (uint16_t sampleCount) { m_sampleCount = sampleCount; }
|
||||
void setPatternCount(uint16_t patternCount) { m_patternCount = patternCount; }
|
||||
void setFlags (uint16_t flags) { m_flags = flags; }
|
||||
void setSpecial (uint16_t special) { m_special = special; }
|
||||
void setCmwt (uint16_t cmwt) { m_cmwt = cmwt; }
|
||||
void setVersion (uint16_t version) { m_version = version; }
|
||||
void setBaseVolume (int baseVolume) { m_baseVolume = baseVolume; }
|
||||
void setTempo (uint8_t tempo) { m_tempo = tempo; }
|
||||
void setBpmSpeed (uint8_t bpmSpeed) { m_bpmSpeed = 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:
|
||||
uint16_t m_sampleLength;
|
||||
bool m_stereo;
|
||||
uint16_t m_instrumentCount;
|
||||
uint16_t m_sampleCount;
|
||||
uint16_t m_patternCount;
|
||||
uint16_t m_version;
|
||||
uint16_t m_cmwt;
|
||||
uint16_t m_flags;
|
||||
uint16_t m_special;
|
||||
int m_baseVolume;
|
||||
uint8_t m_tempo;
|
||||
uint8_t m_bpmSpeed;
|
||||
Properties(const Properties&);
|
||||
Properties &operator=(const Properties&);
|
||||
|
||||
class PropertiesPrivate;
|
||||
PropertiesPrivate *d;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user