libsidplayfp  1.8.7
MUS.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2012-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef MUS_H
22 #define MUS_H
23 
24 #include <stdint.h>
25 
26 #include "SidTuneBase.h"
27 
28 class sidmemory;
29 template <class T> class SmartPtr_sidtt;
30 
31 class MUS : public SidTuneBase
32 {
33 private:
35  uint_least16_t musDataLen;
36 
37 private:
38  static bool detect(const uint_least8_t* buffer, uint_least32_t bufLen,
39  uint_least32_t& voice3Index);
40 
41  bool mergeParts(buffer_t& musBuf, buffer_t& strBuf);
42 
43  void tryLoad(buffer_t& musBuf,
44  buffer_t& strBuf,
46  uint_least32_t voice3Index,
47  bool init);
48 
49 protected:
50  MUS() {}
51 
52  void installPlayer(sidmemory *mem);
53 
54  void setPlayerAddress();
55 
56  virtual void acceptSidTune(const char* dataFileName, const char* infoFileName,
57  buffer_t& buf, bool isSlashedFileName);
58 
59 public:
60  virtual ~MUS() {}
61 
62  static SidTuneBase* load(buffer_t& dataBuf, bool init = false);
63  static SidTuneBase* load(buffer_t& musBuf,
64  buffer_t& strBuf,
65  uint_least32_t fileOffset,
66  bool init = false);
67 
68  virtual bool placeSidTuneInC64mem(sidmemory* mem);
69 
70 private:
71  // prevent copying
72  MUS(const MUS&);
73  MUS& operator=(MUS&);
74 };
75 
76 #endif // MUS_H
Definition: MUS.h:29
virtual bool placeSidTuneInC64mem(sidmemory *mem)
Definition: MUS.cpp:90
Definition: SidTuneBase.h:55
virtual void acceptSidTune(const char *dataFileName, const char *infoFileName, buffer_t &buf, bool isSlashedFileName)
Definition: MUS.cpp:83
Definition: MUS.h:31
Definition: sidmemory.h:30
uint_least32_t fileOffset
For files with header: offset to real data.
Definition: SidTuneBase.h:131