mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
8a7195e962
also handling MediaStream.stop deprecation
43 lines
No EOL
901 B
JavaScript
43 lines
No EOL
901 B
JavaScript
define(["Tone/core/Tone", "Tone/source/ExternalInput"], function(Tone){
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* @class Opens up the default source (typically the microphone).
|
|
*
|
|
* @constructor
|
|
* @extends {Tone.ExternalInput}
|
|
* @example
|
|
* //mic will feedback if played through master
|
|
* var mic = new Tone.Microphone();
|
|
* mic.open(function(){
|
|
* //start the mic at ten seconds
|
|
* mic.start(10);
|
|
* });
|
|
* //stop the mic
|
|
* mic.stop(20);
|
|
*/
|
|
Tone.Microphone = function(){
|
|
|
|
Tone.ExternalInput.call(this, 0);
|
|
|
|
};
|
|
|
|
Tone.extend(Tone.Microphone, Tone.ExternalInput);
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
});
|
|
|
|
return Tone.Microphone;
|
|
}); |