@@ -22,7 +22,7 @@ import { Cline } from "../Cline"
2222import { openMention } from "../mentions"
2323import { getNonce } from "./getNonce"
2424import { getUri } from "./getUri"
25- import { playSound , setSoundEnabled } from "../../utils/sound"
25+ import { playSound , setSoundEnabled , setSoundVolume } from "../../utils/sound"
2626
2727/*
2828https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/default/weather-webview/src/providers/WeatherViewProvider.ts
@@ -66,6 +66,7 @@ type GlobalStateKey =
6666 | "openRouterUseMiddleOutTransform"
6767 | "allowedCommands"
6868 | "soundEnabled"
69+ | "soundVolume"
6970 | "diffEnabled"
7071 | "alwaysAllowMcp"
7172
@@ -597,6 +598,12 @@ export class ClineProvider implements vscode.WebviewViewProvider {
597598 setSoundEnabled ( soundEnabled ) // Add this line to update the sound utility
598599 await this . postStateToWebview ( )
599600 break
601+ case "soundVolume" :
602+ const soundVolume = message . value ?? 0.5
603+ await this . updateGlobalState ( "soundVolume" , soundVolume )
604+ setSoundVolume ( soundVolume )
605+ await this . postStateToWebview ( )
606+ break
600607 case "diffEnabled" :
601608 const diffEnabled = message . bool ?? true
602609 await this . updateGlobalState ( "diffEnabled" , diffEnabled )
@@ -929,6 +936,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
929936 soundEnabled,
930937 diffEnabled,
931938 taskHistory,
939+ soundVolume,
932940 } = await this . getState ( )
933941
934942 const allowedCommands = vscode . workspace
@@ -953,6 +961,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
953961 diffEnabled : diffEnabled ?? false ,
954962 shouldShowAnnouncement : lastShownAnnouncementId !== this . latestAnnouncementId ,
955963 allowedCommands,
964+ soundVolume : soundVolume ?? 0.5 ,
956965 }
957966 }
958967
@@ -1045,6 +1054,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
10451054 allowedCommands ,
10461055 soundEnabled ,
10471056 diffEnabled ,
1057+ soundVolume ,
10481058 ] = await Promise . all ( [
10491059 this . getGlobalState ( "apiProvider" ) as Promise < ApiProvider | undefined > ,
10501060 this . getGlobalState ( "apiModelId" ) as Promise < string | undefined > ,
@@ -1082,6 +1092,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
10821092 this . getGlobalState ( "allowedCommands" ) as Promise < string [ ] | undefined > ,
10831093 this . getGlobalState ( "soundEnabled" ) as Promise < boolean | undefined > ,
10841094 this . getGlobalState ( "diffEnabled" ) as Promise < boolean | undefined > ,
1095+ this . getGlobalState ( "soundVolume" ) as Promise < number | undefined > ,
10851096 ] )
10861097
10871098 let apiProvider : ApiProvider
@@ -1137,6 +1148,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
11371148 allowedCommands,
11381149 soundEnabled,
11391150 diffEnabled,
1151+ soundVolume,
11401152 }
11411153 }
11421154
0 commit comments