This commit is contained in:
parent
2a65a60186
commit
f9b956d088
5 changed files with 110 additions and 23 deletions
|
@ -322,11 +322,14 @@ SpuCommonAttr Attr;
|
||||||
// SsSetSerialVol(SS_SERIAL_A,0,0);
|
// SsSetSerialVol(SS_SERIAL_A,0,0);
|
||||||
|
|
||||||
|
|
||||||
Attr.mask = (SPU_COMMON_CDVOLL|SPU_COMMON_CDVOLR|SPU_COMMON_CDMIX);
|
// Attr.mask = (SPU_COMMON_CDVOLL|SPU_COMMON_CDVOLR|SPU_COMMON_CDMIX);
|
||||||
Attr.cd.volume.left =0;
|
// Attr.cd.volume.left =0;
|
||||||
Attr.cd.volume.right=0;
|
// Attr.cd.volume.right=0;
|
||||||
Attr.cd.mix=SPU_ON;
|
// Attr.cd.mix=SPU_ON;
|
||||||
SpuSetCommonAttr(&Attr);
|
// SpuSetCommonAttr(&Attr);
|
||||||
|
SpuSetCommonCDVolume(0,0);
|
||||||
|
SpuSetCommonCDMix(SPU_ON);
|
||||||
|
|
||||||
CDVol.val0 = 0; // CdL -> SpuL
|
CDVol.val0 = 0; // CdL -> SpuL
|
||||||
CDVol.val1 = 0; // CdL -> SpuR
|
CDVol.val1 = 0; // CdL -> SpuR
|
||||||
CDVol.val2 = 0; // CdR -> SpuR
|
CDVol.val2 = 0; // CdR -> SpuR
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/*
|
||||||
reverb ( trigger from map? )
|
|
||||||
position
|
position
|
||||||
adjust channels ( watery-mario64 style music changes )
|
adjust channels ( watery-mario64 style music changes )
|
||||||
*/
|
*/
|
||||||
|
@ -100,12 +99,18 @@ static XMFILEDATA s_xmSfxData[CSoundMediator::NUM_SFXBANKIDS]=
|
||||||
static SFXDETAILS s_sfxDetails[]=
|
static SFXDETAILS s_sfxDetails[]=
|
||||||
{
|
{
|
||||||
{ 1, 6, 1 },
|
{ 1, 6, 1 },
|
||||||
{ 1, 1, 0 },
|
{ 1, 4, 0 },
|
||||||
{ 1, 2, 0 },
|
{ 1, 5, 0 },
|
||||||
{ 1, 0, 1 },
|
{ 1, 0, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Reverb details
|
||||||
|
static ReverbDetails s_reverbDetails[CSoundMediator::NUM_REVERBTYPES]=
|
||||||
|
{
|
||||||
|
{ SPU_REV_MODE_OFF, 0, 0, 0 }, // NONE
|
||||||
|
{ SPU_REV_MODE_ECHO, 75, 0x3000, 100 }, // ECHO_TEST
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
int s_songChannelCount=10;
|
int s_songChannelCount=10;
|
||||||
|
@ -127,7 +132,6 @@ void CSoundMediator::initialise()
|
||||||
s_spuSound=new ("SPUSound") CSpuSound(); s_spuSound->initialise();
|
s_spuSound=new ("SPUSound") CSpuSound(); s_spuSound->initialise();
|
||||||
s_xmplaySound=new ("XMPlaySound") CXMPlaySound(); s_xmplaySound->initialise();
|
s_xmplaySound=new ("XMPlaySound") CXMPlaySound(); s_xmplaySound->initialise();
|
||||||
CXAStream::Init();
|
CXAStream::Init();
|
||||||
|
|
||||||
|
|
||||||
for(i=0;i<NUM_VOLUMETYPES;i++)
|
for(i=0;i<NUM_VOLUMETYPES;i++)
|
||||||
{
|
{
|
||||||
|
@ -139,6 +143,8 @@ void CSoundMediator::initialise()
|
||||||
// ASSERT(CXAStream::MIN_VOLUME==0); // Just incase someone decides to change any of these.. things in here will break ( PKG )
|
// ASSERT(CXAStream::MIN_VOLUME==0); // Just incase someone decides to change any of these.. things in here will break ( PKG )
|
||||||
// ASSERT(CXAStream::MAX_VOLUME==32767);
|
// ASSERT(CXAStream::MAX_VOLUME==32767);
|
||||||
|
|
||||||
|
// Initial reverb settings
|
||||||
|
setReverbType(ECHO_TEST);
|
||||||
|
|
||||||
SOUND_DBGMSG("Sound mediator initialised");
|
SOUND_DBGMSG("Sound mediator initialised");
|
||||||
s_initialised=true;
|
s_initialised=true;
|
||||||
|
@ -233,6 +239,19 @@ void CSoundMediator::think(int _frames)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CSoundMediator::setReverbType(REVERBTYPE _type)
|
||||||
|
{
|
||||||
|
s_spuSound->setReverbDetails(&s_reverbDetails[_type]);
|
||||||
|
s_spuSound->setReverbActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
|
|
@ -77,6 +77,13 @@ public:
|
||||||
MAX_VOLUME=255,
|
MAX_VOLUME=255,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum REVERBTYPE
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
ECHO_TEST,
|
||||||
|
|
||||||
|
NUM_REVERBTYPES,
|
||||||
|
};
|
||||||
|
|
||||||
// General
|
// General
|
||||||
static void initialise();
|
static void initialise();
|
||||||
|
@ -84,6 +91,9 @@ public:
|
||||||
static void think(int _frames);
|
static void think(int _frames);
|
||||||
|
|
||||||
|
|
||||||
|
// Reverb
|
||||||
|
static void setReverbType(REVERBTYPE _type);
|
||||||
|
|
||||||
// Song interface
|
// Song interface
|
||||||
static void setSong(SONGID _songId);
|
static void setSong(SONGID _songId);
|
||||||
static void playSong();
|
static void playSong();
|
||||||
|
|
|
@ -63,7 +63,6 @@ char CSpuSound::s_spuManagementTable[SPU_MALLOC_RECSIZ*(MAX_SPU_MANAGEMENT+1)];
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CSpuSound::initialise()
|
void CSpuSound::initialise()
|
||||||
{
|
{
|
||||||
SpuReverbAttr rev;
|
|
||||||
SpuEnv env;
|
SpuEnv env;
|
||||||
|
|
||||||
// SPU setup
|
// SPU setup
|
||||||
|
@ -75,18 +74,6 @@ void CSpuSound::initialise()
|
||||||
SpuInitMalloc(MAX_SPU_MANAGEMENT,s_spuManagementTable);
|
SpuInitMalloc(MAX_SPU_MANAGEMENT,s_spuManagementTable);
|
||||||
SpuSetCommonMasterVolume(0x3fff,0x3fff);
|
SpuSetCommonMasterVolume(0x3fff,0x3fff);
|
||||||
|
|
||||||
// Reverb
|
|
||||||
rev.mask=(SPU_REV_MODE|SPU_REV_DEPTHL|SPU_REV_DEPTHR);
|
|
||||||
rev.mode=SPU_REV_MODE_SPACE;
|
|
||||||
rev.depth.left=0x1000;
|
|
||||||
rev.depth.right=0x1000;
|
|
||||||
SpuSetReverbModeParam(&rev);
|
|
||||||
SpuSetReverb(SPU_ON);
|
|
||||||
SpuReserveReverbWorkArea(SPU_ON);
|
|
||||||
SpuSetReverbVoice(SPU_BIT,0x000000);
|
|
||||||
rev.mask=(SPU_REV_DEPTHL|SPU_REV_DEPTHR);
|
|
||||||
SpuSetReverbDepth(&rev);
|
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
env.mask=SPU_ENV_EVENT_QUEUEING;
|
env.mask=SPU_ENV_EVENT_QUEUEING;
|
||||||
env.queueing=SPU_OFF;
|
env.queueing=SPU_OFF;
|
||||||
|
@ -109,5 +96,48 @@ void CSpuSound::shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CSpuSound::setReverbActive(int _active)
|
||||||
|
{
|
||||||
|
SpuReverbAttr rev;
|
||||||
|
|
||||||
|
if(_active)
|
||||||
|
{
|
||||||
|
// Reverb
|
||||||
|
SpuSetReverbModeType(m_currentDetails.m_type);
|
||||||
|
SpuSetReverb(SPU_ON);
|
||||||
|
SpuReserveReverbWorkArea(SPU_ON);
|
||||||
|
SpuSetReverbVoice(SPU_BIT,0xffffff);
|
||||||
|
SpuSetReverbModeDelayTime(m_currentDetails.m_delay);
|
||||||
|
SpuSetReverbModeDepth(m_currentDetails.m_depth,m_currentDetails.m_depth);
|
||||||
|
SpuSetReverbModeFeedback(m_currentDetails.m_feedback);
|
||||||
|
|
||||||
|
m_reverbActive=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpuSetReverb(SPU_OFF);
|
||||||
|
|
||||||
|
m_reverbActive=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CSpuSound::setReverbDetails(ReverbDetails *_details)
|
||||||
|
{
|
||||||
|
m_currentDetails=*_details;
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
end */
|
end */
|
|
@ -29,11 +29,33 @@
|
||||||
Structure defintions
|
Structure defintions
|
||||||
-------------------- */
|
-------------------- */
|
||||||
|
|
||||||
|
typedef struct ReverbDetails
|
||||||
|
{
|
||||||
|
long m_type;
|
||||||
|
long m_delay;
|
||||||
|
short m_depth;
|
||||||
|
long m_feedback;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class CSpuSound
|
class CSpuSound
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
REVERB_MAX_DEPTH=0x7fff,
|
||||||
|
REVERB_MIN_DEPTH=-0x8000,
|
||||||
|
REVERB_MIN_MODE_DELAY=0,
|
||||||
|
REVERB_MAX_MODE_DELAY=127,
|
||||||
|
REVERB_MIN_MODE_FEEDBACK=0,
|
||||||
|
REVERB_MAX_MODE_FEEDBACK=127,
|
||||||
|
};
|
||||||
|
|
||||||
void initialise();
|
void initialise();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
|
void setReverbActive(int _active);
|
||||||
|
void setReverbDetails(ReverbDetails *_details);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
|
@ -43,7 +65,10 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
static char s_spuManagementTable[];
|
static char s_spuManagementTable[];
|
||||||
|
|
||||||
|
int m_reverbActive;
|
||||||
|
ReverbDetails m_currentDetails;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue