File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
editor/standalone/browser
platform/audioCues/browser
workbench/contrib/audioCues/browser Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1077,6 +1077,10 @@ class StandaloneAudioService implements IAudioCueService {
1077
1077
return Event . None ;
1078
1078
}
1079
1079
1080
+ onAlertEnabledChanged ( cue : AudioCue ) : Event < void > {
1081
+ return Event . None ;
1082
+ }
1083
+
1080
1084
async playSound ( cue : Sound , allowManyInParallel ?: boolean | undefined ) : Promise < void > {
1081
1085
}
1082
1086
playAudioCueLoop ( cue : AudioCue ) : IDisposable {
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export interface IAudioCueService {
22
22
isCueEnabled ( cue : AudioCue ) : boolean ;
23
23
isAlertEnabled ( cue : AudioCue ) : boolean ;
24
24
onEnabledChanged ( cue : AudioCue ) : Event < void > ;
25
+ onAlertEnabledChanged ( cue : AudioCue ) : Event < void > ;
25
26
26
27
playSound ( cue : Sound , allowManyInParallel ?: boolean ) : Promise < void > ;
27
28
playAudioCueLoop ( cue : AudioCue , milliseconds : number ) : IDisposable ;
@@ -235,6 +236,10 @@ export class AudioCueService extends Disposable implements IAudioCueService {
235
236
public onEnabledChanged ( cue : AudioCue ) : Event < void > {
236
237
return Event . fromObservableLight ( this . isCueEnabledCache . get ( { cue } ) ) ;
237
238
}
239
+
240
+ public onAlertEnabledChanged ( cue : AudioCue ) : Event < void > {
241
+ return Event . fromObservableLight ( this . isAlertEnabledCache . get ( { cue } ) ) ;
242
+ }
238
243
}
239
244
240
245
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ export class AudioCueLineFeatureContribution
37
37
( ) => this . audioCueService . isCueEnabled ( cue )
38
38
) ) ;
39
39
40
+ private readonly isAlertEnabledCache = new CachedFunction < AudioCue , IObservable < boolean > > ( ( cue ) => observableFromEvent (
41
+ this . audioCueService . onAlertEnabledChanged ( cue ) ,
42
+ ( ) => this . audioCueService . isAlertEnabled ( cue )
43
+ ) ) ;
44
+
40
45
constructor (
41
46
@IEditorService private readonly editorService : IEditorService ,
42
47
@IInstantiationService private readonly instantiationService : IInstantiationService ,
@@ -47,7 +52,7 @@ export class AudioCueLineFeatureContribution
47
52
48
53
const someAudioCueFeatureIsEnabled = derived (
49
54
( reader ) => /** @description someAudioCueFeatureIsEnabled */ this . features . some ( ( feature ) =>
50
- this . isEnabledCache . get ( feature . audioCue ) . read ( reader )
55
+ this . isEnabledCache . get ( feature . audioCue ) . read ( reader ) || this . isAlertEnabledCache . get ( feature . audioCue ) . read ( reader )
51
56
)
52
57
) ;
53
58
@@ -116,7 +121,7 @@ export class AudioCueLineFeatureContribution
116
121
const isFeaturePresent = derivedOpts (
117
122
{ debugName : `isPresentInLine:${ feature . audioCue . name } ` } ,
118
123
( reader ) => {
119
- if ( ! this . isEnabledCache . get ( feature . audioCue ) . read ( reader ) ) {
124
+ if ( ! this . isEnabledCache . get ( feature . audioCue ) . read ( reader ) && ! this . isAlertEnabledCache . get ( feature . audioCue ) . read ( reader ) ) {
120
125
return false ;
121
126
}
122
127
const position = debouncedPosition . read ( reader ) ;
You can’t perform that action at this time.
0 commit comments