Compare commits
2 Commits
67bbb1e1b8
...
793bfcef16
Author | SHA1 | Date |
---|---|---|
![]() |
793bfcef16 | |
![]() |
4589291199 |
|
@ -191,46 +191,48 @@ public:
|
|||
} f_notifier;
|
||||
|
||||
// Synchronization Event
|
||||
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
||||
public:
|
||||
void *hBufferEndEvent;
|
||||
namespace {
|
||||
class FAudio_BufferNotify : public FAudioVoiceCallback {
|
||||
public:
|
||||
void *hBufferEndEvent;
|
||||
|
||||
FAudio_BufferNotify()
|
||||
{
|
||||
hBufferEndEvent = NULL;
|
||||
hBufferEndEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
assert(hBufferEndEvent != NULL);
|
||||
|
||||
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()
|
||||
{
|
||||
CloseHandle(hBufferEndEvent);
|
||||
hBufferEndEvent = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void StaticOnBufferEnd(FAudioVoiceCallback* callback, void * pBufferContext) {
|
||||
FAudio_BufferNotify* self = static_cast<FAudio_BufferNotify*>(callback);
|
||||
if (self != nullptr && self->hBufferEndEvent != NULL)
|
||||
FAudio_BufferNotify()
|
||||
{
|
||||
SetEvent(self->hBufferEndEvent);
|
||||
hBufferEndEvent = nullptr;
|
||||
hBufferEndEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||
assert(hBufferEndEvent != nullptr);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
static void StaticOnVoiceProcessingPassStart(FAudioVoiceCallback* callback, uint32_t BytesRequired) {}
|
||||
static void StaticOnVoiceProcessingPassEnd(FAudioVoiceCallback* callback) {}
|
||||
static void StaticOnStreamEnd(FAudioVoiceCallback* callback) {}
|
||||
static void StaticOnBufferStart(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||
static void StaticOnLoopEnd(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||
static void StaticOnVoiceError(FAudioVoiceCallback* callback, void * pBufferContext, uint32_t Error) {}
|
||||
};
|
||||
|
||||
~FAudio_BufferNotify()
|
||||
{
|
||||
CloseHandle(hBufferEndEvent);
|
||||
hBufferEndEvent = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void StaticOnBufferEnd(FAudioVoiceCallback* callback, void * pBufferContext) {
|
||||
FAudio_BufferNotify* self = static_cast<FAudio_BufferNotify*>(callback);
|
||||
if (self != nullptr && self->hBufferEndEvent != NULL)
|
||||
{
|
||||
SetEvent(self->hBufferEndEvent);
|
||||
}
|
||||
}
|
||||
static void StaticOnVoiceProcessingPassStart(FAudioVoiceCallback* callback, uint32_t BytesRequired) {}
|
||||
static void StaticOnVoiceProcessingPassEnd(FAudioVoiceCallback* callback) {}
|
||||
static void StaticOnStreamEnd(FAudioVoiceCallback* callback) {}
|
||||
static void StaticOnBufferStart(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||
static void StaticOnLoopEnd(FAudioVoiceCallback* callback, void * pBufferContext) {}
|
||||
static void StaticOnVoiceError(FAudioVoiceCallback* callback, void * pBufferContext, uint32_t Error) {}
|
||||
};
|
||||
}
|
||||
|
||||
// Class Declaration
|
||||
class FAudio_Output
|
||||
: public SoundDriver {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue