From b0fc800853d9775c98849016655068c1ec7d14e1 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jancsika@yahoo.com> Date: Tue, 21 Apr 2015 01:57:27 -0400 Subject: [PATCH] added audio api dropdown --- pd/nw/dialog_prefs.html | 16 +++++++++++++++- pd/nw/pdgui.js | 7 +++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html index 6601cae44..c4a811e04 100644 --- a/pd/nw/dialog_prefs.html +++ b/pd/nw/dialog_prefs.html @@ -23,6 +23,8 @@ <fieldset id="audio"> <legend data-i18n="prefs.heading.audio"></legend> + <select id="audio_api"> + </select> Audio stuff </fieldset> @@ -311,9 +313,21 @@ pdgui.gui_post("guistub is " + gfxstub); } } + function populate_audio_apis(apis) { + var i, opt, api_select = document.getElementById('audio_api'); + pdgui.gui_post('apis are ' + apis); + for (i = 0; i < apis.length; i += 2) { + opt = document.createElement('option'); + opt.textContent = apis[i]; + opt.setAttribute('value', apis[i+1]); + api_select.appendChild(opt); + } + } + function audio_prefs_callback(attrs) { - pdgui.gui_post("audio attrs are " + attrs); + pdgui.gui_post("audio attrs FUCK " + attrs); pdgui.gui_post("attrs length " + attrs.length); + populate_audio_apis(attrs[attrs.indexOf('audio_apis') + 1]); } function midi_prefs_callback(attrs) { diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 75680fd19..9b0c460ec 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3273,8 +3273,11 @@ function gui_pd_dsp(state) { } function open_prefs() { - dialogwin['prefs'] = nw_create_window('prefs', 'prefs', 265, 540, 20, 20, 0, - 0, 1, 'white', 'Properties', '', 0, null, null); + if (!dialogwin['prefs']) { + dialogwin['prefs'] = nw_create_window('prefs', 'prefs', + 265, 540, 20, 20, 0, + 0, 1, 'white', 'Properties', '', 0, null, null); + } } exports.open_prefs = open_prefs; -- GitLab