You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Fixed sound panning and changed rolloff model to standard inverse again
Changed methods and members around in AudioMan to support this, and changed audioman player management stuff. Cleaned up cruft accordingly
Made SceneMan GetScrollTarget return a constant vector reference so audioman can hang onto it instead of recopying each player's scroll target vector every frame
Missed a couple spots in AudioMan.h and ContentFile.h that should have been in the previous commit
//TODO Consider replacing this with normal min and max distance (but keep custom rolloff mode) so we can save some pointing issues. Might need to store min audible distance in audioman if fmod is strict about min and max distance sizes wrt each other.
status = status == FMOD_OK ? m_AudioSystem->set3DNumListeners(m_CurrentActivityHumanCount) : status;
100
-
}
99
+
if (m_CurrentActivityHumanPlayerPositions.size() != currentActivityHumanCount) { status = status == FMOD_OK ? m_AudioSystem->set3DNumListeners(currentActivityHumanCount) : status; }
101
100
102
-
int audioSystemPlayerNumber = 0;
103
-
for (short player = Players::PlayerOne; player < currentActivity->GetPlayerCount() && audioSystemPlayerNumber < m_CurrentActivityHumanCount; player++) {
104
-
if (currentActivity->PlayerHuman(player)) {
105
-
status = status == FMOD_OK ? m_AudioSystem->set3DListenerAttributes(audioSystemPlayerNumber, &GetAsFMODVector(g_SceneMan.GetScrollTarget(currentActivity->ScreenOfPlayer(player)), g_SettingsMan.c_ListenerZOffset()), NULL, &c_FMODForward, &c_FMODUp) : status;
for (short player = Players::PlayerOne; player < currentActivity->GetPlayerCount() && m_CurrentActivityHumanPlayerPositions.size() < currentActivityHumanCount; player++) {
if (!soundContainer->IsImmobile()) { UpdatePositionalEffectsForSoundChannel(channel); }
517
519
518
520
if (result != FMOD_OK) {
519
521
g_ConsoleMan.PrintString("ERROR: Could not play sounds from SoundContainer " + soundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
// Now that the sound is playing we can register an event with the SoundContainer's channels, which can be used by clients to identify the sound being played.
result = (result == FMOD_OK) ? UpdatePositionalEffectsForSoundChannel(soundChannel, &soundPosition) : result;
558
560
if (result != FMOD_OK) {
559
561
g_ConsoleMan.PrintString("ERROR: Could not set sound position for the sound being played on channel " + std::to_string(channelIndex) + " for SoundContainer " + soundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
560
562
}
561
-
result = (result == FMOD_OK) ? UpdateMobileSoundChannelCalculated3DEffects(soundChannel) : result;
562
-
if (result != FMOD_OK) {
563
-
g_ConsoleMan.PrintString("ERROR: Could not update attenuation for the sound being played on channel " + std::to_string(channelIndex) + " for SoundContainer " + soundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
FMOD_RESULT result = m_MobileSoundChannelGroup->getNumChannels(&numberOfPlayingChannels);
618
+
if (result != FMOD_OK) {
619
+
g_ConsoleMan.PrintString("ERROR: Failed to get the number of playing channels when updating calculated sound effects for all playing channels: " + std::string(FMOD_ErrorString(result)));
620
+
return;
621
+
}
616
622
623
+
for (int i = 0; i < numberOfPlayingChannels; i++) {
624
+
result = m_MobileSoundChannelGroup->getChannel(i, &soundChannel);
625
+
FMOD_VECTOR channelPosition;
626
+
result = result == FMOD_OK ? soundChannel->get3DAttributes(&channelPosition, nullptr) : result;
627
+
result = result == FMOD_OK ? UpdatePositionalEffectsForSoundChannel(soundChannel, &channelPosition) : result;
628
+
629
+
float channel3dLevel;
630
+
result = (result == FMOD_OK) ? soundChannel->get3DLevel(&channel3dLevel) : result;
631
+
if (result == FMOD_OK && m_CurrentActivityHumanPlayerPositions.size() == 1) {
g_ConsoleMan.PrintString("ERROR: An error occurred updating calculated sound effects for playing channel with index " + std::to_string(i) + ": " + std::string(FMOD_ErrorString(result)));
//NOTE If the scene doesn't wrap and the position hasn't changed, this method doesn't set the channel position below, so there's no need to get it here.
660
+
result = soundChannel->get3DAttributes(&channelPosition, nullptr);
661
+
if (result != FMOD_OK) {
662
+
return result;
663
+
}
664
+
}
629
665
630
-
FMOD_RESULT result = m_MobileSoundChannelGroup->getNumChannels(&numberOfPlayingChannels);
631
-
if (result == FMOD_OK) {
632
-
for (int i = 0; i < numberOfPlayingChannels; i++) {
633
-
result = m_MobileSoundChannelGroup->getChannel(i, &channel);
634
-
result = result == FMOD_OK ? UpdateMobileSoundChannelCalculated3DEffects(channel) : result;
635
-
if (result != FMOD_OK) {
636
-
g_ConsoleMan.PrintString("ERROR: An error occurred when manually attenuating all playing channels, for channel index " + std::to_string(i) + ": " + std::string(FMOD_ErrorString(result)));
if (shortestDistance == -1 || distanceToChannelPosition < shortestDistance) {
681
+
shortestDistance = distanceToChannelPosition;
682
+
channelPosition = wrappedChannelPosition;
637
683
}
638
684
}
639
-
} else {
640
-
g_ConsoleMan.PrintString("ERROR: Failed to get the number of playing channels when manually attenuating all playing channels: " + std::string(FMOD_ErrorString(result)));
641
685
}
686
+
687
+
int soundChannelIndex;
688
+
result = result == FMOD_OK ? soundChannel->getIndex(&soundChannelIndex) : result;
689
+
result = result == FMOD_OK ? soundChannel->setMute(shortestDistance < m_SoundChannelMinimumAudibleDistances.at(soundChannelIndex)) : result;
g_ConsoleMan.PrintString("ERROR: An error occurred when Ending a sound in SoundContainer " + channelSoundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
0 commit comments