# HG changeset patch # User Michael Pavone # Date 1736666496 28800 # Node ID 6f1eebc0a90bf1c1924deb59623d24f5cbd90985 # Parent 78e1769efcdb0b424450b39136c17361bc5a3db9 Add auto option for fm_dac config variable that bases zero offset on the select MD model diff -r 78e1769efcdb -r 6f1eebc0a90b genesis.c --- a/genesis.c Sat Jan 11 23:03:24 2025 -0800 +++ b/genesis.c Sat Jan 11 23:21:36 2025 -0800 @@ -2448,8 +2448,14 @@ config_gain = tern_find_path(config, "audio\0fm_gain\0", TVAL_PTR).ptrval; render_audio_source_gaindb(gen->ym->audio, config_gain ? atof(config_gain) : 0.0f); - char *config_dac = tern_find_path_default(config, "audio\0fm_dac\0", (tern_val){.ptrval="zero_offset"}, TVAL_PTR).ptrval; - ym_enable_zero_offset(gen->ym, !strcmp(config_dac, "zero_offset")); + char *config_dac = tern_find_path_default(config, "audio\0fm_dac\0", (tern_val){.ptrval="auto"}, TVAL_PTR).ptrval; + uint8_t zero_offset = 0; + if (!strcmp(config_dac, "auto")) { + zero_offset = gen->ym->status_address_mask != 0; + } else if (!strcmp(config_dac, "zero_offset")) { + zero_offset = 1; + } + ym_enable_zero_offset(gen->ym, zero_offset); } if (gen->expansion) { diff -r 78e1769efcdb -r 6f1eebc0a90b nuklear_ui/blastem_nuklear.c --- a/nuklear_ui/blastem_nuklear.c Sat Jan 11 23:03:24 2025 -0800 +++ b/nuklear_ui/blastem_nuklear.c Sat Jan 11 23:21:36 2025 -0800 @@ -2113,10 +2113,12 @@ "64" }; const char *dac[] = { + "auto", "zero_offset", "linear" }; const char *dac_desc[] = { + "Default for Model", "Zero Offset", "Linear" }; @@ -2129,7 +2131,7 @@ if (selected_rate < 0 || selected_size < 0 || selected_dac < 0) { selected_rate = find_match(rates, num_rates, "audio\0rate\0", "48000"); selected_size = find_match(sizes, num_sizes, "audio\0buffer\0", "512"); - selected_dac = find_match(dac, num_dacs, "audio\0fm_dac\0", "zero_offset"); + selected_dac = find_match(dac, num_dacs, "audio\0fm_dac\0", "auto"); } uint32_t width = render_width(); uint32_t height = render_height();