mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 15:03:01 +00:00
Namco WSG: per-channel oscilloscope
This commit is contained in:
parent
57fab16269
commit
ee709b85c2
3 changed files with 16 additions and 9 deletions
|
@ -164,9 +164,6 @@ const char* DivPlatformNamcoWSG::getEffectName(unsigned char effect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
short* buf[2]={
|
|
||||||
bufL+start, bufR+start
|
|
||||||
};
|
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
switch (devType) {
|
switch (devType) {
|
||||||
|
@ -186,7 +183,15 @@ void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
regPool[w.addr&0x3f]=w.val;
|
regPool[w.addr&0x3f]=w.val;
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
namco->sound_stream_update(buf,len);
|
for (size_t h=start; h<start+len; h++) {
|
||||||
|
short* buf[2]={
|
||||||
|
bufL+h, bufR+h
|
||||||
|
};
|
||||||
|
namco->sound_stream_update(buf,1);
|
||||||
|
for (int i=0; i<chans; i++) {
|
||||||
|
oscBuf[i]->data[oscBuf[i]->needle++]=namco->m_channel_list[i].last_out*chans;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::updateWave(int ch) {
|
void DivPlatformNamcoWSG::updateWave(int ch) {
|
||||||
|
|
|
@ -172,10 +172,11 @@ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase)
|
||||||
|
|
||||||
|
|
||||||
/* generate sound by oversampling */
|
/* generate sound by oversampling */
|
||||||
uint32_t namco_audio_device::namco_update_one(short* buffer, int size, const int16_t *wave, uint32_t counter, uint32_t freq)
|
uint32_t namco_audio_device::namco_update_one(short* buffer, int size, const int16_t *wave, uint32_t counter, uint32_t freq, int16_t& last_out)
|
||||||
{
|
{
|
||||||
for (int sampindex = 0; sampindex < size; sampindex++)
|
for (int sampindex = 0; sampindex < size; sampindex++)
|
||||||
{
|
{
|
||||||
|
last_out=wave[WAVEFORM_POSITION(counter)];
|
||||||
buffer[sampindex]+=wave[WAVEFORM_POSITION(counter)];
|
buffer[sampindex]+=wave[WAVEFORM_POSITION(counter)];
|
||||||
counter += freq;
|
counter += freq;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +701,7 @@ void namco_audio_device::sound_stream_update(short** outputs, int len)
|
||||||
const int16_t *lw = &m_waveform[lv][voice->waveform_select * 32];
|
const int16_t *lw = &m_waveform[lv][voice->waveform_select * 32];
|
||||||
|
|
||||||
/* generate sound into the buffer */
|
/* generate sound into the buffer */
|
||||||
c = namco_update_one(lmix, len, lw, voice->counter, voice->frequency);
|
c = namco_update_one(lmix, len, lw, voice->counter, voice->frequency, voice->last_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only update if we have non-zero right volume */
|
/* only update if we have non-zero right volume */
|
||||||
|
@ -709,7 +710,7 @@ void namco_audio_device::sound_stream_update(short** outputs, int len)
|
||||||
const int16_t *rw = &m_waveform[rv][voice->waveform_select * 32];
|
const int16_t *rw = &m_waveform[rv][voice->waveform_select * 32];
|
||||||
|
|
||||||
/* generate sound into the buffer */
|
/* generate sound into the buffer */
|
||||||
c = namco_update_one(rmix, len, rw, voice->counter, voice->frequency);
|
c = namco_update_one(rmix, len, rw, voice->counter, voice->frequency, voice->last_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update the counter for this voice */
|
/* update the counter for this voice */
|
||||||
|
@ -789,7 +790,7 @@ void namco_audio_device::sound_stream_update(short** outputs, int len)
|
||||||
const int16_t *w = &m_waveform[v][voice->waveform_select * 32];
|
const int16_t *w = &m_waveform[v][voice->waveform_select * 32];
|
||||||
|
|
||||||
/* generate sound into buffer and update the counter for this voice */
|
/* generate sound into buffer and update the counter for this voice */
|
||||||
voice->counter = namco_update_one(buffer, len, w, voice->counter, voice->frequency);
|
voice->counter = namco_update_one(buffer, len, w, voice->counter, voice->frequency, voice->last_out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
uint32_t noise_counter;
|
uint32_t noise_counter;
|
||||||
int32_t noise_hold;
|
int32_t noise_hold;
|
||||||
int32_t waveform_select;
|
int32_t waveform_select;
|
||||||
|
int16_t last_out;
|
||||||
};
|
};
|
||||||
|
|
||||||
namco_audio_device(uint32_t clock);
|
namco_audio_device(uint32_t clock);
|
||||||
|
@ -43,7 +44,7 @@ public:
|
||||||
|
|
||||||
void build_decoded_waveform( uint8_t *rgnbase );
|
void build_decoded_waveform( uint8_t *rgnbase );
|
||||||
void update_namco_waveform(int offset, uint8_t data);
|
void update_namco_waveform(int offset, uint8_t data);
|
||||||
uint32_t namco_update_one(short* buffer, int size, const int16_t *wave, uint32_t counter, uint32_t freq);
|
uint32_t namco_update_one(short* buffer, int size, const int16_t *wave, uint32_t counter, uint32_t freq, int16_t& last_out);
|
||||||
|
|
||||||
/* waveform region */
|
/* waveform region */
|
||||||
uint8_t* m_wave_ptr;
|
uint8_t* m_wave_ptr;
|
||||||
|
|
Loading…
Reference in a new issue