libsidplayfp  2.0.2
SidTuneInfoImpl.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2015 Leandro Nini
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 SIDTUNEINFOIMPL_H
24 #define SIDTUNEINFOIMPL_H
25 
26 #include <stdint.h>
27 #include <vector>
28 #include <string>
29 
30 #include "sidplayfp/SidTuneInfo.h"
31 
32 #include "sidcxx11.h"
33 
34 namespace libsidplayfp
35 {
36 
40 class SidTuneInfoImpl final : public SidTuneInfo
41 {
42 public:
43  const char* m_formatString;
44 
45  unsigned int m_songs;
46  unsigned int m_startSong;
47  unsigned int m_currentSong;
48 
49  int m_songSpeed;
50 
51  clock_t m_clockSpeed;
52 
53  compatibility_t m_compatibility;
54 
55  uint_least32_t m_dataFileLen;
56 
57  uint_least32_t m_c64dataLen;
58 
59  uint_least16_t m_loadAddr;
60  uint_least16_t m_initAddr;
61  uint_least16_t m_playAddr;
62 
63  uint_least8_t m_relocStartPage;
64 
65  uint_least8_t m_relocPages;
66 
67  std::string m_path;
68 
69  std::string m_dataFileName;
70 
71  std::string m_infoFileName;
72 
73  std::vector<model_t> m_sidModels;
74 
75  std::vector<uint_least16_t> m_sidChipAddresses;
76 
77  std::vector<std::string> m_infoString;
78 
79  std::vector<std::string> m_commentString;
80 
81  bool m_fixLoad;
82 
83 private: // prevent copying
85  SidTuneInfoImpl& operator=(SidTuneInfoImpl&);
86 
87 public:
88  SidTuneInfoImpl() :
89  m_formatString("N/A"),
90  m_songs(0),
91  m_startSong(0),
92  m_currentSong(0),
93  m_songSpeed(SPEED_VBI),
94  m_clockSpeed(CLOCK_UNKNOWN),
95  m_compatibility(COMPATIBILITY_C64),
96  m_dataFileLen(0),
97  m_c64dataLen(0),
98  m_loadAddr(0),
99  m_initAddr(0),
100  m_playAddr(0),
101  m_relocStartPage(0),
102  m_relocPages(0),
103  m_fixLoad(false)
104  {
105  m_sidModels.push_back(SIDMODEL_UNKNOWN);
106  m_sidChipAddresses.push_back(0xd400);
107  }
108 
109  uint_least16_t getLoadAddr() const override { return m_loadAddr; }
110 
111  uint_least16_t getInitAddr() const override { return m_initAddr; }
112 
113  uint_least16_t getPlayAddr() const override { return m_playAddr; }
114 
115  unsigned int getSongs() const override { return m_songs; }
116 
117  unsigned int getStartSong() const override { return m_startSong; }
118 
119  unsigned int getCurrentSong() const override { return m_currentSong; }
120 
121  uint_least16_t getSidChipBase(unsigned int i) const override
122  {
123  return i < m_sidChipAddresses.size() ? m_sidChipAddresses[i] : 0;
124  }
125 
126  int getSidChips() const override { return m_sidChipAddresses.size(); }
127 
128  int getSongSpeed() const override { return m_songSpeed; }
129 
130  uint_least8_t getRelocStartPage() const override { return m_relocStartPage; }
131 
132  uint_least8_t getRelocPages() const override { return m_relocPages; }
133 
134  model_t getSidModel(unsigned int i) const override
135  {
136  return i < m_sidModels.size() ? m_sidModels[i] : SIDMODEL_UNKNOWN;
137  }
138 
139  compatibility_t getCompatibility() const override { return m_compatibility; }
140 
141  unsigned int getNumberOfInfoStrings() const override { return m_infoString.size(); }
142  const char* getInfoString(unsigned int i) const override { return i<getNumberOfInfoStrings() ? m_infoString[i].c_str() : ""; }
143 
144  unsigned int getNumberOfCommentStrings() const override { return m_commentString.size(); }
145  const char* getCommentString(unsigned int i) const override { return i<getNumberOfCommentStrings() ? m_commentString[i].c_str() : ""; }
146 
147  uint_least32_t getDataFileLen() const override { return m_dataFileLen; }
148 
149  uint_least32_t getC64dataLen() const override { return m_c64dataLen; }
150 
151  clock_t getClockSpeed() const override { return m_clockSpeed; }
152 
153  const char* getFormatString() const override { return m_formatString; }
154 
155  bool getFixLoad() const override { return m_fixLoad; }
156 
157  const char* getPath() const override { return m_path.c_str(); }
158 
159  const char* getDataFileName() const override { return m_dataFileName.c_str(); }
160 
161  const char* getInfoFileName() const override { return !m_infoFileName.empty() ? m_infoFileName.c_str() : nullptr; }
162 };
163 
164 }
165 
166 #endif /* SIDTUNEINFOIMPL_H */
libsidplayfp::SidTuneInfoImpl::getNumberOfCommentStrings
unsigned int getNumberOfCommentStrings() const override
Number of comments.
Definition: SidTuneInfoImpl.h:144
libsidplayfp::SidTuneInfoImpl::getC64dataLen
uint_least32_t getC64dataLen() const override
Number of comments.
Definition: SidTuneInfoImpl.h:149
libsidplayfp::SidTuneInfoImpl::getFormatString
const char * getFormatString() const override
Number of comments.
Definition: SidTuneInfoImpl.h:153
libsidplayfp::SidTuneInfoImpl::getNumberOfInfoStrings
unsigned int getNumberOfInfoStrings() const override
Number of comments.
Definition: SidTuneInfoImpl.h:141
SidTuneInfo
Definition: SidTuneInfo.h:39
SidTuneInfo::SPEED_VBI
static const int SPEED_VBI
Vertical-Blanking-Interrupt.
Definition: SidTuneInfo.h:64
libsidplayfp::SidTuneInfoImpl::getPath
const char * getPath() const override
Number of comments.
Definition: SidTuneInfoImpl.h:157
libsidplayfp::SidTuneInfoImpl::getCompatibility
compatibility_t getCompatibility() const override
Number of comments.
Definition: SidTuneInfoImpl.h:139
libsidplayfp::SidTuneInfoImpl::getClockSpeed
clock_t getClockSpeed() const override
Number of comments.
Definition: SidTuneInfoImpl.h:151
libsidplayfp::SidTuneInfoImpl::getInitAddr
uint_least16_t getInitAddr() const override
Number of comments.
Definition: SidTuneInfoImpl.h:111
libsidplayfp::SidTuneInfoImpl::getDataFileName
const char * getDataFileName() const override
Number of comments.
Definition: SidTuneInfoImpl.h:159
libsidplayfp::SidTuneInfoImpl
Definition: SidTuneInfoImpl.h:41
libsidplayfp::SidTuneInfoImpl::getSongSpeed
int getSongSpeed() const override
Number of comments.
Definition: SidTuneInfoImpl.h:128
libsidplayfp::SidTuneInfoImpl::getInfoString
const char * getInfoString(unsigned int i) const override
Number of comments.
Definition: SidTuneInfoImpl.h:142
SidTuneInfo::COMPATIBILITY_C64
@ COMPATIBILITY_C64
File is C64 compatible.
Definition: SidTuneInfo.h:56
libsidplayfp::SidTuneInfoImpl::getDataFileLen
uint_least32_t getDataFileLen() const override
Number of comments.
Definition: SidTuneInfoImpl.h:147
libsidplayfp::SidTuneInfoImpl::getRelocStartPage
uint_least8_t getRelocStartPage() const override
Number of comments.
Definition: SidTuneInfoImpl.h:130
libsidplayfp::SidTuneInfoImpl::getSidChips
int getSidChips() const override
Number of comments.
Definition: SidTuneInfoImpl.h:126
libsidplayfp::SidTuneInfoImpl::getInfoFileName
const char * getInfoFileName() const override
Number of comments.
Definition: SidTuneInfoImpl.h:161
libsidplayfp::SidTuneInfoImpl::getStartSong
unsigned int getStartSong() const override
Number of comments.
Definition: SidTuneInfoImpl.h:117
libsidplayfp::SidTuneInfoImpl::getLoadAddr
uint_least16_t getLoadAddr() const override
Number of comments.
Definition: SidTuneInfoImpl.h:109
libsidplayfp::SidTuneInfoImpl::getPlayAddr
uint_least16_t getPlayAddr() const override
Number of comments.
Definition: SidTuneInfoImpl.h:113
libsidplayfp::SidTuneInfoImpl::getSidModel
model_t getSidModel(unsigned int i) const override
Number of comments.
Definition: SidTuneInfoImpl.h:134
libsidplayfp::SidTuneInfoImpl::getSidChipBase
uint_least16_t getSidChipBase(unsigned int i) const override
Number of comments.
Definition: SidTuneInfoImpl.h:121
libsidplayfp::SidTuneInfoImpl::getRelocPages
uint_least8_t getRelocPages() const override
Number of comments.
Definition: SidTuneInfoImpl.h:132
libsidplayfp::SidTuneInfoImpl::getCommentString
const char * getCommentString(unsigned int i) const override
Number of comments.
Definition: SidTuneInfoImpl.h:145
libsidplayfp::SidTuneInfoImpl::getCurrentSong
unsigned int getCurrentSong() const override
Number of comments.
Definition: SidTuneInfoImpl.h:119
libsidplayfp::SidTuneInfoImpl::getFixLoad
bool getFixLoad() const override
Number of comments.
Definition: SidTuneInfoImpl.h:155
SidTuneInfo::compatibility_t
compatibility_t
Definition: SidTuneInfo.h:55
libsidplayfp::SidTuneInfoImpl::getSongs
unsigned int getSongs() const override
Number of comments.
Definition: SidTuneInfoImpl.h:115