Sha256: 79a9d0e02f92287dd6bddaee32a8f15925c12b3ebd0fa0aeb620f781aba4408a

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

module Ray
  module SoundBufferSet
    extend Ray::ResourceSet

    class << self
      def missing_pattern(string)
        Ray::SoundBuffer[string]
      end

      def select!(&block)
        super(&block)
        Ray::SoundBuffer.select!(&block)
      end
    end
  end

  # Creates a new sound buffer set.
  #
  # @param [Regexp] regex Regular expression used to match file
  # @yield [*args] Block returning the sound buffer
  # @yieldparam args Regex captures
  def sound_buffer_set(regex, &block)
    Ray::SoundBufferSet.add_set(regex, &block)
  end

  module_function :sound_buffer_set
end

require 'open-uri'
Ray.sound_buffer_set(/^(http|ftp):\/\/(\S+)$/) do |protocol, address|
  open("#{protocol}://#{address}") { |io| Ray::SoundBuffer.new(io) }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 lib/ray/sound_buffer_set.rb
ray-0.2.0 lib/ray/sound_buffer_set.rb
ray-0.1.1 lib/ray/sound_buffer_set.rb
ray-0.1.0 lib/ray/sound_buffer_set.rb