Sha256: eef3cc194d5ef45d965cd5eaaca193b68ac90ea60497e47fef6feb47a05da1f7

Contents?: true

Size: 1.01 KB

Versions: 26

Compression:

Stored size: 1.01 KB

Contents

# lib/gemwarrior/misc/music.rb
# Music cue

module Gemwarrior
  module Music
    def self.cue(sequence)
      defaults = {
        :freq_or_note => 440, 
        :waveform     => 'saw', 
        :volume       => 0.3, 
        :duration     => 500,
        :notext       => true
      }

      Thread.start {
        sequence.each do |note|
          note_to_play  = note[:freq_or_note]
          waveform      = note[:waveform].nil? ? defaults[:waveform] : note[:waveform]
          volume        = note[:volume].nil? ? defaults[:volume] : note[:volume]
          duration      = note[:duration].nil? ? defaults[:duration] : note[:duration]
          notext        = note[:notext].nil? ? defaults[:notext] : note[:notext]

          Feep::Base.new({
            :freq_or_note => note_to_play, 
            :waveform     => waveform, 
            :volume       => volume, 
            :duration     => duration,
            :notext       => notext
          })
        end
      }
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
gemwarrior-0.9.24 lib/gemwarrior/misc/music_exp.rb
gemwarrior-0.9.23 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.22 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.21 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.20 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.19 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.18 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.17 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.16 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.15 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.14 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.13 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.12 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.10 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.9 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.8 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.7 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.6 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.5 lib/gemwarrior/misc/music.rb
gemwarrior-0.9.4 lib/gemwarrior/misc/music.rb