pub struct FilePlaybackOptions {
pub stream: bool,
pub volume: f32,
pub panning: f32,
pub speed: f64,
pub repeat: usize,
pub start_time: Option<u64>,
pub fade_in_duration: Option<Duration>,
pub fade_out_duration: Option<Duration>,
pub resampling_quality: ResamplingQuality,
pub playback_pos_emit_rate: Option<Duration>,
}Expand description
Options to control playback of a FileSource.
Fields§
§stream: boolBy default false: when true, the file will be decoded and streamed on the fly. This should be enabled for very long files only, especiall when a lot of files are going to be played at once.
volume: f32By default 1.0f32. Customize to lower or raise the volume of the file.
panning: f32By default 0.0f32. Set in range -1.0..=1.0 to adjust panning position.
speed: f64By default 1.0f64. Customize to pitch the playback speed up or down.
See also resampling_quality property.
repeat: usizeBy default 0: when > 0 the number of times the file should be looped. Set to usize::MAX to repeat forever.
start_time: Option<u64>By default None: when set, the source should start playing at the given sample frame time in the audio output stream.
fade_in_duration: Option<Duration>By default None: when set, the source’s volume will fade in with the given amount when starting to play.
fade_out_duration: Option<Duration>By default 5ms: volume fade out duration, applied when the the source gets stopped before it finished playing.
resampling_quality: ResamplingQualityBy default ResamplingQuality::Default: Quality mode of a applied resampler, either when the source is getting played back on a stream with a sample rate which does not match the file’s sample rate or when pitching the playback up or down.
playback_pos_emit_rate: Option<Duration>Wallclock time rate of playback pos events, emited via PlaybackStatusEvent in the player. By default one second to avoid unnecessary overhead. Set to e.g. Duration::from_secf32(1.0/30.0) to trigger events 30 times per second.
Implementations§
Source§impl FilePlaybackOptions
impl FilePlaybackOptions
pub fn preloaded(self) -> Self
pub fn streamed(self) -> Self
pub fn volume(self, volume: f32) -> Self
pub fn volume_db(self, volume_db: f32) -> Self
pub fn panning(self, panning: f32) -> Self
pub fn fade_in(self, duration: Duration) -> Self
pub fn fade_out(self, duration: Duration) -> Self
pub fn speed(self, speed: f64) -> Self
pub fn repeat(self, count: usize) -> Self
pub fn repeat_forever(self) -> Self
pub fn start_at_time(self, sample_time: u64) -> Self
pub fn playback_pos_emit_rate(self, duration: Duration) -> Self
pub fn resampling_quality(self, quality: ResamplingQuality) -> Self
Trait Implementations§
Source§impl Clone for FilePlaybackOptions
impl Clone for FilePlaybackOptions
Source§fn clone(&self) -> FilePlaybackOptions
fn clone(&self) -> FilePlaybackOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more