lib/beats/kit_builder.rb
# Raised when trying to load a sound file which can't be found at the path specified
Raised when trying to load a sound file which can't be found at the path specified
Raised when trying to load a sound file which can ' t be found at the path specified
def add_item(label, filenames)
      if filenames.is_a?(Array)
        if filenames.empty?
          raise SoundFileNotFoundError, "Kit sound '#{label}' is an empty composite sound (i.e. \"[]\"), which is not valid."
        end
        @composite_replacements[label] = []
        filenames.each do |filename|
          unless filename.is_a?(String)
            raise SoundFileNotFoundError, "Kit sound '#{label}' contains an invalid filename: '#{filename}'. It must be a value that will be parsed from YAML as a String."
          end
          composite_replacement = "#{label}-#{File.basename(filename, ".*")}"
          @labels_to_filenames[composite_replacement] = absolute_file_name(filename)
          @composite_replacements[label] << composite_replacement
        end
      else
        unless filenames.is_a?(String)
          raise SoundFileNotFoundError, "Kit sound '#{label}' has an invalid filename: '#{filenames}'. It must be a value that will be parsed from YAML as a String."
        end
        @labels_to_filenames[label] = absolute_file_name(filenames)
        @composite_replacements.delete(label)
      end
    end
def add_item ( label , filenames ) if filenames . is_a? ( Array ) if filenames . empty? raise SoundFileNotFoundError , "Kit sound '#{label}' is an empty composite sound (i.e. \"[]\"), which is not valid." end @composite_replacements [ label ] = [ ] filenames . each do | filename | unless filename . is_a? ( String ) raise SoundFileNotFoundError , "Kit sound '#{label}' contains an invalid filename: '#{filename}'. It must be a value that will be parsed from YAML as a String." end composite_replacement = "#{label}-#{File.basename(filename, ".*")}" @labels_to_filenames [ composite_replacement ] = absolute_file_name ( filename ) @composite_replacements [ label ] << composite_replacement end else unless filenames . is_a? ( String ) raise SoundFileNotFoundError , "Kit sound '#{label}' has an invalid filename: '#{filenames}'. It must be a value that will be parsed from YAML as a String." end @labels_to_filenames [ label ] = absolute_file_name ( filenames ) @composite_replacements . delete ( label ) end end
Raised when trying to load a sound file which can't be found at the path specified
Raised when trying to load a sound file which can ' t be found at the path specified
label
filenames