Skip to content

Commit

Permalink
-nosound option to disable audio #277
Browse files Browse the repository at this point in the history
  • Loading branch information
lgblgblgb committed Jun 9, 2021
1 parent 1bf15d3 commit 6a203af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions targets/mega65/configdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};

Expand Down
1 change: 1 addition & 0 deletions targets/mega65/configdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct configdb_st {
int stereoseparation;
int mastervolume;
double fast_mhz;
int nosound;
};

extern struct configdb_st configdb;
Expand Down
2 changes: 1 addition & 1 deletion targets/mega65/mega65.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 5 additions & 6 deletions xemu/sid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

1 comment on commit 6a203af

@lgblgblgb
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log at #29 too

Please sign in to comment.