Debian Codegraph @

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