home *** CD-ROM | disk | FTP | other *** search
/ ISV Strong Games / ISV_STRONG_GAMES.iso / demos / syndicate / !SynDemo / DtVoxHelp < prev    next >
Text File  |  1998-06-14  |  70KB  |  1,495 lines

  1.       Help File for DataSuite
  2.       =======================
  3.  
  4.   DataSuite is not an application per se but is in fact a central resource
  5. application for the all applications using the DataSuite system of modules.
  6. The original idea for the resource application was by Julian Wright with minor
  7. sprite improvements by Philip R. Banks. The modules are all accesable by a new
  8. path - the DataSuite: path. All applications intending to use the modules
  9. should use this path to access them if need be.
  10.  
  11.    After having 'seen' this application you should be able to play most
  12. samples simply by double clicking on them. DataVox, Armadeus and DSEdit
  13. samples are all catered for. Furthermore a public area filtype, &FF, has been
  14. assigned to become 'un-typed' sound files that don't have file-types but do
  15. have enough header information to allow them to be played.
  16.  
  17.   The DataSuite set of modules is all code by P.R.Banks who can be contacted
  18. at :-
  19.  
  20.                   10 Southgate Rd,
  21.                   Island Bay,
  22.                   Wellington,
  23.                   New Zealand.
  24.  
  25. If you have any queries. Also included in with this application are the
  26. documentation files for the DataSuite Modules which are the powerhouse
  27. behind the application. These are located inside this application in the sub
  28. directory `Docs`.
  29.  
  30.    The DataVox, DataLoad, DataPatch and DataPlay modules are supplied as
  31. FreeWare. You may use these modules for any non-commercial program you care
  32. to. If you wish to use them in a commercial release then you must obtain my
  33. permision. Why am I releasing these modules as FreeWare? Because these
  34. modules make the use of the sound system much much easier as well as
  35. providing alot of much needed facilities that are currently missing. All I
  36. ask is that in any non-commercial release that you credit me for the use of
  37. the sound modules. Of course a copy of the program would be nice too but it
  38. is optional.
  39.  
  40.    Any other modules present in the DataSuite directory are not FreeWare but
  41. are copyright to me and may *not* be distributed. Any applications that
  42. need these extra modules will have them supplied with it.
  43.  
  44.  N.B. I do not take any responsibility for any damage or loss caused by
  45.         the use or misuse of this software in any way shape or form.
  46.  
  47.  
  48.  
  49.  DataVox Help File.
  50.  ==================
  51.  
  52.  NB If you are using this module under Risc OS kernel version 2.00 then you
  53.     must have IRQutils module v0.9 or greater loaded! This is because
  54.     DataVox makes heavy usage of transient call backs and the 2.00 kernel
  55.     routines have an error in them that IRQutils fixes. Failure to load
  56.     this module can result in address exceptions and your machine crashing!
  57.  
  58.    This module will play chunks of memory through the sound system with the
  59.  emphasis on being able to customise dynamically how it plays. It provides
  60.  several SWI's and * commands for it's control. It is to be noted that
  61.  while the voice can handle a large variety of types of data it cannot
  62.  handle 16 bit data *only* 8 bit data. If demand is high enough I will
  63.  update this module to handle 16 bit data but it will increase its size
  64.  somewhat dramatically! (Which is why I have not included it...)
  65.    The newest feature of this module is complete system speed independance
  66.  of playing of sounds. Code has been written into this module to ensure
  67.  that it will always *attempt* to play a sound at its correct pitch no
  68.  matter what the system speed (in micro seconds) is set to. Due to hardware
  69.  and software limitations this will not always sound terribly good but at
  70.  least it tries. This means your sample set to play nicely at the default
  71.  48 micro seconds (20.833 kHz) will still sound fine when a sound tracker
  72.  is playing, which bumps the system speed up to 34 micro seconds (29.411
  73.  kHz). As far as I am aware this is the first ever module on the Arc to
  74.  attempt this.
  75.    To use this module you use the SWI "DataVox_SetMemory" to set a channel
  76.  up for playing and issue sound commands after setting the appropriate 
  77.  data type using SWI "DataVox_Type". Easy eh? Nope? Well that is why I 
  78.  have bundled this module with its companion 'DataLoad' which provides
  79.  a nice OSCLI command interface for convienance. See the file DtLdHelp
  80.  for more information.
  81.  
  82.  The Concepts of DataVox
  83.  =======================
  84.  
  85.    DataVox is a module exclusively designed to play chunks of memory
  86.  through the sound system of the Arc. DataVox has no concept of files
  87.  or *anything* other than memory when it comes to playing and it has
  88.  been heavily geared towards this. The abstraction of files and loading/
  89.  saving of them etc.. has been kept away from DataVox for two reasons :-
  90.  
  91.  Size - Every effort has been made to keep DataVox as small as possible
  92.       while still retaining a friendly user interface. The other side
  93.       effect is that it helps to keep DataVox as fast as possible.
  94.  
  95.  Flexibility - Because DataVox has no concept of files etc... an application
  96.       can, with very little effort, bend DataVox to play files in any
  97.       manner it sees fit. This allows applications to do things like
  98.       playing compressed samples,playing from disk or just plain having
  99.       all the sound data to be played memory resident.
  100.  
  101.  As you can see this leaves DataVox a very flexible module, part of what
  102.  I set out to do with it.
  103.    The sound system provided on the Arc has two major concepts in it. That
  104.  of a channel and of a voice. DataVox provides a sound system *voice* that
  105.  provides an extra layer to the *channel* system. DataVox's voice allows
  106.  you to play differing things depending on what sound system channel is
  107.  attached to it and to this end provides it's own internal channel system.
  108.  A DataVox channel is a channel internal to DataVox and must not be confused
  109.  with a sound system channel.
  110.    Each DataVox channel is fully independant of all the other DataVox
  111.  channels and there is a direct one-to-one correspondence between DataVox
  112.  channels and sound system channels. That is from the sound system only
  113.  Operating System sound channel 1 can, when assigned to the DataVox Voice,
  114.  access DataVox channel 1, also OS channel 2 can only access DataVox channel
  115.  2,etc.... The layering goes something like this :-
  116.  
  117.   OS sound channels -----> Voices
  118.   (of which there are      WaveSynth-Beep
  119.    eight)                  ...
  120.                            Percussion-Noise
  121.                            DataVox-Voice ------> DataVox channels
  122.                                                  (of which there are eight-
  123.                                                  to allow a 1-1 matching
  124.                                                  with the OS channels)
  125.  
  126.   Each DataVox channel has information about what memory it is to play etc..
  127.   and these settings apply only to that one channel. Some of this infor-
  128.   mation is set out below.
  129.  
  130.   Channel Timed Pitched Type   Start     End       Rpt Start Rpt End   Rvse  
  131.      1     No    No      Log   &00000000 &00000000 &00000000 &00000000 No
  132.  
  133.  This is  Does  Does it The    The start The end   The start The end   Does
  134.  DataVox  it    use     Type   address   address   address   address   it
  135.  channel  play  fixed   of     in memory in memory in memory in memory play
  136.  and its  in    pitch   Data   of what   of what   of where  of where  the
  137.  `master' timed play?   to     to play.  to play.  to begin  to end    Data
  138.  channel. mode?         Play.                      repeating repeating Back-
  139.                                                    play of   play of   wards?
  140.                                                    the Data. the Data.
  141.  
  142.    Rate
  143.    &00
  144.  
  145.  The rate
  146.  in micro-
  147.  seconds 
  148.  the Data
  149.  is played
  150.  at.
  151.  
  152.  All of the settings listed above are reported to you by the *DataVoxStatus
  153.  command. Also stored about each channel is a key for multi-tasking access
  154.  , an address for UpCall code associated with the channel, where the voice
  155.  is up to in memory if the channel is playing & a toggling flag to indicate
  156.  which buffer is in use. For more details about precisely what all these
  157.  flags etc.. mean see the SWI command explanations.
  158.    The various SWI's provided can be divided into several groups based on
  159.  what there general function is. These groups are :-
  160.  
  161.  Setting Channel Data   - DataVox_Type
  162.                           DataVox_Timed
  163.                           DataVox_Pitch
  164.                           DataVox_SetMemory
  165.                           DataVox_SetRepeat
  166.                           DataVox_SetReverse
  167.                           DataVox_UpCallHandler
  168.                           DataVox_SlaveChannel
  169.                           DataVox_AdjustMemory
  170.  
  171.  These SWIs are how applications set the DataVox channel settings.
  172.  
  173.  Reading Channel Data   - DataVox_ReadType
  174.                           DataVox_ReadTimer
  175.                           DataVox_ReadPitch
  176.                           DataVox_ReadMemory
  177.                           DataVox_Repeat
  178.                           DataVox_ReadReverse
  179.                           DataVox_ReadMaster
  180.   
  181.  These SWIs are how applications read what the DataVox channel settings 
  182.  currently are.
  183.  
  184.  Monitoring Channels    - DataVox_ReadAddress
  185.                           DataVox_ReadBufferFlag
  186.  
  187.  These SWIs provide the means by which applications can do real time
  188.  monitoring of the play of data.
  189.  
  190.  Reading DataVox Status - DataVox_VoiceActive
  191.                           DataVox_SystemSpeed
  192.                           DataVox_Version
  193.  
  194.  These SWIs provide general status information about DataVox.
  195.  
  196.  Mulitasking Support    - DataVox_AllocateChannel
  197.                           DataVox_DeAllocateChannel
  198.                           DataVox_RequestChannel
  199.                           DataVox_ChannelsFree
  200.                           DataVox_ChannelFreeMap
  201.  
  202.  These SWIs provide the multi-tasking support of DataVox for applications
  203.  and should *always* be used by an application. See the section `Multi-
  204.  Tasking and DataVox' for more details.
  205.  
  206.  Application Support    - DataVox_PitchToSample
  207.                           DataVox_SampleToPitch
  208.                           DataVox_Duplicate
  209.                           DataVox_Unset
  210.                           DataVox_ConvertByte
  211.                           DataVox_ConvertArea
  212.  
  213.  And these SWIs provide application support to allow an application to
  214.  make use of the system speed independance of DataVox and to generally
  215.  make an applications life easier.
  216.    Okay and that about wraps up all the essential concepts of DataVox.
  217.  The whole idea of DataVox is to provide a consistant,multi-tasking
  218.  & highly flexible system of playing sound data on the Arc. Hopefully
  219.  the information I have given you here and a good reading of what is
  220.  presented below will allow you to make full use of the power of DataVox.
  221.  
  222.  Multi-Tasking and DataVox
  223.  =========================
  224.  
  225.    This module has a set of four SWI's built into it to allow easy and
  226.  smooth multitasking use of itself. These SWI's are AllocateChannel,
  227.  DeAllocateChannel,RequestChannel & ChannelsFree. Three of them require
  228.  the passing of a `Unique Key' to them. All this is is a 32 bit number of
  229.  some kind that is used to provide a measure of allocation security. This
  230.  ,when used wisely, allows an application to claim and use a channel happy
  231.  in the knowledge that it is the only `official' user of that channel.
  232.  It is recommended that the task handle number given to an application
  233.  by the Wimp be used as the key as this will be unique to that particular
  234.  instantation of the application. Of course if you have good reason not
  235.  to use the task handle number then any number will suffice.
  236.    However while an application can be reasonably secure in the knowledge
  237.  that once it has been allocated a channel it is the only application that
  238.  will `officially' own it, no such claims can be made on the settings of
  239.  the channel. This is due to maintaining backwards compatability and
  240.  problems with channel ownership by loader modules. The consequence of
  241.  this is that an application must check the settings before each use of
  242.  the channel. The exact strategy used will vary from application to
  243.  application.
  244.    The recommended procedure for applications using DataVox is as follows.
  245.  
  246.  For `fixed voice no.' applications :-
  247.  
  248.    START
  249.      |
  250.    Verify Sufficient channels are free for use.
  251.    Claim these channels.
  252.      |
  253.    Verify channel Settings---+
  254.    Use channel               |
  255.      |                       |
  256.      +-Loop as required------+
  257.      |
  258.    Deallocate the claimed channels
  259.      |
  260.     END
  261.  
  262.  For `dynamic voice no.' applications :-
  263.  
  264.    START
  265.      |
  266.    Verify Sufficient channels are free.--+
  267.    Claim these channels                  |
  268.    Use said channels                     |
  269.    Release these channels                |
  270.      |                                   |
  271.      +-Loop as required------------------+
  272.      |
  273.     END
  274.  
  275.   As can be seen the only major difference between the two application
  276.   stratageys is when the voices are claimed and released. These minor
  277.   shifts in place require radically different error handling and coding
  278.   however as the dynamic voice application can never make any assumptions
  279.   as to whether sufficient channels will be available for it to use at
  280.   any given time. Both of these stratageys ensure that the application
  281.   verifies the channels settings before use thus catering for possible
  282.   interference with these settings between wimp polls.
  283.     How often tasks need to verify that their channels are set correctly
  284.   will vary according to what the task does. Two main strategys spring
  285.   to mind 1) Check the settings every Wimp_Poll and reset them as needed.
  286.   2) Check the settings just before use is made of the channel (And
  287.   not before). The second strategy is the prefered method as it requires
  288.   less processor time to maintain.
  289.     Finally some tasks will need a particular channel to operate properely
  290.   and so the SWI RequestChannel has been provided. This allows an application
  291.   to request for a particular channel rather than simply asking for one and
  292.   getting any random channel back. Again the application will be turned down
  293.   if they do not own the channel (if it is claimed) so applications must be
  294.   prepared to cope with this.
  295.     Other than these guidelines usage of the channel is up to the 
  296.   application involved. Not following these guidlines is not a good idea
  297.   as this can result in applications `squabbling' over channels with the
  298.   unpredictable results that can result in. Also in no way will DataVox
  299.   ensure that the Arc's Sound System has a sufficient number of channels
  300.   active or that those channels are assigned to it. This is the
  301.   applications responsibility as the way the Sound System handles channels
  302.   may be revised in future releases of the OS. This way the module will
  303.   automatically cope with the new OS...
  304.  
  305.   N.B. I am well aware that the security afforded by the key system is
  306.   ridiculously simple to circumvent. It is not intended to provide a
  307.   secure system but is merely intended as an aid to tasks to allow them
  308.   to share the module in a consistent and easy manner. It is unlikely
  309.   that I will extend the security system to allow security over channel
  310.   settings, as this will destroy the backwards compatability the module
  311.   has with old code, unless I receive sufficient comment from people to
  312.   justify this alteration.
  313.  
  314.  OSCLI Commands
  315.  ==============
  316.  
  317.  *DataVoxPitch
  318.  This sets the fixed pitch of the data being played. Once this is set any 
  319.  sound commands issued to this datachannel will be fixed at this pitch. To 
  320.  return to normal pitching enter 0 as the pitch.
  321.  Syntax *DataVoxPitch <DataChannel> <-&7FFF-&7FFF>.
  322.  
  323.  *DataVoxStatus
  324.  This shows the status of the DataVox channels and their various parameters.
  325.  Syntax *DataVoxStatus.
  326.  
  327.  *DataVoxTimer
  328.  This sets whether the Voice Generator ignores the duration parameter of the
  329.  SOUND command. Enter 0 for no timer control and 1 for timer control.
  330.  Syntax *DataVoxTimer <DataChannel> <0|1>.
  331.  
  332.  *DataVoxType
  333.  This sets the type of data being played. Enter 0 for Logarithmic (Archimedes
  334.  native format),1 for Linear Unsigned (Macintosh & IBM), 2 for Linear Signed
  335.  (Armadeus,Atari St & Amiga) and 3 for Ulaw logarithmic format (Sun).
  336.  Syntax *DataVoxType <DataChannel> <0|1|2|3>.
  337.  
  338.  *DataVoxReverse
  339.  This sets the direction of play. On (1) for reverse play & Off (0) for
  340.  normal play.
  341.  Syntax *DataVoxReverse <DataChannel> <0|1>.
  342.   
  343.  *DataVoxDuplicate
  344.  This copies a DataChannel's settings across to another channel. This allows
  345.  you to have several channels sharing the same piece of sound data easily.
  346.  Note it is invalid to try and duplicate to the same channel number.
  347.  Syntax *DataVoxDuplicate <Source DataChannel> <Destination DataChannel>.
  348.  
  349.  *DataVoxUnset
  350.  This unsets a DataChannel, destroying all settings for that channel.
  351.  Syntax *DataVoxUnset <DataChannel>.
  352.  
  353.  SWI Commands
  354.  ============
  355.  
  356.    Here is the list of SWI commands provided by the DataVoxPlayer module.
  357.  It is to be noted that when an error occurs R0 is always corrupted and not
  358.  preserved as is indicated below. Also if you issue a SWI in the same chunk
  359.  range as DataVoxPlayer but is an unrecognised SWI the error "Unknown 
  360.  DataVox operation" will be returned. For all of these SWI's the interupt
  361.  status is unchanged,the processor is in SVC mode and they are not 
  362.  re-entrant. (Well actually some of them are but I haven't sorted out which
  363.  are yet.)
  364.  
  365.  DataVox_Type
  366.  On Entry:-
  367.  R0 DataChannel
  368.  R1 type to set it to
  369.  On Exit:-
  370.  R0 preserved
  371.  R1 preserved
  372.  Errors:-
  373.  Bad Settype parameters.
  374.  Use:- 
  375.       This SWI sets the data type for the DataVox channel passed to it. R1
  376.  should be 0 for logarithmic,1 for Linear Unsigned,2 for Linear Signed & 3 for
  377.  Ulaw logarithmic. The new data typing will take effect at the next sound
  378.  `start play' command.
  379.  
  380.  DataVox_Timed
  381.  On Entry:-
  382.  R0 DataChannel
  383.  R1 On(1)/Off(0) flag
  384.  On Exit:-
  385.  R0 preserved
  386.  R1 preserved
  387.  Errors:-
  388.  Bad Timer parameters.
  389.  Use:-
  390.       This sets whether the time parameter of a Sound command issued to the
  391.  DataVox channel will be used or not. A Value of 1 will set it,0 will unset
  392.  it.
  393.  
  394.  DataVox_Pitch
  395.  On Entry:-
  396.  R0 DataChannel 
  397.  R1 Pitch
  398.  On Exit:-
  399.  R0 preserved
  400.  R1 preserved
  401.  Errors:-
  402.  Bad Pitch parameters.
  403.  Use:-
  404.       This sets the fixed pitch of the sound channel. The values accepted
  405.  are the same as those used by the *SOUND command for pitch, -&7FFF-&7FFF.
  406.  Passing 0 in R1 turns the fixed pitching off and then the Voice responds
  407.  to *SOUND commands the same as normal.
  408.  
  409.  DataVox_ReadPitch
  410.  On Entry:-
  411.  R0 DataChannel
  412.  On Exit:-
  413.  R0 preserved
  414.  R1 Pitch on exit
  415.  Errors:-
  416.  Bad Read Pitch Channel.
  417.  Use:-
  418.       Not unsurprisingly this reads the pitch value for a channel. A value
  419.  of zero indicates no fixed pitching,any other value is the fixed pitch.
  420.  
  421.  DataVox_ReadTimer
  422.  On Entry:-
  423.  R0 DataChannel
  424.  On Exit:-
  425.  R0 preserved
  426.  R1 Timer Setting on exit
  427.  Errors:-
  428.  Bad Read Timer Channel.
  429.  Use:-
  430.       This returns the setting of the timer flag for a chanel. 0 means no
  431.  timing and any non zero value indicates that timing will be used. This
  432.  means that,when set,the timing parameter of *SOUND commands will be used.
  433.  Otherwise the sound will play until it reaches the end of playable data.
  434.  
  435.  DataVox_ReadType
  436.  On Entry:-
  437.  R0 DataChannel
  438.  On Exit:-
  439.  R0 preserved
  440.  R1 pitch of channel
  441.  Errors:-
  442.  Bad Read Type Channel.
  443.  Use:-
  444.       This returns the type of data to be played by a particular channel.
  445.  A value of 0 indicates Logarithmic data,1 Linear Unsigned and 2 Linear
  446.  Signed.
  447.  
  448.  DataVox_SetMemory
  449.  On Entry:-
  450.  R0 DataChannel
  451.  R1 DataStart
  452.  R2 DataEnd
  453.  On Exit:-
  454.  R0 preserved
  455.  R1 preserved
  456.  R2 preserved
  457.  Errors:-
  458.  Bad Set Memory parameters.
  459.  Use:-
  460.       This sets the chunk of memory that the channel will play. The only
  461.  check that this call makes is that the memory end pointer is indeed larger
  462.  than the memory start pointer. This means that any area in RAM can be played
  463.  . This call also resets the channels type to Logarithmic,timer to off,
  464.  reverse to off,the repeat section to be all of the sample & to normal 
  465.  (unfixed) pitching. The voice fill code is in a privileged processor mode
  466.  so *any* memory area can be played (Even the ROM space if you really want...
  467.  :-) ). You must be careful to ensure that the memory to be played is always
  468.  'there' when the voice generator needs it. This means that under the multi
  469.  tasking Wimp you must not store voice data in application space *unless* you
  470.  do not call Wimp_Poll until the sound has finished playing. Even then you
  471.  must ensure that no sound commands will be issued to that channel while your
  472.  application is paged out. If a sound request is received while the memory is
  473.  paged out an address exception will occur and the voice generator will halt
  474.  play in an undefined way. It can range from hanging the machine to merely 
  475.  halting play! Of course if you *really* want to be a smart alec you can
  476.  point it to physical memory which should always be there...but I don't 
  477.  recommend it as I haven't tried it and thus can't be sure it will work.
  478.  
  479.  DataVox_ReadMemory
  480.  On Entry:-
  481.  R0 DataChannel
  482.  On Exit:-
  483.  R0 preserved
  484.  R1 Start address of channel.
  485.  R2 End addresses of channel.
  486.  Errors:-
  487.  Bad Read Memory Channel.
  488.  Use:-
  489.       This reads the memory start and end address of the specified channel.
  490.  See DataVox_SetMemory for a more detailed account of what the results mean.
  491.  
  492.  DataVox_ReadAddress
  493.  On Entry:-
  494.  R0 DataChannel
  495.  On Exit:-
  496.  R0 preserved
  497.  R1 current address.
  498.  Errors:-
  499.  Bad Read Address Channel.
  500.  Use:-
  501.       This reads the current absolute address that the voice is currently
  502.  up to. If the voice is not playing at the time the SWI is called it will
  503.  return an address of zero. Address returned will *always* be between or
  504.  equal to the voice start address and the voice end address. This SWI is
  505.  a very useful one for timing programs. By waiting for the address returned
  506.  to become zero programs can wait till a particular sound sample has played.
  507.  It must be noted that the update of this address is only at the end of 
  508.  DMA buffer fills and thus will will jump up by the size of the DMA sound
  509.  buffer instead of byte wise. It is,  however,  updated at the start of
  510.  sound play immediately.
  511.  
  512.  DataVox_SetRepeat
  513.  On Entry:-
  514.  R0 DataChannel
  515.  R1 Repeat Start address
  516.  R2 Repeat End address
  517.  On Exit:-
  518.  R0,R1,R2 preserved
  519.  Errors:-
  520.  Bad Set Repeat Channel.
  521.  Bad Set Repeat Memory - Start above End.
  522.  Bad Set Repeat. Voice not active.
  523.  Use:-
  524.       This sets the Repeat address for the channel. Repeating occurs only
  525.  when the timed flag is set and the voice is required to keep playing for
  526.  longer than its play time by the time paramter sent via the sound command.
  527.  When a repeat is neccessary play will start from the sections pointed to
  528.  by these addresses. Note if play is set for reverse then any repeated
  529.  sections will also be played in reverse.
  530.       N.B. In an extension over older versions of DataPlay the Set Repeat
  531.  SWI will no longer require that the addresses passed be inside those set
  532.  by the Voice Start & End addresses. This is to allow you to perform
  533.  buffering if you so wish. Read the description of the SWI ReadBufferFlag
  534.  for more on this topic.
  535.  
  536.  DataVox_ReadRepeat
  537.  On Entry:-
  538.  R0 DataChannel
  539.  On Exit:-
  540.  R0 preserved
  541.  R1 Repeat Start address
  542.  R2 Repeat End address
  543.  Errors:-
  544.  Bad Read Repeat Channel.
  545.  Use:-
  546.       With this SWI you can read the repeat start and end addresses for the
  547.  specified channel.
  548.  
  549.  DataVox_SetReverse
  550.  On Entry:-
  551.  R0 DataChannel
  552.  R1 Bit Flag. 1 for reverse, 0 for normal play.
  553.  On Exit:-
  554.  R0,R1 preserved
  555.  Errors:-
  556.  Bad Set Reverse Channel.
  557.  Use:-
  558.          This sets the voice up to play the sound forwards or backwards. 
  559.  Flipping this quickly will result in the voice changing directions as it
  560.  plays and it can be used to do `scratch' style sounds.
  561.  
  562.  DataVox_ReadReverse
  563.  On Entry:-
  564.  R0 DataChannel
  565. `On Exit:-
  566.  R0 preserved
  567.  R1 Status of reverse flag.
  568.  Errors:-
  569.  Bad Read Reverse Channel.
  570.  Use:-
  571.          This allows you to read whether a channel has been set to reverse
  572.  play or not.
  573.  
  574.  DataVox_PitchToSample
  575.  On Entry:-
  576.  R0 Pitch
  577.  R1 System Sample speed for pitch
  578.  On Exit:-
  579.  R0 Sample speed for pitch
  580.  R1 preserved
  581.  Errors:-
  582.  Bad Pitch to Sample Pitch.
  583.  Bad Pitch to Sample sample rate.
  584.  Use:-
  585.         This converts a pitch, with a given system speed in micro seconds,
  586.  to a sample rate in micro seconds. When this is then fed to Sample to Pitch
  587.  it gives you the system speed independance. It must be noted that this is a
  588.  `lossy' conversion and exact pitching speeds will be lost. However most 
  589.  times the approximation will be so close no discernable difference will
  590.  be observed. Giving a system speed of zero will cause DataVox to use its
  591.  copy of what the system speed is. Read the comments on the next SWI for
  592.  an explanation as to why this is important.
  593.  
  594.  DataVox_SampleToPitch
  595.  On Entry:-
  596.  R0 Sample Speed (micro seconds)
  597.  R1 System Speed (mirco seconds)
  598.  On Exit:-
  599.  R0 Pitch (-&7FFF - &7FFF)
  600.  R1 preserved
  601.  Errors:-
  602.  Bad Sample Speed.
  603.  Bad System Speed.
  604.  Use:-
  605.       This converts a system speed and sample speed pair into a sound pitch
  606.  value that will cause the sound to be played correctly at that system speed.
  607.  The conversion is what gives DataVox its system speed independance. If the
  608.  system speed is 0 then DataVox will use its own copy of the current system
  609.  speed. Because DataVox only updates its copy of what the System Speed is
  610.  everytime a sound is played then it can get very out of sync with what
  611.  the real system speed is. The upshot of this is that if you use the
  612.  Sample to Pitch SWI to get the right pitch to feed into DataVox you
  613.  could end up setting the pitch (correctly for the current system speed)
  614.  but have DataVox readjust it incorrectly when it recalibrates to adjust
  615.  to the `new' system speed. So this giving a system speed of zero to this
  616.  SWI automatically fills in the system speed for you with DataVox's copy of 
  617.  the system speed so that when it comes time to recalibrate DataVox will
  618.  adjust everything correctly. When wanting to use DataVox's system speed
  619.  independance it is reccomended that you use this SWI with the System Speed
  620.  set to zero. Also setting R1 to zero recalibrates DataVox's copy of the
  621.  System Speed.
  622.  
  623.  DataVox_Duplicate
  624.  On Entry:-
  625.  R0 Source DataChannel
  626.  R1 Destination DataChannel
  627.  On Exit:-
  628.  R0,R1 preserved
  629.  Errors:-
  630.  Bad Duplicate Channel.
  631.  Silly. Why are you trying to Duplicate to the same channel?
  632.  Use:-
  633.       This copies all the settings of one DataChannel to another. This 
  634.  allows you to easily have channels that share the same piece of sampled
  635.  data without much mucking about. Especially given the fact that this
  636.  will always copy any new flags/settings I may add in the future.
  637.  
  638.  DataVox_Unset
  639.  On Entry:-
  640.  R0 DataChannel
  641.  On Exit:-
  642.  R0 Preserved
  643.  Errors:-
  644.  Bad Unset Channel.
  645.  Use:-
  646.       This completely clears and blanks a channel. Upon exit the selected
  647.  channel will not have any settings at all having returned to the default
  648.  state. If the channel being unset is playing then play will be terminated.
  649.  
  650.  DataVox_ConvertByte
  651.  On Entry:-
  652.  R0 Byte to Convert
  653.  R1 Datatype the byte is. (0,1,2 or 3 as per DataVox_Type)
  654.  R2 Type to convert the byte to. (0,1,2 or 3 as per DataVox_Type)
  655.  On Exit:-
  656.  R0 The Converted Byte
  657.  R1,R2 preserved
  658.  Errors:-
  659.  I can't convert this. It isn't a byte!
  660.  Bad Convert Byte Source type.
  661.  Bad Convert Byte Convert to type.
  662.  Use:-
  663.       This SWI converts a byte from a particular data type to another type.
  664.  It is perfectly acceptable to specify identical types in R1 & R2, all that
  665.  will happen is that you get the same byte back again. Please Note converting
  666.  between a Logarthimic DataType and a Linear DataType is *lossy*. The
  667.  converted sound will replay almost identically but it will not convert back
  668.  to its original form!
  669.  
  670.  DataVox_ReadBufferFlag
  671.  On Entry:-
  672.  R0 DataChannel to read
  673.  On Exit:-
  674.  R0 The Flag in the lowest bit.
  675.  Errors:-
  676.  Bad Read Buffer Flag Channel.
  677.  Use:-
  678.       Every time the Channel loads the Repeat start and end pointers this 
  679.    flag will be toggled. Once the pointers are loaded they are stored in
  680.    the Voices SCCB and so can be changed safely so that at next loading
  681.    of them they can point to a new area. This SWI allows you to follow
  682.    the loading of these pointers and if you wish to you can do some
  683.    clever buffering for activities like playing samples from disk or
  684.    playing compressed samples. *PLEASE NOTE* I make no guarantees that
  685.    the bit you get back will be set or unset at any particular point
  686.    in time. What I do guarantee is that the bit will change state as
  687.    the pointers are loaded.
  688.  
  689.  DataVox_AllocateChannel
  690.  On Entry:-
  691.  R0 Unique key.
  692.  On Exit:-
  693.  R0 DataChannel assigned if succesful, 0 otherwise.
  694.  Errors:-
  695.  Bad Allocate Channel Key!
  696.  Use:-
  697.       This allows you to request a channel from DataVox that is free. If 
  698.     there are no free channels then 0 is returned. No assumptions can be
  699.     made about which channel will be handed back as this will vary from
  700.     moment to moment depending on how many other applications are using
  701.     the module. Also DataVox will not ensure that the channel is active
  702.     or assigned to itself by the Sound System of the Arc. That is comp-
  703.     letely the applications responsibility as there are too many variables
  704.     for this module to cater for in a tidy fashion.
  705.       The Unique key is the key needed to DeAllocate or Request this channel
  706.     again. This key is needed to do the deallocate or request simply to
  707.     allow the application that has been allocated the channel the knowledge
  708.     that it is, as far as DataVox is concerned, the only owner of that
  709.     channel. It also prevents careless applications from deallocating
  710.     another applications channel. This is crucial to the safe multi-tasking
  711.     of this module as it provides a measure of security allowing an 
  712.     application to know for sure that it can do what it likes with the
  713.     settings of a particular channel and not upset any other application's
  714.     use of the module.
  715.       Of course, due to other considerations, there is nothing to stop
  716.     a badly programmed application from just using the SWI's to re-assign
  717.     the other channels as it wishes so tasks *must* ensure their channel
  718.     is set correctly before use. Whether this requires constant monitoring
  719.     or simply checking just before use is application dependant. Due to
  720.     problems of the ownership of channels by loading modules and maintaining
  721.     backwards compatability this `hole' (More like a subway tunnel!) in
  722.     channel security will *not* be fixed.
  723.  
  724.  DataVox_DeAllocateChannel
  725.  On Entry:-
  726.  R0 DataChannel to free
  727.  R1 Unique key to channel
  728.  On Exit:-
  729.  R0 preserved
  730.  R1 preserved
  731.  Errors:-
  732.  Bad DeAllocate Channel Channel.
  733.  Bad DeAllocate Channel Key!
  734.  Use:-
  735.       This SWI will return, if the passed key is correct, the designated
  736.     channel back to the free 'pool' of channels in DataVox allowing another
  737.     application the chance to use it. This SWI will not disrupt the settings
  738.     of the channel allowing applications to 'trade' channels if they so
  739.     desire. Of course any such scheme must *not* rely totally on getting
  740.     the channel and have code to cope with this contingency.
  741.  
  742.  DataVox_RequestChannel
  743.  On Entry:-
  744.  R0 DataChannel desired
  745.  R1 Unique key for it
  746.  On Exit:-
  747.  R0 0 if request denied else preserved
  748.  R1 preserved
  749.  Errors:-
  750.  Bad Request Channel Channel!
  751.  Use:-
  752.       If an application simply must have a particular channel then it can
  753.     request for it. If the channel is free then the SWI will hand back the
  754.     channel number and mark the channel as allocated with the key passed.
  755.     If the channel is already allocated but the key passed matches the key
  756.     given then the channel is handed back as DataVox considers that the
  757.     application requesting it already `owns' it. Otherwise the request is
  758.     denied by the SWI handing back a 0 as the channel. It is expected that
  759.     applications be nice and actually respect this denial.
  760.  
  761.  DataVox_ChannelsFree
  762.  On Entry:-
  763.  R0 Undefined
  764.  R1 Undefined
  765.  On Exit:-
  766.  R0 Number of unallocated channels available.
  767.  R1 Number of allocated channels.
  768.  Errors:-
  769.  None
  770.  Use:-
  771.       What can be said about this one that isn't obvious? This returns the
  772.     total number of free channels for use and the total number in use.
  773.  
  774.  DataVox_ConvertArea
  775.  On Entry:-
  776.  R0 Start Address
  777.  R1 End Address
  778.  R2 Datatype the byte is. (0,1,2 or 3 as per DataVox_Type)
  779.  R3 Type to convert the byte to. (0,1,2 or 3 as per DataVox_Type)
  780.     OR an address to a 256 byte lookup table.
  781.  On Exit:-
  782.  R0-R3 preserved
  783.  Errors:-
  784.  Your Start Address is below your End Address for conversion.
  785.  Bad Convert Area Type.
  786.  Bad Type to Convert Area to!
  787.  Use:-
  788.       This functions like Convert Byte only instead of converting a Byte
  789.     it converts a chunk of memory at a go. This will be much faster then
  790.     doing a byte by byte conversion of the area in your own code as it
  791.     will not have to go through the high overhead that a SWI call entails
  792.     for every byte.
  793.       If you specify an address in R3 then the type in R2 is ignored and it
  794.     is assumed that the lookup table is adjusted to cope with the datatype
  795.     being converted. Please note R2 in this mode may be used at a later date
  796.     by this code for a special meaning and should be by default set to zero
  797.     in this conversion mode.
  798.       The same comments about conversion restrictions in ConvertByte apply
  799.     here.
  800.  
  801.  DataVox_ChannelFreeMap
  802.  On Entry:-
  803.  R0 undefined
  804.  On Exit:-
  805.  R0 Bitmap of the free channels.
  806.  Errors:-
  807.  None
  808.  Use:-
  809.       This SWI returns a bitmap of the free channels. If the bit is set then
  810.     the channel is allocated else it is free. Bit Zero applies to channel 1,
  811.     Bit One applies to channel 2 etc... I provided this SWI a) because I 
  812.     needed it for one of my applications, b) to allow an application to
  813.     easily monitor the free channels & c) I realised that I had not provided
  814.     any way of non-destructively querying whether a channel is free or not.
  815.     As there are currently only 8 channels supported by the VIDC then only
  816.     the low eight bits will hold meaningful values. However the higher bits
  817.     are by default cleared and no assumptions about their state should be
  818.     made in case a future machine is released with more sound channels
  819.     supported. As an aside you can easily find out the total number of 
  820.     channels available by calling this SWI counting the number of bits set
  821.     and the querying the number of channels free and totalling the two
  822.     results. Of course it is far simpler to simply total the two registers
  823.     passed back by ChannelsFree SWI. I consider it unlikely that more than
  824.     32 channels will ever be supported by future hardware I just hope Acorn
  825.     don't take this as a challenge and provide more than 32 channels! :-)
  826.  
  827.  DataVox_UpCallHandler
  828.  On Entry:-
  829.  R0 DataChannel desired
  830.  R1 Address (absolute) or the routine to be called.(0 to deinstall a handler)
  831.  R2 Private word to be passed to the routine.
  832.  On Exit:-
  833.  R0 preserved
  834.  R1 preserved
  835.  R2 preserved
  836.  Errors:-
  837.  Bad UpCall Handler Channel!
  838.  Use:-
  839.       This SWI provides a means by which special code can be added to DataVox
  840.     to allow precise control over the order in which sample buffers are 
  841.     played. The code is called under two circumstances - when a sound is
  842.     started and when a buffer has been finished. Your code is expected to
  843.     be :-
  844.          a) FAST. Speed is *very* critical in this routine. Your code will
  845.          called in IRQ mode with interupts shut off and so must be as fast
  846.          as is possible to avoid problems. 
  847.          b) always terminate. There must be absolutely no way in which your
  848.          code cannot terminate. If your code does fail to terminate then 
  849.          your machine will lock up! You have been warned...
  850.          c) well behaved. Your code is being given access to the internal
  851.          tables of DataVox and care must be taken not to damage any other
  852.          channels table entries. Do *NOT* attempt to access any of the other
  853.          channels data as this could cause your machine to crash.
  854.          d) terminate cleanly. It is expected that your code generally
  855.          obey the normal restrictions placed on interupt routines. Whatever
  856.          you do do *not* turn interupts back on or exit back to DataVox
  857.          in a processor mode different from that which DataVox called you
  858.          in.
  859.  
  860.   The code calling mechanism is as follows.
  861.    
  862.   On Entry:-
  863.    R0  reason for calling. (0-2 primary reason codes.)
  864.    R1  pointer to word for the start of buffer address.
  865.    R2  pointer to word for the end of buffer address.
  866.    R3  channel number you are being called for. (0-7)
  867.    R4  the private word passed to DataVox at installation.
  868.    R5  pointer to the phase accumulator word used by the fill code.
  869.    R6  #0 (Reason code 0 is an exception to this)
  870.    R14 return address.
  871.   On Exit:-
  872.    R0  Return Code. (0 or 1)
  873.  
  874.     Registers R0-R6 can be corrupted and R14 contains the return address.
  875.   The addresses passed in R1 & R2 are the addresses at which DataVox will
  876.   *next* load the start & end addresses of the next buffer to be played.
  877.   The passing of the channel number allows one chunk of code to handle
  878.   mulitple channels simultaneously and accordingly your code must be
  879.   re-entrant to handle this. (ie. keep your workspace seperate for each
  880.   channel.) The private word passed in R4 is what you handed to DataVox
  881.   when you installed the handler. This cannot be updated by any other means
  882.   than reinstalling the handler. It is intended that routines put into
  883.   modules use this word to point to their workspace... R5 is the phase
  884.   pitch accumulator used by DataVox in fixed pitch play. Altering this
  885.   word allows the UpCall code to alter the speed of sample play. The
  886.   data format is that returned by the SWI "Sound_Pitch". IE a fixed point 32
  887.   bit number with an 8 bit integer and 24 bits fractional data.
  888.     The reason code passed gives you an indication of why your code is
  889.   being called. 
  890.  
  891.   Code 0 indicates a start of sound synthesis/play. It is expected that 
  892.          your code set itself to appropriate default values upon receiving
  893.          this call. Also in this reason code call *alone* R6 is loaded
  894.          with DataVox's copy of what the system speed in micro seconds
  895.          is. It is expected that UpCall code use this to decide if
  896.          certain pitch tables need recalibrating for the system speed.
  897.   Code 1 indicates a normal play call. Under a reason 1 call the return code
  898.          has effect allowing the upcalled code control over when play will
  899.          halt. Returning a value of 1 indicates to DataVox that it should
  900.          play another buffer. Returning 0 indicates an immediate stop in
  901.          play.
  902.   Code 2 indicates that a timed play is underway. In this mode DataVox will
  903.          ignore the return code completely as it has control over when the
  904.          sound play will halt. It is still valid to pass a return code back
  905.          though (It just isn't used thats all....). In this mode looping
  906.          from the start may be neccessary and your code should have some
  907.          method of coping with this. Of course not altering the start &
  908.          end addresses simply means the last buffer played will be played
  909.          again....
  910.  
  911.  These three codes constitute the primary fill reason codes. All of these
  912.  routines are *highly* speed critical and should not waste any time at all
  913.  if possible! However the next few reasons codes are called in circumstances
  914.  where speed is not so critical. Longer and more complex routines can be
  915.  attempted here but again CallBack code writers should not waste time
  916.  needlessly.
  917.  
  918.   Code 3 this is the system speed recalibration code. Your callback code
  919.          will be called when DataVox detects a need to recalibrate the
  920.          system speed and gives your code a chance to do likewise. It is
  921.          expected that UpCall code will use this entry to recalibrate any
  922.          internal pitch tables they have to the new system speed. It is 
  923.          also expected that the code will adjust the phase accumulator
  924.          word and DataVox will *assume* that the UpCall code will keep
  925.          it correctly calibrated for the current system speed.
  926.          Registers:-
  927.  
  928.          R0  #3
  929.          R1  Old System Speed in micro seconds.
  930.          R2  New System Speed in micro seconds.
  931.          R3  Channel number (0-7) being recalibrated.
  932.          R4  Private UpCall Data Word.
  933.          R5  pointer to the phase accumulator word used by the fill code.
  934.          R6  #0
  935.          R14 return address.
  936.  
  937.          No return code is expected and any returned will be ignored.
  938.  
  939.   Code 4 this is the channel assignment entry code. DataVox is informing
  940.          your code of the fact that another DataVox channel has been
  941.          assigned to this code. It is expected that the code prepares
  942.          itself in whatever ways are needed to play the new channel.
  943.          Registers:-
  944.  
  945.          R0  #4
  946.          R1  pointer to word for the start of buffer address.
  947.          R2  pointer to word for the end of buffer address.
  948.          R3  System Speed in micro seconds.
  949.          R4  the private word passed to DataVox at installation.
  950.          R5  pointer to the phase accumulator word used by the fill code.
  951.          R6  #0
  952.          R14 return address.
  953.  
  954.   Code 5 DataVox is requesting that you return in R1 the sequence data the
  955.          upcall code is currently at. Obviously this is highly dependant on
  956.          how your Upcall code is organised but should usually consist of the
  957.          sequence number your code is up to. It is perfectly valid for UpCall
  958.          code to ignore this call in which case an Automatic default will be
  959.          assumed. If you are ignoring it then do not corrupt the registers
  960.          at all.
  961.          On Entry:-
  962.  
  963.          R0  #5
  964.          R1  channel number (0-7)
  965.          R2  #0
  966.          R3  #0
  967.          R4  #0
  968.          R5  #0
  969.          R6  #0
  970.          R14 return address.
  971.  
  972.          On Exit:-
  973.          
  974.          R1  UpCall pause data.
  975.  
  976.   Code 6 Here DataVox is instructing the UpCall code to commence play from
  977.          a specified point, passed in R1. It is expected that the UpCall
  978.          code will restart play from the information passed to it. If the
  979.          information is invalid it is fine for the UpCall code to ignore it
  980.          and simply play as normal. The pause data should only have effect
  981.          at the *next* start of sound play and should then be discarded.
  982.          On Entry:-
  983.  
  984.          R0  #6
  985.          R1  channel number (0-7)
  986.          R2  UpCall pause word returned by reason code 5.
  987.          R3  #0
  988.          R4  #0
  989.          R5  #0
  990.          R6  #0
  991.          R14 return address
  992.  
  993.  Your code should simply ignore any reason codes it doesn't understand and
  994.  return back to DataVox doing nothing. If your code encounters an error it
  995.  should simply unstack itself and exit cleanly rather than try to report
  996.  an error. Any such attempts *will* fail.Also your code, if it is to be used
  997.  in the Desktop, must always be paged in for DataVox to access. This means
  998.  either that it must be stored in the RMA or that it only ever gets called
  999.  while your application is currently paged in. And that about covers it.
  1000.  Please be very careful with this SWI as the potential for trouble with it
  1001.  is very high.
  1002.  
  1003.  DataVox_FlushKeys
  1004.  On Entry:-
  1005.  No parameters required.
  1006.  On Exit:-
  1007.  All registers preserved
  1008.  Errors:-
  1009.  none
  1010.  Use:-
  1011.       This SWI causes DataVox to DeAllocate all channels. This is a highly
  1012.     antisocial SWI and is provided only for development work. All finished
  1013.     applications should be tidy and be deallocating all their channels
  1014.     themselves anyway. However when developing new software channels can
  1015.     be left allocated causing DataVox to refuse to be killed. This means
  1016.     you have to hard reset your machine to get rid of it - very annoying.
  1017.     Under no circumstances should non-development code *ever* use this
  1018.     SWI. Use of this SWI totally destroys the multi-tasking coherency of
  1019.     DataVox and I will get extremely sad at code that does use it...
  1020.  
  1021.  DataVox_VoiceActive
  1022.  On Entry:-
  1023.  R0 0 to read 1 to read and set sound system.
  1024.  On Exit:-
  1025.  R0 Minimum number of sound channels needed active for DataVox.
  1026.  Errors:-
  1027.  none
  1028.  Use:-
  1029.       This SWI is provided to allow applications to keep the sound system at
  1030.     its minimum DMA level needed to support all assigned DataVox channels.
  1031.     If R0 is set to 1 on entry then not just will the minimum number be
  1032.     returned but DataVox will reconfigure the sound system to ensure the
  1033.     required number of voices is active. Please note it will *not* assign
  1034.     these channels to the DataVox voice - merely ensure that they are active
  1035.     for the application(s) to use.
  1036.       Applications that wish to be `social' should use this SWI to determine
  1037.     how many channels are needed and then query the sound system to see if
  1038.     sufficient channels are active already. If there are sufficient channels
  1039.     active then it should not alter the setting...
  1040.  
  1041.  DataVox_SystemSpeed
  1042.  On Entry:-
  1043.  R0 undefined
  1044.  On Exit:-
  1045.  R0 DataVox's copy of the system speed.
  1046.  Errors:-
  1047.  none
  1048.  Use:-
  1049.       The SWI returns to you DataVox's copy of what the system speed current-
  1050.     ly is. This is important because DataVox can be out of sync with what
  1051.     the system speed really is and an application needs to calculate some-
  1052.     thing like duration of play. This also will trigger a recalibration if one
  1053.     is needed.
  1054.  
  1055.  DataVox_Version
  1056.  On Entry:-
  1057.  R0 undefined
  1058.  On Exit:-
  1059.  R0 Version number of DataVox * 100.
  1060.  Errors:-
  1061.  none
  1062.  Use:-
  1063.       This SWI is for informational purposes to allow applications to 
  1064.     determine what facilities are available from DataVox. This allows
  1065.     well written applications to be able to use old versions of DataVox
  1066.     and only allow/use the extended features of new versions of DataVox
  1067.     if they are available.
  1068.  
  1069.  DataVox_SlaveChannel
  1070.  On Entry:-
  1071.  R0 Channel to be slaved.
  1072.  R1 Channel it is to be slaved to.
  1073.  On Exit:-
  1074.  R0,R1 preserved.
  1075.  Errors:-
  1076.  You can't slave the same channel to itself.
  1077.  Bad channel number to slave.
  1078.  Bad channel number to be slaved to.
  1079.  You cannot have a slaved channel as a master channel!
  1080.  Use:-
  1081.       This allows you to link channels together. Please note the master channel
  1082.     is not allowed to be slaved to another channel to prevent circular list
  1083.     problems. Please note you should not slave any channels you have not
  1084.     claimed using DataVox_AllocateChannel or RequestChannel! Please note due
  1085.     to the fact that the linking code is executed by callback there will be
  1086.     a delay between channels linked. If you do not want this delay then it is
  1087.     expected that you will drive the channels yourself in unlinked mode. This
  1088.     linking is purely for wimp applications and command line users to use in
  1089.     non critical sound applications. (Like playing back their favourite
  1090.     stereo beeps...Something I am rather partial to.)
  1091.  
  1092.  DataVox_ReadMaster
  1093.  On Entry:-
  1094.  R0 Channel to read.
  1095.  On Exit:-
  1096.  R0 Master of this channel. 0 for no master.
  1097.  Errors:-
  1098.  Bad channel to read the master of!
  1099.  Use:-
  1100.       This reads the channels master and reports it back to you. It is purely
  1101.     for informational purposes.
  1102.  
  1103.  DataVox_ReadUpCallStatus
  1104.  On Entry:-
  1105.  R0 Channel to read.
  1106.  On Exit:-
  1107.  R0 The UpCall status/pause word as returned.
  1108.  Errors:-
  1109.  Bad channel number to read.
  1110.  No UpCall code to interrogate!
  1111.  Use:-
  1112.       This issues a type 5 reason code call to the UpCall code on the
  1113.     specified channel. If there is no UpCall code on the channel then the
  1114.     routine will error and R0 will be in an undefined state. Please note it is
  1115.     the UpCall code's choice as to whether to ignore this reason code or not so
  1116.     the results returned are subject to what kind of UpCall code is present.
  1117.  
  1118.  DataVox_SetUpCallStatus
  1119.  On Entry:-
  1120.  R0 Channel to affect. 
  1121.  R1 UpCall status/pause word to write.
  1122.  On Exit:-
  1123.  Registers preserved.
  1124.  Errors:-
  1125.  Bad channel number to set.
  1126.  No UpCall code to call!
  1127.  Use:-
  1128.       Basically the opposite of a ReadUpCallStatus call this issues a type 6
  1129.     reason code call to the UpCall code on the specified channel. Again it is
  1130.     at the UpCall codes discretion to acknowledge this call or not.
  1131.  
  1132.  DataVox_AdjustMemory
  1133.  On Entry:-
  1134.  R0 DataChannel
  1135.  R1 DataStart
  1136.  R2 DataEnd
  1137.  On Exit:-
  1138.  R0 preserved
  1139.  R1 preserved
  1140.  R2 preserved
  1141.  Errors:-
  1142.  Bad Adjust Memory parameters.
  1143.  Use:-
  1144.       This functions in an identical manner to SetMemory. However it does not
  1145.     reset the datatype, reverse, pitch, upcall code or any of the other myriad
  1146.     settings bar that of the Repeat start and end addresses. It is intended
  1147.     that this be useful for sound players that can addresses frequently.
  1148.  
  1149.  DataVox_SetInternalPitch
  1150.  On Entry:-
  1151.  R0 DataChannel
  1152.  R1 32 bit fractional step.
  1153.  On Exit:-
  1154.  R0 preserved
  1155.  R1 preserved
  1156.  Errors:-
  1157.  Bad Set Internal Pitch parameters.
  1158.  Use:-
  1159.       This SWI allows the user to fine tune the sample replay stepping rate. It
  1160.    only has effect when the fixed pitching mode is active and is superceded by
  1161.    any SetMemory or SetPitch commands. The number passed in R1 should be
  1162.    treated as 32 bit fixed point number comprising 8 bits integer, 24 bits
  1163.    fractional numeric representation. Use of this SWI is depreciated but may be
  1164.    necessary under extreme circumstances, I would prefer applications to go
  1165.    through SetPitch wherever possible.
  1166.  
  1167. SWI Chunk numbering
  1168. ===================
  1169.  
  1170.      Here is the table of DataVox's SWI chunk numbers on SWI names. Of course
  1171.  all names need to be preceded with `DataVox_' and the chunk range number
  1172.  is :- &44380
  1173.  
  1174.      Chunk # | SWI name
  1175.      --------+------------------
  1176.       0      | Type
  1177.       1      | Timed
  1178.       2      | Pitch
  1179.       3      | ReadPitch
  1180.       4      | ReadTimer
  1181.       5      | ReadType
  1182.       6      | SetMemory
  1183.       7      | ReadMemory
  1184.       8      | ReadAddress
  1185.       9      | SetRepeat
  1186.       10     | ReadRepeat
  1187.       11     | SetReverse
  1188.       12     | ReadReverse
  1189.       13     | PitchToSample
  1190.       14     | SampleToPitch
  1191.       15     | Duplicate
  1192.       16     | Unset
  1193.       17     | ConvertByte
  1194.       18     | ReadBufferFlag
  1195.       19     | AllocateChannel
  1196.       20     | DeAllocateChannel
  1197.       21     | RequestChannel
  1198.       22     | ChannelsFree
  1199.       23     | ConvertArea
  1200.       24     | ChannelFreeMap
  1201.       25     | UpCallHandler
  1202.       26     | FlushKeys
  1203.       27     | VoiceActive
  1204.       28     | SystemSpeed
  1205.       29     | Version
  1206.       30     | SlaveChannel
  1207.       31     | ReadMaster
  1208.       32     | ReadUpCallStatus
  1209.       33     | SetUpCallStatus
  1210.       34     | AdjustMemory
  1211.       35     | SetInternalPitch
  1212.  
  1213. Error Messages
  1214. ==============
  1215.  
  1216.    The Error range begins at &806100, ends at &80613F, and here is the error
  1217. message list.
  1218.  
  1219.    Error # | Error Message
  1220.    --------+-------------------------------------------------------------
  1221.       0    | DataVox is still being used!
  1222.       1    | Unknown DataVox operation
  1223.       2    | Bad Address Channel.
  1224.       3    | Bad Timer parameters.
  1225.       4    | Bad Reverse parameters.
  1226.       5    | Bad Settype parameters.
  1227.       6    | Bad Set Memory parameters.
  1228.       7    | Bad Set Repeat Channel.
  1229.       8    | Bad Set Repeat Memory - Start above End.
  1230.       9    | Bad Set Repeat. Voice not active.
  1231.       10   | Bad Read Pitch Channel.
  1232.       11   | Bad Read Timer Channel.
  1233.       12   | Bad Read Reverse Channel.
  1234.       13   | Bad Read Type Channel.
  1235.       14   | Bad Pitch parameters.
  1236.       15   | Bad Read Memory Channel.
  1237.       16   | Bad Pitch to Sample Pitch.
  1238.       17   | Bad Pitch to Sample sample rate.
  1239.       18   | Bad Sample Speed.
  1240.       19   | Bad System Speed.
  1241.       20   | Bad Duplicate Channel.
  1242.       21   | Silly. Why are you trying to Duplicate to the same channel?
  1243.       22   | Bad Unset Channel.
  1244.       24   | I can't convert this. It isn't a byte!
  1245.       25   | Bad Convert Byte Source type.
  1246.       26   | Bad Convert Byte Convert to type.
  1247.       27   | Bad Read Buffer Flag Channel.
  1248.       28   | Bad DeAllocate Channel Channel.
  1249.       29   | Bad DeAllocate Channel Key!
  1250.       30   | Bad Request Channel Channel!
  1251.       31   | Your Start Address is above your End Address for conversion.
  1252.       32   | Bad Convert Area Type.
  1253.       33   | Bad Type to Convert Area to!
  1254.       34   | Bad UpCall Handler Channel!
  1255.       35   | Bad Allocate Channel Key!
  1256.       36   | Bad Request Channel Key!
  1257.       37   | You can't slave the same channel to itself.
  1258.       38   | Bad channel number to slave.
  1259.       39   | Bad channel number to be slaved to.
  1260.       40   | You cannot have a slaved channel as a master channel!
  1261.       41   | Bad channel to read the master of!
  1262.       42   | Bad channel number to read.
  1263.       43   | No Upcall code to interrogate!
  1264.       44   | Bad channel number to set.
  1265.       45   | No UpCall code to call!
  1266.       46   | Bad Adjust Memory parameters.
  1267.  
  1268.  
  1269.   Version History
  1270.   =========================================================================
  1271.   |Version | Comments.                                                    |
  1272.   =========================================================================
  1273.   | 1.00   | The first DataVox Module that supported only one file,timing |
  1274.   |        |   and data types. Released into the Public Domain.           |
  1275.   |        |   (07-Nov-1990)                                              |
  1276.   | 2.00   | Major re-write of code. Now it only plays chunks of memory   |
  1277.   |        |   and doesn't handle the loading of the data. (15-Jan-1991)  |
  1278.   | 2.01 - | Expanded support to handle eight independant channels from   |
  1279.   | 2.05   |   the one voice slot. Added the incidental code to control   |
  1280.   |        |   this new feature. Tidied up the Voice Code too!            |
  1281.   |        |   (16-Jan-1991 - 01-Feb-1991)                                |
  1282.   | 2.06   | Added the DataVoxStatus feature to show all the channels     |
  1283.   |        |   status. (02-Feb-1991)                                      |
  1284.   | 2.07   | Added the code to handle fixed pitch playing! Now all sounds |
  1285.   |        |   issued from the channel can be forced to play at a preset  |
  1286.   |        |   pitch. This in particular allows voices to be slaved to    |
  1287.   |        |   beep channel and for them to play correctly rather than    |
  1288.   |        |   at a too fast rate. (03-Feb-1991)                          |
  1289.   | 2.08   | Optimised the buffer fill code and corrected for a possible  |
  1290.   |        |   error to do with buffer exit fills. I suspect that I had   |
  1291.   |        |   made a small error in the flush code that resulted in the  |
  1292.   |        |   voice continuing to 'fill' the DMA buffer after the sound  |
  1293.   |        |   data had finished but filling it with 0's,thus resulting   |
  1294.   |        |   in no noise but heavy interupt overheads when there should |
  1295.   |        |   not have been... (24-Mar-1991)                             |
  1296.   | 2.09   | Added the DataVox_ReadAddress SWI at the request of Jason    |
  1297.   |        |   Williams. And saved on 28 bytes of size due to duplicated  |
  1298.   |        |   storage space that wasn't neccessary. (08-Jun-1991)        |
  1299.   | 2.10   | Corrected the timer flag algorithm to allow for repeated play|
  1300.   |        |   of a sample up to the time limit specified. (19-Aug-1991)  |
  1301.   | 2.11   | Allowed the addition of repeated play blocks. This allows    |
  1302.   |        |   samples to have a lead in and then a long repeated section |
  1303.   |        |   if so desired. Useful for coding music players.            |
  1304.   |        |   (19-Aug-1991)                                              |
  1305.   | 2.12   | Added reverse play code! Now you can play your samples either|
  1306.   |        |   way! The repeat loops even will be played in reverse.      |
  1307.   |        |   (20-Aug-1991)                                              |
  1308.   | 3.00   | Finally got the errors, with Julians help, out of the system |
  1309.   |        |   speed independance code. Now you can screw with the system |
  1310.   |        |   speed (Yuck!) and it will attempt to play the sample at the|
  1311.   |        |   right pitch. (26-Aug-1991)                                 |
  1312.   | 3.01   | Fixed a minor error in the Reverse play code. Now it reverses|
  1313.   |        |   properly if the sound is already playing. (28-Aug-1991)    |
  1314.   | 3.02   | Added the Unset and Duplicate code. Now you can very simply  |
  1315.   |        |   clear and copy the settings of any channel. (28-Aug-1991)  |
  1316.   | 3.03   | Fixed an Underflow/Overflow error with the conversion SWI's. |
  1317.   |        |   now only sensible values can be returned by it. Before     |
  1318.   |        |   values large and smaller than possible pitches were being  |
  1319.   |        |   returned. (28-Aug-1991)                                    |
  1320.   | 3.04   | Fixed an embarrising error in the `DataVox_SampleToPitch'    |
  1321.   |        |   SWI.. guess who got a compare the wrong way round...       |
  1322.   |        |   One of these days I guess I will just have to learn how to |
  1323.   |        |   code in assembler. :-). (28-Aug-1991)                      |
  1324.   | 3.05   | Removed an unnecessary SWI and upgraded two other SWI's to   |
  1325.   |        |   take its place. (29-Aug-1991)                              |
  1326.   | 3.06   | Fixed a bug in the smooth update code :- There wasn't any!   |
  1327.   |        |   This caused problems in the usage of volumes from &180 to  |
  1328.   |        |   &1FF. (29-Aug-1991)                                        |
  1329.   | 3.07   | Fixed a bug in the Set Repeat Code. (31-Aug-1991)            |
  1330.   | 3.08   | Fixed a minor bug in the Set Pitch Code. It wasn't clearing  |
  1331.   |        |   the sample rate table. Not harmful just untidy.            |
  1332.   |        |   (31-Aug-1991)                                              |
  1333.   | 3.09   | Added the ConvertByte SWI. My thanks to Edourard Poor &      |
  1334.   |        |   Julian Wright for the algorithm for converting Logarithmic |
  1335.   |        |   to Linear samples. (01-Sep-1991)                           |
  1336.   | 3.10   | Extended the SetRepeat SWI to allow for clever buffering     |
  1337.   |        |   tricks and added the ReadBufferFlag SWI to help with this. |
  1338.   |        |   (08-Sep-1991)                                              |
  1339.   | 3.11   | Added the extra SWI's for multitasking support. This now     |
  1340.   |        |   allows applications to `share' DataVox in a consistant     |
  1341.   |        |   way. (14-Sep-1991)                                         |
  1342.   | 3.12   | Added the ConvertArea SWI to allow fast Sample conversion    |
  1343.   |        |   when needed. (03-Oct-1991)                                 |
  1344.   | 3.13   | Added the ChannelFreeMap SWI to allow better channel         |
  1345.   |        |   allocation monitoring by tasks. (11-Oct-1991)              |
  1346.   | 3.14   | Adjusted the Type SWI to only have effect at the next start  |
  1347.   |        |   of play buffer fill. This cures a few problems with file   |
  1348.   |        |   overlay code... (12-Oct-1991)                              |
  1349.   | 3.15   | Added the UpCallHandler SWI. This now allows code quite fine |
  1350.   |        |   control over how sounds are played in DataVox.             |
  1351.   |        |   (15-Oct-1991)                                              |
  1352.   | 3.16   | Altered DataVox so that it now refuses to be killed till all |
  1353.   |        |   tasks using it have DeAllocated themselves. (15-Oct-1991)  |
  1354.   | 3.17   | Extended the kill system to allow the module to be RMTidied  |
  1355.   |        |   while tasks are using it while still remembering all the   |
  1356.   |        |   data. (16-Oct-1991)                                        |
  1357.   | 3.18   | Added the FlushKeys SWI for developers to use. This has      |
  1358.   |        |   become rather neccessary when DataVox refuses to die until |
  1359.   |        |   all channels are deallocated. (16-Oct-1991)                |
  1360.   | 3.19   | I quad word aligned the voice code to try and keep the IRQ   |
  1361.   |        |   load down as much as possible. DataVox does tend to suck   |
  1362.   |        |   bandwidth a bit... (17-Oct-1991)                           |
  1363.   | 3.20   | Further optimisations in the Fill code to keep the IRQ load  |
  1364.   |        |   down. (17-Oct-1991)                                        |
  1365.   | 3.21   | Fine tuning optimisation in the Fill code. Now the worst case|
  1366.   |        |   fill loop is five instructions per byte with the best case |
  1367.   |        |   four instructions per byte. This is about all the optimis- |
  1368.   |        |   ation I can make in the Fill code loop itself.             |
  1369.   |        |   (17-Oct-1991)                                              |
  1370.   | 3.22   | Extended the UpCall SWI to provide support for modules via   |
  1371.   |        |   a private word. (17-Oct-1991)                              |
  1372.   | 3.23   | Extended the ChannelsFree SWI to be slightly more detailed.  |
  1373.   |        |   (18-Oct-1991)                                              |
  1374.   | 3.24   | Extended the UpCall to pass the internal phase accumulator   |
  1375.   |        |   used by the fill code. (19-Oct-1991)                       |
  1376.   | 3.25   | Extended the Convert Area SWI to allow user defined lookup   |
  1377.   |        |   conversion tables. (25-Oct-1991)                           |
  1378.   | 3.26   | Added the VoiceActive SWI to allow applications to ensure the|
  1379.   |        |   sound system is sufficiently active to support all DataVox |
  1380.   |        |   assigned voices. (02-Nov-1991)                             |
  1381.   | 3.27   | Added two very small SWI's that allow a little more status   |
  1382.   |        |   reading of DataVox :- Version & SystemSpeed SWIs.          |
  1383.   |        |   (03-Nov-1991)                                              |
  1384.   | 3.28   | Corrected the Fill code to cope with timed play buffer sizes |
  1385.   |        |   smaller than the DMA buffer size. (03-Nov-1991)            |
  1386.   | 3.29   | Extended the Reason 0 (Init) UpCall code to load R6 with the |
  1387.   |        |   system sample speed. (04-Nov-1991)                         |
  1388.   | 3.30   | We have now acheived *full* system speed independance! Now   |
  1389.   |        |   the sound will adjust *with* the system if someone changes |
  1390.   |        |   it! (13-Nov-1991)                                          |
  1391.   | 3.31   | Mu Law datatype play has been added giving a fourth type that|
  1392.   |        |   DataVox understands. Now if only I had a sample or two to  |
  1393.   |        |   test these routines out on.... (14-Nov-1991)               |
  1394.   | 3.32   | Added a small bit to the pitch recalculation routines to help|
  1395.   |        |   prevent it being used when it is an undefined state. This  |
  1396.   |        |   should help with interupt usage of DataVox....             |
  1397.   |        |   (14-Nov-1991)                                              |
  1398.   | 3.33   | Fixed the recalibration code to prevent it being called with |
  1399.   |        |   invalid speeds and thus corrupting the pitch tables....    |
  1400.   |        |   (15-Nov-1991)                                              |
  1401.   | 3.34   | Corrected the Conversion code so conversion to and from Mulaw|
  1402.   |        |   now works properly. (16-Nov-1991)                          |
  1403.   | 3.35   | Added the SlaveChannel SWI and corrected a bug in the Reverse|
  1404.   |        |   SWI's code. (17-Nov-1991)                                  |
  1405.   | 3.36   | Fixed the Slaving code to work and updated the DataVoxStatus |
  1406.   |        |   command to cope with it. Added the ReadMaster SWI to allow |
  1407.   |        |   apps to monitor/control the slaving. (18-Nov-1991)         |
  1408.   | 3.37   | Fixed the VoiceActive SWI to correct a very embarrising      |
  1409.   |        |   error with it... It now works properly! (23-Nov-1991)      |
  1410.   | 3.38   | Adjusted the SampleToPitch SWI to recalibrate DataVox's      |
  1411.   |        |   idea of what the system speed is if R1 is 0 on Entry.      |
  1412.   |        |   (27-Nov-1991)                                              |
  1413.   | 3.39   | Fixed the Unset SWI to halt play if the channel being unset  |
  1414.   |        |   is playing at the time of being unset. (29-Nov-1991)       |
  1415.   | 3.40   | Corrected a couple of errors in the unset code introduced in |
  1416.   |        |   version 3.39. (1-Dec-1991)                                 |
  1417.   | 3.41   | Added two new reason codes to the UpCall system in prepera-  |
  1418.   |        |   tion for a standard UpCall file format. (12-Dec-1991)      |
  1419.   | 3.42   | Altered the fill code to fill in a byte wise fashion. This   |
  1420.   |        |   should considerably improve repeating play performance.    |
  1421.   |        |   (15-Dec-1991)                                              |
  1422.   | 3.43   | Corrected a few minor errors in a data-table and corrected an|
  1423.   |        |   error in the style of coding in error reporting...which    |
  1424.   |        |   saved some 200 bytes of space.... (16-Dec-1991)            |
  1425.   | 3.44   | Fixed errors in the newer Upcall code sections. (13-Jan-1992)|
  1426.   | 3.45   | 'Fixed' an error in the Upcall code system introduced in     |
  1427.   |        |   v3.42. However I am not happy with the fix as the code it  |
  1428.   |        |   'fixes' should work.... (16-Jan-1992)                      |
  1429.   | 3.46   | Corrected the Current Address routines to set the address up |
  1430.   |        |   at the start of sound play without waiting a DMA buffer    |
  1431.   |        |   fill. (20-Jan-1992)                                        |
  1432.   | 3.47   | Corrected an error in the Unset SWI routine that could have  |
  1433.   |        |   caused trouble.... Also modified it to not call its own SWI|
  1434.   |        |   routines via a SWI call but via a BL. This should improve  |
  1435.   |        |   its speed slightly. (2-Feb-1992)                           |
  1436.   | 3.48   | Various bug fixes to the UpCall code section. All now appears|
  1437.   |        |   to work as it should. (13-Feb-1992)                        |
  1438.   | 3.49   | Fixed a bug introduced by the UpCall code bug fixes.... Added|
  1439.   |        |   an upcall `pause` facility... (26-Feb-1992)                |
  1440.   | 3.50   | Received the SWI, Error and Message chunk allocations and    |
  1441.   |        |   coded them in. (18-Apr-1992)                               |
  1442.   | 3.51   | Fixed ConvertArea to full functionality. (14-Jun-1992)       |
  1443.   | 3.52   | Fixed the dynamic system speed recalibration to working order|
  1444.   |        |   after the additions made in v3.15 broke it... (Dang!)      |
  1445.   |        |   (28-Sep-1992)                                              |
  1446.   | 3.53   | Added to verify that DataVox is installed as a voice when    |
  1447.   |        |   AllocateChannel or RequestChannel is called. (09-Oct-1992) |
  1448.   | 3.54   | Added the AdjustMemory SWI with associated error message.    |
  1449.   |        |   Minor change to the Repeating pitch refresh. Major         |
  1450.   |        |   revamp of the play code to reduce bandwidth consumed by one|
  1451.   |        |   third. Also the play code now can stop and start on byte   |
  1452.   |        |   boundaries rather than word boundaries.(02-Nov-1992)       |
  1453.   | 3.55   | Added the SetInternalPitch SWI to allow for cases where      |
  1454.   |        |   extremely fine control of the replay rate is needed. Fixed |
  1455.   |        |   smooth update to not generate clicks when there is nothing |
  1456.   |        |   playing to update. Removed a redundant error message.      |
  1457.   |        |   Altered SampleToPitch to return negative pitches as needed.|
  1458.   |        |   SystemSpeed now recalibrates if needed. The internal fill  |
  1459.   |        |   code now uses 32bit fixed point values for sample replay   |
  1460.   |        |   improving the dynamic range coverage considerably.         |
  1461.   |        |   This version may break some early upcall code. Fixed the   |
  1462.   |        |   smooth update code to behave properly with respect to      |
  1463.   |        |   updating the pitch.(08-Nov-1992)                           |
  1464.   | 3.56   | Fixed the pitching commands to now accept pitches in the     |
  1465.   |        |   range -&7fff to &7fff. (26-Nov-1992)                       |
  1466.   | 3.57   | Fixed the Current Address update bug. (17-Apr-1993)          |
  1467.   | 3.58   | Fixed an error in the BufferFlag updating. Correction to     |
  1468.   |        |   buffer reloading code. (05-Jul-1993)                       |
  1469.   | 3.59   | Optimisations to the internal fill code. (2-Aug-1993)        |
  1470.   | 3.60   | Corrections to the Fill stopping code to prevent sample      |
  1471.   |        |   overflow. (7-Aug-1993)                                     |
  1472.   | 3.61   | Adjusted the repeating code to clear the phase accumulator.  |
  1473.   |        |   Corrected the fill code to correctly keep the phase        |
  1474.   |        |   accumulator across buffer fills. Altered the fill code to  |
  1475.   |        |   hopefully finally cure the overrun problem. A nice side    |
  1476.   |        |   effect is that CPU loading is now lowered somewhat.        |
  1477.   |        |   (12-Sep-1993)                                              |
  1478.   | 3.62   | Altered the fill code to reduce the size of it at the cost   |
  1479.   |        |   of one extra S cycle instruction. This allows a much       |
  1480.   |        |   unrolling of the loop allowing up to 64 bytes of the DMA   |
  1481.   |        |   buffer to be filled per loop pass. (compared to 16 bytes   |
  1482.   |        |   with previous versions) A major side effect of which is    |
  1483.   |        |   is further reduced CPU loading. (13-Sep-1993)              |
  1484.   | 3.63   | Fixed minor error with reverse code. (18-Oct-1993)           |
  1485.   | 3.64   | Corrected a few SWIs to return flags settings like they      |
  1486.   |        |   should. (14-Dec-1993)                                      |
  1487.   | 3.65   | Altered the GateOff code to return correct status bits.      |
  1488.   |        |   Altered the fill code to remove a register stacking - minor|
  1489.   |        |   efficiency stuff. (02-Jan-1994)                            |
  1490.   | 3.66   | Corrected a few stacking errors on some error returns.       |
  1491.   |        |   (20-Jan-1994)                                              |
  1492.   | 3.67   | Adjusted the pitch values to be more correct. (25-Jun-1994)  |
  1493.   | 3.68   | Altered ActiveVoices to ensure at least one channel is left  |
  1494.   |        |   active at all times. (27-Mar-1995)                         |
  1495.   =========================================================================