libsidplayfp  1.0.1
SidTune.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2007-2010 Antti Lankila
6  * Copyright 2000 Simon White
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef SIDTUNE_H
24 #define SIDTUNE_H
25 
26 #include <stdint.h>
27 #include <fstream>
28 #include <memory>
29 
30 #include "sidplayfp/siddefs.h"
31 
32 class SidTuneInfo;
33 class SidTuneInfoImpl;
34 class SidTuneBase;
35 class sidmemory;
36 
40 class SID_EXTERN SidTune
41 {
42 public:
43  static const int MD5_LENGTH = 32;
44 
45 private:
47  static const char** fileNameExtensions;
48 
49 private: // -------------------------------------------------------------
50  std::auto_ptr<SidTuneBase> tune;
51 
52  const char* m_statusString;
53 
54  bool m_status;
55 
56 public: // ----------------------------------------------------------------
57 
74  SidTune(const char* fileName, const char **fileNameExt = 0,
75  bool separatorIsSlash = false);
76 
84  SidTune(const uint_least8_t* oneFileFormatSidtune, uint_least32_t sidtuneLength);
85 
86  virtual ~SidTune() {}
87 
96  void setFileNameExtensions(const char **fileNameExt);
97 
104  void load(const char* fileName, bool separatorIsSlash = false);
105 
112  void read(const uint_least8_t* sourceBuffer, uint_least32_t bufferLen);
113 
120  unsigned int selectSong(unsigned int songNum);
121 
127  const SidTuneInfo* getInfo() const;
128 
135  const SidTuneInfo* getInfo(unsigned int songNum);
136 
144  bool getStatus() const;
145 
149  const char* statusString() const;
150 
154  bool placeSidTuneInC64mem(sidmemory* mem);
155 
163  const char *createMD5(char *md5 = 0);
164 
165 private: // prevent copying
166  SidTune(const SidTune&);
167  SidTune& operator=(SidTune&);
168 };
169 
170 #endif /* SIDTUNE_H */