libsidplayfp  0.3.5
resid-emu.h
1 /***************************************************************************
2  resid-emu.h - ReSid Emulation
3  -------------------
4  begin : Fri Apr 4 2001
5  copyright : (C) 2001 by Simon White
6  email : s_a_white@email.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifdef HAVE_CONFIG_H
19 # include "config.h"
20 #endif
21 
22 #include "resid/sid.h"
23 
24 //FIXME
25 #define RESID_NAMESPACE reSID
26 
27 #ifdef RESID_NAMESPACE
28 # define RESID_NS ::RESID_NAMESPACE
29 #else
30 # define RESID_NS
31 #endif
32 
33 enum {
34  OUTPUTBUFFERSIZE = 32768
35 };
36 
37 class ReSID: public sidemu
38 {
39 private:
40  EventContext *m_context;
41  event_phase_t m_phase;
42  class RESID_NS::SID &m_sid;
43  event_clock_t m_accessClk;
44  const char *m_error;
45  bool m_status;
46  bool m_locked;
47  uint8_t m_voiceMask;
48  static char m_credit[180];
49 
50 public:
51  ReSID (sidbuilder *builder);
52  ~ReSID (void);
53 
54  // Standard component functions
55  const char *credits (void) {return m_credit;}
56  void reset () { sidemu::reset (); }
57  void reset (uint8_t volume);
58  uint8_t read (uint_least8_t addr);
59  void write (uint_least8_t addr, uint8_t data);
60  const char *error (void) {return m_error;}
61 
62  // Standard SID functions
63  void clock ();
64  void filter (bool enable);
65  void voice (uint_least8_t num, bool mute);
66 
67  operator bool () { return m_status; }
68  static int devices (char *error);
69 
70  // Specific to resid
71  void sampling (float systemclock, float freq,
72  const sampling_method_t method, const bool fast);
73  //bool filter (const sid_filter_t *filter); //FIXME remove?
74  void bias (const double dac_bias);
75  void model (sid2_model_t model);
76  // Must lock the SID before using the standard functions.
77  bool lock (c64env *env);
78 };