kopia lustrzana https://github.com/backface/turtlestitch
let the Microphone share the Note prototype's AudioContext
make sure all of Snap! uses just a single AudioContext in order to save hardware resourcespull/89/head
rodzic
8d89e1a2d6
commit
eced999b6c
|
@ -53,6 +53,9 @@
|
|||
* German
|
||||
* French
|
||||
|
||||
### 2019-04-01
|
||||
* Objects: let the Microphone share the Note prototype's AudioContext
|
||||
|
||||
### 2019-03-31
|
||||
* Blocks, Threads: added "stage width" and "stage height" as gettable attributes to MY
|
||||
* updated German translation
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<script type="text/javascript" src="src/widgets.js?version=2018-10-02"></script>
|
||||
<script type="text/javascript" src="src/blocks.js?version=2019-03-31"></script>
|
||||
<script type="text/javascript" src="src/threads.js?version=2019-03-31"></script>
|
||||
<script type="text/javascript" src="src/objects.js?version=2019-03-30"></script>
|
||||
<script type="text/javascript" src="src/objects.js?version=2019-04-01"></script>
|
||||
<script type="text/javascript" src="src/gui.js?version=2019-03-25"></script>
|
||||
<script type="text/javascript" src="src/paint.js?version=2019-02-22"></script>
|
||||
<script type="text/javascript" src="src/lists.js?version=2019-02-07"></script>
|
||||
|
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize,
|
|||
TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph,
|
||||
AlignmentMorph, Process, XML_Element, VectorPaintEditorMorph*/
|
||||
|
||||
modules.objects = '2019-March-30';
|
||||
modules.objects = '2019-April-01';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -8929,7 +8929,7 @@ Note.prototype.stop = function () {
|
|||
|
||||
function Microphone() {
|
||||
// web audio components:
|
||||
this.audioContext = null;
|
||||
this.audioContext = null; // shared with Note.prototype.audioContext
|
||||
this.sourceStream = null;
|
||||
this.processor = null;
|
||||
this.analyser = null;
|
||||
|
@ -8995,8 +8995,7 @@ Microphone.prototype.setResolution = function (num) {
|
|||
// Microphone ops
|
||||
|
||||
Microphone.prototype.start = function () {
|
||||
var AudioContext = window.AudioContext || window.webkitAudioContext,
|
||||
myself = this;
|
||||
var myself = this;
|
||||
|
||||
if (this.isStarted) {
|
||||
return;
|
||||
|
@ -9004,10 +9003,11 @@ Microphone.prototype.start = function () {
|
|||
this.isStarted = true;
|
||||
|
||||
this.isReady = false;
|
||||
if (this.audioContext) {
|
||||
this.audioContext.close();
|
||||
// share Note's audioContext:
|
||||
if (!Note.prototype.audioContext) {
|
||||
Note.prototype.setupContext();
|
||||
}
|
||||
this.audioContext = new AudioContext();
|
||||
this.audioContext = Note.prototype.audioContext;
|
||||
|
||||
navigator.mediaDevices.getUserMedia(
|
||||
{
|
||||
|
@ -9033,7 +9033,6 @@ Microphone.prototype.stop = function () {
|
|||
);
|
||||
this.processor.disconnect();
|
||||
this.analyser.disconnect();
|
||||
this.audioContext.close();
|
||||
this.processor = null;
|
||||
this.analyser = null;
|
||||
this.audioContext = null;
|
||||
|
|
Ładowanie…
Reference in New Issue