Workflow merge (#79)

merge workflow_test into apt
This commit is contained in:
Paulchen-Panther
2023-11-13 19:53:56 +01:00
committed by GitHub
parent 1de37ceeff
commit 0359368451
138 changed files with 1664 additions and 2871 deletions

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioGrabber.h>
#include <grabber/audio/AudioGrabber.h>
#include <math.h>
#include <QImage>
#include <QObject>

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioGrabberLinux.h>
#include <grabber/audio/AudioGrabberLinux.h>
#include <alsa/asoundlib.h>

View File

@@ -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;
}

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioWrapper.h>
#include <grabber/audio/AudioWrapper.h>
#include <hyperion/GrabberWrapper.h>
#include <QObject>
#include <QMetaType>

View File

@@ -1,35 +1,38 @@
# Define the current source locations
SET( CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber )
SET( CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio )
if (WIN32)
add_definitions(-DUNICODE -D_UNICODE)
FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Windows.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Windows.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
elseif(${CMAKE_SYSTEM} MATCHES "Linux")
FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Linux.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Linux.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
elseif (APPLE)
#TODO
#FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Apple.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Apple.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
set(AUDIO_GRABBER_SOURCES
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberWindows.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberWindows.cpp
)
elseif(CMAKE_HOST_UNIX AND NOT APPLE)
set(AUDIO_GRABBER_SOURCES
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberLinux.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberLinux.cpp
)
endif()
add_library( audio-grabber ${AUDIO_GRABBER_SOURCES} )
add_library(audio-grabber
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioWrapper.cpp
${AUDIO_GRABBER_SOURCES}
)
set(AUDIO_LIBS hyperion)
if (WIN32)
set(AUDIO_LIBS ${AUDIO_LIBS} DSound)
elseif(${CMAKE_SYSTEM} MATCHES "Linux")
find_package(ALSA REQUIRED)
if (ALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS})
set(AUDIO_LIBS ${AUDIO_LIBS} ${ALSA_LIBRARIES})
endif(ALSA_FOUND)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(AUDIO_LIBS ${AUDIO_LIBS} Threads::Threads) # PRIVATE
if(WIN32)
set(AUDIO_LIBS DSound)
elseif(CMAKE_HOST_UNIX AND NOT APPLE)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(ALSA REQUIRED)
find_package(Threads REQUIRED)
set(AUDIO_LIBS ${ALSA_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(audio-grabber
hyperion
${AUDIO_LIBS}
)
target_link_libraries(audio-grabber ${AUDIO_LIBS} ${QT_LIBRARIES})
if(CMAKE_HOST_UNIX AND NOT APPLE)
target_include_directories(audio-grabber PUBLIC ${ALSA_INCLUDE_DIRS})
endif()