More client-side sound implementation (not done yet)

This commit is contained in:
simon.kagstrom 2009-11-06 06:18:22 +00:00
parent 4a7efdbb68
commit e65c29ed4c
4 changed files with 8 additions and 4 deletions

View File

@ -327,7 +327,8 @@ void MOS6510::write_byte_io(uint16 adr, uint8 byte)
case 0x5: case 0x5:
case 0x6: case 0x6:
case 0x7: case 0x7:
TheSID->WriteRegister(adr & 0x1f, byte); if (this->network_connection_type != CLIENT)
TheSID->WriteRegister(adr & 0x1f, byte);
return; return;
case 0x8: // Color RAM case 0x8: // Color RAM
case 0x9: case 0x9:

View File

@ -427,8 +427,6 @@ void Network::FlushSound(void)
struct NetworkUpdateSound *snd = (NetworkUpdateSound *)dst->data; struct NetworkUpdateSound *snd = (NetworkUpdateSound *)dst->data;
struct NetworkUpdateSoundInfo *snd_info = snd->info; struct NetworkUpdateSoundInfo *snd_info = snd->info;
if (SDL_GetTicks() - this->sound_last_send < 125)
return;
snd->flags = 0; snd->flags = 0;
snd->n_items = this->sound_head - this->sound_tail; snd->n_items = this->sound_head - this->sound_tail;

View File

@ -445,6 +445,7 @@ private:
#if defined(__linux__) || defined(GEKKO) #if defined(__linux__) || defined(GEKKO)
int devfd, sndbufsize, buffer_rate; int devfd, sndbufsize, buffer_rate;
int16 *sound_buffer; int16 *sound_buffer;
uint32 linecnt;
#endif #endif
#ifdef SUN #ifdef SUN

View File

@ -47,6 +47,7 @@ void DigitalRenderer::init_sound(void)
int arg; int arg;
unsigned long format; unsigned long format;
linecnt = 0;
ready = false; ready = false;
devfd = open("/dev/dsp", O_WRONLY); devfd = open("/dev/dsp", O_WRONLY);
if (devfd < 0) if (devfd < 0)
@ -144,9 +145,12 @@ void DigitalRenderer::EmulateLine(void)
{ {
if (!ready) if (!ready)
return; 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(); TheC64->peer->FlushSound();
this->PushVolume(volume); this->PushVolume(volume);
this->linecnt++;
} }