mirror of
https://github.com/bradgrantham/apple2e.git
synced 2025-01-17 03:29:52 +00:00
don't enqueue new audio buffer if no audio
This commit is contained in:
parent
604bf07b4f
commit
0b1b083f6c
10
apple2e.cpp
10
apple2e.cpp
@ -2286,7 +2286,15 @@ int main(int argc, char **argv)
|
||||
MAINboard::display_write_func display = [](int addr, unsigned char data)->bool{return APPLE2Einterface::write(addr, data);};
|
||||
MAINboard::audio_flush_func audio;
|
||||
if(have_audio)
|
||||
audio = [aodev](char *buf, size_t sz){ao_play(aodev, buf, sz);};
|
||||
audio = [aodev](char *buf, size_t sz){
|
||||
static char prev_sample;
|
||||
for(int i = 0; i < sz; i++)
|
||||
if(buf[i] != prev_sample) {
|
||||
ao_play(aodev, buf, sz);
|
||||
break;
|
||||
}
|
||||
prev_sample = buf[sz - 1];
|
||||
};
|
||||
else
|
||||
audio = [](char *buf, size_t sz){};
|
||||
mainboard = new MAINboard(clk, b, display, audio);
|
||||
|
Loading…
x
Reference in New Issue
Block a user