Move network-related sound stuff to common code (so that it will work

on all platforms)
This commit is contained in:
simon.kagstrom 2009-11-07 14:13:21 +00:00
parent 32a405739b
commit ecec8b6134
3 changed files with 31 additions and 34 deletions

View File

@ -912,6 +912,35 @@ void DigitalRenderer::Reset(void)
#include "C64.h" #include "C64.h"
extern C64 *TheC64; extern C64 *TheC64;
/*
* Fill buffer (for Unix sound routines), sample volume (for sampled voice)
*/
void MOS6581::EmulateLine(void)
{
if (the_renderer != NULL)
the_renderer->EmulateLine();
/* Flush network sound every ~100ms */
if (TheC64->network_connection_type == CLIENT)
{
static NetworkUpdateSoundInfo *cur = NULL;
if (!cur) {
cur = TheC64->peer->DequeueSound();
}
while (cur) {
if (cur->delay_cycles > 0)
cur->delay_cycles--;
if (cur->delay_cycles != 0)
break;
/* Delayed long enough - write to the SID! */
this->WriteRegister(cur->adr, cur->val);
cur = TheC64->peer->DequeueSound();
}
}
TheC64->linecnt++;
}
void DigitalRenderer::WriteRegister(uint16 adr, uint8 byte) void DigitalRenderer::WriteRegister(uint16 adr, uint8 byte)
{ {

View File

@ -113,17 +113,6 @@ struct MOS6581State {
}; };
/*
* Fill buffer (for Unix sound routines), sample volume (for sampled voice)
*/
inline void MOS6581::EmulateLine(void)
{
if (the_renderer != NULL)
the_renderer->EmulateLine();
}
inline void MOS6581::PushVolume(uint8 vol) inline void MOS6581::PushVolume(uint8 vol)
{ {
if (the_renderer != NULL) if (the_renderer != NULL)

View File

@ -142,30 +142,9 @@ void DigitalRenderer::PushVolume(uint8 vol)
void DigitalRenderer::EmulateLine(void) void DigitalRenderer::EmulateLine(void)
{ {
// if (!ready) if (!ready)
//return; return;
/* Flush network sound every ~100ms */
if (TheC64->network_connection_type == CLIENT)
{
static NetworkUpdateSoundInfo *cur = NULL;
if (!cur) {
cur = TheC64->peer->DequeueSound();
}
while (cur) {
if (cur->delay_cycles > 0)
cur->delay_cycles--;
if (cur->delay_cycles != 0)
break;
/* Delayed long enough - write to the SID! */
printf("Writing %02x:%02x\n", cur->adr, cur->val);
this->WriteRegister(cur->adr, cur->val);
cur = TheC64->peer->DequeueSound();
}
}
this->PushVolume(volume); this->PushVolume(volume);
TheC64->linecnt++;
} }