Debian Codegraph @

src/engine/platform/dummy.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 #include "../dispatch.h"
21
22 // the dummy platform outputs saw waves.
23 // used when a DivDispatch for a system is not found.
24 class DivPlatformDummy: public DivDispatch {
25 struct Channel {
26 int freq, baseFreq, pitch;
27 unsigned short pos;
28 bool active, freqChanged;
29 unsigned char vol;
30 signed char amp;
31 Channel(): freq(0), baseFreq(0), pitch(0), pos(0), active(false), freqChanged(false), vol(0), amp(64) {}
32 };
33 Channel chan[128];
34 DivDispatchOscBuffer* oscBuf[128];
35 bool isMuted[128];
36 unsigned char chans;
37 friend void putDispatchChip(void*,int);
38 friend void putDispatchChan(void*,int,int);
39 public:
40 void acquire(short** buf, size_t len);
41 void muteChannel(int ch, bool mute);
42 int dispatch(DivCommand c);
43 void notifyInsDeletion(void* ins);
44 void* getChanState(int chan);
45 DivDispatchOscBuffer* getOscBuffer(int chan);
46 void reset();
47 void tick(bool sysTick=true);
48 int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
49 void quit();
50 ~DivPlatformDummy();
51 };