Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Sound asset volume before setup causes hang at startup #419

Open
ironfroggy opened this issue Apr 12, 2020 · 3 comments
Open

Changing Sound asset volume before setup causes hang at startup #419

ironfroggy opened this issue Apr 12, 2020 · 3 comments
Labels
bug discussion Issues that more just discussing than specific flaws or features

Comments

@ironfroggy
Copy link
Contributor

This works:

SOUND_CHIME = ppb.Sound("resources/sound/chimes.wav")
def setup(scene):
    SOUND_SWAP.volume = 0.5
    ...
ppb.run(setup=setup)

But this causes a permanent hang at startup:

SOUND_CHIME = ppb.Sound("resources/sound/chimes.wav")
SOUND_CHIME.volume = 0.5
def setup(scene):
    ...
ppb.run(setup=setup)

The only output I get is this message about the asset:

Waited on <Sound name='resources/sound/chimes.wav'> before the engine began
@pathunstrom pathunstrom added bug discussion Issues that more just discussing than specific flaws or features labels Apr 12, 2020
@pathunstrom
Copy link
Collaborator

I know where that error comes from, but I don't know enough about the implementation to know if we can unhook the volume attribute from the asset load.

@astronouth7303 knows this bit of code.

@AstraLuma
Copy link
Member

OH yes. That was a dumb implementation.

Asset loads don't begin until the engine initializes, and the volume implementation depends on it.

This can be fixed without API changes.

Although upon review I wonder if this is a bad API because it'll change the volume for all usages and there's no way to create new copies.

@pathunstrom
Copy link
Collaborator

Maybe make the volume be a parameter to the event and the sound system can duplicate at the place of use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug discussion Issues that more just discussing than specific flaws or features
Projects
None yet
Development

No branches or pull requests

3 participants