[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Pygame won't send audio to A/V jack



I need Pygame to direct its audio to the 3.5mm A/V jack, and NOT to the HDMI audio..... but can't get it working.

I select A/V jack in the Py desktop, and I try several programs and they are then sending their audio to the A/V jack. But when I then run my Pygame program, the audio only comes out the HDMI.

Got a suggestion that if I disable the HDMI audio driver, that would force the A/V jack output..... tried it (rt-click on speaker, click 'Device Profiles', set HDMI to 'off'), and even though the desktop shows the driver now disabled, Pygame still sends the audio to my HDMI monitor and not the A/V jack.

Then I disconnected the HDMI monitor, rebooted with my Python/Pygame program auto-starting (via rc.local launch), and it runs headless still without A/V audio.  If I then hot plug in the HDMI monitor, the audio is indeed going to the monitor!

At one point, after trying many of the above descriptions in random sequence, the A/V audio started working..... but then on reboot it stopped, and I haven't been able to recreate the success!

Here's my simple test program:

====================
import g                #GLOBAL CONSTANTS
import pygame
import time
from    pygame.locals    import *

def main():
    pygame.init()
    pygame.mixer.init()
    pygame.mixer.music.load (g.HOME_DIR + "music/FroggieWentaCourtin.ogg")

    snd1 = pygame.mixer.Sound( g.HOME_DIR + "sounds/funfiles/SimpsonsWhen17.ogg")
    snd2 = pygame.mixer.Sound( g.HOME_DIR+ "sounds/funfiles/NoStinkinBadges.ogg")

    while True:
        if not pygame.mixer.music.get_busy():         # if bkgnd music done, restart it.
            pygame.mixer.music.play()
            pygame.mixer.music.set_volume(0.3)

        if not pygame.mixer.get_busy():                    # If both sound-files are done, restart them.
            snd1.play()
            snd2.play()

        time.sleep(.5)
====================


Any suggestions would be REALLY welcome....