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 load_sample_buffer(filename)
      sample_buffer = nil
      begin
        reader = WaveFile::Reader.new(filename)
        reader.each_buffer(reader.total_sample_frames) do |buffer|
          sample_buffer = buffer
        end
      rescue Errno::ENOENT
        raise SoundFileNotFoundError, "Sound file `#{filename}` not found."
      rescue WaveFile::UnsupportedFormatError
        raise InvalidSoundFormatError, "Sound file `#{filename}` is not a supported *.wav format. Beats can use *.wav files with a sample format of 8/16/24/32 PCM or floating point."
      rescue WaveFile::InvalidFormatError
        raise InvalidSoundFormatError, "Sound file `#{filename}` is either not a sound file, or is in an unsupported format. Beats can use *.wav files with a sample format of 8/16/24/32 PCM or floating point."
      end
      sample_buffer
    end
def load_sample_buffer ( filename ) sample_buffer = nil begin reader = WaveFile :: Reader . new ( filename ) reader . each_buffer ( reader . total_sample_frames ) do | buffer | sample_buffer = buffer end rescue Errno :: ENOENT raise SoundFileNotFoundError , "Sound file `#{filename}` not found." rescue WaveFile :: UnsupportedFormatError raise InvalidSoundFormatError , "Sound file `#{filename}` is not a supported *.wav format. Beats can use *.wav files with a sample format of 8/16/24/32 PCM or floating point." rescue WaveFile :: InvalidFormatError raise InvalidSoundFormatError , "Sound file `#{filename}` is either not a sound file, or is in an unsupported format. Beats can use *.wav files with a sample format of 8/16/24/32 PCM or floating point." end sample_buffer 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
filename