Debian Codegraph @

src/engine/platform/scvtone.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 _SCV_TONE_H
21 #define _SCV_TONE_H
22
23 #include "../dispatch.h"
24 #include "../../fixedQueue.h"
25 #include "sound/upd1771.h"
26
27 class DivPlatformSCV: public DivDispatch {
28 struct Channel: public SharedChannel<signed char> {
29 unsigned int wave;
30 int pos, duty, baseFreqNoise;
31 Channel():
32 SharedChannel<signed char>(15),
33 wave(0),
34 pos(0),
35 duty(0),
36 baseFreqNoise(0) {}
37 };
38 Channel chan[4];
39 DivDispatchOscBuffer* oscBuf[4];
40 bool isMuted[4];
41 struct QueuedWrite {
42 unsigned char addr;
43 unsigned char val;
44 QueuedWrite(): addr(0), val(9) {}
45 QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {}
46 };
47 FixedQueue<QueuedWrite,512> writes;
48
49 int curChan;
50 int tempL[32];
51 int tempR[32];
52 int coreQuality;
53 unsigned char regPool[16];
54 unsigned char kon[4];
55 unsigned char initWrite[4];
56 upd1771c_device scv;
57
58 unsigned char packet[16];
59
60 bool writePacket, waveMode;
61
62 friend void putDispatchChip(void*,int);
63 friend void putDispatchChan(void*,int,int);
64 public:
65 void acquire(short** buf, size_t len);
66 int dispatch(DivCommand c);
67 void* getChanState(int chan);
68 DivMacroInt* getChanMacroInt(int ch);
69 DivDispatchOscBuffer* getOscBuffer(int chan);
70 unsigned char* getRegisterPool();
71 int getRegisterPoolSize();
72 void reset();
73 void forceIns();
74 void tick(bool sysTick=true);
75 void muteChannel(int ch, bool mute);
76 int getOutputCount();
77 bool keyOffAffectsArp(int ch);
78 void setFlags(const DivConfig& flags);
79 void notifyInsDeletion(void* ins);
80 void poke(unsigned int addr, unsigned short val);
81 void poke(std::vector<DivRegWrite>& wlist);
82 const char** getRegisterSheet();
83 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
84 void quit();
85 ~DivPlatformSCV();
86 };
87
88 #endif