diff --git a/HISTORY.md b/HISTORY.md index bdf8fb5c..99463ab1 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -54,6 +54,7 @@ * new "text costumes" library for generating costumes from letters or words of text * took out "b block" costume from catalog * added microphone "resolution" concept governing "bins" (buffer / bin sizes) +* added microphone "resolution" settings to GUI ### 2019-03-10 * Objects, Blocks, Threads: added microphone note and pitch detection diff --git a/snap.html b/snap.html index 0981b360..fd98040e 100755 --- a/snap.html +++ b/snap.html @@ -9,7 +9,7 @@ - + diff --git a/src/gui.js b/src/gui.js index 14441630..a442a6e2 100644 --- a/src/gui.js +++ b/src/gui.js @@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2019-March-06'; +modules.gui = '2019-March-11'; // Declarations @@ -2773,12 +2773,10 @@ IDE_Morph.prototype.settingsMenu = function () { new Color(100, 0, 0) ); } - if (stage.microphone.isReady) { - menu.addItem( - '\u2611 ' + localize('Microphone'), - function () {stage.microphone.stop(); } - ); - } + menu.addItem( + 'Microphone resolution...', + 'microphoneMenu' + ); menu.addLine(); /* addPreference( @@ -5123,6 +5121,34 @@ IDE_Morph.prototype.saveProjectsBrowser = function () { new ProjectDialogMorph(this, 'save').popUp(); }; +// IDE_Morph microphone settings + +IDE_Morph.prototype.microphoneMenu = function () { + var menu = new MenuMorph(this), + world = this.world(), + pos = this.controlBar.settingsButton.bottomLeft(), + resolutions = ['low', 'normal', 'high', 'max'], + microphone = this.stage.microphone; + + if (microphone.isReady) { + menu.addItem( + '\u2611 ' + localize('Microphone on'), + function () {microphone.stop(); } + ); + menu.addLine(); + } + resolutions.forEach(function (res, i) { + menu.addItem( + (microphone.resolution === i + 1 ? '\u2713 ' : ' ') + + res, + function () { + microphone.setResolution(i + 1); + } + ); + }); + menu.popup(world, pos); +}; + // IDE_Morph localization IDE_Morph.prototype.languageMenu = function () {