mirror of
https://github.com/halpz/re3.git
synced 2024-12-23 17:45:28 +00:00
Make PS2 VB files work together with PC audio files
This commit is contained in:
parent
02c4ada807
commit
780cd225e9
1375
src/audio/sampman.h
1375
src/audio/sampman.h
File diff suppressed because it is too large
Load diff
|
@ -1061,11 +1061,21 @@ cSampleManager::Initialise(void)
|
|||
#endif
|
||||
for ( int32 i = STREAMED_SOUND_MISSION_MOBR1; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
#ifdef PS2_AUDIO_PATHS
|
||||
strcpy(filepath, m_szCDRomRootPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
strcat(filepath, PS2StreamedNameTable[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] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
@ -1102,11 +1112,21 @@ cSampleManager::Initialise(void)
|
|||
|
||||
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
|
||||
{
|
||||
#ifdef PS2_AUDIO_PATHS
|
||||
strcpy(filepath, m_MP3FilesPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
strcat(filepath, PS2StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( !mp3Stream[0] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filepath, m_MP3FilesPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
}
|
||||
|
||||
if (mp3Stream[0])
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
@ -1147,11 +1167,21 @@ cSampleManager::Initialise(void)
|
|||
#endif
|
||||
for ( int32 i = STREAMED_SOUND_MISSION_COMPLETED4; i < STREAMED_SOUND_MISSION_PAGER; i++ )
|
||||
{
|
||||
#ifdef PS2_AUDIO_PATHS
|
||||
strcpy(filepath, m_MiscomPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
strcat(filepath, PS2StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( !mp3Stream[0] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filepath, m_MiscomPath);
|
||||
strcat(filepath, StreamedNameTable[i]);
|
||||
|
||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||
}
|
||||
|
||||
if ( mp3Stream[0] )
|
||||
{
|
||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||
|
@ -2043,12 +2073,21 @@ 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, StreamedNameTable[nFile]);
|
||||
strcat(filepath, PS2StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
||||
|
||||
if ( !mp3Stream[nStream] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
|
||||
strcat(filepath, StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
||||
}
|
||||
|
||||
if ( mp3Stream[nStream] )
|
||||
{
|
||||
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
|
||||
|
@ -2109,10 +2148,20 @@ 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, StreamedNameTable[nFile]);
|
||||
mp3Stream[nStream] =
|
||||
AIL_open_stream(DIG, filename, 0);
|
||||
strcat(filename, PS2StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||
|
||||
if ( !mp3Stream[nStream] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
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;
|
||||
|
@ -2156,11 +2205,20 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
|||
{
|
||||
nFile = 0;
|
||||
_bIsMp3Active = 0;
|
||||
#ifdef PS2_AUDIO_PATHS
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
strcat(filename, PS2StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] =
|
||||
AIL_open_stream(DIG, filename, 0);
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||
|
||||
if ( !mp3Stream[nStream] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
mp3Stream[nStream] =
|
||||
AIL_open_stream(DIG, filename, 0);
|
||||
}
|
||||
if(mp3Stream[nStream]) {
|
||||
AIL_set_stream_loop_count(
|
||||
mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
|
@ -2201,10 +2259,20 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
|||
position = 0;
|
||||
nFile = 0;
|
||||
}
|
||||
#ifdef PS2_AUDIO_PATHS
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
strcat(filename, PS2StreamedNameTable[nFile]);
|
||||
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||
|
||||
if ( !mp3Stream[nStream] )
|
||||
#endif
|
||||
{
|
||||
strcpy(filename, m_MiscomPath);
|
||||
strcat(filename, StreamedNameTable[nFile]);
|
||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||
}
|
||||
|
||||
if ( mp3Stream[nStream] )
|
||||
{
|
||||
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
|
|
|
@ -920,7 +920,11 @@ cSampleManager::Initialise(void)
|
|||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
if ( aStream[0] && aStream[0]->Open(StreamedNameTable[i], IsThisTrackAt16KHz(i) ? 16000 : 32000) )
|
||||
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)) )
|
||||
{
|
||||
uint32 tatalms = aStream[0]->GetLengthMS();
|
||||
aStream[0]->Close();
|
||||
|
@ -1628,8 +1632,6 @@ cSampleManager::StopChannel(uint32 nChannel)
|
|||
void
|
||||
cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
if ( nFile < TOTAL_STREAMED_SOUNDS )
|
||||
|
@ -1637,10 +1639,10 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
|||
CStream *stream = aStream[nStream];
|
||||
|
||||
stream->Close();
|
||||
|
||||
strcpy(filename, StreamedNameTable[nFile]);
|
||||
|
||||
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 ( !stream->Setup() )
|
||||
{
|
||||
stream->Close();
|
||||
|
@ -1701,10 +1703,11 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
|||
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
|
||||
nFile = 0;
|
||||
|
||||
strcpy(filename, StreamedNameTable[nFile]);
|
||||
|
||||
CStream *stream = aStream[nStream];
|
||||
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 ( stream->Setup() ) {
|
||||
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
nStreamLoopedFlag[nStream] = TRUE;
|
||||
|
@ -1756,10 +1759,12 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
|||
{
|
||||
nFile = 0;
|
||||
_bIsMp3Active = 0;
|
||||
strcpy(filename, StreamedNameTable[nFile]);
|
||||
|
||||
CStream* stream = aStream[nStream];
|
||||
stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||
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()) {
|
||||
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
|
@ -1806,7 +1811,10 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
|||
|
||||
CStream *stream = aStream[nStream];
|
||||
|
||||
aStream[nStream]->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 ( stream->Setup() ) {
|
||||
stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||
|
|
|
@ -419,7 +419,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
|||
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
|
||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally)
|
||||
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||
|
|
Loading…
Reference in a new issue