37
37
</div >
38
38
</div >
39
39
</modal >
40
+ <modal :show =" !settings.showStart && showStart && !showWelcome" >
41
+ <div class =" vis-start" >
42
+ <button @click =" startVis" >click to start</button >
43
+ </div >
44
+ </modal >
40
45
<modal :show =" settings.showDonate && showDonate && !showWelcome" >
41
46
<donate-form class =" vis__donate" />
42
47
<div class =" flex" >
@@ -69,6 +74,7 @@ import raVe from '@/js/raVe'
69
74
70
75
export default {
71
76
data : () => ({
77
+ acx: null ,
72
78
analyzer: null ,
73
79
audio: null ,
74
80
microphone: null ,
@@ -89,6 +95,8 @@ export default {
89
95
showWelcome: true ,
90
96
noMoreWelcome: false ,
91
97
98
+ showStart: true ,
99
+
92
100
userActive: true ,
93
101
userActiveTO: 0 ,
94
102
@@ -123,6 +131,11 @@ export default {
123
131
}
124
132
},
125
133
134
+ startVis () {
135
+ if (this .acx .resume ) this .acx .resume ()
136
+ this .showStart = false
137
+ },
138
+
126
139
hideDonate () {
127
140
this .showDonate = false
128
141
if (this .noMoreDonate ) this .stopShowingDonate ()
@@ -131,6 +144,7 @@ export default {
131
144
hideWelcome () {
132
145
this .showWelcome = false
133
146
if (this .noMoreWelcome ) this .stopShowingWelcome ()
147
+ this .startVis ()
134
148
},
135
149
136
150
displayDonate () {
@@ -172,19 +186,20 @@ export default {
172
186
// set up visualizer stuff
173
187
this .audio = new Audio ()
174
188
this .audio .volume = 0.5
175
- const acx = new (window .AudioContext || window .webkitAudioContext )()
176
- const src = acx .createMediaElementSource (this .audio )
177
- src .connect (acx .destination )
189
+ this . acx = new (window .AudioContext || window .webkitAudioContext )()
190
+ const src = this . acx .createMediaElementSource (this .audio )
191
+ src .connect (this . acx .destination )
178
192
179
- const pt = acx .createGain ()
193
+ const pt = this . acx .createGain ()
180
194
src .connect (pt)
181
195
182
196
this .playlist = new Playlist (this .audio )
183
- this .microphone = new Microphone (this .audio , acx, pt)
184
- this .analyzer = new AudioAnalyzer (acx, pt)
197
+ this .microphone = new Microphone (this .audio , this . acx , pt)
198
+ this .analyzer = new AudioAnalyzer (this . acx , pt)
185
199
186
200
const audio = this .audio
187
201
const microphone = this .microphone
202
+ this .microphone .toggle ()
188
203
189
204
this .source = { paused: false }
190
205
setTimeout (() => {
0 commit comments