Skip to content

Commit

Permalink
Merge remote-tracking branch 'timfel/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterc committed Aug 24, 2011
2 parents 81398f1 + f446bb5 commit 46e6352
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion escape/sound.rb
@@ -1,4 +1,6 @@
java_import javax.sound.sampled.AudioSystem
java_import javax.sound.sampled.Clip
java_import javax.sound.sampled.DataLine

class Sound
attr_accessor :clip
Expand All @@ -8,7 +10,8 @@ def self.load_sound(file_name)

url = java.net.URL.new("file://" + ASSETS_DIR + file_name) # nasty little hack due to borked get_resource (means applet won't be easy..)
ais = AudioSystem.get_audio_input_stream(url)
clip = AudioSystem.clip
info = DataLine::Info.new(Clip.java_class, ais.format)
clip = AudioSystem.get_line(info)
clip.open(ais)
clip.extend JRuby::Synchronized
sound.clip = clip
Expand Down

0 comments on commit 46e6352

Please sign in to comment.