@@ -26,7 +26,7 @@ export interface IAudioCueService {
26
26
onEnabledChanged ( cue : AudioCue ) : Event < void > ;
27
27
28
28
playSound ( cue : Sound , allowManyInParallel ?: boolean ) : Promise < void > ;
29
- playAudioCueLoop ( cue : AudioCue ) : IDisposable ;
29
+ playAudioCueLoop ( cue : AudioCue , milliseconds : number ) : IDisposable ;
30
30
playRandomAudioCue ( groupId : AudioCueGroupId , allowManyInParallel ?: boolean ) : void ;
31
31
}
32
32
@@ -75,10 +75,11 @@ export class AudioCueService extends Disposable implements IAudioCueService {
75
75
private readonly playingSounds = new Set < Sound > ( ) ;
76
76
77
77
public async playSound ( sound : Sound , allowManyInParallel = false ) : Promise < void > {
78
+ console . log ( sound . fileName , allowManyInParallel ) ;
78
79
if ( ! allowManyInParallel && this . playingSounds . has ( sound ) ) {
79
80
return ;
80
81
}
81
-
82
+ console . log ( 'playing' , sound . fileName ) ;
82
83
this . playingSounds . add ( sound ) ;
83
84
const url = FileAccess . asBrowserUri ( `vs/platform/audioCues/browser/media/${ sound . fileName } ` ) . toString ( true ) ;
84
85
@@ -99,14 +100,16 @@ export class AudioCueService extends Disposable implements IAudioCueService {
99
100
}
100
101
}
101
102
102
- public playAudioCueLoop ( cue : AudioCue ) : IDisposable {
103
+ public playAudioCueLoop ( cue : AudioCue , milliseconds : number ) : IDisposable {
103
104
let playing = true ;
104
105
const playSound = ( ) => {
105
106
if ( playing ) {
106
107
this . playAudioCue ( cue , true ) . finally ( ( ) => {
107
- if ( playing ) {
108
- playSound ( ) ;
109
- }
108
+ setTimeout ( ( ) => {
109
+ if ( playing ) {
110
+ playSound ( ) ;
111
+ }
112
+ } , milliseconds ) ;
110
113
} ) ;
111
114
}
112
115
} ;
0 commit comments