File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,10 @@ pub async fn display_menu(config_path: &PathBuf) {
4848 let term_height = get_terminal_height ( ) as usize ;
4949 let display_height = term_height. saturating_sub ( 3 ) ;
5050
51- if config. window_title_support {
52- if let Some ( title) = & config. window_title {
53- set_window_title ( title ) ;
54- }
51+ if config. window_title_support
52+ && let Some ( title) = & config. window_title
53+ {
54+ set_window_title ( title ) ;
5555 }
5656
5757 clear_screen ( ) ;
Original file line number Diff line number Diff line change 1- use rodio:: { Decoder , OutputStream , Sink } ;
1+ use rodio:: { Decoder , OutputStreamBuilder , Sink } ;
22use std:: fs:: File ;
33use std:: io:: { BufReader , Write , stdin, stdout} ;
44use std:: path:: PathBuf ;
@@ -40,16 +40,17 @@ pub async fn play_sound(file_path: PathBuf) {
4040 let file_path = file_path. clone ( ) ; // Cloning the PathBuf to be owned by the closure
4141 task:: spawn_blocking ( move || {
4242 // Spawning a blocking task
43- match OutputStream :: try_default ( ) {
44- Ok ( ( _stream, stream_handle) ) => {
43+
44+ match OutputStreamBuilder :: open_default_stream ( ) {
45+ Ok ( stream_handle) => {
4546 // Trying to get the default audio output stream
4647 match File :: open ( & file_path) {
4748 Ok ( file) => {
4849 // Trying to open the audio file
4950 match Decoder :: new ( BufReader :: new ( file) ) {
5051 Ok ( source) => {
5152 // Trying to decode the audio file
52- let sink = Sink :: try_new ( & stream_handle) . unwrap ( ) ; // Creating a sink for the audio stream
53+ let sink = Sink :: connect_new ( stream_handle. mixer ( ) ) ; // Creating a sink for the audio stream
5354 sink. append ( source) ; // Appending the audio source to the sink
5455 sink. sleep_until_end ( ) ; // Sleeping until the audio playback ends
5556 }
You can’t perform that action at this time.
0 commit comments