FAQSBL programming related
BackForward
FAQ / SBL programming related

SOUND



How to get stereo / monaural information set in multiplayer.

Q)
How should I get the stereo / monaural information set in multiplayer?

A)
The audio output (stereo, monaural) information set in the multiplayer is backed up in the SMPC. There is an access macro in the SMPC I / F library as a way to get this information, so get 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 into-back type PER_KD_SYS with the PER_LInit function). The PER_Init function is disabled.

After getting this information, you need to set the sound driver to stereo / monaural. The setting uses the SND_SET_SND_CTRL macro. (It is described in SEGALIB \ MAN \ MANSND.DOC in the sound I / F library)
For details, see

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 you set STEREO / MONO?

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

A)
You can switch between them by manipulating the stereo / monaural bits of the sound driver. (SystemInterfacework 483H) As a switching method,

Form
void SND_SET_SND_CTRL (Uint8 snd_ctrl)

input
Sound control value
SND_CTRL_OUTPUT_STEREO: Stereo
SND_CTRL_OUTPUT_MONO: Monaural

output
none

Function value
none

function
Set the sound control value. Now you can select and set the stereo / monaural mode.
There is a macro called, so please use this.


How to set "fade" of "SND_SetSeqVl"

Q)
I want to change the volume using SND_SetSeqVl, but I don't know the value of fade. The manual says that 1 is the longest and 255 is the shortest, but how long is it? (The length is opposite) Please tell me whether it is a frame unit or something else as a standard.

A)
The number 1 is 2msec at the fastest, depending on the state of the sound CPU 68000, and the volume changes one by one after the specified time. It's difficult to get accurate synchronization, so it's common to adjust by issuing a stop command during the fade.


Loop at the end when playing a PCM stream

Q)
I'm playing a PCM stream on Sega Saturn, but when I try to stop it, it stays in a loop at the end.

A)
The above symptom occurs if the data is not bordered by 4 bytes due to a bug in the SBL PCM library. Please use Ver1.16 or later with the bug fixed.


How to switch the tone bank during sequence playback

Q)
How can I switch between the sequence data of the sequence sound and the tone bank data at the same time?

Currently, I am trying to switch songs by placing multiple sequence data and tone bank data in the sound memory.
The sequence data is switched by specifying the argument of SND_StartSeq, and the tone bank is switched by SND_ChgMix, but in reality, only the sequence is switched and the tone bank does not change.
How do you switch tone banks?

A)
"SND_ChgMix" switches the selection of the mixer (output destination from the DSP that has volume and localization) in the tone bank, not the tone bank data in the memory.
The tone bank data is specified by the control command in 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 ()
Can you tell us more about this?

I think the eight MIDI commands are functions that can be controlled directly, but I don't know the details about the setting values of each parameter.
I also looked at the sound driver documentation, but couldn't find the content of the MIDI command itself. (Already converted to bank)
It won't ring.

A)
Direct MIDI does not have sequence data on the 68000, and is intended to make it possible to control the on / off of pronunciation from SH2.
It is also possible to create a sequencer in SH2 and use the 68000 sound driver only to make the SCSP sound. You can also load only the waveform into the sound RAM and turn the pronunciation on / off with SH2.

The data to be sent to the 68000 uses MIDI data transformed for Sega Saturn. The format is as follows:


Table 1
bit 7 6 Five Four 3 2 1 0
0 * Priority CMD
1 KNo MIDI Ch
2 MIDI Data # 1
3 MIDI Data # 2
* Do not use Priority (level). It is 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 the 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
Four (C0-CFh) Program Change
Five (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 the following is a simple procedure.
Now, let's play the 0th sound effect of bank 0 using the direct MIDI command.

First of all, the basic processing required before starting the performance, such as sound initialization, map change, effect change, mixer change, etc., is completed by a normal request. Please refer to the Programmer's Guide for these things.

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

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

The 3rd byte sets the note number. Note number is data that represents scale data in 7 bits. For details, refer to the MIDI technical book. Let's set it to 0x40 here.

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


How can I set the PAN for a sequence in SBL?

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

A)
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)

Refer to the table below to set parameter 3 (P3).

Table 1 MIDI PAN data details (correspondence with SCSP PAN)
MIDI PAN
 0
 1
 2
 3
 Four
 Five
 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 Ten Ten Ten Ten
40h-4Fh 00 00 00 00 01 01 01 01 01 01 01 01 02 02 02 02 02 02 02 02 03 03 03 03 03 03 03 03
50h-5Fh 04 04 04 04 05 05 05 05 05 05 05 05 06 06 06 06 06 06 06 06 07 07 07 07 07 07 07 07
60h-6Fh 08 08 08 08 08 08 08 08 09 09 09 09 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 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