| 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 _TIA_H |
| 21 |
#define _TIA_H |
| 22 |
|
| 23 |
#include "../dispatch.h" |
| 24 |
#include "sound/tia/Audio.h" |
| 25 |
|
| 26 |
class DivPlatformTIA: public DivDispatch { |
| 27 |
protected: |
| 28 |
struct Channel: public SharedChannel<int> { |
| 29 |
unsigned char shape; |
| 30 |
unsigned char curFreq, tuneCtr, tuneFreq; |
| 31 |
int tuneAcc; |
| 32 |
Channel(): |
| 33 |
SharedChannel<int>(15), |
| 34 |
shape(4), |
| 35 |
curFreq(0), |
| 36 |
tuneCtr(0), |
| 37 |
tuneFreq(0), |
| 38 |
tuneAcc(0) {} |
| 39 |
}; |
| 40 |
Channel chan[2]; |
| 41 |
DivDispatchOscBuffer* oscBuf[2]; |
| 42 |
bool isMuted[2]; |
| 43 |
bool softwarePitch; |
| 44 |
bool oldPitch; |
| 45 |
unsigned char mixingType; |
| 46 |
TIA::Audio tia; |
| 47 |
unsigned char regPool[16]; |
| 48 |
int tuneCounter; |
| 49 |
int prevSample[2]; |
| 50 |
friend void putDispatchChip(void*,int); |
| 51 |
friend void putDispatchChan(void*,int,int); |
| 52 |
|
| 53 |
unsigned char dealWithFreq(unsigned char shape, int base, int pitch); |
| 54 |
int dealWithFreqNew(int shape, int bp); |
| 55 |
|
| 56 |
public: |
| 57 |
void acquireDirect(blip_buffer_t** bb, size_t len); |
| 58 |
int dispatch(DivCommand c); |
| 59 |
void* getChanState(int chan); |
| 60 |
DivMacroInt* getChanMacroInt(int ch); |
| 61 |
DivDispatchOscBuffer* getOscBuffer(int chan); |
| 62 |
unsigned char* getRegisterPool(); |
| 63 |
int getRegisterPoolSize(); |
| 64 |
void reset(); |
| 65 |
void forceIns(); |
| 66 |
void tick(bool sysTick=true); |
| 67 |
void muteChannel(int ch, bool mute); |
| 68 |
void setFlags(const DivConfig& flags); |
| 69 |
float getPostAmp(); |
| 70 |
int getOutputCount(); |
| 71 |
bool keyOffAffectsArp(int ch); |
| 72 |
bool hasAcquireDirect(); |
| 73 |
bool getLegacyAlwaysSetVolume(); |
| 74 |
void notifyInsDeletion(void* ins); |
| 75 |
void poke(unsigned int addr, unsigned short val); |
| 76 |
void poke(std::vector<DivRegWrite>& wlist); |
| 77 |
const char** getRegisterSheet(); |
| 78 |
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); |
| 79 |
void quit(); |
| 80 |
}; |
| 81 |
#endif |