@@ -22,34 +22,20 @@ impl ToF32 for f64 {
2222 }
2323}
2424
25- #[ derive( Debug , Clone , Copy ) ]
26- pub struct ConfigSync {
27- /// default: 0.01
28- pub system_latency_s : f32 ,
29- }
30-
31- impl Default for ConfigSync {
32- fn default ( ) -> Self {
33- Self {
34- system_latency_s : 0.01 ,
35- }
36- }
37- }
38-
3925#[ derive( Debug , Clone , Copy ) ]
4026pub enum VisualizationDataPolicy {
4127 LatestOnly ,
4228 All ,
4329}
4430
4531#[ derive( Debug , Clone , Copy ) ]
46- pub struct ConfigOwned {
32+ pub struct PlayerConfig {
4733 /// default: 0.01
4834 pub system_latency_s : f32 ,
4935 pub visualization_data_policy : Option < VisualizationDataPolicy > ,
5036}
5137
52- impl Default for ConfigOwned {
38+ impl Default for PlayerConfig {
5339 fn default ( ) -> Self {
5440 Self {
5541 system_latency_s : 0.01 ,
@@ -121,7 +107,7 @@ impl Player {
121107 SyncCommandRequestNumSamples ,
122108 > ,
123109 recv_sync_command_done : mpsc:: Receiver < SyncCommandDone > ,
124- config : ConfigSync ,
110+ config : PlayerConfig ,
125111 ) -> anyhow:: Result < ( Stream , StreamConfig ) >
126112 where
127113 T : ToF32 + Send + Sync + Copy + ' static ,
@@ -163,7 +149,7 @@ impl Player {
163149 & self ,
164150 mut sig : S ,
165151 mut f : F ,
166- config : ConfigSync ,
152+ config : PlayerConfig ,
167153 ) -> anyhow:: Result < ( ) >
168154 where
169155 T : ToF32 + Send + Sync + Copy + ' static ,
@@ -217,7 +203,7 @@ impl Player {
217203 pub fn play_signal_sync_mono < T , S > (
218204 & self ,
219205 signal : S ,
220- config : ConfigSync ,
206+ config : PlayerConfig ,
221207 ) -> anyhow:: Result < ( ) >
222208 where
223209 T : ToF32 + Send + Sync + Copy + ' static ,
@@ -231,7 +217,7 @@ impl Player {
231217 & self ,
232218 signal : S ,
233219 mut f : F ,
234- config : ConfigSync ,
220+ config : PlayerConfig ,
235221 ) -> anyhow:: Result < ( ) >
236222 where
237223 T : ToF32 + Send + Sync + Copy + ' static ,
@@ -255,7 +241,7 @@ impl Player {
255241 SyncCommandRequestNumSamples ,
256242 > ,
257243 recv_sync_command_done : mpsc:: Receiver < SyncCommandDone > ,
258- config : ConfigSync ,
244+ config : PlayerConfig ,
259245 ) -> anyhow:: Result < ( Stream , StreamConfig ) >
260246 where
261247 TL : ToF32 + Send + Sync + Copy + ' static ,
@@ -300,7 +286,7 @@ impl Player {
300286 & self ,
301287 mut sig : Stereo < SL , SR > ,
302288 mut f : F ,
303- config : ConfigSync ,
289+ config : PlayerConfig ,
304290 ) -> anyhow:: Result < ( ) >
305291 where
306292 TL : ToF32 + Send + Sync + Copy + ' static ,
@@ -362,7 +348,7 @@ impl Player {
362348 pub fn play_signal_sync_stereo < TL , TR , SL , SR > (
363349 & self ,
364350 sig : Stereo < SL , SR > ,
365- config : ConfigSync ,
351+ config : PlayerConfig ,
366352 ) -> anyhow:: Result < ( ) >
367353 where
368354 TL : ToF32 + Send + Sync + Copy + ' static ,
@@ -378,7 +364,7 @@ impl Player {
378364 & self ,
379365 sig : Stereo < SL , SR > ,
380366 mut f : F ,
381- config : ConfigSync ,
367+ config : PlayerConfig ,
382368 ) -> anyhow:: Result < ( ) >
383369 where
384370 TL : ToF32 + Send + Sync + Copy + ' static ,
@@ -402,7 +388,7 @@ impl Player {
402388 pub fn play_stereo < SL , SR > (
403389 self ,
404390 mut sig : Stereo < SL , SR > ,
405- config : ConfigOwned ,
391+ config : PlayerConfig ,
406392 ) -> anyhow:: Result < PlayerHandle >
407393 where
408394 SL : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
@@ -469,7 +455,7 @@ impl Player {
469455 pub fn play_mono < S > (
470456 self ,
471457 mut sig : S ,
472- config : ConfigOwned ,
458+ config : PlayerConfig ,
473459 ) -> anyhow:: Result < PlayerHandle >
474460 where
475461 S : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
@@ -583,37 +569,23 @@ impl PlayerHandle {
583569 }
584570}
585571
586- pub fn play_mono < S > ( sig : S , config : ConfigOwned ) -> anyhow:: Result < PlayerHandle >
572+ pub fn play_mono < S > (
573+ sig : S ,
574+ config : PlayerConfig ,
575+ ) -> anyhow:: Result < PlayerHandle >
587576where
588577 S : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
589578{
590579 Player :: new ( ) ?. play_mono ( sig, config)
591580}
592581
593- pub fn play_mono_default < S > ( sig : S ) -> anyhow:: Result < PlayerHandle >
594- where
595- S : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
596- {
597- play_mono ( sig, Default :: default ( ) )
598- }
599-
600582pub fn play_stereo < SL , SR > (
601583 sig : Stereo < SL , SR > ,
602- config : ConfigOwned ,
584+ config : PlayerConfig ,
603585) -> anyhow:: Result < PlayerHandle >
604586where
605587 SL : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
606588 SR : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
607589{
608590 Player :: new ( ) ?. play_stereo ( sig, config)
609591}
610-
611- pub fn play_stereo_default < SL , SR > (
612- sig : Stereo < SL , SR > ,
613- ) -> anyhow:: Result < PlayerHandle >
614- where
615- SL : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
616- SR : SigSampleIntoBufT < Item = f32 > + Send + Sync + ' static ,
617- {
618- play_stereo ( sig, Default :: default ( ) )
619- }
0 commit comments