Bugfix: the smaller MAX_SIMULTANEOUS_NOTES define, when used, can lead to silence on audio init
This commit is contained in:
1 parent
f061076a4f
commit
c4a23d0036
1 file changed
+20
-10
+20
-10
@@ -1313,6 +1313,16 @@ void audio_reset_session(void) {
|
||||
gAudioBufferParameters.minAiBufferLength *= gAudioBufferParameters.presetUnk4;
|
||||
gAudioBufferParameters.updatesPerFrame *= gAudioBufferParameters.presetUnk4;
|
||||
|
||||
if (gIsConsole)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_CONSOLE;
|
||||
else
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_EMULATOR;
|
||||
|
||||
if (gMaxSimultaneousNotes > MAX_SIMULTANEOUS_NOTES)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES;
|
||||
else if (gMaxSimultaneousNotes < 0)
|
||||
gMaxSimultaneousNotes = 0;
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (gAudioBufferParameters.presetUnk4 >= 2) {
|
||||
gAudioBufferParameters.maxAiBufferLength -= 0x10;
|
||||
@@ -1330,6 +1340,16 @@ void audio_reset_session(void) {
|
||||
gMinAiBufferLength = gSamplesPerFrameTarget - 0x10;
|
||||
gAudioUpdatesPerFrame = updatesPerFrame = gSamplesPerFrameTarget / 160 + 1;
|
||||
|
||||
if (gIsConsole)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_CONSOLE;
|
||||
else
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_EMULATOR;
|
||||
|
||||
if (gMaxSimultaneousNotes > MAX_SIMULTANEOUS_NOTES)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES;
|
||||
else if (gMaxSimultaneousNotes < 0)
|
||||
gMaxSimultaneousNotes = 0;
|
||||
|
||||
// Compute conversion ratio from the internal unit tatums/tick to the
|
||||
// external beats/minute (JP) or tatums/minute (US). In practice this is
|
||||
// 300 on JP and 14360 on US.
|
||||
@@ -1426,16 +1446,6 @@ void audio_reset_session(void) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (gIsConsole)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_CONSOLE;
|
||||
else
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_EMULATOR;
|
||||
|
||||
if (gMaxSimultaneousNotes > MAX_SIMULTANEOUS_NOTES)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES;
|
||||
else if (gMaxSimultaneousNotes < 0)
|
||||
gMaxSimultaneousNotes = 0;
|
||||
|
||||
sAudioFirstBoot = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user