Skip to content

initialize pygame mixer before use#306

Open
NetSpida wants to merge 1 commit intoadangert:masterfrom
NetSpida:mixerinit
Open

initialize pygame mixer before use#306
NetSpida wants to merge 1 commit intoadangert:masterfrom
NetSpida:mixerinit

Conversation

@NetSpida
Copy link

@NetSpida NetSpida commented Aug 4, 2023

It seems that pygame.mixer was not always initialized.
Fixes #305

@adangert
Copy link
Owner

adangert commented Aug 4, 2023

Thanks! I'll test these soon

@adangert
Copy link
Owner

adangert commented Aug 6, 2023

Hi @NetSpida pygame mixer should always be initialized here: https://github.com/adangert/JoustMania/blob/master/piaudio.py#L274 and https://github.com/adangert/JoustMania/blob/master/piparty.py#L1050

I also tried changing the initialization from pygame.mixer.init(47000, -16, 2 , 4096) to pygame.mixer.init() which lists the frequency, size, channels, and buffer, and started getting a bunch of garbled audio and ALSA lib pcm.c:8545:(snd_pcm_recover) underrun occurred errors in the console.

have you tried doing a clean install of the raspberry pi OS and setup.sh? I'm not seeing this happen on my end.

@DrDecagon
Copy link
Contributor

DrDecagon commented Aug 9, 2023

pygame mixer also gets initialized in update.py. Is it possible it does not release control of the device for piparty.py in some cases. If so, it could cause the pygame.error: ALSA: Couldn't open audio device: Invalid argument errors.

I tried this patch, except with pygame.mixer.init(47000, -16, 2 , 4096) instead of pygame.mixer.init() but still get errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants