This commit is contained in:
parent
8d799509d2
commit
95c3a77a70
3 changed files with 147 additions and 12 deletions
|
@ -12,9 +12,9 @@
|
|||
#include <libcd.h>
|
||||
#include <libsnd.h>
|
||||
|
||||
#ifndef __SOUND_SNDBANK_H__
|
||||
#include "sound\sndbank.h"
|
||||
#endif
|
||||
//#ifndef __SOUND_SNDBANK_H__
|
||||
//#include "sound\sndbank.h"
|
||||
//#endif
|
||||
|
||||
|
||||
// Add this to have CDXA on PC build!!
|
||||
|
@ -292,15 +292,15 @@ void CXAStream::SetVolume(s32 LVol,s32 RVol)
|
|||
{
|
||||
CdlATV CDVol;
|
||||
SpuCommonAttr Attr;
|
||||
int VolumeSetting;
|
||||
|
||||
if (CurrentStream==XA_STREAM_SPEECH)
|
||||
VolumeSetting=CSfxFactory::SNDVOL_SFX;
|
||||
else
|
||||
VolumeSetting=CSfxFactory::SNDVOL_MUSIC;
|
||||
|
||||
LVol=(LVol*CSfxFactory::getVolumeLevel(VolumeSetting))/256;
|
||||
RVol=(RVol*CSfxFactory::getVolumeLevel(VolumeSetting))/256;
|
||||
//int VolumeSetting;
|
||||
//
|
||||
// if (CurrentStream==XA_STREAM_SPEECH)
|
||||
// VolumeSetting=CSfxFactory::SNDVOL_SFX;
|
||||
// else
|
||||
// VolumeSetting=CSfxFactory::SNDVOL_MUSIC;
|
||||
//
|
||||
// LVol=(LVol*CSfxFactory::getVolumeLevel(VolumeSetting))/256;
|
||||
// RVol=(RVol*CSfxFactory::getVolumeLevel(VolumeSetting))/256;
|
||||
Attr.mask = (SPU_COMMON_CDVOLL|SPU_COMMON_CDVOLR|SPU_COMMON_CDMIX);
|
||||
Attr.cd.volume.left =LVol;
|
||||
Attr.cd.volume.right=RVol;
|
||||
|
|
100
source/system/clickcount.cpp
Normal file
100
source/system/clickcount.cpp
Normal file
|
@ -0,0 +1,100 @@
|
|||
/******************/
|
||||
/*** PSX Timer ***/
|
||||
/******************/
|
||||
|
||||
|
||||
#include <libapi.h>
|
||||
|
||||
#include "system\global.h"
|
||||
#include "system\clickcount.h"
|
||||
#include "system/gp.h"
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
u32 CClickCount::s_currentTime=0;
|
||||
bool CClickCount::s_initialised=false;
|
||||
bool CClickCount::s_paused=false;
|
||||
|
||||
static const int COUNT_DOWN_VAL = 17200;//2150;
|
||||
static const int COUNTS_PER_FRAME_INTERNAL = 4;
|
||||
static const int COUNTS_PER_FRAME_EXTERNAL = 4096;
|
||||
|
||||
/*****************************************************************************/
|
||||
void clockTicker()
|
||||
{
|
||||
u32 thisGp;
|
||||
thisGp=ReloadGP();
|
||||
|
||||
CClickCount::updateCurrentTime();
|
||||
SetGP(thisGp);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
u32 CClickCount::timeSinceLast()
|
||||
{
|
||||
if (!s_initialised)
|
||||
{
|
||||
initialise();
|
||||
m_lastTime=getCurrentTime();
|
||||
s_initialised=true;
|
||||
}
|
||||
|
||||
u32 timeSince;
|
||||
u32 currentTime;
|
||||
u32 lastTime;
|
||||
|
||||
lastTime=m_lastTime;
|
||||
currentTime=getCurrentTime();
|
||||
timeSince=currentTime-m_lastTime;
|
||||
|
||||
m_lastTime=currentTime;
|
||||
return((timeSince*COUNTS_PER_FRAME_EXTERNAL)/COUNTS_PER_FRAME_INTERNAL);
|
||||
return(currentTime*4096);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CClickCount::initialise()
|
||||
{
|
||||
unsigned long eventHandle;
|
||||
|
||||
// set up variables and environment
|
||||
|
||||
EnterCriticalSection();
|
||||
eventHandle = OpenEvent( RCntCNT2, EvSpINT, EvMdINTR,(long (*)(...)) clockTicker);
|
||||
EnableEvent( eventHandle );
|
||||
// SetRCnt( RCntCNT2, COUNT_DOWN_VAL, RCntMdINTR|RCntMdSP);
|
||||
SetRCnt( RCntCNT2, COUNT_DOWN_VAL, RCntMdINTR);
|
||||
StartRCnt( RCntCNT2 );
|
||||
ExitCriticalSection();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
u32 CClickCount::getCurrentTime()
|
||||
{
|
||||
return(s_currentTime);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CClickCount::pauseClickCount()
|
||||
{
|
||||
ASSERT(!s_paused);
|
||||
s_paused = true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CClickCount::restartClickCount()
|
||||
{
|
||||
ASSERT(s_paused);
|
||||
s_paused = false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CClickCount::updateCurrentTime()
|
||||
{
|
||||
if (!s_paused)
|
||||
{
|
||||
s_currentTime++;
|
||||
}
|
||||
|
||||
}
|
||||
|
35
source/system/clickcount.h
Normal file
35
source/system/clickcount.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/******************/
|
||||
/*** PSX Timer ***/
|
||||
/******************/
|
||||
|
||||
#ifndef __SYSTEM_CLICKCOUNT_H__
|
||||
#define __SYSTEM_CLICKCOUNT_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
class CClickCount
|
||||
{
|
||||
private:
|
||||
u32 m_lastTime;
|
||||
|
||||
static u32 s_currentTime;
|
||||
static bool s_initialised;
|
||||
static bool s_paused;
|
||||
|
||||
static u32 getCurrentTime();
|
||||
|
||||
friend void clockTicker();
|
||||
|
||||
public:
|
||||
CClickCount(){};
|
||||
|
||||
u32 timeSinceLast();
|
||||
|
||||
static void initialise();
|
||||
static void pauseClickCount();
|
||||
static void restartClickCount();
|
||||
static void updateCurrentTime();
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue