home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilst
/
waveedit
/
!WaveEdit
/
Dox
/
WESound
< prev
Wrap
Text File
|
1993-11-14
|
14KB
|
394 lines
WESound 1.20 docs.
==================
WESound has no commands, but a lot of SWI's. It is designed to keep a
sample in memory for modifying or playing.
Short SWI list
==============
&C0080 WE_Load Load a sample into memory
&C0081 WE_LoadAt Load a sample at a specified position
&C0082 WE_Save Save (part of) the sample in memory
&C0083 WE_Free Forget the sample and free the memory
&C0084 WE_Peek Read a value from the sample
&C0085 WE_LinPeek Read a linear value from the sample
&C0086 WE_Poke Store a value in the sample
&C0087 WE_LinPoke Store a linear value in the sample
&C0088 WE_Play Prepare to play (part of) the sample
&C0089 WE_Amplify Amplify one value
&C008A WE_AmplifyPart Amplify part of the sample
&C008B WE_Convert Convert (part of) the sample from lin to log
&C008C WE_LinToLog Convert a linear value to log
&C008D WE_LogToLin Convert a logarithmic value to lin
&C008E WE_Redraw Plot the sample to the vdu
&C008F WE_Reverse Reverse (part of) the sample
&C0090 WE_Extend Extend the sample while possibly moving it
&C0091 WE_Reduce Reduce the length of the sample
&C0092 WE_Copy Copy part of the sample
&C0093 WE_Create Create an empty sample
&C0094 WE_Maximum Return maximum in (part of) the sample
&C0095 WE_Sample Read data from the ADC into the sample
&C0096 WE_Length Return length of sample using a given threshold
&C0097 WE_AppendData Append (part of) the sample to an open file
&C0098 WE_UpdatePars Adjust the parametres while playing the sample
&C0099 WE_SetVars Set modes for redrawing
&C009A WE_Update Update a part of the sample to the vdu.
&C009B WE_Mix Mix one part of the sample with another.
SWIs in detail
==============
General note: When few or no errors are listed under 'Possible errors', care
should be taken about the parametres passed to the routine. There are no
bounds checking in these routines.
&C0080 'WE_Load' Load a sample into memory
------------------------------------------
On entry: R0 = Pointer to zero-terminated filename
On exit: R0 = Length of file
This call will claim sufficient memory from the RMA and load a file into
it. This cannot be done if a sample has already been loaded, you must call
WE_Free (&C0083) first to release the memory.
Possible errors:
'Sample memory occupied',
'Can't claim enough RMA space'
&C0081 'WE_LoadAt' Load a sample at a specified position
--------------------------------------------------------
On entry: R0 = Pointer to zero-terminated filename
R1 = Destination offset
A file is loaded starting from the given position in an existing sample.
Care must be taken to ensure that there is sufficient room for the resulting
sample, i.e. if the loading of the file would make the sample longer, you
must use 'WE_Extend' first.
&C0082 'WE_Save' Save (part of) the sample in memory
----------------------------------------------------
On entry: R0 = Pointer to zero-terminated filename
R1 = Filetype to give the file
R2 = Start offset into sample
R3 = End offset into sample +1
This SWI will save part of the sample as a file.
&C0083 'WE_Free' Forget the sample and free the memory
------------------------------------------------------
This SWI takes no parametres and will simply release the memory previously
occupied by the sample. Don't Free a sample while it's sounding!
&C0084 'WE_Peek' Read a value from the sample
---------------------------------------------
On entry: R0 = Offset into sample
On exit: R0 = Value at offset
Returns the value at the given offset as a logarithmic value.
Possible errors:
'Read operation beyond end of sample'
&C0085 'WE_LinPeek' Read a linear value from the sample
-------------------------------------------------------
On entry: R0 = Offset into sample
On exit: R0 = Value at offset converted to linear
Returns the value at the given offset as a 13-bit signed linear value.
Possible errors:
'Read operation beyond end of sample'
&C0086 'WE_Poke' Store a value in the sample
--------------------------------------------
On entry: R0 = Offset into sample
R1 = Value to store at offset
Stores the given 8-bit logarithmic value at the specified offset into the
sample.
Possible errors:
'Write operation beyond end of sample'
&C0087 'WE_LinPoke' Store a linear value in the sample
------------------------------------------------------
On entry: R0 = Offset into sample
R1 = Linear value to store at offset
Stores the given 13-bit signed linear value at the specified offset after
converting it to log.
Possible errors:
'Write operation beyond end of sample'
&C0088 'WE_Play' Prepare to play (part of) the sample
-----------------------------------------------------
On entry: R0 = Start offset
R1 = End offset
R2 = Loop flag
R3 = Loop start offset (*)
R4 = Loop end offset (*)
This SWI prepares the voice routine for playing the specified part of the
sample at the next Sound command. The Loop flag is either -1 or 0 to use the
loop data or not. Note, that the loop offsets are offsets from the start
point rather than from the start of the sample. The sound is then controlled
as follows:
SOUND 1,&17F,<pitch>,255 to play the sample. (GateOn)
SOUND 1,&180,<pitch>,255 to stop the sample. (GateOff)
The pitch is needed in the gate-off command because the sound is not
immediately cut off but scaled lineary to 0-amplitude in approx. 0.1 sec.
Without looping, the playing routine just plays the sample to the end unless
stopped by you. When looping, it will play as follows:
Sample offset
^
SE+
| /
| /
| /
LE+ /
| / / / /
| / / / /
| / / / /
| / / / /
LS+ / / / /
| /
| / |
| / |
| / |
| |/ |
SS+--+---------------------+-------> Time
| |
GateOn GateOff
SS = Sample start, LS = Loop start, LE = Loop end, SE = Sample end
Once the GateOff is triggered, the looping is cancelled, and the sample is
played to the end. That's why it's vital always to have some form of fading
at the end of the sample. If, however, the GateOff is received before the
looping has begun, the sound is faded at once, like when no looping is being
used.
Possible errors:
'No sample to play',
'Can't start beyond end of sample',
'Can't play beyond end of sample'
&C0089 'WE_Amplify' Amplify one value
-------------------------------------
On entry: R0 = Offset into sample
R1 = Gain
This SWI will amplify a single value in the sample by the gain specified.
The gain is given as a fixed point value with the point at bit 17. I.e. to
convert a Basic floating point variable 'Gain' into a suitable value, use:
SYS "WE_Amplify",Offset%,Gain*&20000
&C008A 'WE_AmplifyPart' Amplify part of the sample
--------------------------------------------------
On entry: R0 = Start offset into sample
R1 = End offset into sample
R2 = Gain
This call will amplify a given part of the sample by the given gain. The
gain is of the same type as in 'WE_Amplify'.
&C008B 'WE_Convert' Convert (part of) the sample from lin to log
----------------------------------------------------------------
On entry: R0 = Start offset
R1 = End offset
This SWI expects the values at the positions specified to be signed 8-bit
linear values. It will then convert them to logarithmic values.
&C008C 'WE_LinToLog' Convert a