From c1c163d78c7f822b62aa6b0f5c7b00642b961700 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 31 May 2020 20:59:01 +0300 Subject: game logic --- src/audio/sampman.h | 4 ++-- src/audio/sampman_miles.cpp | 11 ++++++++--- src/audio/sampman_null.cpp | 4 ++-- src/audio/sampman_oal.cpp | 12 ++++++++---- 4 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src/audio') diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 655efb5c..b539854c 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -126,10 +126,10 @@ public: void StartChannel (uint32 nChannel); void StopChannel (uint32 nChannel); - void PreloadStreamedFile (uint8 nFile, uint8 nStream); + void PreloadStreamedFile (uint32 nFile, uint8 nStream); void PauseStream (uint8 nPauseFlag, uint8 nStream); void StartPreloadedStreamedFile (uint8 nStream); - bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream); + bool StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream); void StopStreamedFile (uint8 nStream); int32 GetStreamedFilePosition (uint8 nStream); void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream); diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 63e89cac..406e8716 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -2030,7 +2030,7 @@ cSampleManager::StopChannel(uint32 nChannel) } void -cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream) +cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) { if ( m_bInitialised ) { @@ -2081,7 +2081,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) } bool -cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) +cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { uint32 position = nPos; char filename[MAX_PATH]; @@ -2287,7 +2287,12 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect if ( mp3Stream[nStream] ) { if ( nEffectFlag ) - AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14); + { + if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? + AIL_set_stream_volume(mp3Stream[nStream], 64*vol*m_nEffectsVolume >> 14); + else + AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14); + } else AIL_set_stream_volume(mp3Stream[nStream], m_nMusicFadeVolume*vol*m_nMusicVolume >> 14); diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp index 6ec8a521..3638e6fb 100644 --- a/src/audio/sampman_null.cpp +++ b/src/audio/sampman_null.cpp @@ -297,7 +297,7 @@ cSampleManager::StopChannel(uint32 nChannel) } void -cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream) +cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); } @@ -315,7 +315,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) } bool -cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) +cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 5092a4b1..210d128e 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1168,7 +1168,7 @@ cSampleManager::StopChannel(uint32 nChannel) } void -cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream) +cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) { char filename[256]; @@ -1226,7 +1226,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) } bool -cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) +cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { char filename[256]; @@ -1317,8 +1317,12 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect if ( stream ) { - if ( nEffectFlag ) - stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); + if ( nEffectFlag ) { + if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? + stream->SetVolume(64*vol*m_nEffectsVolume >> 14) + else + stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); + } else stream->SetVolume(m_nMusicFadeVolume*nVolume*m_nMusicVolume >> 14); -- cgit v1.2.3 From f945dbc0fb86a8db82d99cb524e54c1f0a0b2371 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 31 May 2020 21:01:36 +0300 Subject: dumb --- src/audio/sampman_miles.cpp | 2 +- src/audio/sampman_oal.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/audio') diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 406e8716..5893ea64 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -2289,7 +2289,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect if ( nEffectFlag ) { if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? - AIL_set_stream_volume(mp3Stream[nStream], 64*vol*m_nEffectsVolume >> 14); + AIL_set_stream_volume(mp3Stream[nStream], 128*vol*m_nEffectsVolume >> 14); else AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14); } diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 210d128e..767e4aa0 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1319,7 +1319,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect { if ( nEffectFlag ) { if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? - stream->SetVolume(64*vol*m_nEffectsVolume >> 14) + stream->SetVolume(128*vol*m_nEffectsVolume >> 14) else stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); } -- cgit v1.2.3 From 815d3e0f61e4c50929f1ba921e6a4dbbed9c4aa0 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 31 May 2020 22:50:32 +0300 Subject: fix --- src/audio/sampman_oal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio') diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 767e4aa0..6ca8e840 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1319,7 +1319,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect { if ( nEffectFlag ) { if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? - stream->SetVolume(128*vol*m_nEffectsVolume >> 14) + stream->SetVolume(128*nVolume*m_nEffectsVolume >> 14) else stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); } -- cgit v1.2.3 From 0631bd9d890ee08dffdfea5f831e2f3a748be5c6 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 31 May 2020 23:16:24 +0300 Subject: fix --- src/audio/sampman_oal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/audio') diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 6ca8e840..de55c2ed 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1319,7 +1319,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect { if ( nEffectFlag ) { if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel? - stream->SetVolume(128*nVolume*m_nEffectsVolume >> 14) + stream->SetVolume(128*nVolume*m_nEffectsVolume >> 14); else stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); } -- cgit v1.2.3