Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to verify lack of sync loss in RX #761

Merged
merged 152 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
7da22fc
Add logic for automatically running RX/TX tests.
tmiw Oct 23, 2024
849d8ca
Add GH action to load loopback audio driver.
tmiw Oct 23, 2024
e2ac90c
Add ctest configuration file.
tmiw Oct 23, 2024
347116e
Try loading modules after installing packages.
tmiw Oct 23, 2024
d72ad6c
Add additional required packages.
tmiw Oct 23, 2024
58348c0
Add automated test script.
tmiw Oct 23, 2024
a5abc0f
Temporarily disable GH action changes.
tmiw Oct 23, 2024
5069641
Have RX take 60 seconds as well.
tmiw Oct 23, 2024
522285d
Merge branch 'ms-test-for-zeros' of github.com:drowe67/freedv-gui int…
tmiw Oct 23, 2024
410ecdb
Ubuntu upgrade broke /bin/sh.
tmiw Oct 24, 2024
4b8dfb8
Fix issue preventing no zero message from printing.
tmiw Oct 24, 2024
856913e
Print sync status once per second and validate no resyncs.
tmiw Oct 28, 2024
f9ee273
Fix spelling error.
tmiw Oct 28, 2024
18f559a
Merge branch 'v2.0-dev' into ms-test-for-zeros
tmiw Oct 28, 2024
8d06412
Switch to RADE main.
tmiw Oct 29, 2024
ee67d99
Another attempt at enabling aloop in the GH action.
tmiw Oct 29, 2024
b34a984
Use _ instead of - for module name.
tmiw Oct 30, 2024
8555bdb
Use pacmd to create virtual sound devices instead.
tmiw Nov 3, 2024
2d0af04
Check sync state every 100ms instead of every 1s.
tmiw Nov 3, 2024
527ab91
Fix issue preventing sync changes from making it to the log.
tmiw Nov 3, 2024
e5f8cb8
Add full duplex test.
tmiw Nov 3, 2024
1575015
Add full duplex tests to CMakeLists.
tmiw Nov 3, 2024
8e187ac
Generate sine wave for TX.
tmiw Nov 3, 2024
f6ae1c0
Update GH action to allow new ctests to run.
tmiw Nov 3, 2024
b2d574f
Add debugging for UT.
tmiw Nov 3, 2024
65a985d
pipewire-pulse is needed to actually use PipeWire.
tmiw Nov 3, 2024
c12ae81
Install suggested packages to get additional required commands.
tmiw Nov 3, 2024
d199b6e
Can't use --install-suggests, so explicitly mention packages.
tmiw Nov 3, 2024
aecfddb
Enable pipewire service.
tmiw Nov 3, 2024
a3e0a2b
Fix call to helper Python script.
tmiw Nov 3, 2024
5b0d473
Show status of pipewire prior to running tests.
tmiw Nov 3, 2024
a5e9375
Remove status display from GH action.
tmiw Nov 3, 2024
a570d4c
Use module-loopback to simulate TX plugged into RX.
tmiw Nov 3, 2024
6f9e6e1
Try explicitly starting pipewire.
tmiw Nov 3, 2024
936944a
Use strict 20ms cadence for TX/RX thread instead of relying on the au…
tmiw Nov 3, 2024
817f5b9
Need to install wireplumber as well.
tmiw Nov 3, 2024
89e9cff
Update regular expression in ctest as sync change message isn't print…
tmiw Nov 3, 2024
f23d668
Add RADE to ctests.
tmiw Nov 3, 2024
307ce01
RADE ctest pass wasn't actually a pass.
tmiw Nov 3, 2024
8a5a185
Need to explicitly check for LINUX for PulseAudio based ctests.
tmiw Nov 3, 2024
27b4cc9
Reenable PortAudio build.
tmiw Nov 3, 2024
474d428
Invert test criteria.
tmiw Nov 3, 2024
5afd473
Show pipewire status just before thye test run.
tmiw Nov 4, 2024
9ffc76a
List sink info prior to each test.
tmiw Nov 4, 2024
9091997
Make sure virtual devices aren't suspended.
tmiw Nov 4, 2024
d888482
Need to have the suspension disable code in another file.
tmiw Nov 4, 2024
fdd4906
Actually, installing pulseaudio isn't a good idea.
tmiw Nov 4, 2024
a1a60d9
Need a window manager for things to refresh properly.
tmiw Nov 4, 2024
f94fae6
Display wireplumber info after FDV start.
tmiw Nov 4, 2024
e307019
Add additional sleep to guarantee that FreeDV is listening when wirep…
tmiw Nov 4, 2024
b8d9e1f
Add pw-top for additional info.
tmiw Nov 4, 2024
05f8412
dbus needs to be running for pipewire to work.
tmiw Nov 4, 2024
be9f821
Need to wait a bit for Xvfb to become available.
tmiw Nov 4, 2024
4e688fa
Get additional pipewire logs prior to UT run.
tmiw Nov 4, 2024
7a9bdd7
Install/run rtkit too.
tmiw Nov 4, 2024
415bf22
Attempt to get pipewire logs after test execution.
tmiw Nov 4, 2024
7ba6b41
Looks like we still need to start pipewire manually.
tmiw Nov 4, 2024
fd7d617
Further increase pipewire debugging.
tmiw Nov 4, 2024
68ae57b
Too much debugging output before.
tmiw Nov 4, 2024
2aac509
Upgrade packages first before installing new ones.
tmiw Nov 4, 2024
f0e806a
We weren't actually running 24.04 on GH.
tmiw Nov 4, 2024
9df66ce
Adjust packages due to using 24.04.
tmiw Nov 4, 2024
7621071
Suppress spellcheck issue.
tmiw Nov 4, 2024
97c3224
Disable pipewire debugging.
tmiw Nov 5, 2024
def803d
Test changes to PulseAudioDevice to improve dropouts.
tmiw Nov 5, 2024
4fba557
Update tests to reflect 1 resync per 120s proposed threshold.
tmiw Nov 5, 2024
4cf6c3a
Disable additional debugging output.
tmiw Nov 5, 2024
c655bf7
Allow override of test audio devices from the command line.
tmiw Nov 7, 2024
646e465
Enable ctests on macOS.
tmiw Nov 8, 2024
3d8ff87
getSync() isn't thread safe, causing false UT failures.
tmiw Nov 8, 2024
8338d23
Install virtual audio devices in CI environment for macOS.
tmiw Nov 8, 2024
8b6e122
Use script to build drivers instead.
tmiw Nov 8, 2024
043e39e
Oops, forgot to remove some code first.
tmiw Nov 8, 2024
27e4f8d
Adjust permissions of script.
tmiw Nov 8, 2024
7bcf79a
Make tests work on Linux again with loopback devices.
tmiw Nov 8, 2024
3c65936
Attempt change to make virtual audio devices actually build.
tmiw Nov 8, 2024
04329e8
Try building on x86 macOS.
tmiw Nov 8, 2024
70ac958
Fix quote escape issues.
tmiw Nov 8, 2024
1449f97
More quote escape issues.
tmiw Nov 8, 2024
e75d7cc
Forgot missed folder change.
tmiw Nov 8, 2024
9ff76a2
Enable mirrored virtual audio devices.
tmiw Nov 8, 2024
6ed31ae
Fix incorrect device names in ctest execution.
tmiw Nov 8, 2024
63e3ddb
Need to append '2ch' to the other device names too.
tmiw Nov 8, 2024
dc155df
Clear sync when transmitting.
tmiw Nov 8, 2024
6a670e3
Grant microphone access to FreeDV.
tmiw Nov 8, 2024
908be67
Need to back out one of the changes due to voice keyer problems.
tmiw Nov 8, 2024
a633db1
Attempt to fix CI failures.
tmiw Nov 8, 2024
80797fb
Take screenshot of macOS CI environment for debugging.
tmiw Nov 8, 2024
71b7043
Let's try running the script separately to get a screenshot.
tmiw Nov 8, 2024
501a6b9
Screenshot was in the wrong place.
tmiw Nov 8, 2024
77eb2cf
Need to grant access to provisioner for microphone.
tmiw Nov 8, 2024
409dab5
Alternate way of granting permissions.
tmiw Nov 8, 2024
5aa3de8
Oops, remove call to tccutil.
tmiw Nov 9, 2024
4113c1c
Per PLT meeting, we shouldn't drop sync at all.
tmiw Nov 9, 2024
65907a3
Shorten test time to 60s.
tmiw Nov 9, 2024
5e04914
More tweaks to make sure that the devices are correct on Linux.
tmiw Nov 9, 2024
83bb91e
Disable screen capture.
tmiw Nov 9, 2024
9fccf98
Additional fixes to resolve script problems on macOS.
tmiw Nov 10, 2024
ed5eec9
I don't think previous PulseAudio changes made anything better.
tmiw Nov 10, 2024
f16c27f
Improve dropouts when using PulseAudio/pipewire.
tmiw Nov 11, 2024
addabca
Revert "Improve dropouts when using PulseAudio/pipewire."
tmiw Nov 12, 2024
e21a3f0
Have stream write callback get audio data from higher level code.
tmiw Nov 12, 2024
96dbdc4
Add PowerShell script for Windows testing.
tmiw Nov 13, 2024
f16be44
Move ctest files into a separate location for organization purposes.
tmiw Nov 15, 2024
6fdfd90
Add parameters for PowerShell test script.
tmiw Nov 15, 2024
3e57f09
Add help text for the script.
tmiw Nov 15, 2024
68321a5
Update conf file path due to previous commits.
tmiw Nov 15, 2024
8dba6d3
Fix syntax errors in script.
tmiw Nov 16, 2024
1c8d1ef
Merge branch 'v2.0-dev' into ms-test-for-zeros
tmiw Nov 16, 2024
34f7b58
Experiment: Test Windows installer on GH action.
tmiw Nov 17, 2024
0b83bd0
Try actually running full duplex test inside Windows.
tmiw Nov 17, 2024
b53bd42
Add 5 seconds to allow Xvfb to fully come up.
tmiw Nov 17, 2024
bc3eb49
Update other actions to use latest checkout.
tmiw Nov 17, 2024
f78b12d
Need VS command prompt.
tmiw Nov 17, 2024
2dec58c
Add additional debugging.
tmiw Nov 17, 2024
d36d46f
Maybe we need to throw an exception to make the GH action fail.
tmiw Nov 17, 2024
aa7def1
List devices another way.
tmiw Nov 17, 2024
235d888
Add yet more debugging.
tmiw Nov 17, 2024
fc58554
Fix audio devices.
tmiw Nov 17, 2024
32224e0
Try with 700D to at least make sure we're on the right track.
tmiw Nov 17, 2024
c3eb1bf
Fix GH action.
tmiw Nov 17, 2024
ace5079
Fix syntax errors.
tmiw Nov 17, 2024
c8dba98
Try installing VAC instead as FreeDV is crashing with Scream.
tmiw Nov 17, 2024
86ab0c3
Fix syntax error.
tmiw Nov 17, 2024
cbaabc5
Try different hardware ID.
tmiw Nov 17, 2024
2de8e06
Ignore error code that actually means success.
tmiw Nov 18, 2024
5b3c136
Oops, fix syntax error.
tmiw Nov 18, 2024
1841c51
Try earlier version of VAC.
tmiw Nov 18, 2024
1762fb4
Fix archive commands.
tmiw Nov 18, 2024
37e81e8
Fix path.
tmiw Nov 18, 2024
8b7ab96
Probably need to start AudioEndpointBuilder too.
tmiw Nov 18, 2024
4f8be0a
Stop services first.
tmiw Nov 18, 2024
15e3908
Print out any errors that might be getting thrown.
tmiw Nov 18, 2024
601ec3e
Revert "Print out any errors that might be getting thrown."
tmiw Nov 18, 2024
5d8b384
Disable test GH action for Windows and investigate failure later.
tmiw Nov 18, 2024
1dfa55d
Merge branch 'v2.0-dev' into ms-test-for-zeros
tmiw Nov 19, 2024
6f8d72d
Reenable Windows testing with new way of debugging.
tmiw Nov 19, 2024
de4f113
Add logging based on clues from Windows event log.
tmiw Nov 19, 2024
1c7d31b
Revert "Add logging based on clues from Windows event log."
tmiw Nov 19, 2024
6a595d8
Use procdump to get a crash dump.
tmiw Nov 19, 2024
7d0893b
Full dump seems to take a while.
tmiw Nov 19, 2024
88cc337
Run procdump in the background.
tmiw Nov 19, 2024
4e64041
Log audio errors.
tmiw Nov 19, 2024
04cfeac
Print device name in error message.
tmiw Nov 19, 2024
0fd3b44
Make sure message box doesn't display.
tmiw Nov 19, 2024
bb0173a
Enable additional PortAudio debugging.
tmiw Nov 20, 2024
29b35c8
Add yet more logging.
tmiw Nov 20, 2024
1c8f965
Add additional Registry key to ensure FreeDV has microphone permissions.
tmiw Nov 20, 2024
43803ff
Need to add Registry key.
tmiw Nov 20, 2024
1397a5c
Add more keys to try to force microphone permission.
tmiw Nov 20, 2024
99c120d
Clean up debugging, add tests for RADE/700E/1600.
tmiw Nov 20, 2024
eded776
More cleanup.
tmiw Nov 20, 2024
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
45 changes: 38 additions & 7 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,64 @@ jobs:
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install packages
shell: bash
run: |
sudo apt-get update
sudo apt-get install codespell libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git libwxgtk3.0-gtk3-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev python3-numpy
sudo apt-get upgrade -y
sudo apt-get install codespell libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git libwxgtk3.2-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity dbus-x11 at-spi2-core rtkit

- name: Spellcheck codebase
shell: bash
run: codespell --ignore-words-list=radae,rade,inout,nin,ontop,parm,tthe,ue `find src -name '*.c*' -o -name '*.h' -o -name '*.mm'`
run: codespell --ignore-words-list=caf,radae,rade,inout,nin,ontop,parm,tthe,ue `find src -name '*.c*' -o -name '*.h' -o -name '*.mm'`

- name: Install Python required modules
shell: bash
working-directory: ${{github.workspace}}
run: |
python3 -m venv rade-venv
. ./rade-venv/bin/activate
pip3 install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
pip3 install matplotlib

- name: Build freedv-gui using PortAudio
shell: bash
working-directory: ${{github.workspace}}
run: UT_ENABLE=1 ./build_linux.sh portaudio
run: |
. ./rade-venv/bin/activate
UT_ENABLE=1 ./build_linux.sh portaudio

- name: Build freedv-gui using PulseAudio
shell: bash
working-directory: ${{github.workspace}}
run: UT_ENABLE=1 ./build_linux.sh pulseaudio
run: |
. ./rade-venv/bin/activate
UT_ENABLE=1 ./build_linux.sh pulseaudio

- name: Execute unit tests
shell: bash
working-directory: ${{github.workspace}}/build_linux
run: make test
run: |
sudo systemctl enable rtkit-daemon
sudo systemctl start rtkit-daemon
Xvfb :99 -screen 0 1024x768x16 &
sleep 5
export DISPLAY=:99.0
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
eval "$(dbus-launch --sh-syntax --exit-with-x11)"
pipewire &
pipewire-pulse &
wireplumber &
metacity --sm-disable --replace &
sleep 5
ln -s ${{github.workspace}}/build_linux/rade_src/model19_check3 model19_check3
. ../rade-venv/bin/activate
PYTHONPATH=${{github.workspace}}/build_linux/rade_src:$PYTHONPATH ctest -V

19 changes: 15 additions & 4 deletions .github/workflows/cmake-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,31 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install packages
shell: bash
working-directory: ${{github.workspace}}
run: brew install automake libtool numpy
run: brew install automake libtool numpy sox

- name: Install virtual audio devices
shell: bash
working-directory: ${{github.workspace}}
run: ./build_macos_sound_drivers.sh

- name: Build freedv-gui
shell: bash
working-directory: ${{github.workspace}}
run: UT_ENABLE=1 ./build_osx.sh

- name: Workaround macOS permission issues
run: |
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/opt/off/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"

- name: Execute unit tests
shell: bash
working-directory: ${{github.workspace}}/build_osx
run: make test

run: |
FREEDV_COMPUTER_TO_RADIO_DEVICE="BlackHoleRadio 2ch" FREEDV_RADIO_TO_COMPUTER_DEVICE="BlackHoleRadio 2ch 2" FREEDV_COMPUTER_TO_SPEAKER_DEVICE="BlackHole1 2ch" FREEDV_MICROPHONE_TO_COMPUTER_DEVICE="BlackHole2 2ch" ctest -V

105 changes: 104 additions & 1 deletion .github/workflows/cmake-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install WINE
run: |
Expand Down Expand Up @@ -48,6 +48,7 @@ jobs:
export WINEPREFIX=`pwd`/wine-env
wget https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
Xvfb :99 -screen 0 1024x768x16 &
sleep 10
export DISPLAY=:99.0
wine ./python-3.12.7-amd64.exe /quiet /log c:\\python.log InstallAllUsers=1 Include_doc=0 Include_tcltk=0 || :
cat $WINEPREFIX/drive_c/python.log
Expand Down Expand Up @@ -76,3 +77,105 @@ jobs:
run: |
export PATH=${{github.workspace}}/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64/bin:$PATH
make -j6 package

- name: Rename installer
shell: bash
working-directory: ${{github.workspace}}/build_windows
run: |
mv FreeDV*.exe FreeDV.exe

- name: Stash for next step
uses: actions/upload-artifact@v4
with:
name: FreeDVSetupProgram
path: ${{github.workspace}}/build_windows/FreeDV.exe

test:
runs-on: windows-latest
needs: build
env:
RADIO_TO_COMPUTER_DEVICE: "CABLE Output (VB-Audio Virtual Cable)"
COMPUTER_TO_RADIO_DEVICE: "Speakers (VB-Audio Virtual Cable)"
MICROPHONE_TO_COMPUTER_DEVICE: "Line 1 (Virtual Audio Cable)"
COMPUTER_TO_SPEAKER_DEVICE: "Line 1 (Virtual Audio Cable)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: FreeDVSetupProgram
path: ${{github.workspace}}

- uses: ilammy/msvc-dev-cmd@v1

- name: Install FreeDV on hard drive
shell: pwsh
run: |
.\FreeDV.exe /S /D=${{github.workspace}}\FreeDV-Install-Location | Out-Null

- name: Copy test script to install folder
shell: pwsh
run: |
Copy-Item -Path ${{github.workspace}}/test/TestFreeDVFullDuplex.ps1 -Destination ${{github.workspace}}\FreeDV-Install-Location\bin
Copy-Item -Path ${{github.workspace}}/test/freedv-ctest-fullduplex.conf.tmpl -Destination ${{github.workspace}}\FreeDV-Install-Location\bin

- name: Install VB-Cable ("Radio" sound device)
uses: LABSN/sound-ci-helpers@v1

- run: 'Invoke-WebRequest https://software.muzychenko.net/trials/vac464.zip -OutFile vac464.zip'
- run: 'Expand-Archive -Path vac464.zip -DestinationPath vac464'
- run: 'Import-Certificate -FilePath ${{github.workspace}}\test\vac464.cer -CertStoreLocation Cert:\LocalMachine\root'
- run: 'Import-Certificate -FilePath ${{github.workspace}}\test\vac464.cer -CertStoreLocation Cert:\LocalMachine\TrustedPublisher'
- name: Install driver
shell: pwsh
run: |
.\vac464\setup64.exe -s -k 30570681-0a8b-46e5-8cb2-d835f43af0c5 | Out-Null
Start-Sleep -Seconds 10
# For convenience, make sure we fail fast if for whatever reason the install gets blocked on some GUI prompt.
timeout-minutes: 5

- name: Grant FreeDV access to the microphone
run: |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone" -Name Value -Value Allow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone" -Name Value -Value Allow
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone\" -Name "NonPackaged" -Force
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone\NonPackaged" -Name Value -Value Allow
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\" -Name "AppPrivacy" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Name LetAppsAccessMicrophone -Value 0

- name: Start Windows Audio Service
run: |
net start audiosrv

- name: List audio devices
shell: pwsh
run: |
Get-CimInstance win32_sounddevice

- name: Test RADE
shell: pwsh
working-directory: ${{github.workspace}}\FreeDV-Install-Location\bin
run: |
.\TestFreeDVFullDuplex.ps1 -RadioToComputerDevice "${{env.RADIO_TO_COMPUTER_DEVICE}}" -ComputerToRadioDevice "${{env.COMPUTER_TO_RADIO_DEVICE}}" -MicrophoneToComputerDevice "${{env.MICROPHONE_TO_COMPUTER_DEVICE}}" -ComputerToSpeakerDevice "${{env.COMPUTER_TO_SPEAKER_DEVICE}}" -ModeToTest RADE -NumberOfRuns 1
timeout-minutes: 5

- name: Test 700D
shell: pwsh
working-directory: ${{github.workspace}}\FreeDV-Install-Location\bin
run: |
.\TestFreeDVFullDuplex.ps1 -RadioToComputerDevice "${{env.RADIO_TO_COMPUTER_DEVICE}}" -ComputerToRadioDevice "${{env.COMPUTER_TO_RADIO_DEVICE}}" -MicrophoneToComputerDevice "${{env.MICROPHONE_TO_COMPUTER_DEVICE}}" -ComputerToSpeakerDevice "${{env.COMPUTER_TO_SPEAKER_DEVICE}}" -ModeToTest 700D -NumberOfRuns 1
timeout-minutes: 5

- name: Test 700E
shell: pwsh
working-directory: ${{github.workspace}}\FreeDV-Install-Location\bin
run: |
.\TestFreeDVFullDuplex.ps1 -RadioToComputerDevice "${{env.RADIO_TO_COMPUTER_DEVICE}}" -ComputerToRadioDevice "${{env.COMPUTER_TO_RADIO_DEVICE}}" -MicrophoneToComputerDevice "${{env.MICROPHONE_TO_COMPUTER_DEVICE}}" -ComputerToSpeakerDevice "${{env.COMPUTER_TO_SPEAKER_DEVICE}}" -ModeToTest 700E -NumberOfRuns 1
timeout-minutes: 5

- name: Test 1600
shell: pwsh
working-directory: ${{github.workspace}}\FreeDV-Install-Location\bin
run: |
.\TestFreeDVFullDuplex.ps1 -RadioToComputerDevice "${{env.RADIO_TO_COMPUTER_DEVICE}}" -ComputerToRadioDevice "${{env.COMPUTER_TO_RADIO_DEVICE}}" -MicrophoneToComputerDevice "${{env.MICROPHONE_TO_COMPUTER_DEVICE}}" -ComputerToSpeakerDevice "${{env.COMPUTER_TO_SPEAKER_DEVICE}}" -ModeToTest 1600 -NumberOfRuns 1
timeout-minutes: 5

14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -719,3 +719,17 @@ elseif(UNIX AND NOT APPLE)
include(CPack)

endif(WIN32)

if(UNITTEST)
# The below tests are currently Linux-only due to a dependency on
# PulseAudio/pipewire.
macro(DefineAudioTest utName)
add_test(NAME fullduplex_${utName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test/test_zeros.sh txrx ${utName})
set_tests_properties(fullduplex_${utName} PROPERTIES PASS_REGULAR_EXPRESSION "Got 1 sync changes")
endmacro()

DefineAudioTest(RADE)
DefineAudioTest(700D)
DefineAudioTest(700E)
DefineAudioTest(1600)
endif(UNITTEST)
51 changes: 51 additions & 0 deletions build_macos_sound_drivers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

git clone https://github.com/tmiw/BlackHole.git
cd BlackHole

bundleID=audio.existential.BlackHoleRadio
driverName=BlackHoleRadio

xcodebuild \
-project BlackHole.xcodeproj \
-configuration Release \
-target BlackHole \
CONFIGURATION_BUILD_DIR=build \
PRODUCT_BUNDLE_IDENTIFIER=$bundleID \
GCC_PREPROCESSOR_DEFINITIONS="$GCC_PREPROCESSOR_DEFINITIONS \
kNumber_Of_Channels='2' \
kPlugIn_BundleID='\"$bundleID\"' \
kDriver_Name='\"$driverName\"' \
kDevice2_IsHidden=false \
kDevice2_HasInput=true \
kDevice2_HasOutput=true" \
MACOSX_DEPLOYMENT_TARGET=10.13

sudo mv build/BlackHole.driver /Library/Audio/Plug-Ins/HAL/$driverName.driver

for i in {1..2}; do
git reset --hard
rm -rf build

export bundleID=audio.existential.BlackHole$i
export driverName=BlackHole$i

xcodebuild \
-project BlackHole.xcodeproj \
-configuration Release \
-target BlackHole \
CONFIGURATION_BUILD_DIR=build \
PRODUCT_BUNDLE_IDENTIFIER=$bundleID \
GCC_PREPROCESSOR_DEFINITIONS="$GCC_PREPROCESSOR_DEFINITIONS \
kNumber_Of_Channels='2' \
kPlugIn_BundleID='\"$bundleID\"' \
kDriver_Name='\"$driverName\"' \
kDevice2_IsHidden=false \
kDevice2_HasInput=true \
kDevice2_HasOutput=true" \
MACOSX_DEPLOYMENT_TARGET=10.13

sudo mv build/BlackHole.driver /Library/Audio/Plug-Ins/HAL/$driverName.driver
done

sudo killall -9 coreaudiod
2 changes: 1 addition & 1 deletion cmake/BuildRADE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ExternalProject_Add(build_rade
SOURCE_DIR rade_src
BINARY_DIR rade_build
GIT_REPOSITORY https://github.com/drowe67/radae.git
GIT_TAG dr-reset
GIT_TAG main
CMAKE_ARGS ${RADE_CMAKE_ARGS}
#CMAKE_CACHE_ARGS -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
INSTALL_COMMAND ""
Expand Down
1 change: 1 addition & 0 deletions cmake/Buildportaudio-2.0.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#set(BUILD_SHARED_LIBS OFF CACHE STRING "Disable shared libraries for portaudio")
#set(PA_ENABLE_DEBUG_OUTPUT ON CACHE STRING "Enable debug output")

include(FetchContent)
FetchContent_Declare(
Expand Down
8 changes: 8 additions & 0 deletions src/audio/PulseAudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ void PulseAudioDevice::start()
outputPendingLength_ = 0;
targetOutputPendingLength_ = PULSE_FPB * getNumChannels() * 2;
outputPendingThreadActive_ = true;
#if 0
if (direction_ == IAudioEngine::AUDIO_ENGINE_OUT)
{
outputPendingThread_ = new std::thread([&]() {
Expand Down Expand Up @@ -200,6 +201,7 @@ void PulseAudioDevice::start()
});
assert(outputPendingThread_ != nullptr);
}
#endif
}

pa_threaded_mainloop_unlock(mainloop_);
Expand Down Expand Up @@ -268,6 +270,7 @@ void PulseAudioDevice::StreamWriteCallback_(pa_stream *s, size_t length, void *u
memset(data, 0, sizeof(data));

PulseAudioDevice* thisObj = static_cast<PulseAudioDevice*>(userdata);
#if 0
{
std::unique_lock<std::mutex> lk(thisObj->outputPendingMutex_);
if (thisObj->outputPendingLength_ >= numSamples)
Expand All @@ -286,7 +289,12 @@ void PulseAudioDevice::StreamWriteCallback_(pa_stream *s, size_t length, void *u

thisObj->targetOutputPendingLength_ = std::max(thisObj->targetOutputPendingLength_, 2 * numSamples);
}
#endif

if (thisObj->onAudioDataFunction)
{
thisObj->onAudioDataFunction(*thisObj, data, numSamples / thisObj->getNumChannels(), thisObj->onAudioDataState);
}
pa_stream_write(s, &data[0], length, NULL, 0LL, PA_SEEK_RELATIVE);
}
}
Expand Down
Loading