Skip to content

SpatialPlayer does not work with set_speed and looped decoder #880

@Bobitsmagic

Description

@Bobitsmagic

When using a SpatialPlayer the engine sound makes weird noises when the player speed is changed.
This issue does not occur on any playbackspeed when using a normal player/sink.

fn main() {
    let stream_handle = rodio::DeviceSinkBuilder::open_default_sink().unwrap();

    let player = rodio::SpatialPlayer::connect_new(
        stream_handle.mixer(),
        [0.0; 3], 
        [0.0, -1.0, 0.0],
        [0.0, 1.0, 0.0]
    );

    // let player = rodio::Player::connect_new(stream_handle.mixer());

    let file = std::fs::File::open("assets/engine.mp3").unwrap();
    let source = rodio::Decoder::new_looped(file).unwrap();

    player.append(source);
    player.set_speed(1.5);

    player.sleep_until_end();
}

I tried let source = rodio::Decoder::try_from(file).unwrap().repeat_infinite(); instead but it made the sound even worse.

What can i do to fix this, or is this an Issue of the crate itself.

Thank you for your help.

Rodio: 22.2, Windows 11
engine.mp3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions