Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- MOD File Format - <b>subfunction 23 : play a sample</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Subfunction 23 : Play a sample

 AH    = 82
 AL    = 23
 DX:CX = Buffer with the folowing data
 If the function is successful, AX will hold 5722h on return.

 +--------------------------------------------------------------------------+
 | Offset | Length | Description                                            |
 |--------+--------+--------------------------------------------------------|
 |   00   |  Byte  | This byte must be set to 'S'.                          |
 |   01   |  Byte  | This byte must be set to 'P'.                          |
 |   02   |  Word  | This word holds the segment of the sample to be        |
 |        |        | played. The sample data must therefore be paragraph    |
 |        |        | aligned. The sample data, is the data described in     |
 |        |        | section 6 of the MOD file structure above.             |
 |   04   |  Word  | The length of the sample. In old versions of MODRES,   |
 |        |        | this length was in bytes (limiting the length of       |
 |        |        | samples to 64K). In new versions, this length is in    |
 |        |        | words. For both cases the length must be in 8086       |
 |        |        | format as opposed to the Amiga format in which it is   |
 |        |        | stored in the MOD file.                                |
 |   06   |  Byte  | Output device number - see description at offset 02 of |
 |        |        | subfunction 20h.                                       |
 |   07   |  Word  | This word holds a value corresponding to the frequency |
 |        |        | of the note to be played. See section 5 of the MOD     |
 |        |        | file docs for a description of how the frequency is    |
 |        |        | represented.                                           |
 |--------+--------+--------------------------------------------------------|
 |   09   |  Byte  | This byte is used to specify the volume at which the   |
 |        |        | sample is to be played. If the value is not zero, it   |
 |        |        | is decremented and then used as a multiplier (in six-  |
 |        |        | teenths). A value of 2, for example, will multiply the |
 |        |        | volume by 1/16; 3 will multiply by 2/16, etc. Zero and |
 |        |        | one produce the same effect - no volume at all.        |
 |   10   |  Word  | This is the loop start (if the loop length is greater  |
 |        |        | than or equal to 4). This value is an offset in words  |
 |        |        | ans is in 8086 format.                                 |
 |   12   |  Word  | If this value is less than 4 then the sample does not  |
 |        |        | loop, otherwise this is the loop length. This value is |
 |        |        | measured in words and is in 8086 format.               |
 |   14   |  Byte  | This byte is used to specify the quality of sound      |
 |        |        | output required. It can have a value in the range 0 to |
 |        |        | 6 - the lower the value, the better the quality. Note, |
 |        |        | however, that you will need a fast machinve to use the |
 |        |        | low values without crashing. A value of 1 is assumed   |
 |        |        | if an out of range value is specified.                 |
 +--------------------------------------------------------------------------+

 Note that bytes 9 to 14 were not available in the old versions of MODRES.

See Also: Sampled Sound Data Subfunction 20

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson