Japanese
SOUND ManualSound Driver Programmer's Guide
BackForward
Sound Driver Programmer's Guide

6. debugging techniques


When a sound control command is executed, the running status and necessary information are returned to the main system as a return status. The return status is stored in the status area of the system area, so refer to it as necessary.

status area


Sequence playback mode and status

+0 Sequence playback mode (0-4)
+1 Sequence playback status (0-FFh)

While the sequence is playing, the current status is written to the mode/status area at any time. To find out the current status of sequence playback, please refer to the mode/status area.
The mode/status area has a total of 16 bytes, 2 bytes x 8 sequences, corresponding to pronunciation control numbers 0 to 7. For details on area addresses, please refer to the host interface work section in the system area.

[Sequence playback mode]
0x00 initial state
0x01 Now playing
0x03 Pause during playback
0x05 Fade in progress

[Sequence playback status]
0x00 normal
0x80 Resolution exceeds SEGASATURN's capabilities.
0x81 There is no tempo data.
0x82 No event data.
0x83 Tempo data is set outside the range.
0x84 There is no control in the sequence data.
0x85 A bank that does not exist was specified.
0x86 You specified a program that does not exist.
0x87 A program change was performed without a bank set. When the 0X85 error occurs, this error often occurs in succession.
0x88 Volume bias value is too large for Total level.
0x89 A mixer change was performed on a bank that does not exist.
0x8A Using MONO MODE
0x8B Layer is not set on the Tone editor.
0x8C Because the number of simultaneous pronunciations exceeded 32, the oldest key-on was forcibly destroyed.
0x8D A layer that does not exist was specified.
0x8E Trouble occurred in DSP
0x8F An unsupported MIDI event was issued.
0x92 There were some notes that could not be played because there were too many FM sound source channels.
0x93 Double assignment of slot (program error)
0x94 An attempt was made to play on a MIDI channel other than 1-16.
0x99 NOTE ON was canceled because all slots were filled with FM.


CD-DA input level

Stores the digital audio input signal level. When the control command "Digital Audio In input level analysis start (0Ah)" is issued, input signal detection starts and this area is set. The value is 0 to 7FFFh, where 0 is no input signal and 7FFFh is the input signal at maximum level. Also, since this input signal level is an instantaneous value, it constantly changes as the input signal level changes.
Normally, only the Lch/Rch of the total level is stored, but using a dedicated DSP program (DSP - 3 Band Ana.EXB), it is also possible to detect levels divided into high temperature, midrange, and low temperature ranges. However, what can be detected here is the level of the input signal, so even if you change the output volume using the control command "CD-DA Level (80h)", the signal level set in this area will not change.

Note: This process places a load on the sound driver, so if level detection is no longer required, issue the "Digital Audio In input level analysis end (0Bh)" command to end level detection.

+0 PCM stream playback position (0-15)
+1 unused

This is the data position currently being played. Relative number of samples from the beginning of the PCM stream playback buffer, values from 0 to 15 are stored. You can monitor in units of 4K samples (4KB for 8-bit playback, 8KB for 16-bit playback), so when the value advances by 1, it means that the playback position advances by 4K samples. Also, even in stereo playback, Rch and Lch have the same playback address.
The PCM stream playback position area corresponds to stream playback numbers 0 to 7, and has a total of 16 bytes (2 bytes x 8 streams). For details on area addresses, please refer to the host interface work section in the system area.

+0 Sequence playback position (H)
+1 Sequence playback position (L)

While a sequence is being played, the playback position of the sequence is stored in this area. Values from 0 to FFFFh are stored sequentially. This indicates the time since the start of playback, and can be used as a guide to roughly know where the playback is currently being played. The value advances by 1 every 100msec.
The sequence playback position area corresponds to pronunciation management numbers 0 to 7, and has a total of 16 bytes (2 bytes x 8 sequences). For details on area addresses, please refer to the host interface work section in the system area.

Note: The sequence playback position is absolute time, so if the tempo changes, the position shown will change even if the value is the same. In order to accurately synchronize with the sequence being played, please take measures such as storing a synchronization message in the sequence data.

□ Now, I will introduce how to debug and check.

If a sound-related problem occurs, please check the areas below as data may be saved that can be helpful in investigating the cause.

○ Bitmap of error status

If an error occurs while the sound driver is operating, an error bit corresponding to the error is set in the system interface table (4 bytes starting from 420h). For details, please refer to "5 Error Status Bitmap".

○ Sound control command history

The history of sound control commands is stored in the reserved area of the system area (2048 bytes from 800h to FFFh). Control commands (16 bytes) that the sound driver receives from the main system and executes are written in this area at any time in the order in which they were executed.
Writing is done in a ring buffer format, and when the area is full, it is rewritten starting with the oldest command, so that the latest 128 commands are always recorded. (If the number of commands processed exceeds 128, the area will be overwritten from the beginning again.) Even in such a case, the next data write position will be FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF. Therefore, you can find the location of the most recently written data.
The 15th and 16th bytes (words) of the command history (16 bytes) store the elapsed time since the previous command processing, so you can also verify the temporal timing of command issuance. One count is approximately 2msec.

By referring to this area, you can check items like the example below.


BackForward
SOUND ManualSound Driver Programmer's Guide
Copyright SEGA ENTERPRISES, LTD., 1997