From e65c29ed4c0bc4f22b74c555a83d47d389b9ed6a Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Fri, 6 Nov 2009 06:18:22 +0000 Subject: [PATCH] More client-side sound implementation (not done yet) --- Src/CPUC64.cpp | 3 ++- Src/Network.cpp | 2 -- Src/SID.cpp | 1 + Src/SID_linux.h | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Src/CPUC64.cpp b/Src/CPUC64.cpp index b6b3bb4..8a83ae0 100644 --- a/Src/CPUC64.cpp +++ b/Src/CPUC64.cpp @@ -327,7 +327,8 @@ void MOS6510::write_byte_io(uint16 adr, uint8 byte) case 0x5: case 0x6: case 0x7: - TheSID->WriteRegister(adr & 0x1f, byte); + if (this->network_connection_type != CLIENT) + TheSID->WriteRegister(adr & 0x1f, byte); return; case 0x8: // Color RAM case 0x9: diff --git a/Src/Network.cpp b/Src/Network.cpp index 0f9aaa7..3a560aa 100644 --- a/Src/Network.cpp +++ b/Src/Network.cpp @@ -427,8 +427,6 @@ void Network::FlushSound(void) struct NetworkUpdateSound *snd = (NetworkUpdateSound *)dst->data; struct NetworkUpdateSoundInfo *snd_info = snd->info; - if (SDL_GetTicks() - this->sound_last_send < 125) - return; snd->flags = 0; snd->n_items = this->sound_head - this->sound_tail; diff --git a/Src/SID.cpp b/Src/SID.cpp index bfd8326..5c159a5 100644 --- a/Src/SID.cpp +++ b/Src/SID.cpp @@ -445,6 +445,7 @@ private: #if defined(__linux__) || defined(GEKKO) int devfd, sndbufsize, buffer_rate; int16 *sound_buffer; + uint32 linecnt; #endif #ifdef SUN diff --git a/Src/SID_linux.h b/Src/SID_linux.h index a4c57b7..2719179 100644 --- a/Src/SID_linux.h +++ b/Src/SID_linux.h @@ -47,6 +47,7 @@ void DigitalRenderer::init_sound(void) int arg; unsigned long format; + linecnt = 0; ready = false; devfd = open("/dev/dsp", O_WRONLY); if (devfd < 0) @@ -144,9 +145,12 @@ void DigitalRenderer::EmulateLine(void) { if (!ready) return; - if (TheC64->network_connection_type == MASTER) + /* Flush network sound every ~100ms */ + if (TheC64->network_connection_type == MASTER && + this->linecnt % 2048 == 0) TheC64->peer->FlushSound(); this->PushVolume(volume); + this->linecnt++; }