libsidplayfp  1.3.0
resid-emu.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 2001 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 RESID_EMU_H
24 #define RESID_EMU_H
25 
26 #include <stdint.h>
27 #include <string>
28 
29 #include "sidplayfp/SidConfig.h"
30 #include "sidplayfp/sidemu.h"
31 #include "sidplayfp/event.h"
32 #include "resid/sid.h"
33 
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37 
38 //FIXME
39 #define RESID_NAMESPACE reSID
40 
41 #ifdef RESID_NAMESPACE
42 # define RESID_NS ::RESID_NAMESPACE
43 #else
44 # define RESID_NS
45 #endif
46 
47 class ReSID: public sidemu
48 {
49 private:
50  EventContext *m_context;
51  RESID_NS::SID &m_sid;
52  event_clock_t m_accessClk;
53  const char *m_error;
54  bool m_status;
55  bool m_locked;
56  uint8_t m_voiceMask;
57 
58  static std::string m_credit;
59 
60 public:
61  static const char* getCredits();
62 
63 public:
64  ReSID(sidbuilder *builder);
65  ~ReSID();
66 
67  // Standard component functions
68  const char *credits () const { return getCredits(); }
69 
70  void reset() { sidemu::reset (); }
71  void reset(uint8_t volume);
72 
73  uint8_t read(uint_least8_t addr);
74  void write(uint_least8_t addr, uint8_t data);
75 
76  const char *error() const { return m_error; }
77 
78  // Standard SID functions
79  void clock();
80  void filter(bool enable);
81  void voice(unsigned int num, bool mute);
82 
83  bool getStatus() const { return m_status; }
84 
85  // Specific to resid
86  void sampling(float systemclock, float freq,
87  SidConfig::sampling_method_t method, bool fast);
88 
89  void bias(double dac_bias);
90  void model(SidConfig::sid_model_t model);
91 
92  // Must lock the SID before using the standard functions.
93  bool lock(EventContext *env);
94  void unlock();
95 };
96 
97 #endif // RESID_EMU_H
Definition: sidemu.h:45
Definition: event.h:101
Definition: resid-emu.h:47
Definition: sidbuilder.h:37