mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Updated the JUCE demo plugin to support standalone targets on all platforms
This commit is contained in:
parent
9f3fb1c0a6
commit
dda135a9eb
4 changed files with 87 additions and 17 deletions
|
|
@ -11,9 +11,9 @@
|
|||
bundleIdentifier="com.juce.JuceDemoPlugin" jucerVersion="4.3.1"
|
||||
companyName="ROLI Ltd." aaxIdentifier="com.yourcompany.JuceDemoPlugin"
|
||||
buildAAX="0" pluginAAXCategory="AAX_ePlugInCategory_Dynamics"
|
||||
includeBinaryInAppConfig="1" buildVST3="1" pluginManufacturerEmail="support@yourcompany.com"
|
||||
includeBinaryInAppConfig="1" buildVST3="0" pluginManufacturerEmail="support@yourcompany.com"
|
||||
companyWebsite="www.juce.com" companyEmail="info@juce.com" pluginIsMidiEffectPlugin="0"
|
||||
buildAUv3="0">
|
||||
buildAUv3="1" buildStandalone="1">
|
||||
<EXPORTFORMATS>
|
||||
<XCODE_MAC targetFolder="Builds/MacOSX" vstFolder="" rtasFolder="~/SDKs/PT_80_SDK"
|
||||
objCExtraSuffix="JuceDemo" aaxFolder="" postbuildCommand="" vst3Folder="">
|
||||
|
|
@ -83,6 +83,51 @@
|
|||
<MODULEPATH id="juce_audio_formats" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</LINUX_MAKE>
|
||||
<XCODE_IPHONE targetFolder="Builds/iOS" iosScreenOrientation="landscape" iosBackgroundAudio="1"
|
||||
iosBackgroundBle="1">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="JuceDemoPlugin"/>
|
||||
<CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="JuceDemoPlugin"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_gui_extra" path="../../modules"/>
|
||||
<MODULEPATH id="juce_gui_basics" path="../../modules"/>
|
||||
<MODULEPATH id="juce_graphics" path="../../modules"/>
|
||||
<MODULEPATH id="juce_events" path="../../modules"/>
|
||||
<MODULEPATH id="juce_data_structures" path="../../modules"/>
|
||||
<MODULEPATH id="juce_core" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_utils" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_processors" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_plugin_client" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_formats" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_devices" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</XCODE_IPHONE>
|
||||
<ANDROIDSTUDIO targetFolder="Builds/Android" androidSDKPath="" androidNDKPath=""
|
||||
androidTheme="@android:style/Theme.NoTitleBar" androidScreenOrientation="landscape"
|
||||
androidMinimumSDK="23">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" androidArchitectures="armeabi x86" isDebug="1" optimisation="1"
|
||||
targetName="JuceDemoPlugin"/>
|
||||
<CONFIGURATION name="Release" androidArchitectures="" isDebug="0" optimisation="3"
|
||||
targetName="JuceDemoPlugin"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_gui_extra" path="../../modules"/>
|
||||
<MODULEPATH id="juce_gui_basics" path="../../modules"/>
|
||||
<MODULEPATH id="juce_graphics" path="../../modules"/>
|
||||
<MODULEPATH id="juce_events" path="../../modules"/>
|
||||
<MODULEPATH id="juce_data_structures" path="../../modules"/>
|
||||
<MODULEPATH id="juce_core" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_utils" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_processors" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_plugin_client" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_formats" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_devices" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</ANDROIDSTUDIO>
|
||||
</EXPORTFORMATS>
|
||||
<MAINGROUP id="dYAMo6Ykd" name="JuceDemoPlugin">
|
||||
<FILE id="RCFlkTAef" name="PluginEditor.cpp" compile="1" resource="0"
|
||||
|
|
|
|||
|
|
@ -147,8 +147,7 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
JuceDemoPluginAudioProcessor::JuceDemoPluginAudioProcessor()
|
||||
: AudioProcessor (BusesProperties().withInput ("Input", AudioChannelSet::stereo(), true)
|
||||
.withOutput ("Output", AudioChannelSet::stereo(), true)),
|
||||
: AudioProcessor (getBusesProperties()),
|
||||
lastUIWidth (400),
|
||||
lastUIHeight (200),
|
||||
gainParam (nullptr),
|
||||
|
|
@ -186,21 +185,33 @@ void JuceDemoPluginAudioProcessor::initialiseSynth()
|
|||
bool JuceDemoPluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
|
||||
{
|
||||
// Only mono/stereo and input/output must have same layout
|
||||
const AudioChannelSet& mainInput = layouts.getMainInputChannelSet();
|
||||
const AudioChannelSet& mainOutput = layouts.getMainOutputChannelSet();
|
||||
|
||||
// input and output layout must be the same
|
||||
if (mainInput != mainOutput) return false;
|
||||
if (wrapperType != wrapperType_Standalone && layouts.getMainInputChannelSet() != mainOutput)
|
||||
return false;
|
||||
|
||||
// do not allow disabling the main buses
|
||||
if (mainInput.isDisabled()) return false;
|
||||
if (mainOutput.isDisabled()) return false;
|
||||
|
||||
// only allow stereo and mono
|
||||
if (mainInput.size() > 2) return false;
|
||||
if (mainOutput.size() > 2) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AudioProcessor::BusesProperties JuceDemoPluginAudioProcessor::getBusesProperties()
|
||||
{
|
||||
// This plug-in should not have any inputs when run as a standalone plug-in
|
||||
|
||||
if (PluginHostType::getPluginLoadedAs() == wrapperType_Standalone)
|
||||
return BusesProperties().withOutput ("Output", AudioChannelSet::stereo(), true);
|
||||
else
|
||||
return BusesProperties().withInput ("Input", AudioChannelSet::stereo(), true)
|
||||
.withOutput ("Output", AudioChannelSet::stereo(), true);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void JuceDemoPluginAudioProcessor::prepareToPlay (double newSampleRate, int /*samplesPerBlock*/)
|
||||
{
|
||||
// Use this method as the place to do any pre-playback
|
||||
|
|
@ -244,8 +255,8 @@ void JuceDemoPluginAudioProcessor::process (AudioBuffer<FloatType>& buffer,
|
|||
{
|
||||
const int numSamples = buffer.getNumSamples();
|
||||
|
||||
// apply our gain-change to the incoming data..
|
||||
applyGain (buffer, delayBuffer);
|
||||
if (wrapperType == wrapperType_Standalone)
|
||||
buffer.clear();
|
||||
|
||||
// Now pass any incoming midi messages to our keyboard state object, and let it
|
||||
// add messages to the buffer if the user is clicking on the on-screen keys
|
||||
|
|
@ -257,11 +268,16 @@ void JuceDemoPluginAudioProcessor::process (AudioBuffer<FloatType>& buffer,
|
|||
// Apply our delay effect to the new output..
|
||||
applyDelay (buffer, delayBuffer);
|
||||
|
||||
// In case we have more outputs than inputs, we'll clear any output
|
||||
// channels that didn't contain input data, (because these aren't
|
||||
// guaranteed to be empty - they may contain garbage).
|
||||
for (int i = getTotalNumInputChannels(); i < getTotalNumOutputChannels(); ++i)
|
||||
buffer.clear (i, 0, numSamples);
|
||||
if (wrapperType != wrapperType_Standalone)
|
||||
{
|
||||
// In case we have more outputs than inputs, we'll clear any output
|
||||
// channels that didn't contain input data, (because these aren't
|
||||
// guaranteed to be empty - they may contain garbage).
|
||||
for (int i = getTotalNumInputChannels(); i < getTotalNumOutputChannels(); ++i)
|
||||
buffer.clear (i, 0, numSamples);
|
||||
}
|
||||
|
||||
applyGain (buffer, delayBuffer); // apply our gain-change to the outgoing data..
|
||||
|
||||
// Now ask the host for the current time so we can store it to be displayed later...
|
||||
updateCurrentTimeInfoFromHost();
|
||||
|
|
@ -273,7 +289,7 @@ void JuceDemoPluginAudioProcessor::applyGain (AudioBuffer<FloatType>& buffer, Au
|
|||
ignoreUnused (delayBuffer);
|
||||
const float gainLevel = *gainParam;
|
||||
|
||||
for (int channel = 0; channel < getTotalNumInputChannels(); ++channel)
|
||||
for (int channel = 0; channel < getTotalNumOutputChannels(); ++channel)
|
||||
buffer.applyGain (channel, 0, buffer.getNumSamples(), gainLevel);
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +301,7 @@ void JuceDemoPluginAudioProcessor::applyDelay (AudioBuffer<FloatType>& buffer, A
|
|||
|
||||
int delayPos = 0;
|
||||
|
||||
for (int channel = 0; channel < getTotalNumInputChannels(); ++channel)
|
||||
for (int channel = 0; channel < getTotalNumOutputChannels(); ++channel)
|
||||
{
|
||||
FloatType* const channelData = buffer.getWritePointer (channel);
|
||||
FloatType* const delayData = delayBuffer.getWritePointer (jmin (channel, delayBuffer.getNumChannels() - 1));
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ private:
|
|||
|
||||
void initialiseSynth();
|
||||
void updateCurrentTimeInfoFromHost();
|
||||
static BusesProperties getBusesProperties();
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceDemoPluginAudioProcessor)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -368,6 +368,11 @@ public:
|
|||
|
||||
createEditorComp();
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
setFullScreen (true);
|
||||
Desktop::getInstance().setKioskModeComponent (this, false);
|
||||
#else
|
||||
|
||||
if (PropertySet* props = pluginHolder->settings)
|
||||
{
|
||||
const int x = props->getIntValue ("windowX", -100);
|
||||
|
|
@ -382,15 +387,18 @@ public:
|
|||
{
|
||||
centreWithSize (getWidth(), getHeight());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
~StandaloneFilterWindow()
|
||||
{
|
||||
#if (! JUCE_IOS) && (! JUCE_ANDROID)
|
||||
if (PropertySet* props = pluginHolder->settings)
|
||||
{
|
||||
props->setValue ("windowX", getX());
|
||||
props->setValue ("windowY", getY());
|
||||
}
|
||||
#endif
|
||||
|
||||
pluginHolder->stopPlaying();
|
||||
deleteEditorComp();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue