@@ -767,6 +767,7 @@ impl Sound {
767767 }
768768
769769 // Debug: log sound register writes
770+ #[ cfg( debug_assertions) ]
770771 if a == 0xFF26 && v & 0x80 == 0x80 {
771772 println ! ( "Sound enabled" ) ;
772773 }
@@ -908,6 +909,7 @@ pub mod cpal_audio {
908909 let device = match cpal:: default_host ( ) . default_output_device ( ) {
909910 Some ( e) => e,
910911 None => {
912+ #[ cfg( debug_assertions) ]
911913 eprintln ! ( "No default output device found" ) ;
912914 return None ;
913915 }
@@ -917,6 +919,7 @@ pub mod cpal_audio {
917919 let supported_configs = match device. supported_output_configs ( ) {
918920 Ok ( e) => e,
919921 Err ( err) => {
922+ #[ cfg( debug_assertions) ]
920923 eprintln ! ( "Failed to get supported configs: {}" , err) ;
921924 return None ;
922925 }
@@ -935,6 +938,7 @@ pub mod cpal_audio {
935938 }
936939 }
937940 if supported_config. is_none ( ) {
941+ #[ cfg( debug_assertions) ]
938942 eprintln ! ( "No supported audio configuration found" ) ;
939943 return None ;
940944 }
@@ -944,8 +948,10 @@ pub mod cpal_audio {
944948 let channels = selected_config. channels ( ) ;
945949 let config: cpal:: StreamConfig = selected_config. into ( ) ;
946950
947- let err_fn =
948- |err| eprintln ! ( "An error occurred on the output audio stream: {}" , err) ;
951+ let err_fn = |err| {
952+ #[ cfg( debug_assertions) ]
953+ eprintln ! ( "An error occurred on the output audio stream: {}" , err) ;
954+ } ;
949955
950956 let shared_buffer = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ;
951957 let stream_buffer = shared_buffer. clone ( ) ;
@@ -970,12 +976,14 @@ pub mod cpal_audio {
970976 match stream {
971977 Ok ( s) => {
972978 if let Err ( e) = s. play ( ) {
979+ #[ cfg( debug_assertions) ]
973980 eprintln ! ( "Failed to play audio stream: {}" , e) ;
974981 return None ;
975982 }
976983 Some ( ( player, s) )
977984 }
978985 Err ( e) => {
986+ #[ cfg( debug_assertions) ]
979987 eprintln ! ( "Failed to build audio stream: {}" , e) ;
980988 None
981989 }
0 commit comments