diff --git a/Src/C64_SDL.h b/Src/C64_SDL.h index eade45c..85557d5 100644 --- a/Src/C64_SDL.h +++ b/Src/C64_SDL.h @@ -536,6 +536,7 @@ void C64::network_vblank() * if this is the master or not) */ if (this->network_connection_type == MASTER) { + remote->FlushSound(); /* Skip this frame if the data rate is too high */ if (remote->ThrottleTraffic()) has_throttled = true; diff --git a/Src/Network.cpp b/Src/Network.cpp index fcb6962..ef7cb45 100644 --- a/Src/Network.cpp +++ b/Src/Network.cpp @@ -415,7 +415,7 @@ void Network::EnqueueSound(uint32 linecnt_diff, uint8 adr, uint8 val) this->sound_head = 0; /* Head has reached tail */ - if (this->sound_head >= this->sound_tail) + if (this->sound_head == this->sound_tail) this->sound_tail = (this->sound_head + 1) % NETWORK_SOUND_BUF_SIZE; } @@ -453,11 +453,9 @@ void Network::FlushSound(void) } this->sound_tail = (this->sound_tail + snd->n_items) % NETWORK_SOUND_BUF_SIZE; - /* Reset the buffer again */ - printf("Flushing sound (%d bytes in %d ms)\n", bytes, SDL_GetTicks() - this->sound_last_send); this->sound_last_send = SDL_GetTicks(); - InitNetworkUpdate(dst, SOUND_UPDATE, + InitNetworkUpdate(dst, SOUND_UPDATE, sizeof(NetworkUpdate) + sizeof(NetworkUpdateSound) + sizeof(NetworkUpdateSoundInfo) * snd->n_items); this->AddNetworkUpdate(dst); @@ -811,7 +809,7 @@ bool Network::DeMarshalData(NetworkUpdate *p) cur->delay_cycles = ntohs(cur->delay_cycles); } - } + } break; default: /* Unknown data... */ printf("Got unknown data: %d\n", p->type); diff --git a/Src/SID_linux.h b/Src/SID_linux.h index 6cfff69..99765c3 100644 --- a/Src/SID_linux.h +++ b/Src/SID_linux.h @@ -146,10 +146,7 @@ void DigitalRenderer::EmulateLine(void) if (!ready) return; /* Flush network sound every ~100ms */ - if (TheC64->network_connection_type == MASTER && - this->linecnt % 2048 == 0) - TheC64->peer->FlushSound(); - else if (TheC64->network_connection_type == CLIENT) + if (TheC64->network_connection_type == CLIENT) { static NetworkUpdateSoundInfo *cur = NULL;