Proper fix for the 500 sound issue.

This commit is contained in:
andriy921 2016-04-12 02:52:19 +03:00
parent 8de7f2c6ec
commit d346803f29
2 changed files with 8 additions and 13 deletions

View File

@ -216,7 +216,7 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length)
void SoundHandler::executeThread()
{
// v2 sound lib can not properly end transition audio on old firmwares.
// v2 sound lib can not properly end transition audio on old firmwares
if (OS_FIRMWARE <= 410)
{
ProperlyEndTransitionAudio();
@ -227,9 +227,12 @@ void SoundHandler::executeThread()
AXInitWithParams(params);
for(u32 i = 0; i < MAX_DECODERS; ++i)
// The problem with last voice on 500 was caused by it having priority 0
// We would need to change this priority distribution if for some reason
// we would need MAX_DECODERS > Voice::PRIO_MAX
for(u32 i = 0; i < MAX_DECODERS; ++i)
{
int priority = (MAX_DECODERS - 1 - i) * (Voice::PRIO_MAX - Voice::PRIO_MIN) / (MAX_DECODERS - 1);
int priority = (MAX_DECODERS - i) * Voice::PRIO_MAX / MAX_DECODERS;
voiceList[i] = new Voice(priority); // allocate voice 0 with highest priority
}
@ -263,15 +266,7 @@ void SoundHandler::executeThread()
AXRegisterFrameCallback(NULL);
AXQuit();
// deleting the last voice from the decoder produced DSI errors on 5.0.0 so we skip it
// expecting same behaviour on every FW below 532
u32 delete_skip = 0;
if(OS_FIRMWARE < 532)
{
delete_skip = 1;
}
for(u32 i = 0; i < MAX_DECODERS - delete_skip; ++i)
for(u32 i = 0; i < MAX_DECODERS; ++i)
{
delete voiceList[i];
voiceList[i] = NULL;

View File

@ -26,7 +26,7 @@ public:
enum VoicePriorities
{
PRIO_MIN = 0,
PRIO_MIN = 1,
PRIO_MAX = 31
};