Debian Codegraph @

src/engine/platform/ted.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 _TED_H
21 #define _TED_H
22
23 #include "../dispatch.h"
24 #include "../../fixedQueue.h"
25 #include "sound/ted-sound.h"
26
27 class DivPlatformTED: public DivDispatch {
28 struct Channel: public SharedChannel<signed char> {
29 bool noise, square;
30 Channel():
31 SharedChannel<signed char>(8),
32 noise(false),
33 square(true) {}
34 };
35 Channel chan[2];
36 DivDispatchOscBuffer* oscBuf[2];
37 bool isMuted[2];
38 struct QueuedWrite {
39 unsigned char addr;
40 unsigned char val;
41 QueuedWrite(): addr(0), val(0) {}
42 QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {}
43 };
44 FixedQueue<QueuedWrite,64> writes;
45
46 struct plus4_sound_s ted;
47 unsigned char vol;
48 bool updateCtrl, keyPriority;
49
50 unsigned char chanOrder[2];
51 unsigned char regPool[8];
52 friend void putDispatchChip(void*,int);
53 friend void putDispatchChan(void*,int,int);
54 public:
55 void acquire(short** buf, size_t len);
56 int dispatch(DivCommand c);
57 bool isVolGlobal();
58 void* getChanState(int chan);
59 DivMacroInt* getChanMacroInt(int ch);
60 DivDispatchOscBuffer* getOscBuffer(int chan);
61 unsigned char* getRegisterPool();
62 int getRegisterPoolSize();
63 void reset();
64 void forceIns();
65 void tick(bool sysTick=true);
66 void muteChannel(int ch, bool mute);
67 int getOutputCount();
68 bool keyOffAffectsArp(int ch);
69 void setFlags(const DivConfig& flags);
70 void notifyInsDeletion(void* ins);
71 void poke(unsigned int addr, unsigned short val);
72 void poke(std::vector<DivRegWrite>& wlist);
73 const char** getRegisterSheet();
74 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
75 void quit();
76 ~DivPlatformTED();
77 };
78
79 #endif