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