libsidplayfp  2.0.2
exsid-emu.h
1 /***************************************************************************
2  exsid-emu.h - exSID support interface.
3  -------------------
4  Based on hardsid-emu.h (C) 2000-2002 Simon White, (C) 2001-2002 Jarno Paananen
5 
6  copyright : (C) 2015 Thibaut VARENE
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License version 2 as *
12  * published by the Free Software Foundation. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef EXSID_EMU_H
17 #define EXSID_EMU_H
18 
19 #include "sidemu.h"
20 #include "Event.h"
21 #include "EventScheduler.h"
22 #include "sidplayfp/siddefs.h"
23 
24 #include "sidcxx11.h"
25 
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29 
30 namespace libsidplayfp
31 {
32 
33 #define EXSID_VOICES 3
34 
35 // Approx 30ms
36 #define EXSID_DELAY_CYCLES 50480
37 
38 /***************************************************************************
39  * exSID SID Specialisation
40  ***************************************************************************/
41 class exSID final : public sidemu
42 {
43 private:
44  //friend class HardSIDBuilder;
45 
46  // exSID specific data
47  static unsigned int sid;
48 
49  bool m_status;
50 
51  bool readflag;
52 
53  uint8_t busValue;
54 
55  bool muted[3];
56 
57  SidConfig::sid_model_t runmodel;
58 
59 private:
60  unsigned int delay();
61 
62 public:
63  static const char* getCredits();
64 
65 public:
66  exSID(sidbuilder *builder);
67  ~exSID();
68 
69  bool getStatus() const { return m_status; }
70 
71  uint8_t read(uint_least8_t addr) override;
72  void write(uint_least8_t addr, uint8_t data) override;
73 
74  // c64sid functions
75  void reset(uint8_t volume) override;
76 
77  // Standard SID functions
78  void clock() override;
79 
80  void model(SidConfig::sid_model_t model, bool digiboost) override;
81 
82  void voice(unsigned int num, bool mute) override;
83 
84  void filter(bool) {}
85 
86  void sampling(float systemclock, float freq,
87  SidConfig::sampling_method_t method, bool) override;
88 
89  // exSID specific
90  void flush();
91 
92  // Must lock the SID before using the standard functions.
93  bool lock(EventScheduler *env) override;
94  void unlock() override;
95 };
96 
97 }
98 
99 #endif // EXSID_EMU_H
libsidplayfp::exSID
Definition: exsid-emu.h:54
SidConfig::sampling_method_t
sampling_method_t
Sampling method.
Definition: SidConfig.h:75
libsidplayfp::exSID::unlock
void unlock() override
Definition: exsid-emu.cpp:181
libsidplayfp::exSID::voice
void voice(unsigned int num, bool mute) override
Definition: exsid-emu.cpp:160
sidbuilder
Definition: sidbuilder.h:41
libsidplayfp::exSID::lock
bool lock(EventScheduler *env) override
Definition: exsid-emu.cpp:176
libsidplayfp::exSID::model
void model(SidConfig::sid_model_t model, bool digiboost) override
Definition: exsid-emu.cpp:165
libsidplayfp::exSID::clock
void clock() override
Definition: exsid-emu.cpp:111
SidConfig::sid_model_t
sid_model_t
SID chip model.
Definition: SidConfig.h:51