Skip to content

State doesn't reflect current resuming process #138

@roudikk

Description

@roudikk

Reproducer:

use std::time::Duration;
use kira::{AudioManager, AudioManagerSettings, DefaultBackend, Easing, StartTime, Tween};
use kira::sound::static_sound::StaticSoundData;

const INSTANT: Tween = Tween {
    start_time: StartTime::Immediate,
    duration: Duration::ZERO,
    easing: Easing::Linear,
};

fn main() {
    let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default()).unwrap();
    let sound_data = StaticSoundData::from_file("file.wav").unwrap();

    let mut handle = manager.play(sound_data).unwrap();

    handle.pause(INSTANT);
    handle.seek_to(50.0);
    handle.resume(INSTANT);
    println!("{}, {:?}", handle.position(), handle.state());

    loop {}
}

Output: 0, Playing

I understand that it's async and the position might not have been updated but shouldn't the state be Resuming? I understand that it's about fading in the volume but I also expected Playing to reflect that it had finished loading the track at the current position too.

Edit:
I also though seek_to would update the position even if it's not resumed.

In the above example:

    handle.seek_to(50.0);
    thread::sleep(Duration::from_millis(1000));
    println!("Position: {:?}", handle.position());

Output: Position: 2.2675736961451248e-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions