Hi, my college course has been structured for Visual Studio however I am using Xcode. This weeks project is designing a panning dial.
the code i was asked to add was two lines after the processor.cpp constructor, the main loop, change the projectnameAudioProcessorEditor to GenericAudioProcessorEditor under the createEditor () section and add juce::AudioParameterFloat* panPosition; into the private class in the header.
It builds successfully however the standalone plugin wont open and EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) error occurs. How can I get around this?
Thanks in adv. Code below
PROCESSOR.cpp
/*
This file contains the basic framework code for a JUCE plugin processor.
==============================================================================
*/
#include “PluginProcessor.h”
#include “PluginEditor.h”
//==============================================================================
DualPanningAudioProcessor::DualPanningAudioProcessor()
#ifndef JucePlugin_PreferredChannelConfigurations
: AudioProcessor (BusesProperties()
#if ! JucePlugin_IsMidiEffect
#if ! JucePlugin_IsSynth
.withInput (“Input”, juce::AudioChannelSet::stereo(), true)
#endif
.withOutput (“Output”, juce::AudioChannelSet::stereo(), true)
#endif
)
#endif
{
panPosition = new juce::AudioParameterFloat(“panPosition”, “Pan Position”, -1.0f, 1.0f, 0.0f);
addParameter(panPosition);
}
DualPanningAudioProcessor::~DualPanningAudioProcessor()
{
}
//==============================================================================
const juce::String DualPanningAudioProcessor::getName() const
{
return JucePlugin_Name;
}
bool DualPanningAudioProcessor::acceptsMidi() const
{
#if JucePlugin_WantsMidiInput
return true;
#else
return false;
#endif
}
bool DualPanningAudioProcessor::producesMidi() const
{
#if JucePlugin_ProducesMidiOutput
return true;
#else
return false;
#endif
}
bool DualPanningAudioProcessor::isMidiEffect() const
{
#if JucePlugin_IsMidiEffect
return true;
#else
return false;
#endif
}
double DualPanningAudioProcessor::getTailLengthSeconds() const
{
return 0.0;
}
int DualPanningAudioProcessor::getNumPrograms()
{
return 1; // NB: some hosts don’t cope very well if you tell them there are 0 programs,
// so this should be at least 1, even if you’re not really implementing programs.
}
int DualPanningAudioProcessor::getCurrentProgram()
{
return 0;
}
void DualPanningAudioProcessor::setCurrentProgram (int index)
{
}
const juce::String DualPanningAudioProcessor::getProgramName (int index)
{
return {};
}
void DualPanningAudioProcessor::changeProgramName (int index, const juce::String& newName)
{
}
//==============================================================================
void DualPanningAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
// Use this method as the place to do any pre-playback
// initialisation that you need..
}
void DualPanningAudioProcessor::releaseResources()
{
// When playback stops, you can use this as an opportunity to free up any
// spare memory, etc.
}
#ifndef JucePlugin_PreferredChannelConfigurations
bool DualPanningAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const
{
#if JucePlugin_IsMidiEffect
juce::ignoreUnused (layouts);
return true;
#else
// This is the place where you check if the layout is supported.
// In this template code we only support mono or stereo.
// Some plugin hosts, such as certain GarageBand versions, will only
// load plugins that support stereo bus layouts.
if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::mono()
&& layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo())
return false;
// This checks if the input layout matches the output layout
#if ! JucePlugin_IsSynth
if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
return false;
#endif
return true;
#endif
}
#endif
void DualPanningAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
// In case we have more outputs than inputs, this code clears any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
// This is here to avoid people getting screaming feedback
// when they first compile a plugin, but obviously you don't need to keep
// this code if your algorithm always overwrites all the output channels.
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
float pDash = (panPosition->get() + 1.0f) / 2.0f;
// This is the place where you'd normally do the guts of your plugin's
// audio processing...
// Make sure to reset the state if your inner loop is processing
// the samples and the outer loop is handling the channels.
// Alternatively, you can process the samples with the channels
// interleaved by keeping the same state.
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* channelData = buffer.getWritePointer (channel);
for (int i = 0; 1 < buffer.getNumSamples(); i++)
{
if (channel == 0)
{
channelData[i] = channelData[i] * (1.0 - pDash);
}
else
{
channelData[i] = channelData[i] * pDash;
}
}
}
}
//==============================================================================
bool DualPanningAudioProcessor::hasEditor() const
{
return true; // (change this to false if you choose to not supply an editor)
}
juce::AudioProcessorEditor* DualPanningAudioProcessor::createEditor()
{
return new juce::GenericAudioProcessorEditor(*this);
}
//==============================================================================
void DualPanningAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
{
// create a memory stream object.
juce::MemoryOutputStream stream(destData, true);
// store a float into memory.
stream.writeFloat(*panPosition);
}
void DualPanningAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
// create a memory stream object.
juce::MemoryInputStream stream(data, static_cast<size_t>(sizeInBytes), false);
// read a float from memory.
*panPosition = stream.readFloat();
}
//==============================================================================
// This creates new instances of the plugin..
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
return new DualPanningAudioProcessor();
}
PROCESSOR.h
/*
==============================================================================
This file contains the basic framework code for a JUCE plugin processor.
==============================================================================
*/
#pragma once
#include <JuceHeader.h>
//==============================================================================
/**
*/
class DualPanningAudioProcessor : public juce::AudioProcessor
{
public:
//==============================================================================
DualPanningAudioProcessor();
~DualPanningAudioProcessor() override;
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;
#ifndef JucePlugin_PreferredChannelConfigurations
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
#endif
void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
//==============================================================================
juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;
//==============================================================================
const juce::String getName() const override;
bool acceptsMidi() const override;
bool producesMidi() const override;
bool isMidiEffect() const override;
double getTailLengthSeconds() const override;
//==============================================================================
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const juce::String getProgramName (int index) override;
void changeProgramName (int index, const juce::String& newName) override;
//==============================================================================
void getStateInformation (juce::MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
private:
juce::AudioParameterFloat* panPosition;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DualPanningAudioProcessor)
};

