home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / desktop / d / datavox / Docs / Dtloadhelp next >
Encoding:
Text File  |  1992-11-26  |  44.0 KB  |  890 lines

  1.  DataVoxLoader Help File.
  2.  ========================
  3.  
  4.    This module complements the DataVox Module by loading and storing in
  5.  RMA the data files for play. This module requires the DataVox module to
  6.  be memory resident to both be loaded and for it to work. Removing the
  7.  DataVox module while this one is loaded is a dangerous move and may cause
  8.  undefined results (Read a machine crash.) to occur.
  9.  
  10.  The Concepts of DataLoad
  11.  ========================
  12.  
  13.    DataLoad provides a system of slots (or really logical sound channels)
  14.  to which files can be loaded and which can be related to real sound
  15.  channels. The mapping goes something like this:-
  16.  
  17.              +------+
  18.  File -----> | Slot | ---------+
  19.  ...         | ...  |          |      +------------+
  20.  ...         | ...  |          +----> | DataVox    |
  21.  ...         | ...  | --------------> | channel(s) |
  22.  ...         | ...  |          +----> +------------+
  23.  ...         | ...  | ---------+
  24.  File------> | Slot |
  25.              +------+
  26.  
  27.  The current version of DataLoad supports 1024 slots but this may be changed
  28.  at a later date and must not be counted on. Use the DataLoad_SlotsFree SWI
  29.  to find out how many slots are available instead.
  30.  
  31.    The slots may be linked freely to as many or as few DataVox channels as
  32.  desired. Also any data written to a slot linked to a DataVox channel or
  33.  channels will be automatically passed on to those channels for you. This
  34.  means your application need never touch DataVox for most operations other
  35.  than claiming channels from it.
  36.  
  37.  OSCLI Commands
  38.  ==============
  39.  
  40.  *DataLoadStatus
  41.    This command reads out the status of the logical channels in use in 
  42.  DataLoad. It informs you of their address,length,assignment & name.
  43.  Syntax: *DataLoadStatus
  44.  
  45.  *DataLoad_Load
  46.    This command loads files into DataLoad Slots for use. The Stereo flag
  47.  only has effect when the sample being loaded is stereo and not supplying
  48.  the DataVox channel to assign to causes the file to be simply loaded and
  49.  not assigned. Files that are recognised are Armadeus sample,DSEdit raw
  50.  sample,Amiga IFF 8SVX sample,Tracker sample,SUN audio file and ,of course,
  51.  the DataVox file. All bar the DataVox type III,Amiga IFF 8SVX,SUN audio
  52.  file & Tracker samples are recognised by their file type alone. The SUN
  53.  audio file,Amiga IFF 8SVX & Tracker samples are recognised by their file
  54.  contents. DataVox type III files are recognised by both their contents and
  55.  their filetype.
  56.  Syntax: *DataLoad_Load <filename> [DataVox channel] [Stereo Flag]
  57.  
  58.  *DataLoad_Save
  59.    This command saves a DataLoad Slot back to a file. All settings held by
  60.  the slot will be saved with the file. The file will be a DataVox file.
  61.  Syntax: *DataLoad_Save <filename> <DataLoad Slot>
  62.  
  63.  *DataLoad_AssignSlot
  64.    This command assigns a DataLoad Slot to a DataVox channel for play. If no
  65.  stereo flag is given and the sample is stereo then 0 is assumed.
  66.  Syntax: *DataLoad_AssignSlot <DataLoad Slot> <DataVox channel> [Stereo flag]
  67.  
  68.  *DataLoad_DeAssignSlot
  69.    This command deassigns a DataLoad Slot from a DataVox channel.
  70.  Syntax: *DataLoad_DeAssignSlot <DataLoad Slot> <DataVox channel>
  71.  
  72.  *DataLoad_ClearSlot
  73.    This command clears a DataLoad Slot - delinking DataVox from any 
  74.  references to it and releasing the claimed space back into the RMA.
  75.  Syntax: *DataLoad_ClearSlot <DataLoad Slot>
  76.  
  77.  SWI Commands
  78.  ============
  79.  
  80.  DataLoad_Load
  81.   On Entry :-
  82.    R0 file name/path pointer.
  83.    R1 channel. 0 for just load.
  84.    R2 Stereo bias if sample is stereo - 0 for Left 1 for Right.
  85.   On Exit  :-
  86.    R0 Data Load Slot assigned.
  87.    R1 file format recognised string. (0 for not recognised.)
  88.    R2 preserved.
  89.   Errors :-
  90.    I do not understand the format of this file - it is too new.
  91.    No free DataLoad Slots available.
  92.    This is not a file.
  93.    Insufficient RMA Space to Load file.
  94.    Bad DataVox channel to load to.
  95.    Bad Stereo Assignment - 0 or 1 please.
  96.   Use :-
  97.         This SWI handles the loading of files into the RMA for use,allocating
  98.   them to a DataVox channel using the stereo flag if the sample being loaded
  99.   is stereo. It hands back to you a Slot number which is to be used to
  100.   reference the sample. This is for multi-tasking usage of the module and
  101.   it is expected that applications do *not* reference any slots but those
  102.   given to them. Also any filing system error can be reported back by this
  103.   routine as well as the errors listed above.
  104.  
  105.        The loader code recognises and will interpret data from :-
  106.  
  107.   DataVox files v1,v2 & v3. (All flags. surprise surprise! :-) )
  108.   Armadeus sample files.    (Data type and sample speed)
  109.   DSEdit raw sample files.  (Data type)
  110.   Tracker sample files.     (Data type & Repeat points)
  111.   Amiga IFF 8SVX files.     (Data type,stereo flag and sample speed)
  112.   SUN Audio files.          (Data type and sample speed)
  113.   
  114.   Any file not mentioned above will be loaded but no interpretation is made
  115.   on them and simple default values are assigned of :- Logarithmic data type
  116.   ,&4000 pitch,repeat block the whole file. So you can load and play text
  117.   files if you *really* want to. The Amiga IFF,Tracker & SUN file formats
  118.   are recognised by their internal contents and can be any file type. If the
  119.   file loaded is a compressed file (DataVox v3 supports this) then it
  120.   will *not* be assigned to the DataVox channel requested but it will be
  121.   loaded in memory. DataVox type III files will also be recognised by their
  122.   file contents and will be correctly loaded regardless of their filetype.
  123.  
  124.         The number returned in R1 signals the kind of file recognised by
  125.   providing a pointer to a null terminated string that names the format loaded.
  126.   If zero is returned then the file format was unrecognised and default values
  127.   were be arranged.
  128.  
  129.   N.B. Please note DataLoad assumes that the Tracker and IFF headers are
  130.   well defined chunks and can react strangely to corrupted headers. It
  131.   shouldn't crash but merely do unexpected things like play more data than
  132.   there is in the file resulting in RMA being played.
  133.  
  134.  DataLoad_Save
  135.   On Entry:-
  136.    R0=Pointer to path/filename.
  137.    R1=DataLoad Slot number.
  138.   On Exit:-
  139.    R0,R1 preserved.
  140.   Errors:-
  141.    Bad DataLoad Slot.
  142.   Use:-
  143.        Not unsurprisingly this SWI saves a DataLoad Slot back to a file.
  144.   All flags etc set by the DataLoad_WriteData SWI will be saved in the file.
  145.   The files are always DataVox type 3 files. Also filing system errors can
  146.   be reported back as well as the error listed above.
  147.  
  148.  DataLoad_AssignSlot
  149.   On Entry:-
  150.    R0 = DataLoad Slot to be assigned.
  151.    R1 = DataVox Channel.
  152.    R2 = Stereo assignment (0 or 1 as per DataLoad_Load)
  153.   On Exit:-
  154.    R0,R1,R2 preserved
  155.   Errors:-
  156.    Bad DataVox Channel to assign to.
  157.    Bad DataLoad Slot to assign.
  158.    Bad DataLoad Slot to assign - Block is compressed.
  159.    Bad Stereo flag - 0 or 1 please.
  160.   Use:-
  161.        This SWI assigns a DataLoad Slot to the DataVox channel specified.
  162.   All flags etc will be set up for you and the channel will be pointed at
  163.   the correct block of memory. More importantly DataLoad will take note
  164.   that this Slot is assigned to that DataVox channel and will ensure that
  165.   that channel is from here on in is pointing at the right memory. This is
  166.   important as it allows DataLoad to clean up after itself where needed
  167.   and ensure that DataVox is not pointing at an invalid block of memory.
  168.   Thus it is reccomended that you use this SWI for all references to
  169.   files held by DataLoad. Please note that if the sample being assigned is
  170.   not stereo then the stereo flag will be ignored.
  171.  
  172.  DataLoad_DeAssignSlot
  173.   On Entry:-
  174.    R0 = DataLoad Slot to be deassigned.
  175.    R1 = DataVox Channel it was assigned to.
  176.   On Exit:-
  177.    R0,R1 preserved.
  178.   Errors:-
  179.    Bad DataVox Slot to deassign.
  180.    Bad DataLoad Slot to deassign.
  181.    This DataLoad Slot is not assigned to that DataVox channel!
  182.   Use:-
  183.        This SWI delinks a DataLoad slot from a DataVox channel when needed.
  184.   It also informs DataLoad that it does not need to ensure that that DataVox
  185.   channel is pointing to valid data anymore. All settings on the DataVox
  186.   channel are unset.
  187.  
  188.  DataLoad_ClearSlot
  189.   On Entry:-
  190.    R0=DataLoad Slot to clear.
  191.   On Exit:-
  192.    R0 preserved.
  193.   Error:-
  194.    Bad DataLoad Slot to Clear.
  195.   Use:-
  196.        This SWI clears a DataLoad slot releasing any memory held by it back
  197.   to the RMA and delinking any DataVox channels that reference that Slot.
  198.   Please note this function is only properely performed if the Slot was
  199.   linked using the DataLoad_AssignSlot SWI and not if an application did
  200.   the linking itself.
  201.  
  202.  DataLoad_ReadData
  203.   On Entry:-
  204.    R0 Reason Code.
  205.    R1 DataLoad Slot to Read.
  206.   On Exit:-
  207.    R0,R1 preserved.
  208.    R2 Data wanted.
  209.   Errors:-
  210.    Unknown Read operation.
  211.    Bad DataLoad Slot to read.
  212.    Bad DataLoad Slot to read - no data linked to it.
  213.   Use:-
  214.        This is a general purpose reading SWI that allows you to read the
  215.   various settings of a DataLoad Slot. Precisely what data is returned is
  216.   governed by the reason code used and these are listed below.
  217.  
  218.    Reason Code | Data Read
  219.    ------------+-----------------------------------------------------------
  220.        0       | Data type of the slot. 0 Logarithmic,1 Linear Unsigned,
  221.                |  2 Linear signed & 3 Ulaw Logarithmic format.
  222.                |
  223.        1       | Timer flag of the slot. 1 for timed play ,0 otherwise.
  224.                |
  225.        2       | Reverse flag of the slot. 1 for reverse play ,0 otherwise.
  226.                |
  227.        3       | Fixed pitch flag. If this is set then the fixed pitch
  228.                |  read by reason code 6 will be used when the slot is
  229.                |  assigned to a DataVox channel.
  230.                |
  231.        4       | Stereo flag. 1 for a stereo slot. Only if this flag is set
  232.                |  will the stereo flag passed to the Load & AssignSlot calls
  233.                |  have any effect.
  234.                |
  235.        5       | Compressed flag. 1 for a compressed slot ,0 otherwise. If 
  236.                |  this flag is set then the slot can not be assigned to
  237.                |  a channel.
  238.                |
  239.        6       | Pitch. This reads the pitch setting of a slot. The pitch
  240.                |  given is a standard Arc one in the range 0-&8000 as used
  241.                |  by the sound system. 0 indicates no fixed pitch and
  242.                |  supercedes the fixed pitch flag.(if set) N.B. pitches
  243.                |  returned by this SWI are always scaled to a 48 us system
  244.                |  speed. If the current system speed is different from
  245.                |  48 us then this pitch will be different from the actual
  246.                |  pitch in use.
  247.                |
  248.        7       | DataOffset - this gives the offset from the start of the
  249.                |  slot block to the actual Data to be played.
  250.                |
  251.        8       | RepeatStart - this is an offset from the start of the
  252.                |  slot block to the start of the repeat block.
  253.                |
  254.        9       | RepeatEnd - this is an offset from the start of the slot
  255.                |  slot block to the end of the repeat block.
  256.                |
  257.        10      | Uncompressed Size - this is the size of the block
  258.                |  uncompressed. If the file is already uncompressed then
  259.                |  this will simply be the total size of the block and the
  260.                |  total size of the file held in memory but if the file is
  261.                |  compressed then this is the total size of the block of
  262.                |  memory holding the file. This is for file compression
  263.                |  as supported by DataLoad.
  264.                |
  265.        11      | UpCall Offset. This reads the offset from the start of the
  266.                |  slot block to the slots UpCall code (if any). If UpCall
  267.                |  code is present then this will always be word sized
  268.                |  otherwise it is always zero.
  269.                |
  270.        12      | BufferStart. This returns the absolute memory address of the
  271.                |  start of the slot block.
  272.                |
  273.        13      | BufferLength. This returns the total length of the slot 
  274.                |  block. This should be identical to the Uncompressed
  275.                |  size but does not have to be. (It should never be smaller
  276.                |  than it though for average cases.)
  277.                |
  278.        14      | SlotName. This returns a pointer to the null terminated
  279.                |  leaf string of the slot name.
  280.                |
  281.        15      | 16 bit flag. 1 for a sixteen bit sample, 0 otherwise.
  282.        16      | FullSlotName. This returns a pointer to the null terminated
  283.                |  full path, as given to DataLoad, for that slot.
  284.  
  285.   This SWI should be the only way in which applications interrogate what the
  286.   settings of a DataLoad slot are.
  287.  
  288.  DataLoad_WriteData
  289.   On Entry:-
  290.    R0 Reason Code.
  291.    R1 DataLoad Slot to Write.
  292.    R2 Data to Write.
  293.   On Exit:-
  294.    R0,R1,R2 preserved.
  295.   Errors:-
  296.    Unknown Write operation.
  297.    Bad DataLoad Slot to write - no data linked to it.
  298.    Bad DataLoad Slot to write.
  299.   Use:-
  300.        This is a general purpose SWI for setting a DataLoad Slots settings.
  301.   Any DataVox channels assigned to this Slot by the AssignSlot SWI will be
  302.   automatically updated to reflect the new settings. Each reason code has
  303.   its own extra error message associated with it and the reason codes &
  304.   error messages are :-
  305.                        
  306.   Reason Code | Comment
  307.   ------------+-----------------------------------------------------------
  308.        0      | Writes the Slots data type. (0,1,2 or 3)
  309.               | Error:- Bad DataType to Write.
  310.               |
  311.        1      | Sets the Slots timed flag. (0 or1)
  312.               | Error:- Bad Timer Flag to Write.
  313.               |
  314.        2      | Writes the Slots reverse flag. (0 or 1)
  315.               | Error:- Bad Reverse Flag to Write.
  316.               |
  317.        3      | Writes the Slots fixed pitching flag. (0 or 1)
  318.               | Error:- Bad Pitch Flag to Write.
  319.               |
  320.        4      | Writes the Slots stereo flag. (0 or 1)
  321.               | This automatically delinks all DataVox channels from this
  322.               | slot.
  323.               | Error:- Bad Stereo Flag to Write.
  324.               |
  325.        5      | Writes the Slots compressed flag. (0 or 1)
  326.               | Error:- Bad Compressed Flag to Write.
  327.               |
  328.        6      | Writes the Slots pitch. (0-&8000)
  329.               | Error:- Bad Pitch to Write.
  330.               |
  331.        7      | Writes the Slots DataOffset. (32-Block Size)
  332.               | Error:- Bad Data Offset to Write.
  333.               |
  334.        8      | Writes the Slots Repeat Start Offset. (32-Block Size)
  335.               | Error:- Bad Repeat Start Offset to Write.
  336.               |
  337.        9      | Writes the Slots RepeatEnd Offset. 
  338.               | (Repeat Start Offset-Block Size)
  339.               | Error:- Bad Repeat End Offset to Write.
  340.               |
  341.        10     | Writes the Slots Uncompressed Size. (32-What Ever)
  342.               |
  343.        11-14  | Reserved for future expansion.
  344.               |
  345.        15     | Writes the Slots sixteen bit flag. (0 or 1)
  346.               | Error:- Bad 16 bit Flag to Write.
  347.  
  348.  DataLoad_SlotsFree
  349.   On Entry:-
  350.    R0,R1 Undefined.
  351.   On Exit:-
  352.    R0 No. Unallocated channels.
  353.    R1 No. Allocated channels.
  354.   Errors:-
  355.    none.
  356.   Use:-
  357.        This returns the number of Allocated and Unallocated channels
  358.   maintained by DataLoad. This allows applications to query if sufficient
  359.   slots are available for use.
  360.  
  361.  DataLoad_CreateSlot
  362.   On Entry:-
  363.    R0 Pointer to Name.
  364.    R1 Size of Data.
  365.    R2 Type of Data.
  366.   On Exit:-
  367.    R0 Slot No.
  368.    R1 Ptr to Start of Buffer. (first byte of data after header data.)
  369.    R2 Ptr to End of Buffer.
  370.   Errors:-
  371.    No free slots to Create Slot into.
  372.    Insufficient RMA space to Create Slot.
  373.    This is a silly size to Create a Slot to!
  374.   Use:-
  375.        This SWI allows you to create an empty slot for use. This is primarily
  376.    intended for Sound Samplers to use but anyone who needs to create a Slot
  377.    can use this. The Slot is pre-initialised to an appropriate set of
  378.    values and is cleared out to 'zero sound'. Exactly what the slot is filled
  379.    with is decided by the Data Type. Please note that due to the way the RMA
  380.    allocates blocks the delivered space may be a few bytes *larger* (never
  381.    smaller) than requested. NB The size passed is assumed to be *sans*
  382.    header and sufficient space for a header will be automatically added to
  383.    this size before allocation occurs.
  384.  
  385.  DataLoad_ExtendSlot
  386.   On Entry:-
  387.    R0 DataLoad Slot to extend.
  388.    R1 Signed integer of amount to extend.
  389.   On Exit:-
  390.    R0 & R1 preserved.
  391.   Errors:-
  392.    Bad DataLoad Slot to Extend.
  393.    Bad DataLoad Slot to Extend - no data linked to it.
  394.    Bad Size to Extend by! This makes the slot smaller than header size!.
  395.    No Room in RMA for Block Extension.
  396.   Use:-
  397.        This allows you to alter the size of an existing slot to whatever
  398.   is needed. If the Slot is extended in size then the extended area is
  399.   automatically cleared to 'zero-sound' for you. If any channels are
  400.   linked to this slot then they are unlinked automatically. Please note that
  401.   any size given is expected to be *inclusive* of the 32 bytes of header
  402.   space.... Changes are currently *not* echoed to any assigned channels....
  403.  
  404.   N.B. This SWI assumes you know what you are doing and does *not* adjust
  405.   most of the header information. Therefore care should be exercised in its
  406.   use.... It does perform clipping though to ensure that certain offsets are
  407.   still valid.
  408.  
  409.   N.N.B. Using an adjust size of 0 will cause the RMA to reshuffle the block
  410.   in memory, allowing you to force the RMA to try and relocate the block as
  411.   low in memory as possible. Care must be taken though to ensure this trick
  412.   is only used when sufficient free memory *below* the block is available
  413.   else the block could be shuffled up higher in the RMA.
  414.  
  415.  DataLoad_Version
  416.   On Entry:-
  417.    R0 Undefined
  418.   On Exit:-
  419.    R0 Version Number * 100 
  420.   Errors:-
  421.    none
  422.   Use:-
  423.        Fairly self explanitory really.
  424.  
  425.  DataLoad_QueryAssign
  426.   On Entry:-
  427.    R0 DataVox channel to query.
  428.   On Exit:-
  429.    R0 Slot number attached to that channel. (0 if none)
  430.   Errors:-
  431.    Bad real channel to query.
  432.   Use:-
  433.        This allows applications to intelligently decide whether or not an
  434.   allocation call is needed. This is because allocation calls are time
  435.   intensive compared to this SWI and an application may wish to avoid
  436.   unecessary delays where possible.
  437.  
  438. Error Messages
  439. ==============
  440.  
  441.    The Error range begins at &806180, ends at &8061BF, and here is the error
  442. message list. This list only comprises errors generated *by* DataLoad, errors
  443. from filing systems will be reported back as appropriate too.
  444.  
  445.    Error # | Error Message
  446.    --------+-------------------------------------------------------------
  447.      0     | DataVox is not loaded in memory. I cannot initialise!
  448.      1     | DataLoad is in use.
  449.      2     | Bad DataVox channel to assign the file to.
  450.      3     | Bad Stereo flag.
  451.      4     | Bad Slot number to save.
  452.      5     | Insufficient RMA Space to Initialise!
  453.      6     | Unknown DataLoad operation.
  454.      7     | I do not understand the format of this file - it is too new.
  455.      8     | No free DataLoad Slots available.
  456.      9     | This is not a file.
  457.      10    | Insufficient RMA Space to Load file.
  458.      11    | Bad DataVox channel to load to.
  459.      12    | Bad Stereo Assignment - 0 or 1 please.
  460.      13    | Bad DataLoad Slot.
  461.      14    | Bad DataVox Channel to assign to.
  462.      15    | Bad DataLoad Slot to assign.
  463.      16    | Bad DataLoad Slot to assign - Block is compressed.
  464.      17    | Bad Stereo flag - 0 or 1 please.
  465.      18    | Bad DataVox Slot to deassign.
  466.      19    | Bad DataLoad Slot to deassign.
  467.      20    | This DataLoad Slot is not assigned to that DataVox channel!
  468.      21    | Bad DataLoad Slot to Clear
  469.      22    | Unknown Read operation.
  470.      23    | Bad DataLoad Slot to read.
  471.      24    | Bad DataLoad Slot to read - no data linked to it.
  472.      25    | Unknown Write operation.
  473.      26    | Bad DataLoad Slot to write.
  474.      27    | Bad DataLoad Slot to write - no data linked to it.
  475.      28    | Bad DataType to Write.
  476.      29    | Bad Timer Flag to Write.
  477.      30    | Bad Reverse Flag to Write.
  478.      31    | Bad Pitch to Write.
  479.      32    | Bad Data Offset to Write.
  480.      33    | Bad Repeat Start Offset to Write.
  481.      34    | Bad Repeat End Offset to Write.
  482.      35    | Bad Stereo Flag to Write.
  483.      36    | Bad Compressed Flag to Write.
  484.      37    | Bad Pitch Flag to Write.
  485.      38    | Bad 16 bit Flag to Write.
  486.      39    | No free slots to Create Slot into.
  487.      40    | Insufficient RMA space to Create Slot.
  488.      41    | This is a silly size to Create a Slot to!
  489.      42    | Bad datatype to Create a Slot with!
  490.      43    | Bad DataLoad Slot to Extend.
  491.      44    | Bad DataLoad Slot to Extend - no data linked to it.
  492.      45    | Bad Size to Extend by! This makes the slot smaller than header
  493.            |   size!
  494.      46    | No Room in RMA for Block Extension.
  495.      47    | Bad real channel to query.
  496.  
  497.  DataVox File Format
  498.  ===================
  499.  
  500.    Consists of eight header words then pure sample data in the newest format.
  501.  However the two older formats are supported for load only and are noted here
  502.  as well. Any bits whose function is not specifically stated should always be
  503.  cleared to zero as they are reserved for future expansion. Filetype &108 is
  504.  the officially allocated type for these files.
  505.  
  506.   File Format 1
  507.   -------------
  508.  
  509.                         Byte | Comment
  510.                         -----+------------------------------------------
  511.                            0 | Data Type. Currently in the range 0-2.
  512.                              |   0 Log, 1 Linear Unsigned & 2 Linear
  513.                              |   Signed.
  514.                            1 | Flag Byte. Bit 0 set for timed unset for
  515.                              |   untimed.Bit 1 set for fixed pitching 0
  516.                              |   for normal play.
  517.                          2-3 | 16 bit pitch value for sample.
  518.                           4  | 32 bit offset from header start to data.
  519.                              |   8 for this format.
  520.                           8+ | Sample data.
  521.  
  522.   File Format 2
  523.   -------------
  524.              
  525.                       Byte   | Comment
  526.                       -------+------------------------------------------
  527.                            0 | Data Type. Currently in the range 0-2.
  528.                              |   0 Log, 1 Linear Unsigned & 2 Linear
  529.                              |   Signed.
  530.                            1 | Flag Byte. Bit 0 set for timed unset for
  531.                              |   untimed.Bit 1 set for reversed play 0
  532.                              |   for normal play. Bit 2 set for fixed
  533.                              |   pitching 0 for normal.
  534.                          2-3 | 16 bit pitch value for sample.
  535.                          4-7 | 32 bit offset from header start to data.
  536.                              |   16 for this format.
  537.                         8-11 | 32 bit offset to start of repeated data.
  538.                        12-15 | 32 bit offset to end of repeated data.
  539.                          16+ | Sample data.
  540.  
  541.   File Format 3
  542.   -------------
  543.  
  544.                       Byte   | Comment
  545.                       -------+-----------------------------------------
  546.                            0 | Data Type. Currently in the range 0-3.
  547.                              |   0 Log, 1 Linear Unsigned, 2 Linear
  548.                              |   Signed & Ulaw Logarithmic.
  549.                            1 | Flag Byte.
  550.                              |   Bit 0 set for timed play.
  551.                              |   Bit 1 set for reversed play.
  552.                              |   Bit 2 set for fixed pitching.
  553.                              |   Bit 3 set for stereo sample.
  554.                              |   Bit 4 set for compressed sample.
  555.                              |   Bit 5 set for 16 bit data.
  556.                          2-3 | 16 bit pitch value for sample.
  557.                              |   If bit 15 is set then the number is a
  558.                              |   negative number with the top 16 bits
  559.                              |   assumed to be &FFFF.
  560.                          4-7 | 32 bit offset from header start to data.
  561.                              |   32 for this format.
  562.                         8-11 | 32 bit offset to start of repeated data.
  563.                        12-15 | 32 bit offset to end of repeated data.
  564.                        16-19 | 32 bit "DVOX" ID Word. (&584F5644)
  565.                        20-23 | 32 bit Version Number. (3)
  566.                        24-27 | 32 bit Offset to Upcall Code.
  567.                        28-31 | 32 bit Uncompressed File Size.
  568.                         32+  | Sample data.
  569.  
  570.  
  571.    Formats 1 & 2 are provided purely for compatability reasons whereas
  572.  Format 3 is the format currently used. The layout of the file must be :-
  573.  
  574.     +----------+--------+-----------------+
  575.     | Header   | UpCall | Sample          |
  576.     | 32 bytes | Code   | Data            |
  577.     +----------+--------+-----------------+
  578.  
  579.  The UpCall code must be between the sample data and the header information
  580.  and it is the Editors responsibility to ensure that the UpCall code is
  581.  kept valid if the Block size is altered.
  582.  
  583.    If the sample is stereo then the file looks something like this :-
  584.  
  585.     +----------+--------+---------------+---------------+
  586.     | Header   | UpCall | Sample        | Sample        |
  587.     | 32 bytes | Code   | Data   Part A | Data   Part B |
  588.     +----------+--------+---------------+---------------+
  589.  
  590.  Where part A is refered to by Stereo flag setting 0 & part B referred to
  591.  as Stereo flag 1. Please note to determine the boundary between part A &
  592.  part B the following calculation is used :-
  593.  
  594.  Part A Start Offset :- Data Offset
  595.         End   Offset :- Data Offset + ((Length of Block - Data Offset)/2)
  596.  Part B Start Offset :- Data Offset + ((Length of Block - Data Offset)/2)
  597.         End   Offset :- Length of Block
  598.  
  599.  If the sample is a 16 bit one then the sample data is further sub-divided
  600.  into two sections :-
  601.                                   
  602.   +---------------+--------------+
  603.   | Sample Data   | Sample Data  |
  604.   |   high bytes. |   low bytes. |
  605.   +---------------+--------------+
  606.  
  607.  Each of these sections is exactly half of the original size of the data
  608.  section. Of the two sections only the high bytes will be actually played
  609.  as the archimedes sound system is currently capable of only outputing 
  610.  eight bit samples. Other than this change the data area is treated
  611.  identically....
  612.  
  613.    Also an area is being reserved for applications. This area will be totally
  614.  ignored by DataLoad but may be used by applications to add `supplemental`
  615.  data that they feel the sample needs. The idea is data like, date of
  616.  sampling, textual note as to what the sample is, etc... will be stored
  617.  here. In no way is *anything* required to be stored here however. It is
  618.  a chunk based area where each chunk is headed by two words.
  619.  
  620.   Chunk format :-
  621.  
  622.   Byte | Comment
  623.   -----+-----------------------------------------------------------------
  624.   0-3  | An ID word identifying what the chunk is. All chunk ID's should
  625.        |   be registered with me to avoid name collision.
  626.   4-7  | A length word. Relative to the start of the chunk this should be
  627.        |   word sized length of the chunk in bytes. All chunks *must* be
  628.        |   word sized.
  629.   8+   | Chunk data. This is entirely arbitrary to the chunk....
  630.  
  631.   This area is placed between the header data and before the UpCall code (if
  632.   any is present.) otherwise it is before the Sample Data. Like so:-
  633.  
  634.     +----------+-------------+--------+-----------------+
  635.     | Header   | Application | UpCall | Sample          |
  636.     | 32 bytes | Area        | Code   | Data            |
  637.     +----------+-------------+--------+-----------------+
  638.  
  639.   Currently defined chunks are:-
  640.  
  641.   Chunk ID         | Comment
  642.   -----------------+----------------------------------------------------
  643.   `Date` &65746144 | A five byte time detailing the date of sampling. The
  644.                    |   format of the bytes is as per OS_Word 14,3.
  645.   `Name` &656D614E | A null terminated string detailing the long name of
  646.                    |   the sample.
  647.   `Note` &65746F4E | A null terminated textual string detailing something
  648.                    |   about the sample.(Intended to store human readable
  649.                    |   interesting data.)
  650.  
  651.    Next the Upcall area is organised into two distinct types. There is the
  652.  `custom` uneditable type that has been presumably created for a special
  653.  purpose and there is the editable type. The two are distinguished by the
  654.  first word of the upcall area being a `UpCl` or &6C437055. If this word
  655.  is present the next few words are in a special format. This looks like
  656.  this :-
  657.  
  658.   Bytes  | Comment
  659.   -------+----------------------------------------
  660.    0-3   |  ID Word `UpCl`.
  661.    4-7   |  Offset to entry point for UpCall code.
  662.    8-11  |  ID Word (for Editors)
  663.    11+   |  Version Dependant Jump table.
  664.  
  665.   The offset(s) contained in the code should (bar internal to your code) all
  666. be relative to byte 0 or the start of the upcall area. The ID word is purely
  667. for Editors to be able to identify the type of upcall code being used. The
  668. word is divided into two 16 bit parts. The high 16 bits (bits 31-16) contain
  669. the *type* of upcall code contained. This should be a number in the range 
  670. 0-65535 and dictates how the next few words should be interpreted. The low
  671. 16 bits is the minor version number * 100. This allows for each major type
  672. of upcall code to have its own version type and history as required.
  673.  
  674.   After the first three words the next few words format is totally dictated
  675. by the major version number. Editors encountering a major version number
  676. that they don't understand should refuse to allow editing of the upcall
  677. code. (Removal yes but not editing.) There is currently only one defined
  678. upcall type but again I expect this to change. To register your particular
  679. type of upcall code you must send all the details and some example source
  680. code of it (and some examples would be nice) to me. I will then assign it a
  681. major type number and note the neccesary details that an editor will need to
  682. know here. A short descriptive name of the purpose of the upcall code is
  683. needed too.
  684.  
  685.   Some general points to remember about Upcall code are that the code is
  686. being called under interupts so re-entrancy is vital. Basically stacking
  687. R0-R12 & R14 along with keeping references to workspace to a minimum in the
  688. Upcall update code will ensure this. Of course calling SWI's from the
  689. primary update code is ill advised. Only do that if you really *must*! Other
  690. than that coding UpCall code with all the restrictions that interupt code
  691. has is the best course.
  692.  
  693.  Upcall types:-
  694.  --------------
  695.    
  696.   +--------------+---------------------------------------------------------+
  697.   |Version No.s  | Comment/Notes.                                          |
  698.   +------+-------|                                                         |
  699.   |Major | Minor |                                                         |
  700.   +------+-------+---------------------------------------------------------+
  701.   | 0    | 0.04  | Description - Table Sequenced Song.                     |
  702.   |      |       | Uses - 4 extra header words.                            |
  703.   |      |       |  bytes 12-15 are the offset to a Pitch Table which is   |
  704.   |      |       |   laid out two words per entry.                         |
  705.   |      |       |   Word 0 16 bit number - total number of pitches held in|
  706.   |      |       |     the table. 0 indicates no pitches are held. The top |
  707.   |      |       |     16 bits reserved for future expansion.              |
  708.   |      |       |   Word 1 The system speed in micro seconds this table is|
  709.   |      |       |     calibrated for. All 24 other bits reserved for      |
  710.   |      |       |     future expansion.                                   |
  711.   |      |       |   Word n*2 (where n is a index  number) is the 16 bit   |
  712.   |      |       |     pitch.                                              |
  713.   |      |       |   Word n*2+1 is the internal format phase accumulator   |
  714.   |      |       |     pitch. (IE the value returned from SWI "Sound_Pitch"| 
  715.   |      |       |     shifted down by 16 bits.)                           |
  716.   |      |       |  Bytes 16-19 are the offset to a Start Address Table    |
  717.   |      |       |    which is laid out one word per entry.                |
  718.   |      |       |   Word 0 is a 16 bit number - total number of Start     |
  719.   |      |       |     Addresses held. Top 16 bits reserved.               |
  720.   |      |       |   Word n (where n is an index number) is the 32 bit     |
  721.   |      |       |     offset from the start of data to the actual start   |
  722.   |      |       |     for this entry.                                     |
  723.   |      |       |   Bytes 20-23 are the offset to an End Address Table    |
  724.   |      |       |    which is laid out in an indentical fashion to the    |
  725.   |      |       |    start address table.                                 |
  726.   |      |       |   Bytes 24-27 are the offset to the Sequence Table.     |
  727.   |      |       |    Two words per entry.                                 |
  728.   |      |       |    Word 0 16 bit number - total number of sequences     |
  729.   |      |       |      held. top 16 bits reserved.                        |
  730.   |      |       |    Word 1 reserved for future expansion.                |
  731.   |      |       |    Word n*2 (where n is an index number) :-             |
  732.   |      |       |      top 16 bits - Start Address index number           |
  733.   |      |       |      low 16 bits - End Address index number             |
  734.   |      |       |    Word n*2+1 :-                                        |
  735.   |      |       |      top 16 bits - Reserved for future expansion.       |
  736.   |      |       |      low 16 bits - Pitch index number.                  |
  737.   |      |       |  This is a very simple system designed purely for speed.|
  738.   +------+-------+---------------------------------------------------------+
  739.  
  740.    Finally DataLoad allows for the concept of a compressed file. The layout
  741.  of a compressed file is :-
  742.                                            
  743.     <------------File Length-------------->
  744.     <------------Block Length in Memory-------------->
  745.     +----------+--------+--------+--------+- - - - - +
  746.     | Header   | UpCall | Header | Sample |          |
  747.     | 32 bytes | Code   | Byte   | Data   |          |
  748.     +----------+--------+--------+--------+- - - - - +
  749.     <---Data Offset---->
  750.  
  751.  The data offset points to a header byte that identifies the compression
  752.  method used on the data ,followed by the compressed sample data. DataLoad
  753.  does not have any compression routines in it and will refuse to allow a
  754.  compressed sample to be linked to a DataVox channel. Instead it is the
  755.  applications responsibility to uncompress the file first. If you wish
  756.  to write a compression routine and want to incorporate it with DataLoad
  757.  please register such a routine with me so that you do not use conflicting
  758.  header bytes that may have been allocated to another compression routine.
  759.  Currently no compression routines have been defined but I expect this
  760.  to change real soon...
  761.  
  762.  Version History
  763.  +---------+--------------------------------------------------------------+
  764.  | Version | Comments.                                                    |
  765.  +---------+--------------------------------------------------------------+
  766.  | 1.00    | The complement to the DataPlayerModule DataLoad maintains up |
  767.  |         |  eight files in the RMA and attaches them appropriately to   |
  768.  |         |  the DataVoxPlayer channels. (16-Feb-1991)                   |
  769.  | 1.01    | Added to the loader SWI the added commands for the modules   |
  770.  |         |  file type. The file type stores in it the pitch,type,timing |
  771.  |         |  control,offset to data and data itself for a Noise. Filetype|
  772.  |         |  &401 is used. (16-Feb-1991)                                 |
  773.  | 1.02    | Corrected a loading routine error that didn't release memory |
  774.  |         |  before it claimed more memory resulting in a rapidly        |
  775.  |         |  increasing RMA Space... (16-Feb-1991)                       |
  776.  | 1.03    | Added the save SWI to store sounds back to disk...(suprise,  |
  777.  |         |  surprise..) (18-Feb-1991)                                   |
  778.  | 1.04    | Added a nice wee OSCLI command interface to allow the loading|
  779.  |         |  ,saving and clearing of files from or to DataChannels.      |
  780.  |         |  (19-Feb-1991)                                               |
  781.  | 1.05    | Updated the save code to give more meaningful errors (It was-|
  782.  |         |  n't before). (05-Apr-1991)                                  |
  783.  | 1.06    | Updated the save so that it passes the errors from the filing|
  784.  |         |  system ,which are the most meaningful! (21-Apr-1991)        |
  785.  | 1.07    | Added the ability to load Armadeus samples and make a reason-|
  786.  |         |  able approximation of their playing speed. Also now loads   |
  787.  |         |  DSEdit raw sound files but it makes no guess as to their    |
  788.  |         |  playing speed - this must be set by the user. (19-May-1991) |
  789.  | 1.08    | Corrected an embarrasing error with the DataLoad command that|
  790.  |         |   caused only DataChannel 1's pitch to affected when loading |
  791.  |         |   correctly typed files. (08-Jun-1991)                       |
  792.  | 1.09    | Corrected to work with the non-standard OS_File behaviour of |
  793.  |         |   Arcfs v0.30 which played silly buggers with the load       |
  794.  |         |   address in R2 from OS_File 255. Reduced code size by a     |
  795.  |         |   whole 4 bytes! Amazing huh for fixing an error I shouldn't |
  796.  |         |   have had to in the first place! (06-Jul-1991)              |
  797.  | 1.10    | Finally got a working formula for kHz to pitch mapping and   |
  798.  |         |   have corrected DataLoad to use it. Now it always maps the  |
  799.  |         |   right speed. (15-Jul-1991)                                 |
  800.  | 1.11    | Updated to work with version 3.07 of DataPlay. It will now   |
  801.  |         |   save/restore the reverse flag and the repeated area        |
  802.  |         |   settings. Also due to the new facilities of DataPlay it    |
  803.  |         |   reliably copes with Armadeus files. (31-Aug-1991)          |
  804.  | 1.12    | Fixed an error in the Armadeus file loading code. I wonder   |
  805.  |         |   who forgot about little things like channel numbers... :-) |
  806.  |         |   (31-Aug-1991)                                              |
  807.  | 1.13    | Added the FindBuffer SWI to allow applications using DataLoad|
  808.  |         |   to manipulate the stored data directly. (01-Sep-1991)      |
  809.  | 1.14    | Fixed an error in the Loading Code that dealt with Format 2  |
  810.  |         |   files. (08-Sep-1991)                                       |
  811.  | 1.15    | Extended the Save code to cope with the extended version of  |
  812.  |         |   SetRepeat SWI. (08-Sep-1991)                               |
  813.  | 1.16    | Fixed a intermittant error in the Save code that was causing |
  814.  |         |   errors when doing file loads. (16-Oct-1991)                |
  815.  | 2.00    | The all new singing and dancing version of Dataload. It      |
  816.  |         |   supports mulitple files and a whole lot more...            |
  817.  |         |   (04-Nov-1991)                                              |
  818.  | 2.01    | Fixed the IFF 8SVX load code to correctly interpret the speed|
  819.  |         |   of the file. (05-Nov-1991)                                 |
  820.  | 2.02    | Optimized the Restore Code to only use Pitch independance    |
  821.  |         |   neccessary so that in normal use all 16 bits of the Pitch  |
  822.  |         |   are significant.(Otherwise only eight are...) (08-Nov-1991)|
  823.  | 2.03    | Corrected the IFF load code to correctly recognise Stereo &  |
  824.  |         |   non-stereo samples. Also corrected the load scan to make it|
  825.  |         |   more efficient. (08-Nov-1991)                              |
  826.  | 2.04    | Added the QueryAssign SWI to allow applications to do 'smart'|
  827.  |         |   decisions about whether or not to use the AssignSlot SWI.  |
  828.  |         |   (12-Nov-1991)                                              |
  829.  | 2.05    | Added SUN audio file load code and corrected a possible error|
  830.  |         |   in IFF file load and the Create Slot SWI. (15-Nov-1991)    |
  831.  | 2.06    | Altered the PitchWrite code to stop uneccessary pitch conver-|
  832.  |         |   sions. (19-Nov-1991)                                       |
  833.  | 2.07    | Correct an error in the range checking of the ClearSlot SWI. |
  834.  |         |   Because of this error some slot numbers passed to the SWI  |
  835.  |         |   could lock the machine up. (20-Nov-1991)                   |
  836.  | 2.08    | Corrected a minor, non fatal, error in the load code that    |
  837.  |         |   caused it to refuse to load some samples claiming a lack   |
  838.  |         |   of RMA space! Guess who was letting a V flag slide....     |
  839.  |         |   I never knew a CMP could set the V Flag.... (16-Dec-1991)  |
  840.  | 2.09    | Added 16 bit data support with a 16 bit flag. If set the     |
  841.  |         |   sample data is treated as described in the file format     |
  842.  |         |   section. (29-Dec-1991)                                     |
  843.  | 2.10    | Added the support needed for the UpCall code format.         |
  844.  |         |   (16-Jan-1992)                                              |
  845.  | 2.11    | Corrected a minor error in the DSEdit load code. Also altered|
  846.  |         |   it to not call its own SWI's except by BL. (2-Feb-1992)    |
  847.  | 2.12    | Corrected a R12 corruption error in the OSCLI interface. I   |
  848.  |         |   knew I shouldn't have listened to Julian on those mods he  |
  849.  |         |   suggested.... :-) (12-Feb-1992)                            |
  850.  | 2.13    | Received the SWI, Error and Wimp message chunk allocation.   |
  851.  |         |   Hardcoded these values in. (18-Apr-1992)                   |
  852.  | 2.14    | Fixed up an error or three in CreateSlot code. Corrected a   |
  853.  |         |   mistake in the Save code. Adjusted the module to use the   |
  854.  |         |   freshly allocated Filetype number of &108. (19-May-1992)   |
  855.  | 2.15    | Corrected the initialisation procedure to check for the      |
  856.  |         |   correct version of DataVox as well as it's prescense.      |
  857.  |         |   (15-Jun-1992)                                              |
  858.  | 2.16    | Minor fix to CreateSlot - R1 was returning a position 28     |
  859.  |         |   bytes higher than it should be. (21-Jun-1992)              |
  860.  | 2.17    | Fix to Extend Slot - now it won't clear out the entire slot  |
  861.  |         |   when extending a block, only the new extension area.       |
  862.  |         |   All file paths are stored as full ones now. ReadData type  |
  863.  |         |   16 (ReadFullName) has been added to reflect this change.   |
  864.  |         |   DataVox Type III files are now recognised by both the      |
  865.  |         |   filetype and by word 5 of the header, thus DvoxIII files   |
  866.  |         |   will be correctly loaded regardless of filetype.           |
  867.  |         |   (27-Aug-1992)                                              |
  868.  | 2.18    | Due to the RMA Memory Manager behaving weirdly the zero size |
  869.  |         |   has had to be removed. It now quietly ignores the call.    |
  870.  |         |   (04-Sep-1992)                                              |
  871.  | 2.19    | Thanks to some information from Acorn regarding a typing     |
  872.  |         |   error in the PRMs the ExtendSlot SWI now works *properly*  |
  873.  |         |   inclusive of the zero size 'RMA re-shuffle' trick.         |
  874.  |         |   (14-Sep-1992)                                              |
  875.  | 2.20    | Fixed an error in Type III file loading for when the header  |
  876.  |         |   has a zero, and thus badly formed, uncompressed size field.|
  877.  |         |   Corrected CreateSlot to correctly set the uncompressed size|
  878.  |         |   as it should. (24-Sep-1992)                                |
  879.  | 2.21    | Corrected an error in the load routine introduced by the     |
  880.  |         |   bug 'fix' of 2.20 on the uncompressed header size. Thank   |
  881.  |         |   goodness for DDT's ability to step through modules. Fixed  |
  882.  |         |   Extend Slot to correctly clear out the sample extension to |
  883.  |         |   the proper 'zero sound' value for the DataType.            |
  884.  |         |   (12-Oct-1992)                                              |
  885.  | 2.22    | Add the original format type identifier to DataLoad_Load.    |
  886.  |         |   Now front-ends can know what format the sample was         |
  887.  |         |   originally for information displays. (29-Oct-1992)         |
  888.  | 2.23    | Minor changes to allow negative pitches in Type III files.   |
  889.  |         |   (26-Nov-1992)                                              |
  890.  +---------+--------------------------------------------------------------+