INNER CODE UNIT · Rust
repeat
PistonDevelopers/piston_window · src/piston_script.rs:378
if repeat == -1.0 {
if let Some(sound_data) = sound_data {
let _ = sound_track.play(sound_data.clone().loop_region(..).volume(f(volume as f32)));
} else {
let data = StaticSoundData::from_file(Path::new(&**file)).unwrap();
let _ = sound_track.play(data.clone().loop_region(..).volume(f(volume as f32)));
*sound_data = Some(data);
}
} else if repeat != 0.0 {
if let Some(sound_data) = sound_data {
let _ = sound_track.play(sound_data.clone().volume(f(volume as f32)));
} else {
let data = StaticSoundData::from_file(Path::new(&**file)).unwrap();
let _ = sound_track.play(data.clone().volume(f(volume as f32)));
*sound_data = Some(data);
}
let duration = if let Some(sound_data) = sound_data {
sound_data.duration()