Debian Codegraph @

src/engine/platform/zxbeeperquadtone.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 _ZXBEEPERQUADTONE_H
21 #define _ZXBEEPERQUADTONE_H
22
23 #include "../dispatch.h"
24
25 class DivPlatformZXBeeperQuadTone: public DivDispatch {
26 struct Channel: public SharedChannel<unsigned char> {
27 unsigned short sPosition;
28 unsigned char duty;
29 unsigned char out;
30 Channel():
31 SharedChannel<unsigned char>(2),
32 sPosition(0),
33 duty(128),
34 out(0) {}
35 };
36 Channel chan[5];
37 DivDispatchOscBuffer* oscBuf[5];
38 bool isMuted[5];
39 bool noHiss;
40 bool deHisser[8];
41
42 int cycles, curChan, sOffTimer, delay, curSample, curSamplePeriod;
43 unsigned int curSamplePos;
44 unsigned int outputClock;
45 unsigned char regPool[17];
46 friend void putDispatchChip(void*,int);
47 friend void putDispatchChan(void*,int,int);
48 public:
49 void acquire(short** buf, size_t len);
50 int dispatch(DivCommand c);
51 void* getChanState(int chan);
52 DivMacroInt* getChanMacroInt(int ch);
53 DivDispatchOscBuffer* getOscBuffer(int chan);
54 unsigned char* getRegisterPool();
55 int getRegisterPoolSize();
56 void reset();
57 void forceIns();
58 void tick(bool sysTick=true);
59 void muteChannel(int ch, bool mute);
60 bool keyOffAffectsArp(int ch);
61 void setFlags(const DivConfig& flags);
62 void notifyWaveChange(int wave);
63 void notifyInsDeletion(void* ins);
64 void poke(unsigned int addr, unsigned short val);
65 void poke(std::vector<DivRegWrite>& wlist);
66 const char** getRegisterSheet();
67 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
68 void quit();
69 ~DivPlatformZXBeeperQuadTone();
70 private:
71 void writeOutVol(int ch);
72 };
73
74 #endif