Debian Codegraph @

src/engine/platform/scc.h

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef _SCC_H
21 #define _SCC_H
22
23 #include "../dispatch.h"
24 #include "../waveSynth.h"
25 #include "vgsound_emu/src/scc/scc.hpp"
26
27 class DivPlatformSCC: public DivDispatch {
28 struct Channel: public SharedChannel<signed char> {
29 bool freqInit;
30 signed short wave;
31 signed char waveROM[32] = {0}; // 8 bit signed waveform
32 DivWaveSynth ws;
33 Channel():
34 SharedChannel<signed char>(15),
35 freqInit(false),
36 wave(-1) {}
37 };
38 Channel chan[5];
39 DivDispatchOscBuffer* oscBuf[5];
40 bool isMuted[5];
41 unsigned char writeOscBuf;
42 int lastUpdated34;
43
44 scc_core* scc;
45 bool isPlus;
46 unsigned char regBase;
47 unsigned char regPool[225];
48 void updateWave(int ch);
49 friend void putDispatchChip(void*,int);
50 friend void putDispatchChan(void*,int,int);
51 public:
52 void acquire(short** buf, size_t len);
53 void acquireDirect(blip_buffer_t** bb, size_t len);
54 int dispatch(DivCommand c);
55 void* getChanState(int chan);
56 DivMacroInt* getChanMacroInt(int ch);
57 DivDispatchOscBuffer* getOscBuffer(int chan);
58 unsigned char* getRegisterPool();
59 int getRegisterPoolSize();
60 void reset();
61 void forceIns();
62 void tick(bool sysTick=true);
63 void muteChannel(int ch, bool mute);
64 int getOutputCount();
65 bool hasAcquireDirect();
66 void notifyWaveChange(int wave);
67 void notifyInsDeletion(void* ins);
68 void poke(unsigned int addr, unsigned short val);
69 void poke(std::vector<DivRegWrite>& wlist);
70 const char** getRegisterSheet();
71 void setFlags(const DivConfig& flags);
72 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
73 void setChipModel(bool isPlus);
74 void quit();
75 ~DivPlatformSCC();
76 };
77
78 #endif