Skip to content

AudioStreamPlayer "finished" signal is never emitted if there is no audio output device #71640

Closed
@tcoxon

Description

@tcoxon

Godot version

3.5.1.stable

System information

Windows 10, GLES3, NVIDIA GTX 970, driver version 31.0.15.1694

Issue description

The AudioStreamPlayer node's "finished" signal is never emitted if the system has no audio output device. I tested this by unplugging all headphones and line out devices from my machine, and then starting my project. My intuition is that having no output device should functionally equivalent to muting the game, however this is not the case. If the game is muted (but still has an output device) the "finished" signal is still emitted.

If you don't know that the lack of an audio output device causes this signal to never be emitted, and you yield on the signal in code, this can easily lead to severe game-breaking bugs.

I guess it makes some kind of sense that no audio can be played without an audio output device, however the is_playing method on AudioStreamPlayer does return true even when there is no output device.

I have not tested AudioStreamPlayer3D or AudioStreamPlayer2D, but they are probably affected too.

Steps to reproduce

Sample code:

$AudioStreamPlayer.stream = preload("some audio file.wav")
$AudioStreamPlayer.play()
yield($AudioStreamPlayer, "finished")
print("This line is never printed")

Unplug all your headphones and speakers, and then run the code. The print statement is never executed.

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions