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

Re: [pygame] Using sound with python 2.7 and above



Thanks code now seems to work

#------------------------------------------------------------------------------

import pygame

#------------------------------------------------------------------------------

from App_Class import *

#------------------------------------------------------------------------------

def main():


 retValue = pygame.mixer.pre_init(frequency=22050, size=-16, channels=2, buffer=4096)
ÂÂ
 pygame.init()

 if retValue == None:Â
  print ("Warning, sound disabled")

 app = AppClass ()

 app.run ()

#------------------------------------------------------------------------------

#this calls the 'main' function when this script is executed
if __name__ == '__main__': main()

#------------------------------------------------------------------------------

On 29 October 2014 17:38, Alec Bennett <wrybread@xxxxxxxxx> wrote:
Looking at the docs:

http://www.pygame.org/docs/ref/mixer.html

You also need to init the mixer.



On Wed, Oct 29, 2014 at 10:33 AM, Ian Dickinson <ianldickinson52@xxxxxxxxx> wrote:
no change it still prints warning



On 29 October 2014 16:43, Alec Bennett <wrybread@xxxxxxxxx> wrote:
And if you put that line after the pygame.init() line?



On Wed, Oct 29, 2014 at 7:37 AM, NuMedia <ianldickinson52@xxxxxxxxx> wrote:
Hi can any one help with this when using python 2.7 and above or 3.X the line

Âif not pygame.mixer:
  print 'Warning, sound disabled'

message gets printed how do i get round this

thanks NuMedia

code below

#------------------------------------------------------------------------------

import pygame

#------------------------------------------------------------------------------

from App_Class import *

#------------------------------------------------------------------------------

def main():

 if not pygame.mixer:
  print 'Warning, sound disabled'

 pygame.init()

 app = AppClass ()

 app.run ()

#------------------------------------------------------------------------------

#this calls the 'main' function when this script is executed
if __name__ == '__main__': main()

#------------------------------------------------------------------------------



--
View this message in context: http://pygame-users.25799.x6.nabble.com/Using-sound-with-python-2-7-and-above-tp1492.html
Sent from the pygame-users mailing list archive at Nabble.com.