libsidplayfp 2.16.0
usbsid-emu.h
1
2#ifndef USBSID_EMU_H
3#define USBSID_EMU_H
4
5#include <stdint.h>
6
7#include "sidplayfp/SidConfig.h"
8#include "sidemu.h"
9#include "Event.h"
10#include "EventScheduler.h"
11#include "sidplayfp/siddefs.h"
12#include "driver/src/USBSID.h"
13
14#include "sidcxx11.h"
15
16#ifdef HAVE_CONFIG_H
17# include "config.h"
18#endif
19
20namespace libsidplayfp
21{
22
23/***************************************************************************
24 * USBSID SID Specialisation
25 ***************************************************************************/
26class USBSID final : public sidemu, private Event//, public USBSIDBuilder
27{
28private:
29 /* USBSID specific data */
31 int m_handle;
32 int sidno;
33
34 bool m_status;
35
36 uint8_t busValue; /* Return value on read */
37
38 SidConfig::sid_model_t runmodel; /* Read model type */
39
40 event_clock_t delay(); /* Event */
41
42public:
43 static const char* getCredits();
44
45public:
46 USBSID(sidbuilder *builder);
47 ~USBSID() override;
48
49 /* static variables required due to
50 * multiple class initializations */
51 static long raster_rate;
52 static event_clock_t m_delayClk;
53
54 bool getStatus() const { return m_status; }
55
56 uint8_t read(uint_least8_t addr) override;
57 void write(uint_least8_t addr, uint8_t data) override;
58
59 /* c64sid functions */
60 void reset(uint8_t volume) override;
61
62 /* Standard SID functions */
63 // void clock() override;
64 void clock() {};
65
66
67 void sampling(float systemclock, float freq,
68 SidConfig::sampling_method_t method, bool);
69
70 void model(SidConfig::sid_model_t model, MAYBE_UNUSED bool digiboost) override;
71
72 /* USBSID specific */
73 void flush(void);
74 void filter(bool enable);
75
76 /* ISSUE: Disabled, blocks playing */
77 // Must lock the SID before using the standard functions.
78 // bool lock(EventScheduler *env) override;
79 // void unlock() override;
80
81private:
82 // Fixed interval timer delay to prevent sidplay2
83 // shoot to 100% CPU usage when song no longer
84 // writes to SID.
85 void event() override;
86};
87
88}
89
90#endif // USBSID_EMU_H
sid_model_t
SID chip model.
Definition SidConfig.h:51
sampling_method_t
Sampling method.
Definition SidConfig.h:84
Definition USBSID.h:276
Event(const char *const name)
Definition Event.h:58
virtual void event()=0
void clock()
Definition usbsid-emu.h:64
Definition sidbuilder.h:41