Add patch to fix initial AU sample rate mismatch
This commit is contained in:
parent
066344b8b0
commit
f76d931127
2 changed files with 53 additions and 0 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -532,6 +532,7 @@ jobs:
|
|||
if [ "${{ env.WITH_LTO }}" != "true" ]; then export PAWPAW_SKIP_LTO=1; fi
|
||||
pushd deps/PawPaw; source local.env macos; popd
|
||||
git clone --depth=1 -b 6.1.6 https://github.com/juce-framework/JUCE.git jucewrapper/JUCE
|
||||
patch -d jucewrapper/JUCE -p1 -i ../bf85b6dcc7d17d35ed31dc9761a46eb510a668ac.patch
|
||||
sed -i -e 's/kAudioUnitProperty_SupportsMPE/kAudioUnitProperty_ignore_SupportsMPE/' jucewrapper/JUCE/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h
|
||||
mkdir -p jucewrapper/build
|
||||
pushd jucewrapper/build; cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.8 -DCMAKE_OSX_SYSROOT="macosx" -DCMAKE_BUILD_TYPE=Release .. && make VERBOSE=1 -j $(sysctl -n hw.logicalcpu); popd
|
||||
|
@ -621,6 +622,7 @@ jobs:
|
|||
if [ "${{ env.WITH_LTO }}" != "true" ]; then export PAWPAW_SKIP_LTO=1; fi
|
||||
pushd deps/PawPaw; source local.env macos-universal; popd
|
||||
git clone --depth=1 -b 6.1.6 https://github.com/juce-framework/JUCE.git jucewrapper/JUCE
|
||||
patch -d jucewrapper/JUCE -p1 -i ../bf85b6dcc7d17d35ed31dc9761a46eb510a668ac.patch
|
||||
mkdir -p jucewrapper/build
|
||||
pushd jucewrapper/build; cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DCMAKE_OSX_SYSROOT="macosx" -DCMAKE_BUILD_TYPE=Release .. && make VERBOSE=1 -j $(sysctl -n hw.logicalcpu); popd
|
||||
mv jucewrapper/build/*_artefacts/Release/AU/*.component bin/
|
||||
|
|
51
jucewrapper/bf85b6dcc7d17d35ed31dc9761a46eb510a668ac.patch
Normal file
51
jucewrapper/bf85b6dcc7d17d35ed31dc9761a46eb510a668ac.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
From bf85b6dcc7d17d35ed31dc9761a46eb510a668ac Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Kraft <sebastian.kraft@nektartech.com>
|
||||
Date: Fri, 6 May 2022 09:09:34 +0200
|
||||
Subject: [PATCH] Always set sample rate of hosted AU plugins, fixes a bug with
|
||||
plugins reporting incorrect sample rates
|
||||
|
||||
---
|
||||
.../juce_AudioUnitPluginFormat.mm | 25 ++++++++-----------
|
||||
1 file changed, 11 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
|
||||
index 59c0e06d368..8ee8f9a465c 100644
|
||||
--- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
|
||||
+++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
|
||||
@@ -1057,25 +1057,22 @@ void prepareToPlay (double newSampleRate, int estimatedSamplesPerBlock) override
|
||||
|
||||
AudioUnitGetProperty (audioUnit, kAudioUnitProperty_SampleRate, scope, static_cast<UInt32> (i), &sampleRate, &sampleRateSize);
|
||||
|
||||
- if (sampleRate != sr)
|
||||
+ if (isAUv3) // setting kAudioUnitProperty_SampleRate fails on AUv3s
|
||||
{
|
||||
- if (isAUv3) // setting kAudioUnitProperty_SampleRate fails on AUv3s
|
||||
- {
|
||||
- AudioStreamBasicDescription stream;
|
||||
- UInt32 dataSize = sizeof (stream);
|
||||
- auto err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_StreamFormat, scope, static_cast<UInt32> (i), &stream, &dataSize);
|
||||
+ AudioStreamBasicDescription stream;
|
||||
+ UInt32 dataSize = sizeof (stream);
|
||||
+ auto err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_StreamFormat, scope, static_cast<UInt32> (i), &stream, &dataSize);
|
||||
|
||||
- if (err == noErr && dataSize == sizeof (stream))
|
||||
- {
|
||||
- stream.mSampleRate = sr;
|
||||
- AudioUnitSetProperty (audioUnit, kAudioUnitProperty_StreamFormat, scope, static_cast<UInt32> (i), &stream, sizeof (stream));
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
+ if (err == noErr && dataSize == sizeof (stream))
|
||||
{
|
||||
- AudioUnitSetProperty (audioUnit, kAudioUnitProperty_SampleRate, scope, static_cast<UInt32> (i), &sr, sizeof (sr));
|
||||
+ stream.mSampleRate = sr;
|
||||
+ AudioUnitSetProperty (audioUnit, kAudioUnitProperty_StreamFormat, scope, static_cast<UInt32> (i), &stream, sizeof (stream));
|
||||
}
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ AudioUnitSetProperty (audioUnit, kAudioUnitProperty_SampleRate, scope, static_cast<UInt32> (i), &sr, sizeof (sr));
|
||||
+ }
|
||||
|
||||
if (isInput)
|
||||
{
|
Loading…
Add table
Add a link
Reference in a new issue