Debian Codegraph @

src/engine/platform/rf5c68.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 _RF5C68_H
21 #define _RF5C68_H
22
23 #include "../dispatch.h"
24 #include "sound/rf5c68.h"
25
26 class DivPlatformRF5C68: public DivDispatch {
27 struct Channel: public SharedChannel<int> {
28 unsigned int audPos;
29 int sample, wave;
30 int panning;
31 bool setPos;
32 int macroVolMul;
33 Channel():
34 SharedChannel<int>(255),
35 audPos(0),
36 sample(-1),
37 wave(-1),
38 panning(255),
39 setPos(false),
40 macroVolMul(64) {}
41 };
42 Channel chan[8];
43 DivDispatchOscBuffer* oscBuf[8];
44 bool isMuted[8];
45 int chipType;
46 unsigned char curChan;
47 unsigned int* sampleOffRFC;
48 bool* sampleLoaded;
49
50 unsigned char* sampleMem;
51 size_t sampleMemLen;
52 rf5c68_device rf5c68;
53 DivMemoryComposition memCompo;
54 unsigned char regPool[144];
55 friend void putDispatchChip(void*,int);
56 friend void putDispatchChan(void*,int,int);
57
58 public:
59 void acquire(short** buf, size_t len);
60 int dispatch(DivCommand c);
61 void* getChanState(int chan);
62 DivMacroInt* getChanMacroInt(int ch);
63 unsigned short getPan(int chan);
64 DivDispatchOscBuffer* getOscBuffer(int chan);
65 unsigned char* getRegisterPool();
66 int getRegisterPoolSize();
67 void reset();
68 void forceIns();
69 void tick(bool sysTick=true);
70 void muteChannel(int ch, bool mute);
71 int getOutputCount();
72 void setChipModel(int type);
73 void notifyInsChange(int ins);
74 void notifyWaveChange(int wave);
75 void notifyInsDeletion(void* ins);
76 void setFlags(const DivConfig& flags);
77 void poke(unsigned int addr, unsigned short val);
78 void poke(std::vector<DivRegWrite>& wlist);
79 const char** getRegisterSheet();
80 const void* getSampleMem(int index = 0);
81 size_t getSampleMemCapacity(int index = 0);
82 size_t getSampleMemUsage(int index = 0);
83 bool isSampleLoaded(int index, int sample);
84 const DivMemoryComposition* getMemCompo(int index);
85 void renderSamples(int chipID);
86 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
87 void quit();
88 DivPlatformRF5C68();
89 ~DivPlatformRF5C68();
90 private:
91 void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
92 };
93
94 #endif