Compare commits

..

2 Commits

Author SHA1 Message Date
Zach Bacon 793bfcef16
Merge 4589291199 into f46da1c525 2024-03-09 14:26:26 +00:00
Zach Bacon 4589291199 FAudio: Implement and have functional FAudio output
Corrected the current FAudio output code, FAudio api wasn't
a direct 1 for 1 code replacement. Adjusted the existing
code structure so that FAudioVoiceCallBack struct
was being properly called on.

Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
2024-03-09 09:26:16 -05:00
1 changed files with 41 additions and 39 deletions

View File

@ -191,15 +191,16 @@ public:
} f_notifier;
// Synchronization Event
namespace {
class FAudio_BufferNotify : public FAudioVoiceCallback {
public:
void *hBufferEndEvent;
FAudio_BufferNotify()
{
hBufferEndEvent = NULL;
hBufferEndEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
assert(hBufferEndEvent != NULL);
hBufferEndEvent = nullptr;
hBufferEndEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
assert(hBufferEndEvent != nullptr);
OnBufferEnd = &FAudio_BufferNotify::StaticOnBufferEnd;
OnVoiceProcessingPassStart = &FAudio_BufferNotify::StaticOnVoiceProcessingPassStart;
@ -230,6 +231,7 @@ public:
static void StaticOnLoopEnd(FAudioVoiceCallback* callback, void * pBufferContext) {}
static void StaticOnVoiceError(FAudioVoiceCallback* callback, void * pBufferContext, uint32_t Error) {}
};
}
// Class Declaration
class FAudio_Output
@ -252,7 +254,7 @@ public:
void device_change();
// Configuration Changes
void setThrottle(unsigned short throttle);
void setThrottle(unsigned short throttle_);
private:
bool failed;
@ -609,7 +611,7 @@ void FAudio_Output::setThrottle(unsigned short throttle_)
if (throttle_ == 0)
throttle_ = 100;
uint32_t hr = FAudioSourceVoice_SetFrequencyRatio(sVoice, (float)throttle_ / 100.0f, FAUDIO_MAX_FILTER_FREQUENCY);
uint32_t hr = FAudioSourceVoice_SetFrequencyRatio(sVoice, (float)throttle_ / 100.0f, FAUDIO_COMMIT_NOW);
assert(hr == 0);
}