File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ pub use cpal::{
171171mod common;
172172mod sink;
173173mod spatial_sink;
174- #[ cfg( all( feature = "playback" , feature = "experimental" ) ) ]
174+ // #[cfg(all(feature = "playback", feature = "experimental"))]
175175pub mod speakers;
176176#[ cfg( feature = "playback" ) ]
177177pub mod stream;
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ where
513513 /// # Ok::<(), Box<dyn std::error::Error>>(())
514514 /// ```
515515 pub fn get_config ( & self ) -> InputConfig {
516- self . config . copied ( ) . expect ( "ConfigIsSet" )
516+ self . config . expect ( "ConfigIsSet" )
517517 }
518518}
519519
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ use cpal::{
108108
109109use crate :: { common:: assert_error_traits, StreamError } ;
110110
111+ /// TODO
111112pub mod builder;
112113mod config;
113114
@@ -126,6 +127,7 @@ assert_error_traits! {ListError}
126127#[ derive( Clone ) ]
127128pub struct Output {
128129 inner : cpal:: Device ,
130+ default : bool ,
129131}
130132
131133impl From < Output > for cpal:: Device {
@@ -134,6 +136,13 @@ impl From<Output> for cpal::Device {
134136 }
135137}
136138
139+ impl Output {
140+ /// TODO
141+ pub fn is_default ( & self ) -> bool {
142+ self . default
143+ }
144+ }
145+
137146impl fmt:: Debug for Output {
138147 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
139148 f. debug_struct ( "Device" )
@@ -151,10 +160,11 @@ impl fmt::Display for Output {
151160/// Returns a list of available output devices on the system.
152161pub fn available_outputs ( ) -> Result < Vec < Output > , ListError > {
153162 let host = cpal:: default_host ( ) ;
154- let devices = host
155- . output_devices ( )
156- . map_err ( ListError ) ?
157- . map ( |dev| Output { inner : dev } ) ;
163+ let default = host. default_output_device ( ) . map ( |d| d. name ( ) ) ;
164+ let devices = host. output_devices ( ) . map_err ( ListError ) ?. map ( |dev| Output {
165+ default : Some ( dev. name ( ) ) == default,
166+ inner : dev,
167+ } ) ;
158168 Ok ( devices. collect ( ) )
159169}
160170
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ where
513513 /// # Ok::<(), Box<dyn std::error::Error>>(())
514514 /// ```
515515 pub fn get_config ( & self ) -> OutputConfig {
516- self . config . copied ( ) . expect ( "ConfigIsSet" )
516+ self . config . expect ( "ConfigIsSet" )
517517 }
518518}
519519
You can’t perform that action at this time.
0 commit comments