If I wrote, that you could try this sample, I didn't meant to play in a player, but in Gosu. Code below is simplest possible to show the problem. I just don't know WHAT IS WITH THIS SAMPLE THAT GOSU DOESN'T PLAY IT CORRECTLY.
____________
require 'gosu'
include Gosu
class GameWindow < Gosu::Window
def initialize
super(640, 480, false)
self.caption = "Test Game"
Sample.new(self,'mgunr.wav').play
end
def update
end
def draw
end
end
GameWindow.new.show
By jlnr (dev)
Date 2010-10-20 21:14
I think you don't do that in your real game, but: Sample.new(...).play is a bit dangerous because the Sample may be garbage-collected while playing. Not sure what (and on which platform) happens then :)
This works for me:
begin
require 'rubygems'
rescue LoadError
end
require 'gosu'
class GameWindow < Gosu::Window
def initialize
super(640, 480, false)
self.caption = "Gosu Tutorial Game"
s = Gosu::Sample.new(self,"mgunr.wav")
s.play
end
def update
end
def draw
end
end
window = GameWindow.new
window.show