PCE: half working channel osc

it doesn't look right
This commit is contained in:
tildearrow 2025-03-04 12:37:31 -05:00
parent 11c99f9f96
commit ac8df480ab
3 changed files with 13 additions and 5 deletions

View file

@ -60,6 +60,7 @@ void DivPlatformPCE::acquire(short** buf, size_t len) {
void DivPlatformPCE::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
for (int i=0; i<6; i++) {
oscBuf[i]->begin(len);
pce->channel[i].oscBuf=oscBuf[i];
}
pce->bb[0]=bb[0];
@ -130,10 +131,6 @@ void DivPlatformPCE::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
writes.pop();
}
/*
for (int i=0; i<6; i++) {
oscBuf[i]->putSample(h,CLAMP(pce->channel[i].blip_prev_samp[0]+pce->channel[i].blip_prev_samp[1],-32768,32767));
}*/
h+=advance;
}
pce->Update(pos);

View file

@ -78,6 +78,8 @@ inline void PCE_PSG::UpdateOutputSub(const int32_t timestamp, psg_channel *ch, c
if (delta[0]) blip_add_delta(bb[0],timestamp,delta[0]);
if (delta[1]) blip_add_delta(bb[1],timestamp,delta[1]);
ch->oscBuf->putSample(timestamp-ch->lasttsbase,CLAMP(samp0+samp1,-32768,32767));
ch->blip_prev_samp[0] = samp0;
ch->blip_prev_samp[1] = samp1;
@ -407,11 +409,13 @@ PCE_PSG::PCE_PSG(int want_revision)
bb[1]=NULL;
lastts = 0;
lasttsbase = 0;
for(int ch = 0; ch < 6; ch++)
{
channel[ch].blip_prev_samp[0] = 0;
channel[ch].blip_prev_samp[1] = 0;
channel[ch].lastts = 0;
channel[ch].lasttsbase = 0;
}
SetVolume(1.0); // Will build dbtable in the process.
@ -749,9 +753,12 @@ void PCE_PSG::Update(int32_t timestamp)
void PCE_PSG::ResetTS(int32_t ts_base)
{
lastts = ts_base;
lasttsbase = ts_base;
for(int chc = 0; chc < 6; chc++)
for(int chc = 0; chc < 6; chc++) {
channel[chc].lastts = ts_base;
channel[chc].lasttsbase = ts_base;
}
}
void PCE_PSG::Power(const int32_t timestamp)

View file

@ -25,6 +25,7 @@
#include <stdint.h>
#include "../../blip_buf.h"
#include "../../dispatch.h"
class PCE_PSG;
@ -41,6 +42,7 @@ struct psg_channel
int32_t counter;
void (PCE_PSG::*UpdateOutput)(const int32_t timestamp, psg_channel *ch);
DivDispatchOscBuffer* oscBuf;
uint32_t freq_cache;
uint32_t noise_freq_cache; // Channel 4,5 only
@ -50,6 +52,7 @@ struct psg_channel
int32_t samp_accum; // The result of adding up all the samples in the waveform buffer(part of an optimization for high-frequency playback).
int32_t blip_prev_samp[2];
int32_t lastts;
int32_t lasttsbase;
uint16_t frequency; /* Channel frequency */
uint8_t balance; /* Channel balance */
@ -184,6 +187,7 @@ class PCE_PSG
bool vol_pending;
int32_t lastts;
int32_t lasttsbase;
int revision;
int32_t dbtable_volonly[32];