Having a very confusing problem at the moment. I’ve made three classes, which sit in a nested array structure.
It’s pretty basic stuff, but for some reason, merely having an instance of this class as a member of my juce filter causes an exception in juce::SortedSet::insertInternal(…). What possible reason could there be for this?
Is there any chance anyone could include this in a plugin and add a member of SixteenChannelMaps to the filter class to check I’m not going insane?
Here’s the code for the class file…
class SingleNoteMap
{
public:
SingleNoteMap ()
{
}
void setTargetNote (int noteNumber)
{
jassert (noteNumber < 128);
note = noteNumber;
}
int getTargetNote ()
{
return note;
}
void setTargetChannel (int chan)
{
jassert ((chan > 0) && (chan < 17));
channel = chan;
}
int getTargetChannel ()
{
return channel;
}
private:
int channel;
int note;
};
class NoteMap
{
public:
NoteMap ()
{
}
void resetAll (int channelNumber)
{
channel = channelNumber;
for (int i=0; i<128; i++)
{
map [i].setTargetNote (i);
map [i].setTargetChannel (channel);
}
}
SingleNoteMap& getMap (int inputNoteNumber)
{
jassert (inputNoteNumber < 128);
return map [inputNoteNumber];
}
int getOutputNoteFor (int inputNoteNumber)
{
jassert (inputNoteNumber < 128);
return map [inputNoteNumber].getTargetNote ();
}
int getOutputChannelFor (int inputNoteNumber)
{
jassert (inputNoteNumber < 128);
return map [inputNoteNumber].getTargetChannel ();
}
void setOutputNoteFor (int inputNoteNumber, int output)
{
jassert ((inputNoteNumber < 128) && (output < 128));
map [inputNoteNumber].setTargetNote (output);
}
void setOutputChannelFor (int inputNoteNumber, int output)
{
jassert ((inputNoteNumber < 128) && (output > 0) && (output < 17));
map [inputNoteNumber].setTargetChannel (output);
}
private:
SingleNoteMap map [128];
int channel;
};
class SixteenChannelMaps
{
public:
SixteenChannelMaps ()
{
for (int i=1; i<17; i++)
{
maps[i].resetAll (i);
}
}
NoteMap& getMapForChannel (int channel)
{
jassert ((channel > 0) && (channel < 17));
return maps [channel];
}
private:
NoteMap maps [16];
};