Skip to content

Commit e086148

Browse files
committed
fix
1 parent 4908243 commit e086148

File tree

9 files changed

+36
-40
lines changed

9 files changed

+36
-40
lines changed

src/vs/editor/standalone/browser/standaloneServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class StandaloneAudioService implements IAudioCueService {
10581058
playAudioCueLoop(cue: AudioCue): IDisposable {
10591059
return toDisposable(() => { });
10601060
}
1061-
playRandomAudioCue(groupId: AudioCueGroupId, allowManyInParallel?: boolean | undefined, loop?: boolean): void | IDisposable {
1061+
playRandomAudioCue(groupId: AudioCueGroupId, allowManyInParallel?: boolean | undefined): void | IDisposable {
10621062
}
10631063
}
10641064

src/vs/platform/audioCues/browser/audioCueService.ts

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { localize } from 'vs/nls';
1313
import { observableFromEvent, derived } from 'vs/base/common/observable';
1414

1515
export const enum AudioCueGroupId {
16-
chatResponsePending = 'chatResponsePending'
16+
chatResponseReceived = 'chatResponseReceived'
1717
}
1818

1919
export const IAudioCueService = createDecorator<IAudioCueService>('audioCue');
@@ -27,7 +27,7 @@ export interface IAudioCueService {
2727

2828
playSound(cue: Sound, allowManyInParallel?: boolean): Promise<void>;
2929
playAudioCueLoop(cue: AudioCue): IDisposable;
30-
playRandomAudioCue(groupId: AudioCueGroupId, loop?: boolean): IDisposable | void;
30+
playRandomAudioCue(groupId: AudioCueGroupId, allowManyInParallel?: boolean): IDisposable | void;
3131
}
3232

3333
export class AudioCueService extends Disposable implements IAudioCueService {
@@ -57,14 +57,10 @@ export class AudioCueService extends Disposable implements IAudioCueService {
5757
await Promise.all(Array.from(sounds).map(sound => this.playSound(sound, true)));
5858
}
5959

60-
public playRandomAudioCue(groupId: AudioCueGroupId, loop?: boolean): void | IDisposable {
60+
public playRandomAudioCue(groupId: AudioCueGroupId, allowManyInParallel?: boolean): void | IDisposable {
6161
const cues = AudioCue.allAudioCues.filter(cue => cue.groupId === groupId);
6262
const index = Math.floor(Math.random() * cues.length);
63-
if (loop) {
64-
return this.playAudioCueLoop(cues[index]);
65-
} else {
66-
this.playAudioCue(cues[index]);
67-
}
63+
this.playAudioCue(cues[index], allowManyInParallel);
6864
}
6965

7066
private getVolumeInPercent(): number {
@@ -224,12 +220,12 @@ export class Sound {
224220
public static readonly diffLineDeleted = Sound.register({ fileName: 'diffLineDeleted.mp3' });
225221
public static readonly diffLineModified = Sound.register({ fileName: 'diffLineModified.mp3' });
226222
public static readonly chatRequestSent = Sound.register({ fileName: 'chatRequestSent.mp3' });
227-
public static readonly chatResponsePending1 = Sound.register({ fileName: 'chatResponsePending1.mp3' });
228-
public static readonly chatResponsePending2 = Sound.register({ fileName: 'chatResponsePending2.mp3' });
229-
public static readonly chatResponsePending3 = Sound.register({ fileName: 'chatResponsePending3.mp3' });
230-
public static readonly chatResponsePending4 = Sound.register({ fileName: 'chatResponsePending4.mp3' });
231-
public static readonly chatResponsePending5 = Sound.register({ fileName: 'chatResponsePending5.mp3' });
232-
public static readonly chatResponseReceived = Sound.register({ fileName: 'chatResponseReceived.mp3' });
223+
public static readonly chatResponsePending = Sound.register({ fileName: 'chatResponsePending.mp3' });
224+
public static readonly chatResponseReceived1 = Sound.register({ fileName: 'chatResponseReceived1.mp3' });
225+
public static readonly chatResponseReceived2 = Sound.register({ fileName: 'chatResponseReceived2.mp3' });
226+
public static readonly chatResponseReceived3 = Sound.register({ fileName: 'chatResponseReceived3.mp3' });
227+
public static readonly chatResponseReceived4 = Sound.register({ fileName: 'chatResponseReceived4.mp3' });
228+
public static readonly chatResponseReceived5 = Sound.register({ fileName: 'chatResponseReceived5.mp3' });
233229

234230
private constructor(public readonly fileName: string) { }
235231
}
@@ -355,41 +351,41 @@ export class AudioCue {
355351
settingsKey: 'audioCues.chatRequestSent'
356352
});
357353

358-
public static readonly chatResponsePending = {
359-
name: localize('audioCues.chatResponsePending', 'Chat Response Pending'),
360-
settingsKey: 'audioCues.chatResponsePending',
361-
groupId: AudioCueGroupId.chatResponsePending
354+
public static readonly chatResponseReceived = {
355+
name: localize('audioCues.chatResponseReceived', 'Chat Response Received'),
356+
settingsKey: 'audioCues.chatResponseReceived',
357+
groupId: AudioCueGroupId.chatResponseReceived
362358
};
363359

364-
public static readonly chatResponsePending1 = AudioCue.register({
365-
sound: Sound.chatResponsePending1,
366-
...this.chatResponsePending
360+
public static readonly chatResponseReceived1 = AudioCue.register({
361+
sound: Sound.chatResponseReceived1,
362+
...this.chatResponseReceived
367363
});
368364

369-
public static readonly chatResponsePending2 = AudioCue.register({
370-
sound: Sound.chatResponsePending2,
371-
...this.chatResponsePending
365+
public static readonly chatResponseReceived2 = AudioCue.register({
366+
sound: Sound.chatResponseReceived2,
367+
...this.chatResponseReceived
372368
});
373369

374-
public static readonly chatResponsePending3 = AudioCue.register({
375-
sound: Sound.chatResponsePending3,
376-
...this.chatResponsePending
370+
public static readonly chatResponseReceived3 = AudioCue.register({
371+
sound: Sound.chatResponseReceived3,
372+
...this.chatResponseReceived
377373
});
378374

379-
public static readonly chatResponsePending4 = AudioCue.register({
380-
sound: Sound.chatResponsePending4,
381-
...this.chatResponsePending
375+
public static readonly chatResponseReceived4 = AudioCue.register({
376+
sound: Sound.chatResponseReceived4,
377+
...this.chatResponseReceived
382378
});
383379

384-
public static readonly chatResponsePending5 = AudioCue.register({
385-
sound: Sound.chatResponsePending5,
386-
...this.chatResponsePending
380+
public static readonly chatResponseReceived5 = AudioCue.register({
381+
sound: Sound.chatResponseReceived5,
382+
...this.chatResponseReceived
387383
});
388384

389-
public static readonly chatResponseReceived = AudioCue.register({
390-
name: localize('audioCues.chatResponseReceived', 'Chat Response Received'),
391-
sound: Sound.chatResponseReceived,
392-
settingsKey: 'audioCues.chatResponseReceived'
385+
public static readonly chatResponsePending = AudioCue.register({
386+
name: localize('audioCues.chatResponsePending', 'Chat Response Pending'),
387+
sound: Sound.chatResponsePending,
388+
settingsKey: 'audioCues.chatResponsePending'
393389
});
394390

395391
private constructor(
Binary file not shown.

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ export class ChatWidget extends Disposable implements IChatWidget {
392392
}
393393
this.audioCueService.playAudioCue(AudioCue.chatRequestSent, true);
394394
const input = query ?? editorValue;
395-
const cue = this.audioCueService.playRandomAudioCue(AudioCueGroupId.chatResponsePending, true);
395+
const cue = this.audioCueService.playAudioCueLoop(AudioCue.chatResponsePending);
396396
const result = await this.chatService.sendRequest(this.viewModel.sessionId, input);
397397
if (result) {
398398
this.inputPart.acceptInput(query);
399399
result.responseCompletePromise.then(async () => {
400400
cue?.dispose();
401-
this.audioCueService.playAudioCue(AudioCue.chatResponseReceived, true);
401+
this.audioCueService.playRandomAudioCue(AudioCueGroupId.chatResponseReceived);
402402
const responses = this.viewModel?.getItems().filter(isResponseVM);
403403
const lastResponse = responses?.[responses.length - 1];
404404
if (lastResponse) {

0 commit comments

Comments
 (0)