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

4. Specific method of requesting sound


Basically, to start the sound driver, simply transfer the sound driver to the sound memory and cancel the reset signal. However, the contents of the memory when the power is turned on are not guaranteed, so initialization such as zero clearing is required.
Follow steps 1 to 6 below to start the sound driver. This will start the sound driver and start running from the beginning of the program. For details on hardware such as SCSP and reset, please refer to the SCSP and SMPC user's manuals.

Start-up steps

order Processing content explanation
1 stop 68000
(Resets the sound CPU)
Execute "Sound OFF" in the software library "SMPC Interface Library".
2 Initialize SCSP registers Write 02h as a byte to SH address 25B00400.
(DAC18B=0, MEM4MB=1 settings)
3 Clear the system area to zero Clear all SH addresses from 25A00000 to 25A0AFFF to zero.
4 Transfer sound programs to sound memory Transfer the sound program (SDDRVS.TSK) from SH address 25A00000.
5 Transfer sound area map to sound memory Transfer the sound area map from SH address 25A0A000 to.
6 Start 68000
(Cancels sound CPU reset)
Execute "Sound ON" in the software library "SMPC Interface Library".

remarks)
The maximum size of a sound area map is 0x1000 bytes, so if the size is larger than this, please divide it into multiple sound area maps and have them created. However, in that case, if necessary, please replace the sound area map before changing the map (as explained in the section on how to play sound).

Even if you know the details of the request command, it often happens that you don't know how to actually issue the command. Although the general request procedure is shown here, it is recommended that you decide on the request command buffer allocation before proceeding. The command buffer allocation recommended by SEGA is as follows (regardless of the order, the roles are divided).

0x25A00700 Dedicated for important commands such as sound initials and map changes
0x25A00710 Only for pose on/off
0x25A00720 Dedicated for on/off of PCM stream playback
0x25A00730 CD-DA control only
0x25A00740 For normal sound effect volume requests only
0x25A00750 For regular sound effect performance on/off requests only
0x25A00760 BGM volume request only
0x25A00770 BGM performance on/off request only

Although this is not necessarily a good idea, we strongly recommend that you at least separate buffers between sound effects and other requests. This is because most of the troubles related to sound requests are related to sound effects. This is due to the fact that the number of requests for sound effects is extremely high compared to others, and because requests are made in real time using the control pad, there are many unpredictable cases. This distinction also saves time spent debugging, in addition to ensuring that other requests are not affected.

Now, I will explain the request procedure from the start of the game.

  1. After loading the sound program, set bit 7 of 0x25A004E1 to enable the timing flag.

  2. Start 68000.

  3. Performs sound initialization.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0700 10 -- 01 01 01 01 01 -- -- -- -- --

    Write the above and set the timing flag.

  4. Load the map data and sound data to address 0x25A0A000 and beyond, and set the transferred flag.

  5. Perform a map change.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0700 08 -- nn -- -- -- -- -- -- -- -- --

    Write the above and set the timing flag.

  6. Perform effect changes (no need to do this if you are not using DSP).

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0700 83 -- nn -- -- -- -- -- -- -- -- --

    Write the above and set the timing flag.

  7. Perform mixer change.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0700 87 -- nn nn -- -- -- -- -- -- -- --

    Write the above and set the timing flag.

    Once you complete the above steps, you will be able to request songs and sound effects. Next, let's request song number 2 in bank 1 with pronunciation control number 3. In this example, it is assumed that no volume was specified by the sound creator.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0760 05 -- 03 80 00 -- -- -- -- -- -- --
    0x0770 01 -- 03 01 02 00 -- -- -- -- -- --

    Write the above and set the timing flag.

    In this way, there is usually no error when issuing a sequence volume command and a sequence volume command to the same INT. Now, let's request the sound effect of song number 3 in bank 2 using pronunciation control number 7. Since the sound effect is produced without stopping the song, the pronunciation control numbers for the song and sound effect must be different.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0740 05 -- 04 80 00 -- -- -- -- -- -- --
    0x0750 01 -- 04 02 03 00 -- -- -- -- -- --

    Write the above and set the timing flag.

    Next, stop the song currently being played with pronunciation control number 3. Please specify 0 for the end mode.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0770 02 -- 03 00 -- -- -- -- -- -- -- --

    Write the above and set the timing flag.

    You can stop playing with just one click. Looking at the command reference, there are other commands that seem to stop the sound, but this is the only one that stops the performance. Now let's fade out and end the song. Let's set the fade-out speed to 0x0A. Most games are about this.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0760 05 -- 03 00 0A -- -- -- -- -- -- --

    Write the above and set the timing flag. Usually, you cannot wait until the song fades out completely, so issue the end play command at an appropriate point.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0770 02 -- 03 00 -- -- -- -- -- -- -- --

    Write the above and set the timing flag.

    You have just finished the song, but after that you want to replace the sound data using overlay processing. In this case, just to be safe (because sequences such as sound effects may be playing with other pronunciation management numbers), stop all sequences.

    +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B
    0x0700 06 -- -- -- -- -- -- -- -- -- -- --

    Write the above, set the timing flag, wait for the timing flag to turn off, return to the beginning, and issue a sound initial, data load, map change, effect change, and mixer change.

In rare cases, it seems that a program is created in SH2 that absorbs requests issued by the main side, treats the request command buffer as a ring buffer of 0x10 bytes, and writes the requests in the order in which they are issued. This can be very dangerous depending on the game, so please never do this. Please share the roles of command buffers!


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