home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
utilities
/
utilst
/
thsound
/
THSoundDoc
< prev
Wrap
Text File
|
1995-12-21
|
3KB
|
76 lines
THSound
=======
by:
Tony Houghton
271 Upper Weston Lane
Southampton
SO19 9HY
tonyh@tcp.co.uk
The purpose of THSound is to allow many different samples to be played
without having to load each one as a module in its own right (often
impractical due to potential name clashes). All it does is take a pointer to
some data and use this to make a sound voice. THSound is deliberately very
basic for flexibility. It is up to your program to manage memory for the
sample data, and to attach the voice to channels and play it using the
standard Sound SWIs.
I wrote THSound because I was writing a program which needed to play a large
number of samples, the data for these being embedded in large files with
other resources. I couldn't find a PD program which could do what I wanted
(other modules only seem to be able to load samples as files) so I studied
the PRM and THSound was born.
Conditions of use
-----------------
THSound may be freely distributed. It may be used in applications provided it
is unaltered and you credit me, the author. If possible, please include this
file with it (I know that won't always be possible), or at least indicate
that it is available with instructions from PD libraries. As a courtesy it
would be very nice if you send me copies of any programs you write which use
it.
Technical details
=================
THSound contains three SWIs for sound sample handling; its SWI chunk is
&4B780 (officially registered with Acorn).
SWI's
-----
THSound_InstallSample &4b780
Entry: R0 = Address of sample (in VIDC 8-bit signed log format)
R1 = Size of sample in bytes (word aligned)
R2 = Slot to install in or 0 for next free slot (see
Sound_InstallVoice)
Exit: R0 = Sample's "handle" (pointer to workspace)
R1 = Voice slot sample is installed in
R2 = Voice slot (copy of R1)
It is recommended that sample data is kept in the RMA, using OS_Module for
memory management (Archimedes), or in a dynamic area (Risc PC). Having sample
data in application workspace could crash SoundDMA if the application is
paged out eg by Wimp_Poll while the sample is playing.
Each sample's voice is given the name THSVoice<hh> where <hh> is a unique hex
code.
THSound_RemoveSample &4b781
Entry: R0 = Sample's handle
Exit: R0 Preserved
Use this to kill a THSound sample, do not use Sound_RemoveVoice. The sample's
data is not freed, just its workspace (handle) allocated when it was
installed.
THSound_GetVoiceSlot &4b782
Entry: R0 = Sample's handle
Exit: R0 Preserved
R1 = Voice slot
Finds the sample's voice slot in case you haven't stored the value returned
by THSound_InstallVoice.