added .mod file support

This commit is contained in:
Mathias Panzenböck
2011-06-14 03:47:08 +02:00
parent 812826fe3a
commit f75f5ac9bb
17 changed files with 374 additions and 123 deletions

View File

@ -36,7 +36,7 @@ public:
{
}
XM::Tag tag;
Mod::Tag tag;
XM::Properties properties;
};
@ -61,7 +61,7 @@ XM::File::~File()
delete d;
}
XM::Tag *XM::File::tag() const
Mod::Tag *XM::File::tag() const
{
return &d->tag;
}
@ -131,27 +131,15 @@ void XM::File::read(bool)
if(instrumentSize > 4)
{
if(!readString(instrumentName, std::min(22UL, instrumentSize-4)))
{
setValid(false);
return;
}
READ_ASSERT(readString(instrumentName, std::min(22UL, instrumentSize-4)));
if(instrumentSize >= (4+22+1))
{
if(!readByte(instrumentType))
{
setValid(false);
return;
}
READ_ASSERT(readByte(instrumentType));
if(instrumentSize >= (4+22+1+2))
{
if(!readU16L(sampleCount))
{
setValid(false);
return;
}
READ_ASSERT(readU16L(sampleCount));
}
}
}

View File

@ -22,13 +22,11 @@
#ifndef TAGLIB_XMFILE_H
#define TAGLIB_XMFILE_H
#include <stdint.h>
#include "tfile.h"
#include "audioproperties.h"
#include "taglib_export.h"
#include "modfilebase.h"
#include "xmtag.h"
#include "modtag.h"
#include "xmproperties.h"
namespace TagLib {
@ -60,7 +58,7 @@ namespace TagLib {
*/
virtual ~File();
XM::Tag *tag() const;
Mod::Tag *tag() const;
/*!
* Returns the XM::Properties for this file. If no audio properties

View File

@ -1,120 +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 "xmtag.h"
using namespace TagLib;
using namespace XM;
class XM::Tag::TagPrivate
{
public:
TagPrivate() {}
String title;
String comment;
String trackerName;
};
XM::Tag::Tag() : TagLib::Tag()
{
d = new TagPrivate;
}
XM::Tag::~Tag()
{
delete d;
}
String XM::Tag::title() const
{
return d->title;
}
String XM::Tag::artist() const
{
return String::null;
}
String XM::Tag::album() const
{
return String::null;
}
String XM::Tag::comment() const
{
return d->comment;
}
String XM::Tag::genre() const
{
return String::null;
}
uint XM::Tag::year() const
{
return 0;
}
uint XM::Tag::track() const
{
return 0;
}
String XM::Tag::trackerName() const
{
return d->trackerName;
}
void XM::Tag::setTitle(const String &title)
{
d->title = title;
}
void XM::Tag::setArtist(const String &)
{
}
void XM::Tag::setAlbum(const String &)
{
}
void XM::Tag::setComment(const String &comment)
{
d->comment = comment;
}
void XM::Tag::setGenre(const String &)
{
}
void XM::Tag::setYear(uint)
{
}
void XM::Tag::setTrack(uint)
{
}
void XM::Tag::setTrackerName(const String &trackerName)
{
d->trackerName = trackerName;
}

View File

@ -1,62 +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_XMTAG_H
#define TAGLIB_XMTAG_H
#include "modtag.h"
namespace TagLib {
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;
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 &);
class TagPrivate;
TagPrivate *d;
};
}
}
#endif