libsidplayfp  1.0.3
SidTune.h
00001 /*
00002  * This file is part of libsidplayfp, a SID player engine.
00003  *
00004  * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
00005  * Copyright 2007-2010 Antti Lankila
00006  * Copyright 2000 Simon White
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021  */
00022 
00023 #ifndef SIDTUNE_H
00024 #define SIDTUNE_H
00025 
00026 #include <stdint.h>
00027 #include <fstream>
00028 #include <memory>
00029 
00030 #include "sidplayfp/siddefs.h"
00031 
00032 class SidTuneInfo;
00033 class SidTuneInfoImpl;
00034 class SidTuneBase;
00035 class sidmemory;
00036 
00040 class SID_EXTERN SidTune
00041 {
00042 public:
00043     static const int MD5_LENGTH = 32;
00044 
00045 private:
00047     static const char** fileNameExtensions;
00048 
00049 private:  // -------------------------------------------------------------
00050     std::auto_ptr<SidTuneBase> tune;
00051 
00052     const char* m_statusString;
00053 
00054     bool m_status;
00055 
00056 public:  // ----------------------------------------------------------------
00057 
00074     SidTune(const char* fileName, const char **fileNameExt = 0,
00075             bool separatorIsSlash = false);
00076 
00084     SidTune(const uint_least8_t* oneFileFormatSidtune, uint_least32_t sidtuneLength);
00085 
00086     virtual ~SidTune() {}
00087 
00096     void setFileNameExtensions(const char **fileNameExt);
00097 
00104     void load(const char* fileName, bool separatorIsSlash = false);
00105 
00112     void read(const uint_least8_t* sourceBuffer, uint_least32_t bufferLen);
00113 
00120     unsigned int selectSong(unsigned int songNum);
00121 
00127     const SidTuneInfo* getInfo() const;
00128 
00135     const SidTuneInfo* getInfo(unsigned int songNum);
00136 
00144     bool getStatus() const;
00145 
00149     const char* statusString() const;
00150 
00154     bool placeSidTuneInC64mem(sidmemory* mem);
00155 
00163     const char *createMD5(char *md5 = 0);
00164 
00165 private:    // prevent copying
00166     SidTune(const SidTune&);
00167     SidTune& operator=(SidTune&);
00168 };
00169 
00170 #endif  /* SIDTUNE_H */