mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor/Create APT/DNF Repository (#1648)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include <grabber/AudioGrabberWindows.h>
|
||||
#include <grabber/audio/AudioGrabberWindows.h>
|
||||
|
||||
#include <climits>
|
||||
|
||||
@@ -71,7 +71,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
|
||||
notificationSize -= notificationSize % audioFormat.nBlockAlign;
|
||||
|
||||
bufferCaptureSize = notificationSize * AUDIO_NOTIFICATION_COUNT;
|
||||
|
||||
|
||||
DSCBUFFERDESC bufferDesc;
|
||||
bufferDesc.dwSize = sizeof(DSCBUFFERDESC);
|
||||
bufferDesc.dwFlags = 0;
|
||||
@@ -80,7 +80,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
|
||||
bufferDesc.lpwfxFormat = &audioFormat;
|
||||
bufferDesc.dwFXCount = 0;
|
||||
bufferDesc.lpDSCFXDesc = NULL;
|
||||
|
||||
|
||||
// Create Capture Device's Buffer
|
||||
LPDIRECTSOUNDCAPTUREBUFFER preBuffer;
|
||||
if (FAILED(recordingDevice->CreateCaptureBuffer(&bufferDesc, &preBuffer, NULL)))
|
||||
@@ -101,7 +101,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
|
||||
}
|
||||
|
||||
preBuffer->Release();
|
||||
|
||||
|
||||
// Create Notifications
|
||||
LPDIRECTSOUNDNOTIFY8 notify;
|
||||
|
||||
@@ -112,7 +112,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
|
||||
recordingBuffer->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create Events
|
||||
notificationEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
@@ -133,11 +133,11 @@ bool AudioGrabberWindows::configureCaptureInterface()
|
||||
positionNotify[i].dwOffset = (notificationSize * i) + notificationSize - 1;
|
||||
positionNotify[i].hEventNotify = notificationEvent;
|
||||
}
|
||||
|
||||
|
||||
// Set Notifications
|
||||
notify->SetNotificationPositions(AUDIO_NOTIFICATION_COUNT, positionNotify);
|
||||
notify->Release();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -162,12 +162,12 @@ bool AudioGrabberWindows::start()
|
||||
}
|
||||
|
||||
Info(_log, "Capture audio from %s", QSTRING_CSTR(getDeviceName(_device)));
|
||||
|
||||
|
||||
if (!this->configureCaptureInterface())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(recordingBuffer->Start(DSCBSTART_LOOPING)))
|
||||
{
|
||||
Error(_log, "Failed starting audio capture from '%s'", QSTRING_CSTR(getDeviceName(_device)));
|
||||
@@ -214,7 +214,7 @@ void AudioGrabberWindows::stop()
|
||||
{
|
||||
Error(_log, "Audio capture failed to stop: '%s'", QSTRING_CSTR(getDeviceName(_device)));
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(recordingBuffer->Release()))
|
||||
{
|
||||
Error(_log, "Failed to release recording buffer: '%s'", QSTRING_CSTR(getDeviceName(_device)));
|
||||
@@ -306,7 +306,7 @@ void AudioGrabberWindows::processAudioBuffer()
|
||||
|
||||
// Buffer wrapped around, read second position
|
||||
if (capturedAudio2 != NULL)
|
||||
{
|
||||
{
|
||||
bufferCapturePosition += capturedAudio2Length;
|
||||
bufferCapturePosition %= bufferCaptureSize; // Circular Buffer
|
||||
}
|
||||
@@ -318,13 +318,13 @@ void AudioGrabberWindows::processAudioBuffer()
|
||||
{
|
||||
CopyMemory(readBuffer + capturedAudioLength, capturedAudio2, capturedAudio2Length);
|
||||
}
|
||||
|
||||
|
||||
// Release Buffer Lock
|
||||
recordingBuffer->Unlock(capturedAudio, capturedAudioLength, capturedAudio2, capturedAudio2Length);
|
||||
|
||||
|
||||
// Process Audio Frame
|
||||
this->processAudioFrame(readBuffer, frameSize);
|
||||
|
||||
|
||||
delete[] readBuffer;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user