Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1796:51417bb557b6
Configurable gain for overall output and individual components
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 23 Mar 2019 17:18:10 -0700 |
parents | a29f35c47da4 |
children | 5278b6e44fc1 |
comparison
equal
deleted
inserted
replaced
1795:a02b4ed940b6 | 1796:51417bb557b6 |
---|---|
1436 config_dirty = 1; | 1436 config_dirty = 1; |
1437 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(buffer)}, TVAL_PTR); | 1437 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(buffer)}, TVAL_PTR); |
1438 } | 1438 } |
1439 } | 1439 } |
1440 | 1440 |
1441 void settings_float_property(struct nk_context *context, char *label, char *name, char *path, float def, float min, float max, float step) | |
1442 { | |
1443 char *curstr = tern_find_path(config, path, TVAL_PTR).ptrval; | |
1444 float curval = curstr ? atof(curstr) : def; | |
1445 nk_label(context, label, NK_TEXT_LEFT); | |
1446 float val = curval; | |
1447 nk_property_float(context, name, min, &val, max, step, step); | |
1448 if (val != curval) { | |
1449 char buffer[64]; | |
1450 sprintf(buffer, "%f", val); | |
1451 config_dirty = 1; | |
1452 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(buffer)}, TVAL_PTR); | |
1453 } | |
1454 } | |
1455 | |
1441 typedef struct { | 1456 typedef struct { |
1442 char *fragment; | 1457 char *fragment; |
1443 char *vertex; | 1458 char *vertex; |
1444 } shader_prog; | 1459 } shader_prog; |
1445 | 1460 |
1670 if (nk_begin(context, "Audio Settings", nk_rect(0, 0, width, height), 0)) { | 1685 if (nk_begin(context, "Audio Settings", nk_rect(0, 0, width, height), 0)) { |
1671 nk_layout_row_static(context, context->style.font->height , desired_width, 2); | 1686 nk_layout_row_static(context, context->style.font->height , desired_width, 2); |
1672 selected_rate = settings_dropdown(context, "Rate in Hz", rates, num_rates, selected_rate, "audio\0rate\0"); | 1687 selected_rate = settings_dropdown(context, "Rate in Hz", rates, num_rates, selected_rate, "audio\0rate\0"); |
1673 selected_size = settings_dropdown(context, "Buffer Samples", sizes, num_sizes, selected_size, "audio\0buffer\0"); | 1688 selected_size = settings_dropdown(context, "Buffer Samples", sizes, num_sizes, selected_size, "audio\0buffer\0"); |
1674 settings_int_input(context, "Lowpass Cutoff Hz", "audio\0lowpass_cutoff\0", "3390"); | 1689 settings_int_input(context, "Lowpass Cutoff Hz", "audio\0lowpass_cutoff\0", "3390"); |
1690 settings_float_property(context, "Gain", "Overall", "audio\0gain\0", 0, -30.0f, 30.0f, 0.5f); | |
1691 settings_float_property(context, "", "FM", "audio\0fm_gain\0", 0, -30.0f, 30.0f, 0.5f); | |
1692 settings_float_property(context, "", "PSG", "audio\0psg_gain\0", 0, -30.0f, 30.0f, 0.5f); | |
1675 if (nk_button_label(context, "Back")) { | 1693 if (nk_button_label(context, "Back")) { |
1676 pop_view(); | 1694 pop_view(); |
1677 } | 1695 } |
1678 nk_end(context); | 1696 nk_end(context); |
1679 } | 1697 } |