Hey,
We are busy creating a nice game in Python/Panda3D and we are now at the point of implementing the audio part.
After reading the documentation we decided to use the audio3dmanager.
Now i have one audiosys.py file, where the audio files are managed. Other .py files import this file so the function of, for instance, jumping can use the code: self.play_sound(“jump”).
Now, using the 3d audio manager, we got some nasty error:
:audio(warning): stereo sound /c/SVN/trunk/code/media/audio/tada.wav will not be spatialized
:audio(warning): stereo sound /c/SVN/trunk/code/media/audio/tada.wav will not be spatialized
:audio(warning): stereo sound /c/SVN/trunk/code/media/audio/tada.wav will not be spatialized
:audio(warning): stereo sound /c/SVN/trunk/code/media/audio/tada.wav will not be spatialized
Seems nobody at google has this error, and i have no idea at all what’s wrong with this. Everything seems right :<.
Code:
from direct.showbase import Audio3DManager
audio3d = Audio3DManager.Audio3DManager(base.sfxManagerList[0], camera)
class SoundByteWAV(object):
sound = None
def __init__(self, name):
self.sound = audio3d.loadSfx('media/audio/%s.wav' % name)
class SoundByteMP3(object):
sound = None
def __init__(self, name):
self.sound = audio3d.loadSfx('media/audio/%s.mp3' % name)
class AudioHelper():
cur = ""
sounds = {
'jump': SoundByteWAV('tada'),
'evil': SoundByteWAV('tada'),
'good': SoundByteWAV('tada'),
'streetlight': SoundByteWAV('tada')
}
def play_sound(self, sound_name):
the_sound = self.sounds[sound_name].sound
the_sound.stop()
the_sound.play()
def attach_sound(self, sound_name, object_name):
the_sound = self.sounds[sound_name].sound
audio3d.attachSoundToObject(the_sound, object_name)
def loop_sound(self, sound_name, bool):
the_sound = self.sounds[sound_name].sound
the_sound.setLoop(bool)