File tree Expand file tree Collapse file tree 4 files changed +51
-20
lines changed
Expand file tree Collapse file tree 4 files changed +51
-20
lines changed Original file line number Diff line number Diff line change 2626 padding-bottom : 0 ;
2727}
2828
29+ .get-started {
30+ padding : 80px ;
31+ text-align : center ;
32+ max-width : 600px ;
33+ margin :0 auto ;
34+ }
35+ .get-started button {
36+ background-color : $blue ;
37+ padding : 24px 36px ;
38+ color : white ;
39+ }
40+
2941.scroll-container {
3042 padding : 0 ;
3143 margin : 0 ;
Original file line number Diff line number Diff line change @@ -21,12 +21,8 @@ import EventEmitter from 'event-emitter'
2121
2222import WaveTableData from './data/WaveTableData.json'
2323
24- let audioContext
25- const eventEmitter = new EventEmitter ( )
2624
27- if ( window . AudioContext ) {
28- audioContext = new AudioContext ( )
29- }
25+ const eventEmitter = new EventEmitter ( )
3026
3127class App extends React . Component {
3228 constructor ( props ) {
@@ -68,18 +64,13 @@ class App extends React.Component {
6864 </ div >
6965 )
7066 }
71- // Shows a message if not Chrome.
72- const isChrome = ! ! window . chrome && ! ! window . chrome . webstore
67+ const { audioContext } = this . props ;
68+
69+
70+
7371 return (
7472 < div >
7573 < div className = 'scroll-container' >
76- { ! isChrome &&
77- < div >
78- < h1 className = 'text-center' >
79- Try this synth in Chrome for better audio quality and MIDI support.
80- </ h1 >
81- </ div >
82- }
8374 < header >
8475 < div >
8576 < h1 > Wavetable</ h1 >
Original file line number Diff line number Diff line change @@ -11,10 +11,37 @@ import App from './App.js'
1111import Reducers from './data/Reducers.js'
1212
1313let store = createStore ( Reducers )
14+ let audioContext
15+ const createAudioContext = ( ) => {
16+ audioContext = new AudioContext ( )
17+ renderApp ( ) ;
18+ }
1419
15- render (
16- < Provider store = { store } >
17- < App store = { store } />
18- </ Provider > ,
19- document . getElementById ( 'root' )
20- )
20+ const renderApp = ( ) => {
21+ if ( ! audioContext ) {
22+ return render (
23+ < div className = "get-started" >
24+ < h1 > Welcome to Wavetable synth!</ h1 >
25+ < p > Click on the piano keys, type keys on your keyboard, or even hook up a MIDI keyboard to hear it in action!</ p >
26+ < button
27+ onClick = { createAudioContext } >
28+ Click Here to Start
29+ </ button >
30+ </ div > ,
31+ document . getElementById ( 'root' )
32+ ) ;
33+ }
34+
35+ return render (
36+ < Provider store = { store } >
37+ < App
38+ store = { store }
39+ audioContext = { audioContext }
40+ createAudioContext = { createAudioContext }
41+ />
42+ </ Provider > ,
43+ document . getElementById ( 'root' )
44+ )
45+ }
46+
47+ renderApp ( ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class Presets extends React.Component {
2929 }
3030
3131 render ( ) {
32+ console . log ( "options --->" , this . props . presetId , this . state . options ) ;
3233 return (
3334 < div className = 'preset-list-container' >
3435 < Select
You can’t perform that action at this time.
0 commit comments