summaryrefslogtreecommitdiffstats
path: root/src/synth_gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth_gui.c')
-rw-r--r--src/synth_gui.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/synth_gui.c b/src/synth_gui.c
index 43cfda1..d1dc78e 100644
--- a/src/synth_gui.c
+++ b/src/synth_gui.c
@@ -708,17 +708,21 @@ void get_nth_entry(const char *str, int n, char *result) {
}
char *soundcards = NULL;
+char *midi_devices = NULL;
void
draw_audiomidisetup(synth_t *synth, const char *midi_devices)
{
static int edit_midi = 0;
static int edit_sound = 0;
- static int pick = 0;
+ static int midi_pick = 0;
+ static int soundcard_pick = 0;
if (synth->gui.audiomidi_initialized == 0) {
soundcards = get_soundcards();
- pick = 0;
+ midi_devices = get_midi_devices();
+ soundcard_pick = 0;
+ midi_pick = 0;
synth->gui.audiomidi_initialized = 1;
printf("================ AUDIOMIDISETUP GUI INITIALIZED!\n");
}
@@ -734,38 +738,38 @@ draw_audiomidisetup(synth_t *synth, const char *midi_devices)
if (GuiButton((Rectangle){WIDTH - 100 - 50,
50 + 24 + 6 + 24 + 6 + 24 + 6 + 24 + 6, 100, 24},
"apply")) {
- if (pick != 0) {
- get_nth_entry(soundcards, pick, synth->soundcard.name);
- printf("CHANGING TO %s\n", synth->soundcard.name);
+ if (soundcard_pick != 0) {
+ get_nth_entry(soundcards, soundcard_pick, synth->soundcard.name);
+ printf("[AUDIO] CHANGING TO %s\n", synth->soundcard.name);
change_soundcard(synth);
}
+ if (midi_pick != 0) {
+ get_nth_entry(midi_devices, midi_pick, synth->midi_device.name);
+ printf("[MIDI] CHANGING TO %s\n", synth->midi_device.name);
+ change_midi_device(synth);
+ }
synth->gui.screen = SCREEN_MAIN;
}
- // audio dev
+ // midi dev
if (GuiDropdownBox((Rectangle){WIDTH - 300 - 50,
12 + 24 + 6, 300,
24},
- soundcards, &pick, edit_sound)) {
- edit_sound = !edit_sound;
+ midi_devices, &midi_pick, edit_midi)) {
+ edit_midi = !edit_midi;
}
- /* if (old_soundcard_id != synth->soundcard_id) { */
- /* old_soundcard_id = synth->soundcard_id; */
- /* get_nth_entry(soundcards, pick, synth->soundcard_name); */
- /* } */
- // midi dev
+ // audio dev
if (GuiDropdownBox((Rectangle){WIDTH - 300 - 50,
- 12, 200,
+ 12, 300,
24},
- midi_devices, &synth->midi_device_id, edit_midi)) {
- edit_midi = !edit_midi;
+ soundcards, &soundcard_pick, edit_sound)) {
+ edit_sound = !edit_sound;
}
/* if (old_midi_device_id != synth->midi_device_id) { */
/* old_midi_device_id = synth->midi_device_id; */
- /* change_midi_device(synth); */
/* } */
@@ -778,6 +782,7 @@ draw_main(synth_t *synth)
{
if (synth->gui.audiomidi_initialized != 0) {
if (soundcards) free(soundcards);
+ if (midi_devices) free(midi_devices);
synth->gui.audiomidi_initialized = 0;
}
BeginDrawing();
@@ -891,7 +896,6 @@ rayrun(synth_t *synth){
draw_audiomidisetup(synth, midi_devices);
//----------------------------------------------------------------------------------
-
current_time = Pa_GetStreamTime(synth->stream);
//printf("%f :: %ld\n", current_time - prev_time, phase);