2015-07-14 23:26:16 +00:00
|
|
|
define(["Tone/core/Tone", "Tone/source/ExternalInput"], function(Tone){
|
2014-04-06 00:47:59 +00:00
|
|
|
|
2014-09-04 04:41:40 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-06-19 05:40:16 +00:00
|
|
|
/**
|
2015-09-19 00:19:09 +00:00
|
|
|
* @class Opens up the default source (typically the microphone).
|
2014-06-19 05:40:16 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
2015-07-14 23:26:16 +00:00
|
|
|
* @extends {Tone.ExternalInput}
|
2015-07-04 16:43:21 +00:00
|
|
|
* @example
|
2015-07-14 23:26:16 +00:00
|
|
|
* //mic will feedback if played through master
|
|
|
|
* var mic = new Tone.Microphone();
|
2015-08-26 18:29:49 +00:00
|
|
|
* mic.open(function(){
|
|
|
|
* //start the mic at ten seconds
|
|
|
|
* mic.start(10);
|
|
|
|
* });
|
|
|
|
* //stop the mic
|
|
|
|
* mic.stop(20);
|
2014-06-19 05:40:16 +00:00
|
|
|
*/
|
2015-07-14 23:26:16 +00:00
|
|
|
Tone.Microphone = function(){
|
2015-09-19 00:19:09 +00:00
|
|
|
|
|
|
|
Tone.ExternalInput.call(this, 0);
|
|
|
|
|
2014-06-19 05:40:16 +00:00
|
|
|
};
|
2015-09-19 00:19:09 +00:00
|
|
|
|
2015-07-14 23:26:16 +00:00
|
|
|
Tone.extend(Tone.Microphone, Tone.ExternalInput);
|
2014-03-13 16:47:26 +00:00
|
|
|
|
2015-09-30 17:47:42 +00:00
|
|
|
/**
|
|
|
|
* If getUserMedia is supported by the browser.
|
|
|
|
* @type {Boolean}
|
|
|
|
* @memberOf Tone.Microphone#
|
|
|
|
* @name supported
|
|
|
|
* @static
|
|
|
|
* @readOnly
|
|
|
|
*/
|
|
|
|
Object.defineProperty(Tone.Microphone, "supported", {
|
|
|
|
get : function(){
|
|
|
|
return Tone.ExternalInput.supported;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-04-06 00:47:59 +00:00
|
|
|
return Tone.Microphone;
|
|
|
|
});
|