Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
67ed614
Check incremental C++ code health and add agent verification loop (#41)
dayfine Oct 24, 2026
0983576
Docs: note how upstream reviews, tests and vests contributors (Oct 20…
dayfine Oct 25, 2026
4e017f8
Merge remote-tracking branch 'upstream/main' into HEAD
dayfine Oct 27, 2026
e61ff41
Merge remote-tracking branch 'upstream/main' into HEAD
dayfine Oct 28, 2026
4995906
Merge remote-tracking branch 'upstream/main' into HEAD
dayfine Oct 28, 2026
fd9134c
Merge remote-tracking branch 'upstream/main' into HEAD
dayfine Oct 28, 2026
82c9079
Merge remote-tracking branch 'upstream/main' into HEAD
dayfine Oct 30, 2026
4aa1551
code_health: class-size and include-layering checks, base from upstre…
dayfine Oct 30, 2026
5231f03
Design: FireRed AutoStory pilot to Brock, reusable pieces in their fi…
dayfine Oct 30, 2026
eb619bd
Code health: report findings as GitHub Actions annotations (#74)
dayfine Oct 30, 2026
f6f658f
Lab control folder: start/stop the selected program from scripts (#76)
dayfine Oct 30, 2026
687bc48
Merge upstream/main into main
dayfine Oct 31, 2026
6715b24
Lab: set up lab/main, the base for lab builds (#92)
dayfine Oct 31, 2026
d5b1a30
Code health: skip nested and detail classes in the single-method inte…
dayfine Oct 31, 2026
25edc8e
Code health: lexical C++ style checks on added lines (#94)
dayfine Oct 31, 2026
0135d0e
code_health: match functions to their base by name, not by signature …
dayfine Oct 31, 2026
52fb02b
Merge origin/main into lab/main
dayfine Nov 1, 2026
0e737fb
Settings: default audio display and collapsed console settings (#99)
dayfine Nov 1, 2026
c9d9657
devtools/maps: decode map grids from the pret decompilation, overlay …
dayfine Nov 1, 2026
877cee4
Merge origin/main into lab/main (#83)
dayfine Nov 1, 2026
cd2a04a
Merge origin/main into lab/main (#104)
dayfine Nov 1, 2026
70cf475
Settings: default audio display and collapsed console settings (#99) …
dayfine Nov 1, 2026
322e754
Merge lab/tooling (#107) into lab/main
dayfine Nov 1, 2026
8d13713
Merge lab/tooling review fixes into lab/main
dayfine Nov 1, 2026
9fd401f
Merge upstream/main into main
dayfine Nov 1, 2026
a45c82b
Merge origin/main into lab/main
dayfine Nov 1, 2026
2f46423
Design: AutoStory architecture (#133)
dayfine Nov 2, 2026
e9c0a65
Design: the AutoStory demo plan and FRLG sizing, next to the architec…
dayfine Nov 2, 2026
ddbfe7f
Merge upstream/main into main
dayfine Nov 2, 2026
fed71d6
Merge origin/main into lab/main
dayfine Nov 2, 2026
20abe43
Code health: run the linter from the agents branch (#200)
dayfine Nov 3, 2026
04f6521
Replace the USE_QT_UI global with use_qt_ui()
dayfine Nov 3, 2026
e06d70e
Add SerialProgramsTests, a unit test runner without the GUI
dayfine Nov 3, 2026
41720ee
Merge upstream/main into main
dayfine Nov 3, 2026
c1f27b6
Merge origin/main into lab/main
dayfine Nov 3, 2026
ee20fdc
Merge origin/main into build/use-qt-ui-accessor
dayfine Nov 3, 2026
43edf27
Merge origin/build/use-qt-ui-accessor into build/headless-tests
dayfine Nov 3, 2026
ad6aa40
SerialProgramsTests: address review (span filters, namespaces, docs)
dayfine Nov 3, 2026
c213cac
Unit test runner: blank lines around unit_test_names()
dayfine Nov 3, 2026
6cf3cdb
Add SerialProgramsTests for running unit tests without the GUI
dayfine Nov 4, 2026
981c0ea
Merge upstream/main into main
dayfine Nov 4, 2026
d5d34b8
Use structured bindings for filtered unit test entries
dayfine Nov 4, 2026
0f9d232
Handle empty test selections before listing or running
dayfine Nov 4, 2026
006d547
Drop the --list option from SerialProgramsTests
dayfine Nov 4, 2026
9d7341b
Merge upstream/main into main
dayfine Nov 4, 2026
b9548df
Merge origin/main into lab/main
dayfine Nov 4, 2026
0910e0f
Merge origin/main into build/use-qt-ui-accessor
dayfine Nov 4, 2026
e8d97ba
Merge origin/build/use-qt-ui-accessor into build/headless-tests
dayfine Nov 4, 2026
32f9003
Lab: reject unsafe startup and isolate native test launches (#233)
dayfine Nov 6, 2026
2a69297
Merge upstream/main into main
dayfine Nov 6, 2026
f369bf0
Merge origin/main into lab/main
dayfine Nov 6, 2026
3a00943
Merge origin/main into build/use-qt-ui-accessor
dayfine Nov 6, 2026
f66d3c3
Merge origin/build/use-qt-ui-accessor into build/headless-tests
dayfine Nov 6, 2026
58af96a
Lab: seed isolated profiles and validate staged app identity (#236)
dayfine Nov 6, 2026
83dec64
Lab: enforce device ownership before hardware opens (#237)
dayfine Nov 6, 2026
61f361a
Remove unused Qt UI accessor from standalone test runner
dayfine Nov 7, 2026
1f0edf0
Merge upstream main and retain test runner alongside Python bindings
dayfine Nov 7, 2026
f5ed406
Merge origin/upstream/headless-tests (SerialProgramsTests) into lab/main
dayfine Nov 8, 2026
68ecbf8
Lab: merge lab/tooling into lab/main (lab commands start inference th…
dayfine Nov 8, 2026
036a05e
Lab devices: a refusal names the device it refused (#257)
dayfine Nov 8, 2026
356aa15
Merge build/headless-tests (#207) into lab/main
dayfine Nov 11, 2026
8da7692
docs: rework headless CC design against lab/main and address review
dayfine Nov 19, 2026
8fffda0
docs: address re-review (macOS scope, readiness, ownership, leases)
dayfine Nov 19, 2026
cd86fe3
Merge pull request #657 from dayfine/lab/headless-cc-design
dayfine Nov 19, 2026
d65712c
PanelCatalog: extract widget-free catalog and load_panel_session() (P…
dayfine Nov 19, 2026
a76e8ff
PanelCatalog: free functions instead of a catalog class (review)
dayfine Nov 19, 2026
ce1636d
docs: Headless-CC names the PanelCatalog free functions
dayfine Nov 19, 2026
87d8957
Merge pull request #660 from dayfine/lab/panel-catalog
dayfine Nov 19, 2026
3a76d5f
HeadlessHost: add --headless --run one-shot runner (PR 2)
dayfine Nov 19, 2026
fbed013
HeadlessHost: fix CoreLib placement, test types, and code-health checks
dayfine Nov 19, 2026
7b55ff0
code-health: split helpers and remove char*[] parameter
dayfine Nov 19, 2026
f52f606
code-health: pass QApplication& to run_headless_application
dayfine Nov 19, 2026
3312187
HeadlessHost: address PR #669 review (RAII SignalPipe, StartupDialogs…
dayfine Nov 19, 2026
9626443
code-health: move signal globals into function-local static and extra…
dayfine Nov 19, 2026
647bf18
HeadlessHost: implement download_added and all_downloads_done in Head…
dayfine Nov 19, 2026
a160a29
HeadlessHost: trim boilerplate in implementation and tests
dayfine Nov 19, 2026
084ad8c
Merge pull request #669 from dayfine/lab/headless-run
dayfine Nov 19, 2026
2806e45
Merge remote-tracking branch 'origin/lab/main' into lab/sync-main-to-…
dayfine Nov 19, 2026
5cc8572
HeadlessHost: pass ActionSource::CLI to start_program/stop_program
dayfine Nov 19, 2026
b539824
HeadlessHost: guard STOP_TIMEOUT under !defined(_WIN32)
dayfine Nov 19, 2026
76148ba
Merge remote-tracking branch 'origin/lab/tooling' into lab/sync-update
dayfine Nov 19, 2026
af0610f
CommandLineTests.h: match lab/main 1-arg run_command_line_tests decla…
dayfine Nov 19, 2026
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
53 changes: 53 additions & 0 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: C++ Code Health
# Stub: the linter (devtools/code_health) and its self-tests live on the fork's agents branch.
# This checks that branch out next to the code and runs it against the code checkout.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
base-ref:
description: Revision to compare with (e.g. origin/main); empty = whole tree
required: false

permissions:
contents: read

jobs:
code-health:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/checkout@v7
with:
repository: dayfine/Arduino-Source
ref: agents
path: .agents-tools
- uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: pip
cache-dependency-path: .agents-tools/devtools/code_health/requirements.txt
- run: python -m pip install -r .agents-tools/devtools/code_health/requirements.txt
- name: Linter self-tests
working-directory: .agents-tools
env:
CODE_HEALTH_REPO: ${{ github.workspace }}
run: python -m unittest discover -s devtools/code_health/tests -v
- name: Check changed C++ files
working-directory: .agents-tools
env:
PR_BASE: ${{ github.event.pull_request.base.sha }}
INPUT_BASE: ${{ inputs.base-ref }}
PUSH_BASE: ${{ github.event.before }}
CODE: ${{ github.workspace }}
shell: bash
run: |
base="${PR_BASE:-${INPUT_BASE:-$PUSH_BASE}}"
if [[ -z "$base" || "$base" == 0000000000000000000000000000000000000000 ]]; then
base=$(git -C "$CODE" hash-object -w -t tree --stdin </dev/null)
fi
python -m devtools.code_health --root "$CODE" --base-ref "$base" --github
27 changes: 24 additions & 3 deletions .github/workflows/cpp-ci-serial-programs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ jobs:
# The unit tests assume the downloadable resources they need are already downloaded
# (see Packages/Resources/ResourceDownloadList.json). Unzip them from the Packages
# checkout into where the program looks for them, DOWNLOADED_RESOURCE_PATH():
# the working directory on Windows/Linux, and ~/Library/Application Support/SerialPrograms
# on macOS.
# the working directory on Windows/Linux, and ~/Library/Application Support/SerialPrograms/Profiles/unit-tests
# on macOS (the isolated test profile).
- name: Install downloadable resources for tests
if: inputs.run-tests
shell: bash
run: |
if [[ "${{inputs.os}}" == mac* ]]; then
DOWNLOADED_RESOURCES="$HOME/Library/Application Support/SerialPrograms/DownloadedResources"
DOWNLOADED_RESOURCES="$HOME/Library/Application Support/SerialPrograms/Profiles/unit-tests/DownloadedResources"
else
DOWNLOADED_RESOURCES="Arduino-Source/SerialPrograms/bin/DownloadedResources"
fi
Expand Down Expand Up @@ -289,6 +289,27 @@ jobs:
cd Arduino-Source/SerialPrograms/bin
./SerialPrograms --command-line-test-mode

- name: Reject unsafe lab launches (Mac)
if: startsWith(inputs.os, 'mac') && inputs.run-tests
shell: bash
run: |
cd Arduino-Source/SerialPrograms/bin
binary=./SerialPrograms.app/Contents/MacOS/SerialPrograms
expect_rejection() {
local status=0
"$binary" "$@" || status=$?
if [[ "$status" != 2 ]]; then
echo "Expected startup rejection (2), read $status"
exit 1
fi
}
expect_rejection --test bdsp
expect_rejection --profile
expect_rejection --profile ../lab-A
expect_rejection --command-line-test-mode --profile lab-A
# CI's default build has no PA_LAB_PROFILE: unprofiled relaunch must fail.
expect_rejection

- name: Run tests (Mac)
if: startsWith(inputs.os, 'mac') && inputs.run-tests
run: |
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/lab-device-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lab device ownership
on:
pull_request:
workflow_dispatch:
jobs:
native-leases:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: jurplel/install-qt-action@v4
with:
version: '6.10.2'
cache: true
- run: cmake -S SerialPrograms/Source/CommonFramework/Devices -B build-lab-devices -DCMAKE_BUILD_TYPE=Debug
- run: cmake --build build-lab-devices --config Debug -j4
- run: ctest --test-dir build-lab-devices -C Debug --output-on-failure
21 changes: 21 additions & 0 deletions .github/workflows/lab-instance-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lab instance tools
on:
pull_request:
paths:
- 'devtools/lab/**'
- 'SerialPrograms/cmake/LabBuildReceipt.cmake'
- 'SerialPrograms/CMakeLists.txt'
- '.github/workflows/lab-instance-tools.yml'
workflow_dispatch:
jobs:
offline-preparation:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- run: python3 -m unittest discover -s devtools/lab -p 'test_lab_instance.py' -v
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ build_*/
.cache/*
Packages/*


# Local agent/linter environments.
.venv-code-health/
__pycache__/
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ migrate a file to the wrappers when you're already touching it and it's straight
Windows/Linux; `~/Library/Application Support/SerialPrograms/DownloadedResources` on macOS).
- Headless Linux: `QT_QPA_PLATFORM=offscreen` and
`TESSDATA_PREFIX=<bin>/Resources/Tesseract`.
- `SerialProgramsTests` (built by default next to `SerialPrograms`; `-DTEST_RUNNER_EXE=OFF`
turns it off) runs the same tests without the GUI, settings or device scans, so it can run
while SerialPrograms is open: `ninja SerialProgramsTests`, then
`SerialProgramsTests --filter <text>` (repeatable) or `--list`. Its exit code is the number
of failed tests. Same requirements as above.
- Test framework: test classes derive `UnitTest` (`Common/Cpp/TestRunners/UnitTest.h`) and are
collected via per-module `add_tests(UnitTestDatabase&)` — see
`SerialPrograms/Source/Tests/CommandLineTests.h`.
Expand Down
9 changes: 5 additions & 4 deletions Common/Cpp/Filesystem/Filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#ifndef PokemonAutomation_Filesystem_Filesystem_H
#define PokemonAutomation_Filesystem_Filesystem_H

#include <string_view>
#include <cstdint>
#include <vector>
#include "FilePath.h"
Expand Down Expand Up @@ -115,11 +116,11 @@ Path application_install_path();
Path application_scratch_path();


// Set a profile for program settings (/UserSettings/PROFILE_NAME/) on MacOS.
// Have to run the program with command-line argument "open -n PATH_TO_APP --args --profile PROFILE_NAME" to set the profile and launch a new window.
// This allows multiple instances of the program to run since settings are no longer shared.
#if defined(__APPLE__)
void set_startup_profile(int& argc, char* argv[]);
// Set a validated macOS settings profile before any settings paths are cached.
// GUI launch uses --profile NAME or the build-bound PA_LAB_PROFILE identity.
void set_startup_profile(std::string_view profile);
// Return the identity used for the window title and scratch directory.
const std::string& STARTUP_PROFILE();
#endif

Expand Down
19 changes: 3 additions & 16 deletions Common/Cpp/Filesystem/Filesystem_Mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,9 @@ namespace Filesystem{

static std::string g_startup_profile;

void set_startup_profile(int& argc, char* argv[]){
for (int i = 1; i + 1 < argc; i++){
if (strcmp(argv[i], "--profile") == 0){
std::string profile = argv[i + 1];
for (char c : profile){
if (!(std::isalpha(c) || std::isdigit(c)) && c != u'_' && c != u'-') c = u'_';
}
g_startup_profile = std::move(profile);
// Shift everything after --profile <name> down by 2.
for (int j = i; j + 2 < argc; j++){
argv[j] = argv[j + 2];
}
argc -= 2;
return;
}
}
// Store the already-validated identity before any scratch/settings path is cached.
void set_startup_profile(std::string_view profile){
g_startup_profile = profile;
}

const std::string& STARTUP_PROFILE(){
Expand Down
36 changes: 36 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ find_package(Threads REQUIRED)
# Define a toggle option (ON by default)
option(COMMAND_LINE_EXE "Build the optional executable" ON)

# Build SerialProgramsTests, which runs the unit tests without the GUI.
option(TEST_RUNNER_EXE "Build the unit test executable, SerialProgramsTests" ON)
# Build the _pa_core Python (pybind11) module; see Source/PythonBindings/README.md.
# OFF by default because it needs a Python interpreter with development headers
# and pybind11 (a system package or `pip install pybind11`).
Expand Down Expand Up @@ -236,6 +238,27 @@ if (APPLE)
# https://stackoverflow.com/questions/53560288/how-to-create-a-macos-app-bundle-with-cmake
# https://cmake.org/cmake/help/latest/command/add_executable.html
add_executable(SerialPrograms MACOSX_BUNDLE ${SerialPrograms_ICON} ${EXECUTABLE_SOURCES})
# Compiled identity survives Finder/TCC relaunch without command-line arguments.
set(PA_LAB_PROFILE "" CACHE STRING "Bind this lab binary to one macOS settings profile")
if(NOT PA_LAB_PROFILE STREQUAL "")
if(NOT PA_LAB_PROFILE MATCHES "^[A-Za-z0-9_][A-Za-z0-9_-]*$")
message(FATAL_ERROR "PA_LAB_PROFILE must contain only ASCII letters, digits, '_' or '-'.")
endif()
target_compile_definitions(SerialPrograms PRIVATE PA_LAB_PROFILE="${PA_LAB_PROFILE}")
endif()

# Receipt binds packaging to the linked binary, not just a CMake cache value.
set_property(TARGET SerialPrograms APPEND PROPERTY LINK_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/LabBuildReceipt.cmake")
add_custom_command(TARGET SerialPrograms POST_BUILD
COMMAND "${CMAKE_COMMAND}"
"-DBINARY=$<TARGET_FILE:SerialPrograms>"
"-DPROFILE=${PA_LAB_PROFILE}"
"-DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/.."
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/LabBuildReceipt.cmake"
VERBATIM
)

set_target_properties(SerialPrograms PROPERTIES
BUNDLE True
MACOSX_BUNDLE_GUI_IDENTIFIER PokemonAutomation.SerialPrograms
Expand Down Expand Up @@ -368,6 +391,10 @@ if(NOT EXISTS "${DEST_DIR}/Scripts")
)
endif()

if(TEST_RUNNER_EXE)
include(Source/Tests/TestRunnerExecutable.cmake)
endif()

if (WIN32)
if (PA_SDL)
add_library(SDL3_lib IMPORTED UNKNOWN)
Expand Down Expand Up @@ -944,6 +971,15 @@ if(COMMAND_LINE_EXE)
include(Source/CommandLine/CommandLineExecutable.cmake)
endif()

# The registered cross-process tests use this GUI-free native runner as their child.
add_subdirectory(Source/CommonFramework/Devices)
if(WIN32)
set_target_properties(LabDeviceAccessTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${WIN_DEPLOY_DIR}")
else()
set_target_properties(LabDeviceAccessTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:SerialPrograms>")
endif()
add_dependencies(SerialPrograms LabDeviceAccessTests)

if(PA_PYTHON_BINDINGS)
# Python bindings (GUI-free) from subdirectory
include(Source/PythonBindings/PythonBindings.cmake)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "Sources/AudioSource_File.h"
#include "Sources/AudioSource_Device.h"
#include "AudioOption.h"
#include "AudioPipelineOptions.h"
#include "CommonFramework/GlobalSettingsPanel.h"

//#include <iostream>
//using std::cout;
Expand Down Expand Up @@ -55,6 +57,7 @@ std::string AudioOption::audioDisplayTypeToString(AudioOption::AudioDisplayType

AudioOption::AudioOption()
: m_input_source(new AudioSourceDescriptor_Null())
, m_display_type(GlobalSettings::instance().AUDIO_PIPELINE->DEFAULT_DISPLAY)
{}

void AudioOption::set_input(std::shared_ptr<AudioSourceDescriptor> descriptor){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class AudioOption{

AudioInputChoice m_input_choice;
AudioDeviceInfo m_output_device;
AudioDisplayType m_display_type = AudioDisplayType::FREQ_BARS;
AudioDisplayType m_display_type; // the global default until load_json() sets one
double m_volume = 1.0; // Volume Range: [0, 1.0]
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
#include "Common/Cpp/Options/SimpleIntegerOption.h"
#include "Common/Cpp/Options/FloatingPointOption.h"
#include "Common/Cpp/Options/EnumDropdownOption.h"
#include "CommonFramework/AudioPipeline/AudioOption.h"
#include "CommonFramework/StaticGlobals.h"

namespace PokemonAutomation{
Expand All @@ -18,7 +20,7 @@

class AudioPipelineOptions : public GroupOption{
public:
AudioPipelineOptions()

Check failure on line 23 in SerialPrograms/Source/CommonFramework/AudioPipeline/AudioPipelineOptions.h

View workflow job for this annotation

GitHub Actions / code-health

Code health

PokemonAutomation::AudioPipelineOptions::AudioPipelineOptions(): function_lines=60, limit=50, allowed 50
: GroupOption(
"Audio Pipeline",
LockMode::LOCK_WHILE_RUNNING,
Expand All @@ -26,6 +28,17 @@
true,
false
)
, DEFAULT_DISPLAY(
"<b>Default Audio Display:</b><br>"
"What a program's console shows for its audio until you pick a display in that console's settings.",
{
{AudioOption::AudioDisplayType::NO_DISPLAY, "none", "No Display"},
{AudioOption::AudioDisplayType::FREQ_BARS, "freq-bars", "Frequency Bars"},
{AudioOption::AudioDisplayType::SPECTROGRAM, "spectrogram", "Spectrogram"},
},
LockMode::UNLOCK_WHILE_RUNNING,
AudioOption::AudioDisplayType::FREQ_BARS
)
, FILE_VOLUME_SCALE(
"<b>Audio File Input Volume Scale:</b><br>"
"Multiply audio file playback by this factor. (This is linear scale. So each factor of 10 is 20dB.)",
Expand Down Expand Up @@ -58,6 +71,7 @@
5
)
{
PA_ADD_OPTION(DEFAULT_DISPLAY);
PA_ADD_OPTION(FILE_VOLUME_SCALE);
PA_ADD_OPTION(DEVICE_VOLUME_SCALE);
PA_ADD_OPTION(USE_KAISER_WINDOW);
Expand All @@ -68,6 +82,7 @@
}

public:
EnumDropdownOption<AudioOption::AudioDisplayType> DEFAULT_DISPLAY;
FloatingPointOption FILE_VOLUME_SCALE;
FloatingPointOption DEVICE_VOLUME_SCALE;
BooleanCheckBoxOption USE_KAISER_WINDOW;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Audio Passthrough Pair (Qt)

Check warning on line 1 in SerialPrograms/Source/CommonFramework/AudioPipeline/Backends/AudioPassthroughPairQt.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=566 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -397,7 +397,7 @@
: m_logger(logger)
{}

void AudioPassthroughPairQt::reset(

Check warning on line 400 in SerialPrograms/Source/CommonFramework/AudioPipeline/Backends/AudioPassthroughPairQt.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::AudioPassthroughPairQt::reset( const std :: shared_ptr<AudioSourceDescriptor> & descriptor , const AudioInputChoice & format , const AudioDeviceInfo & output , double output_volume): function_lines=26 (advisory above 25, limit 50)
const std::shared_ptr<AudioSourceDescriptor>& descriptor,
const AudioInputChoice& format,
const AudioDeviceInfo& output,
Expand All @@ -406,16 +406,12 @@
auto scope_check = m_sanitizer.check_scope();
QMetaObject::invokeMethod(this, [this, format, descriptor, output, output_volume]{
auto scope_check = m_sanitizer.check_scope();
close_audio_source();
std::unique_ptr<AudioSource> source;
if (descriptor){
source = descriptor->make_AudioSource(m_logger, format);
}
WriteSpinLock lg(m_lock, PA_CURRENT_FUNCTION);
if (m_reader){
teardown_tree();
m_sink_device.reset();
m_reader.reset();
}
m_input_choice = format;
m_output_device = output;
m_output_volume = output_volume;
Expand All @@ -427,6 +423,15 @@
}
});
}
// Called on this object's Qt thread before constructing a replacement input.
void AudioPassthroughPairQt::close_audio_source(){
WriteSpinLock lg(m_lock, PA_CURRENT_FUNCTION);
if (m_reader){
teardown_tree();
m_sink_device.reset();
m_reader.reset();
}
}
void AudioPassthroughPairQt::clear_audio_source(){
auto scope_check = m_sanitizer.check_scope();
QMetaObject::invokeMethod(this, [this]{
Expand All @@ -447,16 +452,12 @@
auto scope_check = m_sanitizer.check_scope();
QMetaObject::invokeMethod(this, [this, descriptor, format]{
auto scope_check = m_sanitizer.check_scope();
close_audio_source();
std::unique_ptr<AudioSource> source;
if (descriptor){
source = descriptor->make_AudioSource(m_logger, format);
}
WriteSpinLock lg(m_lock, PA_CURRENT_FUNCTION);
if (m_reader){
teardown_tree();
m_sink_device.reset();
m_reader.reset();
}
m_input_choice = format;
if (source){
m_reader = std::move(source);
Expand Down
Loading
Loading