Japanese
FAQSBL programming related
BackForward
FAQ/SBL programming related

SOUND



How to obtain stereo/monaural information set in multiplayer.

Q)
How can I obtain the stereo/monaural information set in multiplayer?

A)
Audio output (stereo, monaural) information set in multiplayer is backed up in SMPC. There is an access macro in the SMPC I/F library as a way to obtain this information, so please obtain it as follows.

ret = PER_GS_SM(data) & PER_MSK_STEREO;

Before execution, it is necessary to perform SMPC system information acquisition processing (issue the insertback type PER_KD_SYS using the PER_LInit function). Use of the PER_Init function is prohibited.

After obtaining this information, you need to configure your sound driver for stereo/mono. For settings, use the SND_SET_SND_CTRL macro. (Described in SEGALIB\MAN\MANSND.DOC of the sound I/F library)
For more details, please refer to

reference
"Hardware Manual SMPC User's Manual"
Chapter 2 SMPC commands NO.4 SNDON , NO.5 SNDOFF and
See 2.4 Non-reset system management commands .


How do I set up STEREO/MONO?

Q)
Please tell me which flag should I operate on the MAIN side to switch between STEREO/MONO at the start of the game.

A)
You can switch by operating the stereo/monaural bit of the sound driver. (SystemInterfacework 483H) As for the switching method,

Format
void SND_SET_SND_CTRL(Uint8 snd_ctrl)

input
sound control value
SND_CTRL_OUTPUT_STEREO: Stereo
SND_CTRL_OUTPUT_MONO: Mono

output
none

function value
none

function
Set sound control values. Currently, you can select and set stereo/monaural mode.
There is a macro called, so please use it.


How to set "fade" in "SND_SetSeqVl"

Q)
I want to change the volume using SND_SetSeqVl, but I don't know the fade value. The manual says 1 is the longest and 255 is the shortest, but how long is it exactly? (lengths and shorts are reversed) Please let me know if it is based on frame units or something else.

A)
The number 1 is the sound CPU.Depending on the state of the 68000, the fastest time is 2ms, and after the specified time, the volume will change one by one. Accurate synchronization is difficult to achieve, so adjustments are usually made by issuing a stop command during the fade.


Loop at the end when playing PCM stream

Q)
I'm playing a PCM stream on my Sega Saturn, but even when I try to stop it, it keeps looping at the end.

A)
Due to a bug in SBL's PCM library, the above symptoms occur if the data is not aligned on 4-byte boundaries. Please use version 1.16 or later, which has bugs fixed.


How to switch tone banks during sequence playback

Q)
How can I switch both sequence data and tone bank data for a sequence sound at the same time?

We are currently trying to place multiple sequence data and tone bank data in sound memory and switch songs.
Switching of sequence data is done by specifying the argument of SND_StartSeq, and switching of tone banks is done by SND_ChgMix, but in reality only the sequence is switched, and the tone bank does not change.
How do I switch tone banks?

A)
"SND_ChgMix" switches the mixer (output destination from the DSP that has volume and localization) in the tone bank, and does not change the tone bank data in memory.
Tone bank data is specified using a control command within the sequence data and cannot be changed programmatically.


Please tell me how to use SND_CtrlDirMidi().

Q)
PROGRAMMER'S GUIDE VOL.1
MIDI direct control of "Sound I/F Library" SND_CtrlDirMidi()
Could you please tell me the details?

I think the eight MIDI commands are functions that can be directly controlled, but I don't know the details of the settings for each parameter.
I looked at the sound driver documentation, but I couldn't find anything about the MIDI commands themselves. (Also converted to bank)
It will stop ringing.

A)
Direct MIDI allows the 68000 to control on/off of sound without having sequence data on the 68000.
It is also possible to create a sequencer with SH2 and use the 68000 sound driver only to generate SCSP sounds. You can also load only the waveform into sound RAM and turn the sound on/off using SH2.

The data sent to the 68000 uses MIDI data transformed for the Sega Saturn. The format looks like this:


Table 1
bit 7 6 5 4 3 2 1 0
0 * Priority CMD
1 KNo MIDI Ch
2 MIDI Data #1
3 MIDI Data #2
* Priority (level) is not used. Always 0.

Table 2
Priority level
 0-31
Pronunciation priority at Sequence Start
CMD
 0-7
MIDI command
Kno
 0-7
Pronunciation control number
MIDI Ch
 0-31
MIDI channel
MIDI data #1
 0-127
MIDI data byte #1
MIDI data #2
 0-127
MIDI data byte #2


Correspondence with actual MIDI Event

Table 3
CMD value Corresponding MIDI Event
0 (80-8Fh) Note Off Event
1 (90-9Fh) Note On Event
2 (A0-AFh) After Touch
3 (B0-BFh) Control Change
4 (C0-CFh) Program Change
5 (D0-DFh) Channel Pressure
6 (E0-EFh) Pitch Wheel
7 (F0-FFh) System Message


It will be easier to understand if you give a concrete example, so I will explain the simple steps below.
Now, let's play the 0th sound effect of bank 0 using a direct MIDI command.

First, the basic processing required before starting play, such as sound initialization, map changes, effect changes, and mixer changes, is completed using normal requests. Please refer to the programmer's guide for these matters.

Now, let's play the 0th sound effect of bank 0 with pronunciation control number 1 and MIDI channel 0. Set Note on as the 1st byte for "Table 1". Note on means the beginning of pronunciation, so you can select 1 as the value of CMD from Table 3. Since priority is not used, the 1st byte will be 0x01.

Similarly, the 2nd byte is 0x20 because the pronunciation control number = 1 and the MIDI channel = 0.

The 3rd byte sets the note number. A note number is data that represents musical scale data in 7 bits. For more information, please refer to a MIDI textbook. Here we will set it to 0x40.

The 4th byte is velocity. Velocity is 7-bit data that represents strength.


How can I set PAN to a sequence in SBL?

Q)
How can I set PAN to a sequence in SBL?

A)
Please use the following sound I/F library functions.

SndRet SND_SetSeqPan(SndSeqNum P1, Uint8 P2, Uint8 P3);
P1:
Pronunciation control number (0-7)
P2:
00h→PAN Control ON
80h→PAN Control OFF
P3:
MIDI PAN data (00h-7Fh)

Please refer to the table below when setting parameter 3 (P3).

Table 1 Details of MIDI PAN data (correspondence with SCSP PAN)
MIDI PAN
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 A
 B
 C
 D
 E
 F
00h - 0Fh 1F 1F 1F 1F 1E 1E 1E 1E 1D 1D 1D 1D 1C 1C 1C 1C
10h - 1Fh 1B 1B 1B 1B 1A 1A 1A 1A 19 19 19 19 18 18 18 18
20h - 2Fh 17 17 17 17 16 16 16 16 15 15 15 15 14 14 14 14
30h - 3Fh 13 13 13 13 12 12 12 12 11 11 11 11 10 10 10 10
40h - 4Fh 00 00 00 00 01 01 01 01 02 02 02 02 03 03 03 03
50h - 5Fh 04 04 04 04 05 05 05 05 06 06 06 06 07 07 07 07
60h - 6Fh 08 08 08 08 09 09 09 09 0A 0A 0A 0A 0B 0B 0B 0B
70h - 7Fh 0C 0C 0C 0C 0D 0D 0D 0D 0E 0E 0E 0E 0F 0F 0F 0F

Image diagram of MIDI PAN data
Left                    Center                     Right
00h  <-----------------> 40h <--------------------> 7Fh

Table 2 Correspondence between SCSP PAN and MIDI PAN
PAN L(db) R(db) Localization PAN L(db) R(db) Localization
00h -00.0 -00.0 C 10h -00.0 -00.0 C
01h -03.0 -00.0 R1 11h -00.0 -03.0 L1
02h -06.0 -00.0 R2 12h -00.0 -06.0 L2
03h -09.0 -00.0 R3 13h -00.0 -09.0 L3
04h -12.0 -00.0 R4 14h -00.0 -12.0 L4
05h -15.0 -00.0 R5 15h -00.0 -15.0 L5
06h -18.0 -00.0 R6 16h -00.0 -18.0 L6
07h -21.0 -00.0 R7 17h -00.0 -21.0 L7
08h -24.0 -00.0 R8 18h -00.0 -24.0 L8
09h -27.0 -00.0 R9 19h -00.0 -27.0 L9
0Ah -30.0 -00.0 R10 1Ah -00.0 -30.0 L10
0Bh -33.0 -00.0 R11 1Bh -00.0 -33.0 L11
0Ch -36.0 -00.0 R12 1Ch -00.0 -36.0 L12
0Dh -39.0 -00.0 R13 1Dh -00.0 -39.0 L13
0Eh -42.0 -00.0 R14 1Eh -00.0 -42.0 L14
0Fh -infinite -00.0 R15 1Fh -00.0 -infinite L15

BackForward
FAQSBL programming related
Copyright SEGA ENTERPRISES, LTD. 1997