cAudioManager::DirectlyEnqueueSample

This commit is contained in:
Sergeanur 2021-08-29 17:32:36 +03:00
parent c6f9bbce8e
commit a404689e50
4 changed files with 28 additions and 4 deletions

View file

@ -1402,6 +1402,28 @@ cAudioManager::GenerateIntegerRandomNumberTable()
m_anRandomTable[i] = myrand();
}
void
cAudioManager::DirectlyEnqueueSample(uint32 sample, uint8 bank, uint32 counter, uint32 priority, uint32 freq, uint8 volume, uint8 framesToPlay, uint32 notStereo)
{
m_sQueueSample.m_nSampleIndex = sample;
m_sQueueSample.m_bReflections = FALSE;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bIs2D = FALSE;
m_sQueueSample.m_bStatic = FALSE;
m_sQueueSample.m_nPan = 0;
m_sQueueSample.m_nBankIndex = bank;
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nVolume = volume;
m_sQueueSample.m_nPriority = priority;
m_sQueueSample.m_nFramesToPlay = framesToPlay;
AudioManager.AddSampleToRequestedQueue();
if (!notStereo) {
m_sQueueSample.m_nPan = 127;
AudioManager.AddSampleToRequestedQueue();
}
}
#ifdef EXTERNAL_3D_SOUND
void
cAudioManager::AdjustSamplesVolume()

View file

@ -359,6 +359,7 @@ public:
void ClearActiveSamples();
void GenerateIntegerRandomNumberTable();
void LoadBankIfNecessary(uint8 bank);
void DirectlyEnqueueSample(uint32 sample, uint8 bank, uint32 counter, uint32 priority, uint32 freq, uint8 volume, uint8 framesToPlay, uint32 notStereo = 0);
#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
void AdjustSamplesVolume(); // inlined

View file

@ -1108,8 +1108,8 @@ enum
MI_COMET = -972,
MI_KAUFMAN = -967,
MI_BAGGAGE = -963,
MI_VICECHEE = -954,
MI_RCBARON = -955,
MI_VICECHEE = -954,
// HACK HACK, hopefully temporary
MI_JETMAX = -2000,

View file

@ -14,6 +14,7 @@
#include "TempColModels.h"
#include "WaterLevel.h"
#include "World.h"
#include "sampman.h"
CFerryInst* CFerry::mspInst;
@ -706,7 +707,7 @@ void CFerry::OpenDoor(void)
m_bUseFrontDoor = true;
if (fDistToCar4 < fDistToCar1)
m_bUseFrontDoor = false;
// AudioManager.DirectlyEnqueueSample(0xb8,0,0,1,0x5622,0x7f,0x14,0); // TODO
AudioManager.DirectlyEnqueueSample(SFX_GATE_START_CLU, SFX_BANK_0, 0, 1, 22050, 127, 20);
}
void CFerry::CloseDoor(void)
@ -714,7 +715,7 @@ void CFerry::CloseDoor(void)
printf("closing the ferry door\n");
m_nDoorState = FERRY_DOOR_CLOSING;
m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 10000;
// AudioManager.DirectlyEnqueueSample(0xb8, 0, 0, 1, 0x5622, 0x7f, 0x14, 0); // TODO
AudioManager.DirectlyEnqueueSample(SFX_GATE_START_CLU, SFX_BANK_0, 0, 1, 22050, 127, 20); // shouldn't this be SFX_GATE_STOP_CLU?
}
bool CFerry::IsDoorOpen(void)
@ -798,7 +799,7 @@ void CFerry::PlayArrivedHorn(void)
float fDistToCamera = (GetPosition() - TheCamera.GetPosition()).Magnitude();
if (fDistToCamera < 200.0f) {
uint8 volume = (200.0f - fDistToCamera) / 200.0f * 127;
// AudioManager.DirectlyEnqueueSample(0x32, 0, 0, 1, 18000, volume, 0x32, 0); // TODO
AudioManager.DirectlyEnqueueSample(SFX_CAR_HORN_TRUCK, SFX_BANK_0, 0, 1, 18000, volume, 50);
}
}