Debian Codegraph @

src/engine/platform/arcade.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 _ARCADE_H
21 #define _ARCADE_H
22 #include "fmshared_OPM.h"
23 #include "../../../extern/opm/opm.h"
24 #include "sound/ymfm/ymfm_opm.h"
25
26 class DivArcadeInterface: public ymfm::ymfm_interface {
27
28 };
29
30 class DivPlatformArcade: public DivPlatformOPM {
31 protected:
32 const unsigned short chanOffs[8]={
33 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
34 };
35
36 struct Channel: public FMChannel {
37 unsigned char chVolL, chVolR;
38 Channel():
39 FMChannel(),
40 chVolL(1),
41 chVolR(1) {}
42 };
43 Channel chan[8];
44 DivDispatchOscBuffer* oscBuf[8];
45 opm_t fm;
46 int baseFreqOff;
47 unsigned char amDepth, pmDepth;
48
49 ymfm::ym2151* fm_ymfm;
50 ymfm::ym2151::output_data out_ymfm;
51 DivArcadeInterface iface;
52
53 bool useYMFM;
54
55 bool isMuted[8];
56
57 int octave(int freq);
58 int toFreq(int freq);
59 void commitState(int ch, DivInstrument* ins);
60
61 void acquire_nuked(short** buf, size_t len);
62 void acquire_ymfm(short** buf, size_t len);
63
64 friend void putDispatchChan(void*,int,int);
65 friend void putDispatchChip(void*,int);
66 public:
67 void acquire(short** buf, size_t len);
68 int dispatch(DivCommand c);
69 void* getChanState(int chan);
70 DivDispatchOscBuffer* getOscBuffer(int chan);
71 unsigned char* getRegisterPool();
72 int getRegisterPoolSize();
73 void reset();
74 void forceIns();
75 void tick(bool sysTick=true);
76 void muteChannel(int ch, bool mute);
77 DivMacroInt* getChanMacroInt(int ch);
78 unsigned short getPan(int chan);
79 void notifyInsChange(int ins);
80 void notifyInsDeletion(void* ins);
81 void setFlags(const DivConfig& flags);
82 int getOutputCount();
83 void setYMFM(bool use);
84 void poke(unsigned int addr, unsigned short val);
85 void poke(std::vector<DivRegWrite>& wlist);
86 const char** getRegisterSheet();
87 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
88 void quit();
89 ~DivPlatformArcade();
90 };
91 #endif