Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 86 additions & 26 deletions .github/workflows/buildcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: Install Build Dependencies
run: |
sudo apt update
Expand Down Expand Up @@ -64,42 +63,100 @@ jobs:
cmake --build cmake-build-libprojectm --parallel
cmake --install "${{ github.workspace }}/cmake-build-libprojectm"

- name: Checkout frontend-sdl2 Sources
- name: Checkout frontend-sdl-cpp Sources
uses: actions/checkout@v6
with:
path: frontend-sdl2
path: frontend-sdl-cpp
submodules: recursive

- name: Build frontend-sdl2
- name: Build frontend-sdl-cpp
env:
CMAKE_PREFIX_PATH: "${{ github.workspace }}/install-libprojectm;${{ github.workspace }}/install-poco"
run: |
mkdir cmake-build-frontend-sdl2
cmake -G Ninja -S frontend-sdl2 -B cmake-build-frontend-sdl2 \
mkdir cmake-build-frontend
cmake -G Ninja -S frontend-sdl-cpp -B cmake-build-frontend \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install-libprojectm;${GITHUB_WORKSPACE}/install-poco" \
"-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-frontend-sdl2"
cmake --build cmake-build-frontend-sdl2 --parallel
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" \
"-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-frontend" \
-DUSE_SDL=SDL2
cmake --build cmake-build-frontend --parallel

- name: Package projectMSDL
run: |
cd cmake-build-frontend-sdl2
cd cmake-build-frontend
cpack -G DEB

- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: projectMSDL-buildcheck-linux
path: cmake-build-frontend-sdl2/*.deb
path: cmake-build-frontend/*.deb

build-arch:
name: Arch Linux, x86_64
runs-on: ubuntu-latest
container: archlinux:latest

steps:
- name: Install Build Dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm base-devel cmake ninja git poco glew freetype2 sdl2

- name: Checkout libprojectM Sources
uses: actions/checkout@v6
with:
repository: projectM-visualizer/projectm
path: projectm
submodules: recursive

- name: Build/Install libprojectM
run: |
mkdir cmake-build-libprojectm
cmake -G Ninja -S projectm -B cmake-build-libprojectm \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-libprojectm
cmake --build cmake-build-libprojectm --parallel
cmake --install cmake-build-libprojectm || \
cmake --build cmake-build-libprojectm --target install || true

- name: Checkout frontend-sdl-cpp Sources
uses: actions/checkout@v6
with:
path: frontend-sdl-cpp
submodules: recursive

- name: Build frontend-sdl-cpp
run: |
mkdir cmake-build-frontend
cmake -G Ninja -S frontend-sdl-cpp -B cmake-build-frontend \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install-libprojectm" \
"-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-frontend" \
-DUSE_SDL=SDL2
cmake --build cmake-build-frontend --parallel

- name: Package projectMSDL
run: |
cd cmake-build-frontend
cpack -G TGZ

- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: projectMSDL-buildcheck-arch
path: cmake-build-frontend/*.tar.gz

build-windows:
name: Windows, x64
runs-on: windows-latest
runs-on: windows-2022
env:
USERNAME: projectM-visualizer
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite"


steps:
- name: Checkout vcpkg
uses: actions/checkout@v6
Expand Down Expand Up @@ -143,33 +200,34 @@ jobs:
- name: Checkout projectMSDL Sources
uses: actions/checkout@v6
with:
path: frontend-sdl2
path: frontend-sdl-cpp
submodules: recursive

- name: Build projectMSDL
run: |
mkdir cmake-build-frontend-sdl2
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES
cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel --config Release
mkdir cmake-build-frontend
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/frontend-sdl-cpp" -B "${{ github.workspace }}/cmake-build-frontend" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL_LINKAGE=static -DBUILD_TESTING=YES -DUSE_SDL=SDL2
cmake --build "${{ github.workspace }}/cmake-build-frontend" --parallel --config Release

- name: Package projectMSDL
run: |
cd cmake-build-frontend-sdl2
cd cmake-build-frontend
cpack -G ZIP

- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: projectMSDL-buildcheck-windows
path: cmake-build-frontend-sdl2/*.zip
path: cmake-build-frontend/*.zip

build-darwin:
name: macOS, x86_64
runs-on: macos-latest

steps:
- name: Install Build Dependencies
run: brew install sdl2 ninja googletest poco
run: |
brew install sdl2 ninja googletest poco

- name: Checkout libprojectM Sources
uses: actions/checkout@v6
Expand All @@ -188,22 +246,24 @@ jobs:
- name: Checkout projectMSDL Sources
uses: actions/checkout@v6
with:
path: frontend-sdl2
path: frontend-sdl-cpp
submodules: recursive

- name: Build projectMSDL
env:
CMAKE_PREFIX_PATH: "${{ github.workspace }}/install-libprojectm"
run: |
mkdir cmake-build-frontend-sdl2
cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2"
cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel
mkdir cmake-build-frontend
cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl-cpp" -B "${{ github.workspace }}/cmake-build-frontend" -DCMAKE_BUILD_TYPE=Release "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend" -DUSE_SDL=SDL2
cmake --build "${{ github.workspace }}/cmake-build-frontend" --parallel

- name: Package projectMSDL
run: |
cd cmake-build-frontend-sdl2
cd cmake-build-frontend
cpack -G TGZ

- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: projectMSDL-buildcheck-macos
path: cmake-build-frontend-sdl2/*.tar.gz
path: cmake-build-frontend/*.tar.gz
9 changes: 9 additions & 0 deletions src/AudioCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ void AudioCapture::FillBuffer()
_impl->FillBuffer();
}

float AudioCapture::CurrentAudioLevel() const
{
if (!_impl)
{
return -1.0f;
}
return _impl->CurrentAudioLevel();
}

void AudioCapture::PrintDeviceList(const AudioDeviceMap& deviceList) const
{
if (_config->getBool("listDevices", false))
Expand Down
6 changes: 6 additions & 0 deletions src/AudioCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class AudioCapture : public Poco::Util::Subsystem
*/
void FillBuffer();

/**
* @brief Returns the current audio peak level (0.0-1.0) for display.
* @return The current audio level, or -1.0 if not available.
*/
float CurrentAudioLevel() const;

protected:
/**
* @brief Prints a list of available audio devices on standard output if requested by the user.
Expand Down
5 changes: 5 additions & 0 deletions src/AudioCaptureImpl_SDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,8 @@ void AudioCaptureImpl::AudioInputCallback(void* userData, unsigned char* stream,
projectm_pcm_add_float(instance->_projectMHandle, reinterpret_cast<float*>(stream), samples,
static_cast<projectm_channels>(instance->_channels));
}

float AudioCaptureImpl::CurrentAudioLevel() const
{
return -1.0f;
}
10 changes: 6 additions & 4 deletions src/AudioCaptureImpl_SDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ class AudioCaptureImpl

/**
* @brief Asks the capture client to fill projectM's audio buffer for the next frame.
*
* As of now, SDL uses async callbacks to directly fill projectM's audio buffer.
*
* @todo Store audio samples internally and push them to projectM when requested.
*/
void FillBuffer(){};

/**
* @brief Returns the current audio peak level.
* @return A value between 0.0 and 1.0, or -1.0 if not available.
*/
float CurrentAudioLevel() const;

protected:
/**
* @brief Opens the SDL audio device with the currently selected index.
Expand Down
5 changes: 5 additions & 0 deletions src/AudioCaptureImpl_WASAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ void AudioCaptureImpl::FillBuffer()
}
}

float AudioCaptureImpl::CurrentAudioLevel() const
{
return -1.0f;
}

HRESULT AudioCaptureImpl::QueryInterface(const IID& riid, void** ppvObject)
{
if (ppvObject == nullptr)
Expand Down
6 changes: 6 additions & 0 deletions src/AudioCaptureImpl_WASAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ class AudioCaptureImpl : public IMMNotificationClient
*/
void FillBuffer();

/**
* @brief Returns the current audio peak level.
* @return A value between 0.0 and 1.0, or -1.0 if not available.
*/
float CurrentAudioLevel() const;

/**
* @brief Converts a widechar/unicode string to a UTF-8-encoded string
* @param unicodeString A pointer to a widechar string
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ add_executable(projectMSDL WIN32 MACOSX_BUNDLE
AudioCapture.h
FPSLimiter.cpp
FPSLimiter.h
PlaylistManager.cpp
PlaylistManager.h
PresetRatings.cpp
PresetRatings.h
ProjectMSDLApplication.cpp
ProjectMSDLApplication.h
ProjectMWrapper.cpp
Expand Down
Loading