PROGRAMMER'S GUIDESound I / F library
■ | Advance
Sound I / F library

1. 1. guide


1.1 Purpose

It is to provide an interface between the sound system and the main (including CD system) system and control the sound.

1.2 Overview

The sound system allows you to control the sound of sequences, PCM, and CDs.
To control sound, you must first boot your sound system. Next, for sequences and PCM, you need to transfer the sound data to the sound memory in preparation for playing. Also, the result of sound control is acquired by acquiring the status. The details will be explained in the following order.
See also the Sound Driver System Interface in the Sound Development Manual.

1.3 Starting the sound system

The sound system must be started when the power is turned on. The calling sequence is shown below.

void sndStart ()
{
     SndIniDt sys_ini; / * Data storage area for system boot * /

     SND_INI_PRG_ADR (sys_ini) = (Uint16 *) 0x22002400;
                              / * 68K Program storage start address setting * /
     SND_INI_PRG_SZ (sys_ini) = (Uint16 *) 0x4fc8;
                              / * 68K program size setting * /
     SND_INI_ARA_ADR (sys_ini) = (Uint16 *) 0x22004400;     
                              / * Sound area map storage start address setting * /
     SND_INI_ARA_SZ (sys_ini) = 0x0550;
                              / * Sound area map size (word specification) setting * /
     SND_Init (& sys_ini); / * Sound system boot * /
     ...
}

1.4 Preparation for performance

[sequence]
It is necessary to transfer the sequence data (song data, sound effect data) to be executed by the sound control function to the sound memory. Please transfer according to the current sound area map. For the sound area map, see the sound development manual. The calling sequence is shown in " Sound Control ".

[PCM]
To prepare for playing PCM, see the Sound Driver System Interface in the Sound Development Manual.

1.5 Sound control

[Functional overview]
Sound control functions write commands to sound memory. There are eight command buffers. The sound control function can be used without being aware of the command buffer.

[Calling sequence]
The following calling sequence is the process up to the start of the sequence.

void sndCnt ()
{
     sndStart (); / * Sound system start (see item above) * /
     SND_ChgMap (2); / * Change sound area map * /
     SND_MoveData ((Uint16 *) 0x22005000, 0xffff, SND_KD_SEQ, 2);
                                        / * Sound data transfer (sequence) * /
     SND_MoveData ((Uint16 *) 0x22005500, 0xffff, SND_KD_TONE, 2);
                                        / * Sound data transfer (tone) * /
     SND_SetTlVl (15); / * Overall volume setting * /
     SND_StartSeq (0, 2, 5, 0); / * Start sequence * /
     ...
}

1.6 Get status

[Functional overview]
The function outline is shown below for each sound data.

[Calling sequence]
The following calling sequence is the process of starting another sequence at pronunciation control number 0 if the sequence with pronunciation control number 0 is stopped.

void sndHantei ()
{
     SndSeqStat status; / * Sequence status storage area definition * /
     ...
     SND_GetSeqStat (& status, 0); / * Get sequence status * /
     if (SND_SEQ_STAT_MODE (stauts) == SND_MD_STOP) {
                                        / * Is the sequence of pronunciation control number 0 stop? * /
          SND_StartSeq (0, 2, 6, 0); / * Start sequence * /
     }
}


■ | Advance
PROGRAMMER'S GUIDESound I / F library
Copyright SEGA ENTERPRISES, LTD., 1997