libsidplayfp 2.16.1
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
65
66 void sampling(float systemclock, float freq,
67 SidConfig::sampling_method_t method, bool) override;
68
69 void model(SidConfig::sid_model_t model, MAYBE_UNUSED bool digiboost) override;
70
71 /* USBSID specific */
72 void flush(void);
73 void filter(bool enable);
74
75 /* ISSUE: Disabled, blocks playing */
76 // Must lock the SID before using the standard functions.
77 // bool lock(EventScheduler *env) override;
78 // void unlock() override;
79
80private:
81 // Fixed interval timer delay to prevent sidplay2
82 // shoot to 100% CPU usage when song no longer
83 // writes to SID.
84 void event() override;
85};
86
87}
88
89#endif // USBSID_EMU_H
sid_model_t
SID chip model.
Definition SidConfig.h:51
sampling_method_t
Sampling method.
Definition SidConfig.h:84
Definition emscripten/src/USBSID.h:309
Definition Event.h:39
Definition usbsid-emu.h:27
void clock() override
Definition usbsid-emu.h:63
Definition sidemu.h:47
Definition sidbuilder.h:41