Merge pull request #4102 from FIX94/master

(WiiU) properly set audio offset before starting playback
This commit is contained in:
aliaspider 2016-11-30 02:41:09 +01:00 committed by GitHub
commit 01bc910607
3 changed files with 6 additions and 4 deletions

View File

@ -79,9 +79,7 @@ void wiiu_ax_callback(void)
//buffer underrun, stop playback to let it fill up
if(ax->written < AX_AUDIO_SAMPLE_MIN)
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
//make sure to update written value if voice is running
if(AXIsMultiVoiceRunning(ax->mvoice))
ax->written -= AX_AUDIO_SAMPLE_COUNT;
ax->written -= AX_AUDIO_SAMPLE_COUNT;
OSUninterruptibleSpinLock_Release(&ax->spinlock);
}
}
@ -188,8 +186,10 @@ static bool ax_audio_start(void* data)
//set back to playing on enough buffered data
if(ax->written > AX_AUDIO_SAMPLE_LOAD)
{
AXSetMultiVoiceCurrentOffset(ax->mvoice, (ax->pos - ax->written) & AX_AUDIO_COUNT_MASK);
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_PLAYING);
}
return true;
}

View File

@ -12,6 +12,7 @@ typedef struct
void AXAcquireMultiVoice(uint32_t prio, void *cb, uint32_t cbarg, void *setup, AXMVoice **mvoice);
void AXSetMultiVoiceDeviceMix(AXMVoice *mvoice, AXDeviceType type, uint32_t id, uint32_t bus, uint16_t vol, int16_t delta);
void AXSetMultiVoiceOffsets(AXMVoice *mvoice, AXVoiceOffsets *offsets);
void AXSetMultiVoiceCurrentOffset(AXMVoice *mvoice, uint32_t offset);
void AXSetMultiVoiceState(AXMVoice *mvoice, AXVoiceState state);
void AXSetMultiVoiceVe(AXMVoice *mvoice, AXVoiceVeData *veData);
void AXSetMultiVoiceSrcType(AXMVoice *mvoice, AXVoiceSrcType type);

View File

@ -149,6 +149,7 @@ IMPORT(AXRegisterFrameCallback);
IMPORT(AXAcquireMultiVoice);
IMPORT(AXSetMultiVoiceDeviceMix);
IMPORT(AXSetMultiVoiceOffsets);
IMPORT(AXSetMultiVoiceCurrentOffset);
IMPORT(AXSetMultiVoiceState);
IMPORT(AXSetMultiVoiceVe);
IMPORT(AXSetMultiVoiceSrcType);