#include "sgl.h"
Uint8 *sddrvaddr;
Uint32 drvsize;
Uint8 *map;
Uint32 mapsize;
void slInitSound( sddrv, drvsize, map, mapsize );
Uint8 *sddrvaddr - Address of the sound driver
Uint32 drvsize - Size of the sound driver
Uint8 *map - Address of the sound area map
Uint32 mapsize - Size of the sound area map
void - returns nothing.
extern Uint8 *sddrvs;
extern Uint32 sddrvsize;
Uint8 map[ 256 ];
Uint32 mapsz = 256;
slInitSound ( sddrvs, sddrvszize, map, mzpsz );
#include "sgl.h"
void *addr;
void slWaitSound( addr );
void *addr - Address you want to monitor.
void - returns nothing.
slWaitSound ( slSndMapChange ( 2 ) );
slSndMapChange | slSoundRequest |
#include "sgl.h"
Uint8 Lvol;
Uint8 Rvol;
Uint8 Lpan;
Uint8 RPan;
Bool slCDDAOn( Lvol, Rvol, Lpan, Rpan );
Uint8 Lvol - Left volume
Uint8 Rvol - Volume to the right
Uint8 Lpan - Pan to the left
Uint8 RPan - Pan to the right
Bool - Flag indicating whether the command was issued correctly.
slCDDAOn ( 127, 127, 0, 0 );
slCDDAOff | slSndFlush |
#include "sgl.h"
Bool slCDDAOff( void );
void - gives nothing.
Bool - Flag indicating whether the command was issued correctly.
slCDDAOff ();
slCDDAOn | slSndFlush |
#include "sgl.h"
PCM *pcm;
void *data;
Uint32 size;
Sint8 slPCMOn( pcm, data, size );
PCM *pcm - PCM data management structure
void *data - PCM data entity
Uint32 size - PCM data size
Sint8 - PCM channel number or error code.
+---------------+
| |
| R data |
| (frame * datasize byte)
+---------------+
| |
| L data |
| |
+---------------+
PCM type data is a structure in the following format. typedef struct {
Uint8 mode; /* Playback mode */
Uint8 channel; /* Playback channel */
Uint8 level; /* Playback level */
Sint8 pan; /* Playback pan */
Uint16 pitch; /* Playback pitch */
Uint8 eflevelR; /* Effect level (for right and monaural) */
Uint8 efselectR; /* Effect number (for right and monaural) */
Uint8 eflevelL; /* Effect level (for left) */
Uint8 efselectL; /* Effect number (for left) */
}PCM;
Set the playback mode as follows.
slPCMOn ( pcm , dat, datsize );
slPCMOff | slPCMParmChange | slPCMStat | slSndPCMNum |
slSndFlush | DMASt_CPU0 | DMASt_SCU0 |
#include "sgl.h"
PCM *pcm;
Bool slPCMOff( pcm );
PCM *pcm - Management structure for the currently sounding PCM data.
Bool - Flag indicating whether the command was issued correctly.
slPCMOff ( pcm );
slPCMOn | slPCMParmChange | slPCMStat | slSndPCMNum |
slSndFlush |
#include "sgl.h"
PCM *pcm;
Bool slPCMParmChange( pcm );
PCM *pcm - Management structure for the PCM data you want to change.
Bool - Flag indicating whether the command was issued correctly.
extern PCM pcm;
pcm.pitch += 100;
slPCMParmChange ( pcm );
slPCMOn | slPCMOff | slPCMStat | slSndPCMNum |
slSndFlush |
#include "sgl.h"
PCM *pcm;
Bool slPCMStat( pcm );
PCM *pcm - Management structure for the PCM data you want to investigate.
Bool - Flag indicating whether the command was issued correctly.
if ( slPCMStat ( pcm ) == TRUE ) {
/* Playing */
} else {
/* End of playback */
}
slPCMOn | slPCMOff | slPCMParmChange | slSndPCMNum |
slSndFlush |
#include "sgl.h"
Uint8 mode;
Sint8 slSndPCMNum( mode );
Uint8 mode - Mode (stereo or monaural) (described later)
Sint8 - number of free PCM channel.
if ( slSndPCMNum ( _Stereo ) != -1 ) {
slPCMOn ( ... )
}
slPCMOn | slPCMOff | slPCMParmChange | slPCMStat |
DMASt_CPU0 | DMASt_SCU0 |
#include "sgl.h"
Uint8 effect;
Bool slSndEffect( effect );
Uint8 efct - Effect number.
Bool - Flag indicating whether the command was issued correctly.
If the mixer that outputs no effect is 0, and the original mixer is 1, then
slSndMixParmChange ( 0, 127, 0 );
slSndEffect ( 1 );
for ( i = 0 ; i < 60 ; ++i ) slSynch();
slSndMixParmChange ( 1, 127, 0 );
This is an example of how to suppress noise when changing effects.
slSndMixParmChange | slSndVolume | slSndFlush |
#include "sgl.h"
Uint8 mix;
Uint8 vol;
Sint8 pan;
Bool slSndMixParmChange( mix, vol, pan );
Uint8 mix - Mixer number
Uint8 vol - Volume
Sint8 pan - Pan
Bool - Flag indicating whether the command was issued correctly.
slSndMixParmChange ( 1, 127, 0 );
slSndFlush |
#include "sgl.h"
const char *form;
/* arg1, arg2, ... */
Sint8 slSoundRequest( form[], ...);
const char *form - Format of next argument arg1, arg2, ... - Parameter
Sint8 - Function execution status (status)
Uint16 Lev;
Uint8 *data;
Uint16 StreamBuf;
Uint16 StreamSize;
Uint16 Pitch;
StreamBuf = ( Uint16 )( data >> 4 );
Lev = 7; /* Set Volume to max */
slSoundRequest ( "bbwwwbb", SND_PCM_START , _Stereo | _PCM16Bit , Lev << 5 | 0,
StreamBuf, StreamSize, Pitch, 0, 0 );
In this case, SND_PCM_START becomes the function code and is not included in the string.
_Stereo | _PCM16Bit , Lev << 5 | 0 are byte data,
StreamBuf >> 4, StreamSize, Pitch are each passed to the sound driver as word data.
slSndFlush |
#include "sgl.h"
Bool slDSPOff( void );
void - gives nothing.
Bool - Flag indicating whether the command was issued correctly.
slDSPOff ();
slSndFlush | SoundRdCount |
#include "sgl.h"
Uint8 vol;
Bool slSndVolume( vol );
Uint8 vol - Overall volume of the sound.
Bool - Flag indicating whether the command was issued correctly.
slSndVolume( 10 << 3 );
#include "sgl.h"
Bool slSoundAllOff( void );
void - gives nothing.
Bool - Flag indicating whether the command was issued correctly.
slSoundAllOff ();
slSoundAllPause | slSoundAllCont | slSndFlush | SoundRdCount |
#include "sgl.h"
void slSoundAllPause( void );
void - gives nothing.
void - returns nothing.
slSoundAllPause ();
slSoundAllCont | slSoundAllOff | slSndFlush | SoundRdCount |
#include "sgl.h"
void slSoundAllCont( void );
void - gives nothing.
void - returns nothing.
slSoundAllCont ();
slSoundAllPause | slSoundAllOff | slSndFlush | SoundRdCount |
#include "sgl.h"
void slSndFlush( void );
void - gives nothing.
void - returns nothing.
slSndFlush ();