Skip to content

Commit

Permalink
- added HISE_NUM_STANDALONE_OUTPUTS
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Hart committed Sep 26, 2024
1 parent 8cdac4e commit 966fbd2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion currentGitHash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e8696eada2ae6a126a4e711df4e6218eb3a0eb7a
8cdac4eb3161ccb7fc076f17d4653e94518e96b6
2 changes: 1 addition & 1 deletion hi_backend/backend/currentGit.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define PREVIOUS_HISE_COMMIT "e8696eada2ae6a126a4e711df4e6218eb3a0eb7a"
#define PREVIOUS_HISE_COMMIT "8cdac4eb3161ccb7fc076f17d4653e94518e96b6"
9 changes: 8 additions & 1 deletion hi_core/LibConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


#ifndef HISE_NUM_PLUGIN_CHANNELS
#define HISE_NUM_PLUGIN_CHANNELS 2
#define HISE_NUM_PLUGIN_CHANNELS 4
#endif

/** This is the amount of channels that your FX plugin will process.
Expand All @@ -68,6 +68,13 @@
#define HISE_NUM_FX_PLUGIN_CHANNELS 2
#endif

/** Config: HISE_NUM_STANDALONE_OUTPUTS
This lets you define the number of outputs for the standalone HISE app (or exported standalone app).
*/
#ifndef HISE_NUM_STANDALONE_OUTPUTS
#define HISE_NUM_STANDALONE_OUTPUTS HISE_NUM_PLUGIN_CHANNELS
#endif

#define NUM_GLOBAL_VARIABLES 128

Expand Down
7 changes: 5 additions & 2 deletions hi_core/hi_core/HiseSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,11 @@ void HiseSettings::Data::settingWasChanged(const Identifier& id, const var& newV
auto& original = config.outputChannels;

original.clear();
original.setBit(outputIndex * 2, 1);
original.setBit(outputIndex * 2 + 1, 1);

for(int i = 0; i < HISE_NUM_STANDALONE_OUTPUTS; i++)
{
original.setBit(outputIndex * 2 + i, 1);
}

config.useDefaultOutputChannels = false;

Expand Down
6 changes: 5 additions & 1 deletion hi_core/hi_core/MainController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ void MainController::prepareToPlay(double sampleRate_, int samplesPerBlock)


#if IS_STANDALONE_APP || IS_STANDALONE_FRONTEND
getMainSynthChain()->getMatrix().setNumDestinationChannels(2);
getMainSynthChain()->getMatrix().setNumDestinationChannels(HISE_NUM_STANDALONE_OUTPUTS);
#else

#if HISE_IOS
Expand Down Expand Up @@ -2156,6 +2156,10 @@ void MainController::updateMultiChannelBuffer(int numNewChannels)
if(processingBufferSize.get() == -1)
return;

#if IS_STANDALONE_APP || IS_STANDALONE_FRONTEND
numNewChannels = jmax(HISE_NUM_STANDALONE_OUTPUTS, numNewChannels);
#endif

ScopedLock sl(processLock);

// Updates the channel amount
Expand Down
6 changes: 3 additions & 3 deletions hi_core/hi_core/StandaloneProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ void AudioProcessorDriver::initialiseAudioDriver(XmlElement *deviceData)

if (deviceData != nullptr && deviceData->hasTagName("DEVICESETUP"))
{
String errorMessage = deviceManager->initialise(0, 2, deviceData, true);
String errorMessage = deviceManager->initialise(0, HISE_NUM_STANDALONE_OUTPUTS, deviceData, true);

if (errorMessage.isNotEmpty() || deviceManager->getCurrentAudioDevice() == nullptr)
{
logger.logMessage("Error initialising with stored settings: " + errorMessage);

logger.logMessage("Audio Driver Default Initialisation");

const String error = deviceManager->initialiseWithDefaultDevices(0, 2);
const String error = deviceManager->initialiseWithDefaultDevices(0, HISE_NUM_STANDALONE_OUTPUTS);

if (error.isNotEmpty())
logger.logMessage("Error initialising with default settings: " + error);
Expand All @@ -309,7 +309,7 @@ void AudioProcessorDriver::initialiseAudioDriver(XmlElement *deviceData)
{
logger.logMessage("Audio Driver Default Initialisation");

const String error = deviceManager->initialiseWithDefaultDevices(0, 2);
const String error = deviceManager->initialiseWithDefaultDevices(0, HISE_NUM_STANDALONE_OUTPUTS);

if (error.isNotEmpty())
logger.logMessage("Error initialising with default settings: " + error);
Expand Down
4 changes: 3 additions & 1 deletion hi_core/hi_dsp/modules/ModulatorSynthChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ void ModulatorSynthChain::renderNextBlockWithModulators(AudioSampleBuffer &buffe
#if FORCE_INPUT_CHANNELS
if(isRoot)
{
for(int i = 0; i < buffer.getNumChannels(); i++)
int numChannels = jmin(buffer.getNumChannels(), internalBuffer.getNumChannels());

for(int i = 0; i < numChannels; i++)
{
FloatVectorOperations::copy(internalBuffer.getWritePointer(i),
buffer.getReadPointer(i), numSamples);
Expand Down
11 changes: 8 additions & 3 deletions hi_core/hi_dsp/plugin_parameter/PluginParameterProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,12 @@ AudioProcessor::BusesProperties PluginParameterAudioProcessor::getHiseBusPropert
if (getWrapperTypeBeingCreated() == wrapperType_AAX || FORCE_INPUT_CHANNELS)
busProp = busProp.withInput("Input", AudioChannelSet::stereo());

#if IS_STANDALONE_FRONTEND
constexpr int numChannels = 2;
#if IS_STANDALONE_FRONTEND || IS_STANDALONE_APP
constexpr int numChannels = HISE_NUM_STANDALONE_OUTPUTS;
#else
constexpr int numChannels = HISE_NUM_PLUGIN_CHANNELS;
#endif

for (int i = 0; i < numChannels; i += 2)
busProp = busProp.withOutput("Channel " + String(i + 1) + "+" + String(i + 2), AudioChannelSet::stereo());

Expand Down Expand Up @@ -363,11 +363,16 @@ bool PluginParameterAudioProcessor::isBusesLayoutSupported(const BusesLayout& la
#else
return inputs == 2 && outputs == 2;
#endif
#else

#if IS_STANDALONE_FRONTEND || IS_STANDALONE_APP
return outputs == 2 || outputs == HISE_NUM_STANDALONE_OUTPUTS;
#else
bool isStereo = (inputs == 2 || inputs == 0) && outputs == 2;
bool isMultiChannel = (inputs == HISE_NUM_PLUGIN_CHANNELS || inputs == 0) && (outputs == HISE_NUM_PLUGIN_CHANNELS);
return isStereo || isMultiChannel;
#endif
#endif
}

PluginParameterAudioProcessor::~PluginParameterAudioProcessor()
Expand Down

0 comments on commit 966fbd2

Please sign in to comment.