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.cpp161
1 files changed, 154 insertions, 7 deletions
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 49f2f10f..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,7 +1138,7 @@ cSampleManager::Initialise(void)
m_szCDRomRootPath[0] = '\0';
strcpy(m_WavFilesPath, m_szCDRomRootPath);
-
+ /*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
@@ -1082,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
@@ -1100,12 +1183,20 @@ cSampleManager::Initialise(void)
{
#endif
- for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
+ for (int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++)
{
strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[i]);
+ strcat(filepath, ".VB");
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+ if (!mp3Stream[0])
+ {
+ strcpy(filepath, m_MP3FilesPath);
+ strcat(filepath, StreamedNameTable[i]);
+ strcat(filepath, ".MP3");
+ mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
+ }
if (mp3Stream[0])
{
@@ -1141,7 +1232,7 @@ cSampleManager::Initialise(void)
#endif
if ( !bFileNotFound ) {
-
+/*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
@@ -1167,7 +1258,7 @@ cSampleManager::Initialise(void)
bFileNotFound = TRUE;
break;
}
- }
+ }*/
}
m_bInitialised = !bFileNotFound;
@@ -1696,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;
@@ -1725,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;
@@ -1825,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;
@@ -1852,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
@@ -1873,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;
@@ -1899,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;
@@ -1925,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;
@@ -1951,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;
@@ -1982,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;
@@ -2008,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;
@@ -2044,10 +2155,19 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
char filepath[MAX_PATH];
- 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, ".VB");
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
+
+ if(!mp3Stream[nStream])
+ {
+ strcpy(filepath, m_MP3FilesPath);
+ strcat(filepath, StreamedNameTable[nFile]);
+ strcat(filepath, ".MP3");
+ mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
+ }
if ( mp3Stream[nStream] )
{
@@ -2111,8 +2231,17 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
nFile = 0;
strcpy(filename, m_MiscomPath);
strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
+
+ if(!mp3Stream[nStream])
+ {
+ strcpy(filename, m_MP3FilesPath);
+ 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);
nStreamLoopedFlag[nStream] = TRUE;
@@ -2158,9 +2287,17 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
_bIsMp3Active = 0;
strcpy(filename, m_MiscomPath);
strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
+ 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);
@@ -2203,8 +2340,16 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
}
strcpy(filename, m_MiscomPath);
strcat(filename, StreamedNameTable[nFile]);
+ strcat(filename, ".VB");
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
+ 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);
@@ -2328,6 +2473,8 @@ cSampleManager::IsStreamPlaying(uint8 nStream)
bool8
cSampleManager::InitialiseSampleBanks(void)
{
+ SetUpDebugBanksInfo();
+
int32 nBank = SFX_BANK_0;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
@@ -2351,7 +2498,7 @@ cSampleManager::InitialiseSampleBanks(void)
fclose(fpSampleDescHandle);
fpSampleDescHandle = NULL;
-
+
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
#ifdef FIX_BUGS