risoundlib
This library has one command, CludgeSound. It does for sounds what
CludgeShapes does for shapes: it takes an IFF 8SVX sample that the
program already has in memory, for example loaded into a bank, and
makes a sound object of it, the same object that LoadSound of
audiolib fills.
The sample is copied into chip memory, so the file in memory can be
freed afterwards, and the sound is played with Sound as usual.
The sound gets no loop: it plays once. The file must be a valid IFF file, with the pad byte behind every chunk of odd length, and have its sample data among its first seven chunks (see the command’s notes).
Its successor, the second sound library
(risoundlib2),
has the same library number and the same CludgeSound, so only one of
the two can be installed. This one belongs to the library variant
rwe-1999; the variant rwe-1999-ahi has the second one instead
(The RWE userlibs).
LoadBank 0,"sound.8svx"
If CludgeSound(0,Bank(0))
FreeBank 0
Sound 0,1
EndIf
MouseWaitBased on the RI Sound Lib guide by Red When Excited.
Library number 45.
Commands
CludgeSound
Makes sound object sound# from the IFF 8SVX file at address in memory, copying its sample into chip memory. As a function it returns -1 on success, and 0 if the file cannot be used (see below); without enough chip memory the program stops with the runtime error “Out of Memory!”.
Statement or function, result .l. Help text: sound#,address
Arguments: .l, .l
The result is 0 if the file is no 8SVX file with a header chunk, has a sample rate of 0, has no sample data among its first seven chunks (the header chunk included), or has an empty sample or one of 131072 bytes or more. The search for the sample data expects the pad byte that IFF puts behind a chunk of odd length, and ends at the end of the file’s FORM.
The sound object’s old sample is freed only when the file has passed
these checks, so a call that fails leaves the sound as it was. The
old sample is not freed when it is data in chip memory that
DecodeSound uses where it is. The playback rate comes from the
file’s header; the sound has no loop.