WAD::Sound
Inherits WritingAdditions::Sound < Reference < Object
A normal sound effect.
Constants
Constructors
Converts a .wav file to a WAD::Sound given a filename
my_wav_sound = WAD::Sound.from_wav("Path/To/Sound.wav")
Converts a .wav file to a WAD::Sound given a io
File.open("Path/To/Sound.wav") do |io|
my_wav_sound = WAD::Sound.from_wav(io)
end
Parses a sound lump.
Opens a sound file and parses it:
my_sound = WAD::Sound.parse("Path/To/Sound")
Parses a sound lump.
Opens a sound io and parses it:
File.open("Path/To/Sound") do |file|
my_sound = WAD::Sound.parse(file)
end
Class methods
Checks to see if name is a sound with name format 'DSx..x'.
Returns true if the name is a sound:
sound_name = "DSNOWAY"
if WAD::Sound.is_sound?(sound_name)
puts "Is a Sound"
else
puts "Is not a Sound"
end
Instance methods
Returns a copy of self with all instance variables cloned.
UInt16 | UInt32 because when reading from a .wav, sample_rate is given in a UInt32
UInt16 | UInt32 because when reading from a .wav, sample_rate is given in a UInt32
UInt16 | UInt32 because when reading from a .wav, sample_num is given in a UInt32
UInt16 | UInt32 because when reading from a .wav, sample_num is given in a UInt32
Writes to wav file given an output file and returns the written file's size.
Writes a 'wav' file from the my_wad sound "DSPISTOL":
my_wad.sounds["DSPISTOL"].to_wav("Path/To/MyWav.wav")
Writes to wav file given an output io and returns the written file's size.
Writes a 'wav' file from the my_wad sound "DSPISTOL":
File.open("Path/To/MyWav.wav", "w+") do |io|
my_wad.sounds["DSPISTOL"].to_wav(io)
end