diff --git a/targets/mega65/configdb.c b/targets/mega65/configdb.c index a6a6f131..7743112f 100644 --- a/targets/mega65/configdb.c +++ b/targets/mega65/configdb.c @@ -86,6 +86,7 @@ static const struct xemutools_configdef_switch_st switch_options[] = { { "besure", "Skip asking \"are you sure?\" on RESET or EXIT", &i_am_sure_override }, { "skipunhandledmem", "Do not even ask on unhandled memory access (hides problems!!)", &configdb.skip_unhandled_mem }, { "fullborders", "Show non-clipped display borders", &configdb.fullborders }, + { "nosound", "Disables audio emulation", &configdb.nosound }, { NULL } }; diff --git a/targets/mega65/configdb.h b/targets/mega65/configdb.h index 65f26c5f..96785c1b 100644 --- a/targets/mega65/configdb.h +++ b/targets/mega65/configdb.h @@ -86,6 +86,7 @@ struct configdb_st { int stereoseparation; int mastervolume; double fast_mhz; + int nosound; }; extern struct configdb_st configdb; diff --git a/targets/mega65/mega65.c b/targets/mega65/mega65.c index 9be27115..4684f52e 100644 --- a/targets/mega65/mega65.c +++ b/targets/mega65/mega65.c @@ -814,7 +814,7 @@ int main ( int argc, char **argv ) } else if (configdb.autoload) c64_register_fake_typing(fake_typing_for_load65); #endif - if (audio) { + if (audio && !configdb.nosound) { DEBUGPRINT("AUDIO: start" NL); SDL_PauseAudioDevice(audio, 0); } diff --git a/xemu/sid.c b/xemu/sid.c index e0d513f2..f7eaf906 100644 --- a/xemu/sid.c +++ b/xemu/sid.c @@ -658,26 +658,25 @@ void sid_init ( struct SidEmulation *sidemu, unsigned long cyclesPerSec, unsigne // SID emulation (we only have a SID snapshot every 20ms to work with) during rendering our computing // granularity then is 'one sample' (not 'one cpu cycle' - but around 20).. instead of still trying to simulate a // 15-bit cycle-counter we may directly use a sample-counter instead (which also reduces rounding issues). - int i; #ifdef SID_USES_SAMPLE_ENV_COUNTER sidemu->limit_LFSR = round(((float)0x8000)/sidemu->cyclesPerSample); // original counter was 15-bit - for (i=0; i<16; i++) { + for (int i=0; i<16; i++) { // counter must reach respective threshold before envelope value is incremented/decremented sidemu->envelope_counter_period[i]= (int)round((float)(attackTimes[i]*cyclesPerSec)/1000/256/cyclesPerSample)+1; // in samples sidemu->envelope_counter_period_clck[i]= (int)round((float)(attackTimes[i]*cyclesPerSec)/1000/256)+1; // in clocks } #else sidemu->limit_LFSR = 0x8000; // counter 15-bit - for (i=0;i<16;i++) { + for (int i=0; i<16; i++) { // counter must reach respective threshold before envelope value is incremented/decremented sidemu->envelope_counter_period[i]= (int)floor((float)(attackTimes[i]*cyclesPerSec)/1000/256)+1; // in samples sidemu->envelope_counter_period_clck[i]= (int)floor((float)(attackTimes[i]*cyclesPerSec)/1000/256)+1; // in clocks } #endif // lookup table for decay rates - unsigned char from[] = {93, 54, 26, 14, 6, 0}; - unsigned char val[] = { 1, 2, 4, 8, 16, 30}; - for (i= 0; i<256; i++) { + static const unsigned char from[] = {93, 54, 26, 14, 6, 0}; + static const unsigned char val[] = { 1, 2, 4, 8, 16, 30}; + for (int i = 0; i<256; i++) { unsigned char v= 1; unsigned char j; for (j= 0; j<6; j++) {