Linux/python27/pygame not recognizing audio device

Started by BIG-L, August 11, 2014, 04:37:54 AM

Previous topic - Next topic

BIG-L

Gentlemen and Ladies,

Running Python27 & Pygame on A20 debian disy driving LCD & TS (or HDMI dislay for debug) 

The pygame mixer throws off a "no device found" error

Audio app runs fine on the desktop (XP running same python and pygame) obviously not the same hardware or OS but the python/pygame structure is correct.

Not sure I have the sound system in linux properly loaded or initiated ??

What do I need to turn on that's not.

Otherwise this A20 setup has exceeded my expectations!!! 

Regards & Thanks

Insomniac10102

Which board are you using? Can you share any of your code?

BIG-L

Good morning inso ........

Board is A20-OLinuXino-MICRO-4GB.  OS is the Debian Distro provided by Olimex.  Current version

some code that behaves as noted:

# >>>>>> Code starts here >>>>>>>>>>

import pygame
pygame.init()

# Define some colors
white = (255, 255, 255)
black = (0, 0, 0)
blue = (0, 0, 255)

# Call this function so the Pygame library can initialize itself


# Create an 800x480 sized surface named "screen"
screen = pygame.display.set_mode([800, 480])
screen.fill(black)

# This sets the name of the window
pygame.display.set_caption('test')

clock = pygame.time.Clock()

# Before the loop, load the sounds:
click_sound = pygame.mixer.Sound("click.ogg")
alarm_sound = pygame.mixer.Sound("beep2.ogg")

# error occurs when trying to load sounds in two lines above - returns "no device found"

# Set positions of graphics
background_position = [0, 0]
# assigns 0,0 to background_postiion variable

# "scrn_id" controlls the sub modes of the unit
font1 = pygame.font.Font(None, 34)
font2 = pygame.font.Font(None, 100)


# Load and set up graphics.
seq0_image = pygame.image.load("scrn_00.jpg").convert()
seq1_image = pygame.image.load("scrn_0a.jpg").convert()
cursor_image = pygame.image.load("mark.jpg").convert()
cursor_image.set_colorkey(white)

done = False

loop_cnt = 0
salpha = 0
screen_image = seq0_image
x = 0
y = 0


#main loop

while not done:
    salpha = salpha + 5
    if salpha > 255:
        salpha = 256
    screen_image.set_alpha(salpha)   
    screen.blit(screen_image,background_position)
    clock.tick(10)
    loop_cnt = loop_cnt + 1

# activity indicator

    if loop_cnt > 9:
        loop_cnt = 0
    if loop_cnt < 5:
        texta = font1.render("+", 1, white, blue)
    if loop_cnt >= 5:
        texta = font1.render("+", 1, blue, blue)   
   
    for event in pygame.event.get():

        if event.type == pygame.QUIT:
            done = True            # this is the exit option
        elif event.type == pygame.MOUSEBUTTONDOWN:
     
            player_position = pygame.mouse.get_pos()
            click_sound.play()
            x = player_position[0]
            y = player_position[1]
            screen.blit(cursor_image, [x, y])
           
    screen.blit(texta, (775, 450))
    pygame.display.flip()
    pygame.time.delay(10)

pygame.quit ()


As I stated -- this code runs fine on Windows OS running same versions of Python and Pygame.

Thanks