Skip to content

Instantly share code, notes, and snippets.

@maximko
Created September 29, 2021 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximko/a32740e3588e7b18caca5c9c16e6ad11 to your computer and use it in GitHub Desktop.
Save maximko/a32740e3588e7b18caca5c9c16e6ad11 to your computer and use it in GitHub Desktop.
Build desired number of BlackHole drivers
#!/bin/bash
# copy everything from drivers/ folder to /Library/Audio/Plug-Ins/HAL/ and run
# sudo chown -R root:wheel /Library/Audio/Plug-Ins/HAL/Pipe*
# sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod
driver_num=1
build_driver_with_options() {
number=$(printf "%02d" ${1})
channels=${2}
git reset --hard HEAD
sed -i '' "s/BlackHole%ich_UID/BlackHole_pipe_${number}_${channels}ch_UID/g" BlackHole/BlackHole.h
sed -i '' "s/BlackHole%ich_ModelUID/BlackHole_pipe_${number}_${channels}ch_ModelUID/g" BlackHole/BlackHole.h
sed -i '' "s/BlackHole %ich/Pipe ${number} ${channels}ch/g" BlackHole/BlackHole.h
sed -i '' -E "s/NUMBER_OF_CHANNELS[[:space:]]+2$/NUMBER_OF_CHANNELS ${channels}/g" BlackHole/BlackHole.h
xcodebuild CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO && mv -f build/Release/BlackHole.driver "drivers/Pipe ${number} ${channels}ch.driver"
}
mkdir drivers
# Build 8 2ch drivers
for i in {1..8}; do
build_driver_with_options ${driver_num} 2
((driver_num=driver_num+1))
done
# Build 4 8ch drivers
for i in {1..4}; do
build_driver_with_options ${driver_num} 8
((driver_num=driver_num+1))
done
@maximko
Copy link
Author

maximko commented Sep 29, 2021

Because 2 drivers are never enough.

Screenshot 2021-09-29 at 15 57 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment