FAudio: Had to pass function pointers from the struct FAudioVoiceCallBack
In Short, audio works. Just gotta deal with the windows event system pthreads might have what I need, winpthreads can even be used on windows Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
This commit is contained in:
parent
56056f1e9d
commit
d458f0f29e
|
@ -155,6 +155,13 @@ public:
|
||||||
hBufferEndEvent = NULL;
|
hBufferEndEvent = NULL;
|
||||||
//I'm still figuring out how to deal with pthreads, so I'm going to leave this empty for now.
|
//I'm still figuring out how to deal with pthreads, so I'm going to leave this empty for now.
|
||||||
//hBufferEndEvent = pthread_cond_init();
|
//hBufferEndEvent = pthread_cond_init();
|
||||||
|
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
|
||||||
|
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
|
||||||
|
OnVoiceProcessingPassEnd = &FAudio_BufferNotify::StaticOnVoiceProcessingPassEnd;
|
||||||
|
OnStreamEnd = &FAudio_BufferNotify::StaticOnStreamEnd;
|
||||||
|
OnBufferStart = &FAudio_BufferNotify::StaticOnBufferStart;
|
||||||
|
OnLoopEnd = &FAudio_BufferNotify::StaticOnLoopEnd;
|
||||||
|
OnVoiceError = &FAudio_BufferNotify::StaticOnVoiceError;
|
||||||
}
|
}
|
||||||
~FAudio_BufferNotify()
|
~FAudio_BufferNotify()
|
||||||
{
|
{
|
||||||
|
@ -162,16 +169,20 @@ public:
|
||||||
//pthread_cond_destroy(hBufferEndEvent);
|
//pthread_cond_destroy(hBufferEndEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnBufferEnd(void* pBufferContext)
|
|
||||||
{
|
static void StaticOnBufferEnd(FAudioVoiceCallback* callback, void * pBufferContext) {
|
||||||
|
FAudio_BufferNotify* self = static_cast<FAudio_BufferNotify*>(callback);
|
||||||
|
if (self != nullptr && self->hBufferEndEvent != NULL)
|
||||||
|
{
|
||||||
|
SetEvent(self->hBufferEndEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void OnVoiceProcessingPassStart(uint32_t BytesRequired) {}
|
static void StaticOnVoiceProcessingPassStart(FAudioVoiceCallback* callback, uint32_t BytesRequired) {}
|
||||||
void OnVoiceProcessingPassEnd() {}
|
static void StaticOnVoiceProcessingPassEnd(FAudioVoiceCallback* callback) {}
|
||||||
void OnStreamEnd() {}
|
static void StaticOnStreamEnd(FAudioVoiceCallback* callback) {}
|
||||||
void OnBufferStart(void* pBufferContext) {}
|
static void StaticOnBufferStart(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||||
void OnLoopEnd(void* pBufferContext) {}
|
static void StaticOnLoopEnd(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||||
void OnVoiceError(void* pBufferContext, uint32_t Error) {}
|
static void StaticOnVoiceError(FAudioVoiceCallback* callback, void * pBufferContext, uint32_t Error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Class Declaration
|
// Class Declaration
|
||||||
|
@ -329,7 +340,7 @@ bool FAudio_Output::init(long sampleRate)
|
||||||
// create sound emitter
|
// create sound emitter
|
||||||
//This should be FAudio_CreateSourceVoice()
|
//This should be FAudio_CreateSourceVoice()
|
||||||
//hr = faud->CreateSourceVoice(&sVoice, &wfx, 0, 4.0f, ¬ify);
|
//hr = faud->CreateSourceVoice(&sVoice, &wfx, 0, 4.0f, ¬ify);
|
||||||
hr = FAudio_CreateSourceVoice(faud, &sVoice, &wfx, 0, 4.0f, ¬ify);
|
hr = FAudio_CreateSourceVoice(faud, &sVoice, &wfx, 0, 4.0f, ¬ify, NULL, NULL);
|
||||||
|
|
||||||
if (hr != 0) {
|
if (hr != 0) {
|
||||||
wxLogError(_("FAudio: Creating source voice failed!"));
|
wxLogError(_("FAudio: Creating source voice failed!"));
|
||||||
|
@ -482,7 +493,7 @@ void FAudio_Output::write(uint16_t* finalWave, int length)
|
||||||
|
|
||||||
// there is at least one free buffer
|
// there is at least one free buffer
|
||||||
break;
|
break;
|
||||||
} //else {
|
} else {
|
||||||
// the maximum number of buffers is currently queued
|
// the maximum number of buffers is currently queued
|
||||||
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
if (!coreOptions.speedup && coreOptions.throttle && !gba_joybus_active) {
|
||||||
// wait for one buffer to finish playing
|
// wait for one buffer to finish playing
|
||||||
|
|
Loading…
Reference in New Issue