Last active
July 11, 2024 02:36
-
-
Save cosinekitty/3691f5ef324e31af21cabde9a15737be to your computer and use it in GitHub Desktop.
Script for building VCV Rack 2.4.1 with my improved (low-latency) PulseAudio anti-glitching fix applied.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
Fail() | |
{ | |
echo "vcvbuild.sh: $1" | |
exit 1 | |
} | |
CloneVcv() | |
{ | |
git clone https://github.com/VCVRack/Rack.git $1 || Fail "Could not clone VCV Rack source into: $1" | |
git clone https://github.com/VCVRack/Fundamental.git $1/plugins/Fundamental || Fail "Could not clone VCV Fundamental repo into: $1/plugins/Fundamental" | |
pushd $1 > /dev/null || Fail "CloneVcv - error changing directory to: $1" | |
git submodule update --init --recursive || Fail "Could not fetch submodules into: $1" | |
git checkout --recurse-submodules -b donfix $2 || Fail "Could not check out tag: $2" | |
if [[ -z "$3" ]]; then | |
echo "vcvbuild.sh: Keeping latest version of Fundamental modules." | |
else | |
# Hack to work around "taylor5" function rename. | |
cd plugins/Fundamental | |
git checkout $3 || Fail "CloneVcv - error checking out Fundamental commit: $3" | |
fi | |
popd > /dev/null || Fail "CloneVcv - popd" | |
} | |
ApplyGlitchFix() | |
{ | |
pushd "$1/src" > /dev/null || Fail "ApplyGlitchFix cannot change to directory: $1/src" | |
cat > fix.patch << EOF | |
diff --git a/src/rtaudio.cpp b/src/rtaudio.cpp | |
index 09686a3b..a937d445 100644 | |
--- a/src/rtaudio.cpp | |
+++ b/src/rtaudio.cpp | |
@@ -94,7 +94,7 @@ struct RtAudioDevice : audio::Device { | |
options = RtAudio::StreamOptions(); | |
// options.flags |= RTAUDIO_MINIMIZE_LATENCY; | |
options.flags |= RTAUDIO_SCHEDULE_REALTIME; | |
- options.numberOfBuffers = 2; | |
+ options.numberOfBuffers = 4; | |
options.streamName = "VCV Rack"; | |
int32_t closestSampleRate = deviceInfo.preferredSampleRate; | |
EOF | |
git apply fix.patch || Fail "Error applying patch." | |
rm -f fix.patch | |
popd > /dev/null || Fail "ApplyGlitchFix - popd" | |
} | |
BuildVcv() | |
{ | |
pushd "$1" > /dev/null || Fail "BuildVcv - error changing directory to: $1" | |
make dep || Fail "BuildVcv - error making dependencies" | |
make || Fail "BuildVcv - error making Rack" | |
cd plugins/Fundamental || "BuildVcv - error changing directory to: $1/plugins/Fundamental" | |
make || Fail "BuildVcv - error making Fundamental" | |
make dist || Fail "BuildVcv error making Fundamental dist" | |
cd ../.. || "BuildVcv - error changing back to ../.." | |
make dist || Fail "BuildVcv - error making Rack dist" | |
popd > /dev/null || Fail "BuildVcv - popd" | |
} | |
#------------------------------------------------------------------------------- | |
VCVBUILDDIR=${PWD}/build | |
VCVTAG=v2.4.1 | |
FUNDAMENTALTAG="" | |
# Nuke and re-create directory for building Rack from source. | |
rm -rf "${VCVBUILDDIR}" | |
[[ -e "${VCVBUILDDIR}" ]] && Fail "Cannot delete existing build directory" | |
mkdir -pv "${VCVBUILDDIR}" || Fail "Could not create build directory" | |
CloneVcv "${VCVBUILDDIR}" "${VCVTAG}" "${FUNDAMENTALTAG}" | |
ApplyGlitchFix "${VCVBUILDDIR}" | |
BuildVcv "${VCVBUILDDIR}" | |
echo "vcvbuild.sh: Unzipping final build..." | |
unzip -q build/dist/RackFree-2.*-lin-x64.zip || exit 1 | |
ls -l | |
echo "vcvbuild.sh: SUCCESS - you can move the Rack2Free directory manually and run from there." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment