mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-03 09:47:26 +00:00
VIC-20: add an option to disable filters
This commit is contained in:
parent
9fbb7df674
commit
665b722f31
5 changed files with 36 additions and 6 deletions
|
@ -92,6 +92,7 @@ int vic_sound_machine_calculate_samples(sound_vic20_t *snd, int16_t *pbuf, int n
|
||||||
int s = 0;
|
int s = 0;
|
||||||
int i;
|
int i;
|
||||||
float o;
|
float o;
|
||||||
|
float v;
|
||||||
int16_t vicbuf;
|
int16_t vicbuf;
|
||||||
int samples_to_do;
|
int samples_to_do;
|
||||||
|
|
||||||
|
@ -100,9 +101,14 @@ int vic_sound_machine_calculate_samples(sound_vic20_t *snd, int16_t *pbuf, int n
|
||||||
snd->leftover_cycles += samples_to_do - snd->cycles_per_sample;
|
snd->leftover_cycles += samples_to_do - snd->cycles_per_sample;
|
||||||
vic_sound_clock(snd, samples_to_do);
|
vic_sound_clock(snd, samples_to_do);
|
||||||
|
|
||||||
|
v = voltagefunction[(((snd->accum * 7) / snd->accum_cycles) + 1) * snd->volume];
|
||||||
|
if (snd->filter_off) {
|
||||||
|
o = v;
|
||||||
|
} else {
|
||||||
o = snd->lowpassbuf - snd->highpassbuf;
|
o = snd->lowpassbuf - snd->highpassbuf;
|
||||||
snd->highpassbuf += snd->highpassbeta * (snd->lowpassbuf - snd->highpassbuf);
|
snd->highpassbuf += snd->highpassbeta * (snd->lowpassbuf - snd->highpassbuf);
|
||||||
snd->lowpassbuf += snd->lowpassbeta * (voltagefunction[(((snd->accum * 7) / snd->accum_cycles) + 1) * snd->volume] - snd->lowpassbuf);
|
snd->lowpassbuf += snd->lowpassbeta * (v - snd->lowpassbuf);
|
||||||
|
}
|
||||||
|
|
||||||
if (o < -32768) {
|
if (o < -32768) {
|
||||||
vicbuf = -32768;
|
vicbuf = -32768;
|
||||||
|
@ -202,7 +208,7 @@ void vic_sound_machine_store(sound_vic20_t *snd, uint16_t addr, uint8_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int vic_sound_machine_init(sound_vic20_t *snd, int speed, int cycles_per_sec)
|
int vic_sound_machine_init(sound_vic20_t *snd, int speed, int cycles_per_sec, bool filter_off)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
float dt;
|
float dt;
|
||||||
|
@ -214,6 +220,7 @@ int vic_sound_machine_init(sound_vic20_t *snd, int speed, int cycles_per_sec)
|
||||||
|
|
||||||
snd->lowpassbuf = 0.0f;
|
snd->lowpassbuf = 0.0f;
|
||||||
snd->highpassbuf = 0.0f;
|
snd->highpassbuf = 0.0f;
|
||||||
|
snd->filter_off = filter_off;
|
||||||
|
|
||||||
snd->speed = speed;
|
snd->speed = speed;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct sound_vic20_s {
|
struct sound_vic20_s {
|
||||||
unsigned char div;
|
unsigned char div;
|
||||||
|
@ -56,13 +57,14 @@ struct sound_vic20_s {
|
||||||
float highpassbeta;
|
float highpassbeta;
|
||||||
float lowpassbuf;
|
float lowpassbuf;
|
||||||
float lowpassbeta;
|
float lowpassbeta;
|
||||||
|
bool filter_off;
|
||||||
|
|
||||||
uint16_t noise_LFSR;
|
uint16_t noise_LFSR;
|
||||||
uint8_t noise_LFSR0_old;
|
uint8_t noise_LFSR0_old;
|
||||||
};
|
};
|
||||||
typedef struct sound_vic20_s sound_vic20_t;
|
typedef struct sound_vic20_s sound_vic20_t;
|
||||||
|
|
||||||
int vic_sound_machine_init(sound_vic20_t *snd, int speed, int cycles_per_sec);
|
int vic_sound_machine_init(sound_vic20_t *snd, int speed, int cycles_per_sec, bool filter_off);
|
||||||
void vic_sound_machine_store(sound_vic20_t *snd, uint16_t addr, uint8_t value);
|
void vic_sound_machine_store(sound_vic20_t *snd, uint16_t addr, uint8_t value);
|
||||||
int vic_sound_machine_calculate_samples(sound_vic20_t *snd, int16_t *pbuf, int nr, int soc, int scc, uint32_t delta_t);
|
int vic_sound_machine_calculate_samples(sound_vic20_t *snd, int16_t *pbuf, int nr, int soc, int scc, uint32_t delta_t);
|
||||||
void vic_sound_clock(sound_vic20_t *snd, uint32_t cycles);
|
void vic_sound_clock(sound_vic20_t *snd, uint32_t cycles);
|
||||||
|
|
|
@ -317,7 +317,7 @@ void DivPlatformVIC20::reset() {
|
||||||
chan[i]=Channel();
|
chan[i]=Channel();
|
||||||
chan[i].std.setEngine(parent);
|
chan[i].std.setEngine(parent);
|
||||||
}
|
}
|
||||||
vic_sound_machine_init(vic,rate,chipClock);
|
vic_sound_machine_init(vic,rate,chipClock,filterOff);
|
||||||
hasWaveWrite=false;
|
hasWaveWrite=false;
|
||||||
rWrite(14,15);
|
rWrite(14,15);
|
||||||
// hack: starting noise channel right away after this would result in a dead
|
// hack: starting noise channel right away after this would result in a dead
|
||||||
|
@ -336,6 +336,7 @@ void DivPlatformVIC20::notifyInsDeletion(void* ins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformVIC20::setFlags(const DivConfig& flags) {
|
void DivPlatformVIC20::setFlags(const DivConfig& flags) {
|
||||||
|
filterOff=flags.getBool("filterOff",false);
|
||||||
if (flags.getInt("clockSel",0)) {
|
if (flags.getInt("clockSel",0)) {
|
||||||
chipClock=COLOR_PAL/4.0;
|
chipClock=COLOR_PAL/4.0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,6 +37,7 @@ class DivPlatformVIC20: public DivDispatch {
|
||||||
DivDispatchOscBuffer* oscBuf[4];
|
DivDispatchOscBuffer* oscBuf[4];
|
||||||
bool isMuted[4];
|
bool isMuted[4];
|
||||||
bool hasWaveWrite;
|
bool hasWaveWrite;
|
||||||
|
bool filterOff;
|
||||||
|
|
||||||
unsigned char regPool[16];
|
unsigned char regPool[16];
|
||||||
sound_vic20_t* vic;
|
sound_vic20_t* vic;
|
||||||
|
|
|
@ -2612,6 +2612,25 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_SYSTEM_VIC20: {
|
||||||
|
bool sysPal=flags.getInt("clockSel",0);
|
||||||
|
bool filterOff=flags.getBool("filterOff",false);
|
||||||
|
|
||||||
|
if (ImGui::Checkbox(_("PAL"),&sysPal)) {
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
if (ImGui::Checkbox(_("Disable filtering"),&filterOff)) {
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (altered) {
|
||||||
|
e->lockSave([&]() {
|
||||||
|
flags.set("clockSel",(int)sysPal);
|
||||||
|
flags.set("filterOff",filterOff);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case DIV_SYSTEM_SWAN:
|
case DIV_SYSTEM_SWAN:
|
||||||
case DIV_SYSTEM_BUBSYS_WSG:
|
case DIV_SYSTEM_BUBSYS_WSG:
|
||||||
case DIV_SYSTEM_PET:
|
case DIV_SYSTEM_PET:
|
||||||
|
|
Loading…
Reference in a new issue