summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r--src/audio/sampman_oal.cpp169
1 files changed, 136 insertions, 33 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 73f6900b..60d26b7d 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -301,7 +301,7 @@ set_new_provider(int index)
static bool8
IsThisTrackAt16KHz(uint32 track)
{
- return track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
+ return false;// track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
}
cSampleManager::cSampleManager(void)
@@ -314,6 +314,80 @@ cSampleManager::~cSampleManager(void)
}
+int gBankStartOffset[67];
+
+void
+SetUpDebugBanksInfo()
+{
+ gBankStartOffset[3] = SFX_FE_BACK;
+ gBankStartOffset[4] = SFX_CAR_ACCEL_1;
+ gBankStartOffset[5] = SFX_CAR_ACCEL_2;
+ gBankStartOffset[9] = SFX_CAR_ACCEL_6;
+ gBankStartOffset[10] = SFX_CAR_ACCEL_7;
+ gBankStartOffset[1] = SFX_EMPTY;
+ gBankStartOffset[11] = SFX_CAR_ACCEL_8;
+ gBankStartOffset[7] = SFX_CAR_ACCEL_4;
+ gBankStartOffset[15] = SFX_CAR_ACCEL_12;
+ gBankStartOffset[13] = SFX_CAR_ACCEL_10;
+ gBankStartOffset[16] = SFX_CAR_CHAINSAW_IDLE;
+ gBankStartOffset[0] = SFX_AIR_BRAKES;
+ gBankStartOffset[17] = SFX_RC_IDLE;
+ gBankStartOffset[6] = SFX_CAR_ACCEL_3;
+ gBankStartOffset[19] = SFX_CAR_ACCEL_16;
+ gBankStartOffset[12] = SFX_CAR_ACCEL_9;
+ gBankStartOffset[2] = SFX_AMBULAN_VOICE_1_VAN_1;
+ gBankStartOffset[21] = SFX_CAR_ACCEL_18;
+ gBankStartOffset[22] = SFX_CAR_ACCEL_19;
+ gBankStartOffset[8] = SFX_CAR_ACCEL_5;
+ gBankStartOffset[23] = SFX_CAR_ACCEL_20;
+ gBankStartOffset[14] = SFX_CAR_ACCEL_11;
+ gBankStartOffset[20] = SFX_CAR_ACCEL_17;
+ gBankStartOffset[18] = SFX_CAR_RC_HELI;
+ gBankStartOffset[25] = SFX_CAR_AFTER_ACCEL_21;
+ gBankStartOffset[26] = SFX_CAR_FINGER_OFF_ACCEL_21;
+ gBankStartOffset[27] = SFX_CAR_ACCEL_22;
+ gBankStartOffset[28] = SFX_CAR_AFTER_ACCEL_22;
+ gBankStartOffset[29] = SFX_CAR_FINGER_OFF_ACCEL_22;
+ gBankStartOffset[24] = SFX_CAR_ACCEL_21;
+ gBankStartOffset[30] = SFX_HELI_APACHE_1;
+ gBankStartOffset[31] = SFX_HELI_UNUSED_1;
+ gBankStartOffset[32] = SFX_HELI_UNUSED_2;
+ gBankStartOffset[33] = SFX_HELI_UNUSED_3;
+ gBankStartOffset[34] = SFX_HELI_UNUSED_4;
+ gBankStartOffset[35] = SFX_SEAPLANE_LOW;
+ gBankStartOffset[37] = SFX_PLANE_UNUSED_2;
+ gBankStartOffset[38] = SFX_PLANE_UNUSED_3;
+ gBankStartOffset[39] = SFX_PLANE_UNUSED_4;
+ gBankStartOffset[40] = SFX_BUILDINGS_BANK_ALARM;
+ gBankStartOffset[41] = SFX_BUILDING_SNORE;
+ gBankStartOffset[36] = SFX_PLANE_UNUSED_1;
+ gBankStartOffset[43] = SFX_BUILDING_BAR_2;
+ gBankStartOffset[44] = SFX_BUILDING_BAR_3;
+ gBankStartOffset[45] = SFX_BUILDING_BAR_4;
+ gBankStartOffset[46] = SFX_BUILDING_MAL1;
+ gBankStartOffset[47] = SFX_BUILDING_MAL2;
+ gBankStartOffset[42] = SFX_BUILDING_BAR_1;
+ gBankStartOffset[49] = SFX_BUILDING_STR1;
+ gBankStartOffset[50] = SFX_BUILDING_STR2;
+ gBankStartOffset[51] = SFX_BUILDING_STR3;
+ gBankStartOffset[52] = SFX_BUILDING_CHURCH;
+ gBankStartOffset[53] = SFX_BUILDING_FAN_1;
+ gBankStartOffset[48] = SFX_BUILDING_MAL3;
+ gBankStartOffset[55] = SFX_BUILDING_INSECTS_1;
+ gBankStartOffset[56] = SFX_BUILDING_INSECTS_2;
+ gBankStartOffset[54] = SFX_BUILDING_FAN_2;
+ gBankStartOffset[57] = SFX_CLUB_1;
+ gBankStartOffset[58] = SFX_CLUB_2;
+ gBankStartOffset[59] = SFX_CLUB_3;
+ gBankStartOffset[60] = SFX_CLUB_4;
+ gBankStartOffset[61] = SFX_FOOTSTEP_GRASS_1;
+ gBankStartOffset[62] = SFX_FOOTSTEP_GRAVEL_1;
+ gBankStartOffset[63] = SFX_FOOTSTEP_WOOD_1;
+ gBankStartOffset[64] = SFX_FOOTSTEP_METAL_1;
+ gBankStartOffset[65] = SFX_FOOTSTEP_WATER_1;
+ gBankStartOffset[66] = SFX_FOOTSTEP_SAND_1;
+}
+
void cSampleManager::SetSpeakerConfig(int32 nConfig)
{
@@ -759,7 +833,7 @@ cSampleManager::Initialise(void)
{
if ( _bSampmanInitialised )
return TRUE;
-
+ SetUpDebugBanksInfo();
EFXInit();
for(int i = 0; i < MAX_STREAMS; i++)
@@ -920,11 +994,21 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{
- if ( aStream[0] && (
-#ifdef PS2_AUDIO_PATHS
- aStream[0]->Open(PS2StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000) ||
-#endif
- aStream[0]->Open(StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000)) )
+ bool opened = false;
+ char filename[MAX_PATH];
+ sprintf(filename, "%s.VB", StreamedNameTable[i]);
+ if ( aStream[0] )
+ opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000);
+
+ if ( !opened )
+ {
+ sprintf(filename, "%s.MP3", StreamedNameTable[i]);
+ if ( aStream[0] )
+ {
+ opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000);
+ }
+ }
+ if ( opened )
{
uint32 tatalms = aStream[0]->GetLengthMS();
aStream[0]->Close();
@@ -1550,7 +1634,7 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
ASSERT( nChannel >= MAXCHANNELS );
ASSERT( nChannel < NUM_CHANNELS );
- if ( nChannel == CHANNEL_POLICE_RADIO )
+ if( nChannel >= CHANNEL_POLICE_RADIO )
{
uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
@@ -1575,7 +1659,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
ASSERT( nChannel >= MAXCHANNELS );
ASSERT( nChannel < NUM_CHANNELS );
- if ( nChannel == CHANNEL_POLICE_RADIO )
+ if ( nChannel >= CHANNEL_POLICE_RADIO )
{
aChannel[nChannel].SetPan(nPan);
}
@@ -1631,7 +1715,9 @@ cSampleManager::StopChannel(uint32 nChannel)
void
cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
-{
+{
+ char filename[MAX_PATH];
+
ASSERT( nStream < MAX_STREAMS );
if ( nFile < TOTAL_STREAMED_SOUNDS )
@@ -1639,11 +1725,15 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
CStream *stream = aStream[nStream];
stream->Close();
-#ifdef PS2_AUDIO_PATHS
- if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
-#endif
- stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
- if ( !stream->Setup() )
+ sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
+ bool opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ if ( !opened )
+ {
+ sprintf(filename, "%s.MP3", StreamedNameTable[nFile]);
+ opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ }
+
+ if ( opened && !stream->Setup() )
{
stream->Close();
}
@@ -1703,12 +1793,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0;
+ sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
+
CStream *stream = aStream[nStream];
-#ifdef PS2_AUDIO_PATHS
- if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
-#endif
- stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
- if ( stream->Setup() ) {
+ bool opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+
+ if ( !opened )
+ {
+ sprintf(filename, "%s.MP3", StreamedNameTable[nFile]);
+ opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ }
+
+ if ( opened && stream->Setup() ) {
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
nStreamLoopedFlag[nStream] = TRUE;
if (position != 0)
@@ -1759,14 +1855,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
{
nFile = 0;
_bIsMp3Active = 0;
+ sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
- CStream *stream = aStream[nStream];
-#ifdef PS2_AUDIO_PATHS
- if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
-#endif
- stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ CStream* stream = aStream[nStream];
+ bool opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
- if (stream->Setup()) {
+ if ( !opened )
+ {
+ sprintf(filename, "%s.MP3", StreamedNameTable[nFile]);
+ opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ }
+
+ if (opened && stream->Setup()) {
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
nStreamLoopedFlag[nStream] = TRUE;
if (position != 0)
@@ -1807,16 +1907,19 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
position = 0;
nFile = 0;
}
- strcpy(filename, StreamedNameTable[nFile]);
-
+ sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
+
CStream *stream = aStream[nStream];
+
+ bool opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
-#ifdef PS2_AUDIO_PATHS
- if(!stream->Open(PS2StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000))
-#endif
- stream->Open(StreamedNameTable[nFile], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ if ( !opened )
+ {
+ sprintf(filename, "%s.MP3", StreamedNameTable[nFile]);
+ opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
+ }
- if ( stream->Setup() ) {
+ if ( opened && stream->Setup() ) {
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
nStreamLoopedFlag[nStream] = TRUE;
if (position != 0)