summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_miles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/sampman_miles.cpp')
-rw-r--r--src/audio/sampman_miles.cpp215
1 files changed, 147 insertions, 68 deletions
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index b77584d0..73d4406d 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -324,6 +324,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 which)
{
@@ -1027,9 +1101,18 @@ cSampleManager::Initialise(void)
{
strcpy(filepath, m_szCDRomRootPath);
strcat(filepath, StreamedNameTable[0]);
+ strcat(filepath, ".VB");
FILE *f = fopen(filepath, "rb");
+ if ( !f )
+ {
+ strcpy(filepath, m_szCDRomRootPath);
+ strcat(filepath, StreamedNameTable[0]);
+ strcat(filepath, ".MP3");
+ f = fopen(filepath, "rb");
+ }
+
if ( f )
{
fclose(f);
@@ -1055,26 +1138,16 @@ cSampleManager::Initialise(void)
m_szCDRomRootPath[0] = '\0';
strcpy(m_WavFilesPath, m_szCDRomRootPath);
-
+ /*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
for ( int32 i = STREAMED_SOUND_MISSION_MOBR1; i < TOTAL_STREAMED_SOUNDS; i++ )
{
-#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_szCDRomRootPath);
- strcat(filepath, PS2StreamedNameTable[i]);
-
+ strcat(filepath, StreamedNameTable[i]);
+
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
-
- if ( !mp3Stream[0] )
-#endif
- {
- strcpy(filepath, m_szCDRomRootPath);
- strcat(filepath, StreamedNameTable[i]);
-
- mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
- }
if ( mp3Stream[0] )
{
@@ -1092,7 +1165,7 @@ cSampleManager::Initialise(void)
return FALSE;
}
}
-
+ */
// Find path of MP3s (originally in CD-Rom)
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
#ifndef NO_CDCHECK
@@ -1110,20 +1183,18 @@ cSampleManager::Initialise(void)
{
#endif
- for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
+ for (int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++)
{
-#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_MP3FilesPath);
- strcat(filepath, PS2StreamedNameTable[i]);
+ strcat(filepath, StreamedNameTable[i]);
+ strcat(filepath, ".VB");
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
-
- if ( !mp3Stream[0] )
-#endif
+ if (!mp3Stream[0])
{
strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[i]);
-
+ strcat(filepath, ".MP3");
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
}
@@ -1161,26 +1232,16 @@ cSampleManager::Initialise(void)
#endif
if ( !bFileNotFound ) {
-
+/*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
for ( int32 i = STREAMED_SOUND_MISSION_COMPLETED4; i < STREAMED_SOUND_MISSION_PAGER; i++ )
{
-#ifdef PS2_AUDIO_PATHS
strcpy(filepath, m_MiscomPath);
- strcat(filepath, PS2StreamedNameTable[i]);
-
- mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
-
- if ( !mp3Stream[0] )
-#endif
- {
- strcpy(filepath, m_MiscomPath);
- strcat(filepath, StreamedNameTable[i]);
+ strcat(filepath, StreamedNameTable[i]);
- mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
- }
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
if ( mp3Stream[0] )
{
@@ -1197,7 +1258,7 @@ cSampleManager::Initialise(void)
bFileNotFound = TRUE;
break;
}
- }
+ }*/
}
m_bInitialised = !bFileNotFound;
@@ -1726,6 +1787,8 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -1755,6 +1818,8 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -1855,6 +1920,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
nChannelVolume[nChannel] = vol;
@@ -1882,6 +1949,8 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
#ifndef FIX_BUGS
if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
@@ -1903,6 +1972,8 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -1929,6 +2000,8 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -1955,6 +2028,8 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -1981,6 +2056,8 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -2012,6 +2089,8 @@ cSampleManager::StartChannel(uint32 nChannel)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -2038,6 +2117,8 @@ cSampleManager::StopChannel(uint32 nChannel)
switch ( nChannel )
{
case CHANNEL_POLICE_RADIO:
+ case CHANNEL_MISSION_AUDIO_1:
+ case CHANNEL_MISSION_AUDIO_2:
{
b2d = TRUE;
break;
@@ -2073,18 +2154,18 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
}
char filepath[MAX_PATH];
-#ifdef PS2_AUDIO_PATHS
- strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
- strcat(filepath, PS2StreamedNameTable[nFile]);
-
+
+ strcpy(filepath, m_MP3FilesPath);
+ strcat(filepath, StreamedNameTable[nFile]);
+ strcat(filepath, ".VB");
+
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
- if ( !mp3Stream[nStream] )
-#endif
+ if(!mp3Stream[nStream])
{
- strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
+ strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[nFile]);
-
+ strcat(filepath, ".MP3");
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
}
@@ -2148,19 +2229,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
// Try to continue from previous song, if already started
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0;
-#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_MiscomPath);
- strcat(filename, PS2StreamedNameTable[nFile]);
-
- mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
+ mp3Stream[nStream] =
+ AIL_open_stream(DIG, filename, 0);
- if ( !mp3Stream[nStream] )
-#endif
+ if(!mp3Stream[nStream])
{
- strcpy(filename, m_MiscomPath);
+ strcpy(filename, m_MP3FilesPath);
strcat(filename, StreamedNameTable[nFile]);
- mp3Stream[nStream] =
- AIL_open_stream(DIG, filename, 0);
+ strcat(filename, ".MP3");
+ mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
@@ -2205,19 +2285,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
{
nFile = 0;
_bIsMp3Active = 0;
-#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_MiscomPath);
- strcat(filename, PS2StreamedNameTable[nFile]);
-
- mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
- if ( !mp3Stream[nStream] )
-#endif
+ mp3Stream[nStream] =
+ AIL_open_stream(DIG, filename, 0);
+ if(!mp3Stream[nStream])
{
strcpy(filename, m_MiscomPath);
strcat(filename, StreamedNameTable[nFile]);
- mp3Stream[nStream] =
- AIL_open_stream(DIG, filename, 0);
+ strcat(filename, ".MP3");
+ mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
@@ -2259,20 +2338,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
position = 0;
nFile = 0;
}
-#ifdef PS2_AUDIO_PATHS
strcpy(filename, m_MiscomPath);
- strcat(filename, PS2StreamedNameTable[nFile]);
-
+ strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
+
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
-
- if ( !mp3Stream[nStream] )
-#endif
+ if( !mp3Stream[nStream] )
{
strcpy(filename, m_MiscomPath);
strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".MP3");
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
-
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
@@ -2396,6 +2473,8 @@ cSampleManager::IsStreamPlaying(uint8 nStream)
bool8
cSampleManager::InitialiseSampleBanks(void)
{
+ SetUpDebugBanksInfo();
+
int32 nBank = SFX_BANK_0;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
@@ -2419,7 +2498,7 @@ cSampleManager::InitialiseSampleBanks(void)
fclose(fpSampleDescHandle);
fpSampleDescHandle = NULL;
-
+
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
#ifdef FIX_BUGS