home *** CD-ROM | disk | FTP | other *** search
- 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 linear value to log
- --------------------------------------------------
- On entry: R0 = Signed 13-bit linear value
- On exit: R0 = 8-bit logarithmic value
-
- Converts a linear value to the logarithmic approximation.
-
-
- &C008D 'WE_LogToLin' Convert a logarithmic value to lin
- -------------------------------------------------------
- On entry: R0 = 8-bit logarithmic value
- On exit: R0 = Signed 13-bit linear value
-
- Converts a logarithmic value to the linear approximation.
-
-
- &C008E 'WE_Redraw' Plot the sample to the vdu
- ---------------------------------------------
- On entry: R1 = Pointer to normal Wimp_RedrawWindow block.
-
- This SWI will plot (part of) the sample on the screen using the supplied
- values. It's suitable for displaying the sample in a window. Before this SWI
- is called, WE_SetVars (&C0099) should be called at least once to specify
- various values. It is intended for being called in response to a
- RedrawWindow poll action.
-
-
- &C008F 'WE_Reverse' Reverse (part of) the sample
- ------------------------------------------------
- On entry: R0 = Start offset into sample
- R1 = End offset into sample
-
- This SWI will reverse the order of the values in the given part of the
- sample.
-
-
- &C0090 'WE_Extend' Extend the sample while possibly moving it
- -------------------------------------------------------------
- On entry: R0 = New length
- R1 = New offset to put old data from
-
- This SWI will attempt to extend the sample to the given length. After
- doing this, the data is moved to the given offset into the new sample.
- In the current version of the module, space must be available for both the
- old and the new sample. This will be changed some day.
-
- Possible errors:
- 'Can't claim enough RMA space'
-
-
- &C0091 'WE_Reduce' Reduce the length of the sample
- --------------------------------------------------
- On entry: R0 = New length
-
- This SWI will reduce the length of the sample to the new length given. In
- the current version of the module, space must be available for both the old
- and the new sample. This will be changed the same day.
-
- Possible errors:
- 'Can't claim enough RMA space'
-
-
- &C0092 'WE_Copy' Copy part of the sample
- ----------------------------------------
- On entry: R0 = Source start offset
- R1 = Source end offset
- R2 = Destination start offset
-
- This SWI will copy the specified part of the sample to the new position
- given.
-
-
- &C0093 'WE_Create' Create an empty sample
- -----------------------------------------
- On entry: R0 = Length
-
- This call will claim the specified space as a sample and clear it to 0.
-
-
- &C0094 'WE_Maximum' Return maximum in (part of) the sample
- ----------------------------------------------------------
- On entry: R0 = Start offset
- R1 = End offset
- On exit: R0 = Maximum (signed 13-bit linear, but always positive)
-
- This SWI will read through the values at the range given, and return the
- absolute value of the largest one found.
-
-
- &C0095 'WE_Sample' Read data from the ADC into the sample
- ---------------------------------------------------------
- On entry: R0 = Trigger level (13-bit positive linear value)
- R1 = Sample period in 0.5 µs units
-
- This call will set up the neccesary parametres for an 'ADC_Sample' call
- and then call it. See the documentation about 'SampleMod' for a more
- detailed description about the sampling itself.
-
-
- &C0096 'WE_Length' Return length of sample using a given threshold
- ------------------------------------------------------------------
- On entry: R0 = Threshold (signed 13-bit linear, should be positive)
- On exit: R0 = Offset to last value
-
- This SWI will search through the sample for the last value greater than or
- equal to the threshold given. It is not used by WaveEdit, but by a program
- called AutoSample to find the audible end of a sample.
-
-
- &C0097 'WE_AppendData' Append (part of) the sample to an open file
- ------------------------------------------------------------------
- On entry: R0 = File handle
- R1 = Start offset
- R2 = End offset
-
- This SWI will simply append the specified part of the sample to an open
- file.
-
-
- &C0098 'WE_UpdatePars' Adjust the parametres while playing the sample
- ---------------------------------------------------------------------
- On entry: R0 = Start offset
- R1 = End offset
- R2 = Loop flag
- R3 = Loop start offset
- R4 = Loop end offset
-
- This SWI takes the same parametres as 'WE_Play', but can be called while
- the sample is being played. The changes come into effect on the next buffer
- fill event.
-
- Possible errors:
- 'No sample to play',
- 'Can't start beyond end of sample',
- 'Can't play beyond end of sample'
-
- &C0099 'WE_SetVars' Set WE_Redraw and WE_Update parametres
- ----------------------------------------------------------
- On entry: R0 = Window handle
- R1 = Start mark or -1
- R2 = End mark (if R1<>-1)
- R3 = Zoom
- R4 = Cursor position or -1
- R5 = Line mode
-
- This SWI sets up the way to display the sample. R1, R2 and R4 are all
- offsets in bytes from the start of the sample. R1=-1 means that no area is
- marked. Zoom is log2 to the zoom factor, 0 being 1:1. Line mode is 0-3 for
- Dots, Amp, Line and Full.
-
-
- &C009A 'WE_Update' Update the sample on the vdu
- -----------------------------------------------
- On entry: R0 = Start offset
- R1 = End offset
-
- This SWI will update part of the sample by calling Wimp_UpdateWindow and
- then entering the redraw loop as WE_Redraw. WE_SetVars (&C0099) should be
- called at least once before this SWI is called.
-
- &C009B 'WE_Mix' Mix part of the sample with another
- ---------------------------------------------------
- On entry: R0 = Destination start offset
- R1 = Destination end offset
- R2 = Mix start offset
-
- This SWI will overlay the specified part of the sample with another part,
- starting at R2.
-