mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 03:53:07 +00:00
parent
62568bd4ac
commit
3aa76d19c8
15 changed files with 39 additions and 17 deletions
|
@ -22,6 +22,29 @@ GUI.StartButton.prototype.buttonClicked = function(){
|
|||
this.callback();
|
||||
};
|
||||
|
||||
/**
|
||||
* a start button for mobile browsers which require a touchstart event
|
||||
* to start the audio
|
||||
*/
|
||||
GUI.MobileStart = function(callback){
|
||||
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
|
||||
this.element = $("<div>", {"class" : "StartButton"})
|
||||
.appendTo("#Container");
|
||||
this.button = $("<button>")
|
||||
.button({label: "\u25B6"})
|
||||
.click(this.buttonClicked.bind(this))
|
||||
.appendTo(this.element);
|
||||
this.callback = callback;
|
||||
}
|
||||
};
|
||||
|
||||
GUI.MobileStart.prototype.buttonClicked = function(){
|
||||
this.element.fadeTo(500, 0, function(){
|
||||
$(this).remove();
|
||||
});
|
||||
this.callback();
|
||||
};
|
||||
|
||||
/**
|
||||
* Tone.Envelope GUI
|
||||
* @param {jQuery} container the jQuery object to put the gui in
|
||||
|
|
|
@ -48,16 +48,14 @@
|
|||
// GUI //
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.StartButton(function(){
|
||||
Tone.startMobile();
|
||||
panner.start();
|
||||
});
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
var container = $("#Content");
|
||||
|
||||
new GUI.Checkbox(container, function(on){
|
||||
if (on){
|
||||
sine.start();
|
||||
panner.start();
|
||||
} else {
|
||||
sine.stop();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
// GUI //
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
var content = $("#Content");
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
// GUI //
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
// new GUI.StartButton(Tone.startMobile);
|
||||
// new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
$("#tabs").tabs();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
$(function(){
|
||||
var container = $("#Content");
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
//sliders for the envelope controls
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
// GUI //
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
$("#tabs").tabs();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
var content = $("#Content");
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
new GUI.Checkbox(content, function(on){
|
||||
if (on){
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
// GUI //
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
$("#tabs").tabs();
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
/* globals Tone, GUI */
|
||||
|
||||
var noise = new Tone.Noise();
|
||||
noise.setVolume(-10);
|
||||
noise.toMaster();
|
||||
|
||||
var noiseTypes = ["white", "brown", "pink"];
|
||||
|
@ -54,7 +55,7 @@
|
|||
|
||||
// GUI //
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
new GUI.Momentary($("#Button"), function(){
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
$(function(){
|
||||
var content = $("#Content");
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.Checkbox(content, function(on){
|
||||
if (on){
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
// GUI //
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
new GUI.Momentary($("#Content"), function(on){
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
// GUI //
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
new GUI.Momentary($("#Content"), function(on){
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
// GUI //
|
||||
|
||||
var content = $("#Content");
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
//the transport controls
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
// GUI //
|
||||
|
||||
new GUI.TopBar(Tone);
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
|
||||
var container = $("#Content");
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
new GUI.StartButton(Tone.startMobile);
|
||||
new GUI.MobileStart(Tone.startMobile);
|
||||
new GUI.TopBar(Tone);
|
||||
|
||||
var startButton = $("#StartButton");
|
||||
|
|
Loading…
Reference in a new issue