Skip to content
Snippets Groups Projects
Commit f5044dc2 authored by Ray Schamp's avatar Ray Schamp
Browse files

Instantiate AudioEngine in GUI

This way a stage is not necessary for sound blocks to work
parent 124098e5
No related branches found
No related tags found
No related merge requests found
import AudioEngine from 'scratch-audio';
import PropTypes from 'prop-types';
import React from 'react';
import VM from 'scratch-vm';
......@@ -16,6 +17,8 @@ class GUI extends React.Component {
this.state = {tabIndex: 0};
}
componentDidMount () {
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.loadProject(this.props.projectData);
this.props.vm.setCompatibilityMode(true);
this.props.vm.start();
......
......@@ -2,7 +2,6 @@ import bindAll from 'lodash.bindall';
import PropTypes from 'prop-types';
import React from 'react';
import Renderer from 'scratch-render';
import AudioEngine from 'scratch-audio';
import VM from 'scratch-vm';
import StageComponent from '../components/stage/stage.jsx';
......@@ -37,8 +36,6 @@ class Stage extends React.Component {
this.updateRect();
this.renderer = new Renderer(this.canvas);
this.props.vm.attachRenderer(this.renderer);
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
}
shouldComponentUpdate (nextProps) {
return this.props.width !== nextProps.width || this.props.height !== nextProps.height;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment