Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/actions/virtual-audio-device/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2019, Laboratory for Auditory Brain Science and Neuroengineering
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 3 additions & 0 deletions .github/actions/virtual-audio-device/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# virtual-audio-device

Adapted from sound-ci-helpers: https://github.com/LABSN/sound-ci-helpers
18 changes: 18 additions & 0 deletions .github/actions/virtual-audio-device/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'virtual-audio-device'
description: 'set up virtual audio devices for win32, linux, darwin'
inputs:
platform:
description: 'Target platform'
required: true
runs:
using: 'composite'
steps:
- run: '${{ github.action_path }}/linux/setup_sound.sh'
shell: bash -e {0}
if: ${{ inputs.platform == 'linux' }}
- run: '${{ github.action_path }}/macos/setup_sound.sh'
shell: bash -e {0}
if: ${{ inputs.platform == 'darwin' }}
- run: '${{ github.action_path }}/windows/setup_sound.ps1'
shell: powershell -Command {0}
if: ${{ inputs.platform == 'win32' }}
9 changes: 9 additions & 0 deletions .github/actions/virtual-audio-device/linux/setup_sound.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -xeo pipefail

sudo apt update
sudo apt install -y pulseaudio libportaudio2 dbus-x11 libasound-dev
systemctl --user restart pulseaudio.service
systemctl --user restart pulseaudio.socket
pactl list
6 changes: 6 additions & 0 deletions .github/actions/virtual-audio-device/macos/setup_sound.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -xeo pipefail
brew fetch --retry --cask background-music
brew install --cask background-music
sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod || sudo killall coreaudiod
Binary file not shown.
73 changes: 73 additions & 0 deletions .github/actions/virtual-audio-device/windows/setup_sound.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
param (
[string]$Url = 'https://download.vb-audio.com/Download_CABLE/VBCABLE_Driver_Pack45.zip',
[string]$ZipName = 'vbcable.zip',
[string]$ExtractDir = 'vbcable'
)

function Download-Zip {
param($Url, $Out)
Write-Host "Downloading $Url → $Out"
$wc = New-Object System.Net.WebClient
0..2 | ForEach-Object {
try { $wc.DownloadFile($Url, $Out); return } catch { Start-Sleep 1 }
}
$wc.DownloadFile($Url, $Out)
}

function Expand-Zip {
param($Zip, $Dest)
Write-Host "Extracting $Zip → $Dest"
Expand-Archive -LiteralPath $Zip -DestinationPath $Dest -Force
}

function Trust-Cert {
param($Cer)
Write-Host "Adding certificate to TrustedPublisher: $Cer"
certutil -addstore -f TrustedPublisher $Cer
}

function Install-Driver {
param($InfDir)
Write-Host "Installing driver(s) from $InfDir"
Get-ChildItem -Path $InfDir -Filter 'vbMmeCable64_win*.inf' -Recurse |
ForEach-Object {
$inf = $_.FullName
Write-Host " devcon.exe install `"$inf`" VBAudioVACWDM"
& "$PSScriptRoot\devcon.exe" install "$inf" VBAudioVACWDM
}
}

function Restart-AudioServices {
Write-Host "Restarting Audio services to pick up new device"
foreach ($svc in 'AudioSrv','AudioEndpointBuilder') {
if (Get-Service $svc -ErrorAction SilentlyContinue) {
Restart-Service -Name $svc -Force
}
}
}

function Dump-Devices {
Write-Host "Current sound devices:"
Get-CimInstance Win32_SoundDevice |
Select-Object Name,Status |
Format-Table -AutoSize
}

Push-Location $PSScriptRoot

Download-Zip -Url $Url -Out (Join-Path $PSScriptRoot $ZipName)
Expand-Zip -Zip (Join-Path $PSScriptRoot $ZipName) -Dest (Join-Path $PSScriptRoot $ExtractDir)

$cer = Join-Path $PSScriptRoot 'vbcable.cer'
if (Test-Path $cer) {
Write-Host "Adding certificate to TrustedPublisher: $cer"
certutil.exe -addstore -f TrustedPublisher $cer
} else {
Write-Error "Certificate not found at $cer; cannot trust the driver."
}
Install-Driver -InfDir (Join-Path $PSScriptRoot $ExtractDir)

Restart-AudioServices
Dump-Devices

Pop-Location
Binary file not shown.
26 changes: 25 additions & 1 deletion .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: ./.github/actions/virtual-audio-device
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
- run: |
choco install vb-cable -y
choco upgrade llvm
if: ${{ matrix.platform == 'win32' }}
- shell: pwsh
if: ${{ matrix.platform == 'win32' }}
run: |
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy\' -Force
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy\' -Name 'LetAppsAccessMicrophone' -Value 1 -PropertyType DWord
- run: |
sudo apt update
sudo apt install -y \
Expand All @@ -41,8 +54,19 @@ jobs:
libxi-dev \
libxfixes-dev \
libwayland-dev \
xvfb
xvfb \
libpulse-dev \
pulseaudio
if: ${{ matrix.platform == 'linux' }}
- run: pulseaudio -D --start --exit-idle-time=-1
if: ${{ matrix.platform == 'linux' }}
- run: |
brew install switchaudio-osx blackhole-2ch
sudo pkill coreaudiod || true
sleep 10
SwitchAudioSource -s 'BlackHole 2ch' -t input
SwitchAudioSource -s 'BlackHole 2ch' -t output
if: ${{ matrix.platform == 'darwin' }}
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} ${{ matrix.flags }}
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: ./.github/actions/virtual-audio-device
with:
platform: ${{ matrix.platform }}
- run: |
choco install vb-cable -y
choco upgrade llvm
if: ${{ matrix.platform == 'win32' }}
- shell: pwsh
if: ${{ matrix.platform == 'win32' }}
run: |
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy\' -Force
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy\' -Name 'LetAppsAccessMicrophone' -Value 1 -PropertyType DWord
- run: |
sudo apt update
sudo apt install -y \
Expand All @@ -37,10 +49,19 @@ jobs:
libxi-dev \
libxfixes-dev \
libwayland-dev \
xvfb
xvfb \
libpulse-dev \
pulseaudio
if: ${{ matrix.platform == 'linux' }}
- run: choco upgrade llvm
if: ${{ matrix.platform == 'win32' }}
- run: pulseaudio -D --start --exit-idle-time=-1
if: ${{ matrix.platform == 'linux' }}
- run: |
brew install switchaudio-osx blackhole-2ch
sudo pkill coreaudiod || true
sleep 10
SwitchAudioSource -s 'BlackHole 2ch' -t input
SwitchAudioSource -s 'BlackHole 2ch' -t output
if: ${{ matrix.platform == 'darwin' }}
- run: npm install -g bare-runtime bare-make
- run: npm install
- run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} --debug ${{ matrix.flags }}
Expand Down
Loading
Loading