@@ -53,11 +53,10 @@ use uuid::Uuid;
5353mod options;
5454#[ cfg( target_os = "windows" ) ]
5555mod windows_volume;
56+ use speakstream:: ss:: SpeakStream ;
5657use tracing:: { debug, error, info, instrument, warn} ;
5758use tracing_appender:: rolling:: { RollingFileAppender , Rotation } ;
5859
59- use speakstream:: ss:: SpeakStream ;
60-
6160#[ derive( Debug , Subcommand ) ]
6261pub enum SubCommands {
6362 /// Displays keys as you press them so you can figure out what key to use for push to talk.
@@ -1072,6 +1071,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
10721071 // It then sends the path of the recorded audio file to the AI thread.
10731072 let thread_llm_should_stop_mutex = llm_should_stop_mutex. clone ( ) ;
10741073 let thread_speak_stream_mutex = speak_stream_mutex. clone ( ) ;
1074+ let duck_ptt = opt. duck_ptt ;
10751075 thread:: spawn ( move || {
10761076 let mut recorder = rec:: Recorder :: new ( ) ;
10771077 let mut recording_start = std:: time:: SystemTime :: now ( ) ;
@@ -1100,6 +1100,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
11001100 let mut thread_speak_stream =
11011101 thread_speak_stream_mutex. lock ( ) . unwrap ( ) ;
11021102 thread_speak_stream. stop_speech ( ) ;
1103+ if duck_ptt {
1104+ thread_speak_stream. start_audio_ducking ( ) ;
1105+ }
11031106 drop ( thread_speak_stream) ;
11041107 }
11051108
@@ -1149,6 +1152,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
11491152 }
11501153 }
11511154
1155+ if duck_ptt {
1156+ let mut thread_speak_stream =
1157+ thread_speak_stream_mutex. lock ( ) . unwrap ( ) ;
1158+ thread_speak_stream. stop_audio_ducking ( ) ;
1159+ drop ( thread_speak_stream) ;
1160+ }
1161+
11521162 // continue if we failed to get elapsed time
11531163 let elapsed = match elapsed_option {
11541164 Some ( elapsed) => elapsed,
0 commit comments