Esempio n. 1
0
def init(camera, nb_channels = 16, freq = 44100, size = -16, stereo = 2, buffersize = 1024):
	"""init(camera, nb_channels = 16, freq = 44100, size = -16, stereo = 2, buffersize = 1024)

Inits OpenAL for Soya. CAMERA will be used to compute the position of the listener ;
it is not required that it is a Camera, though it is usually one."""
	
	global _LISTENER, _CAMERA, _INITED, _CHANNELS
	_CAMERA = camera
	_FRONT.__init__(_CAMERA, 0.0, 0.0, -1.0)
	_DIR  .__init__(_CAMERA, 0.0, 0.0,  0.0)
	if not _INITED:
		soya.BEFORE_RENDER.append(render)
		pysdl_mixer.init(freq, size, stereo, buffersize)
		pysdl_mixer.allocate_channels(nb_channels)
		_CHANNELS = range(nb_channels)
		_INITED = 1
Esempio n. 2
0
    # clear the inputs value ready for the next user input 
    self.input.value=''

  def begin_round(self):
    MenuIdler.begin_round(self)
    
    # just send all events to the input 
    for e in soya.process_event():
      self.input.process_event(e)
       
 
if __name__=='__main__':
  soya.init(width=800,height=600,title="Balazar Bomber")
  
  #soya.init_audio()
  mixer.init();  

  # play our music file on loop forever :D
  #music=soya.MusicFile(os.path.join(SOUNDS,'test.mod'))
  #music.play(-1)
  music=mixer.Music(os.path.join(SOUNDS,'test.mod'))
  music.play()

  # we load this for later
  #explosion_sound=soya.AudioFile(os.path.join(SOUNDS,'explosion.wav'))
  #bonus_sound=soya.AudioFile(os.path.join(SOUNDS,'arcade.wav'))
  explosion_sound=mixer.Sample(os.path.join(SOUNDS,'explosion.wav'))
  bonus_sound=mixer.Sample(os.path.join(SOUNDS,'arcade.wav'))

  # turn on unicode key events for better text input
  soya.set_use_unicode(True)