2
0
Fork 0

Restored to 1.5.0

This commit is contained in:
George Reales 2019-09-01 21:29:25 +02:00
parent 98cd1d1ead
commit 115e2bab3d
5 changed files with 29 additions and 43 deletions

View file

@ -48,9 +48,8 @@ public:
bool vibratoEnabled; bool vibratoEnabled;
float Volume; float Volume;
const static int MAX_VOICES = 32; const static int MAX_VOICES=8;
const static int MAX_PANNINGS = 8; float pannings[MAX_VOICES];
float pannings[MAX_PANNINGS];
ObxdVoice voices[MAX_VOICES]; ObxdVoice voices[MAX_VOICES];
bool uni; bool uni;
bool Oversample; bool Oversample;
@ -80,7 +79,7 @@ public:
// pannings = new float[MAX_VOICES]; // pannings = new float[MAX_VOICES];
totalvc = MAX_VOICES; totalvc = MAX_VOICES;
vq = VoiceQueue(MAX_VOICES,voices); vq = VoiceQueue(MAX_VOICES,voices);
for(int i = 0 ; i < MAX_PANNINGS;++i) for(int i = 0 ; i < MAX_VOICES;++i)
{ {
pannings[i]= 0.5; pannings[i]= 0.5;
} }
@ -363,12 +362,11 @@ public:
float x1 = processSynthVoice(voices[i],lfovalue,viblfo); float x1 = processSynthVoice(voices[i],lfovalue,viblfo);
if(Oversample) if(Oversample)
{ {
float x2 = processSynthVoice(voices[i],lfovalue2,viblfo2); float x2 = processSynthVoice(voices[i],lfovalue2,viblfo2); vlo+=x2*(1-pannings[i]);
vlo+=x2*(1-pannings[i % MAX_PANNINGS]); vro+=x2*(pannings[i]);
vro+=x2*(pannings[i % MAX_PANNINGS]);
} }
vl+=x1*(1-pannings[i % MAX_PANNINGS]); vl+=x1*(1-pannings[i]);
vr+=x1*(pannings[i % MAX_PANNINGS]); vr+=x1*(pannings[i]);
} }
if(Oversample) if(Oversample)
{ {

View file

@ -166,7 +166,7 @@ public:
} }
void setVoiceCount(float param) void setVoiceCount(float param)
{ {
synth.setVoiceCount(roundToInt((param*(synth.MAX_VOICES-1)) +1)); synth.setVoiceCount(roundToInt((param*7) +1));
} }
void procPitchWheelAmount(float param) void procPitchWheelAmount(float param)
{ {
@ -184,7 +184,7 @@ public:
} }
void processPan(float param,int idx) void processPan(float param,int idx)
{ {
synth.pannings[(idx-1) % synth.MAX_PANNINGS] = param; synth.pannings[idx-1] = param;
} }
void processTune(float param) void processTune(float param)
{ {

BIN
Source/Images/voices.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -287,8 +287,14 @@ void ObxdAudioProcessorEditor::rebuildComponents()
envelopeDetuneKnob = addTinyKnob(1353,300,ownerFilter,ENVDER,"Env",0.2); envelopeDetuneKnob = addTinyKnob(1353,300,ownerFilter,ENVDER,"Env",0.2);
voiceSwitch = addNormalButtonList(124,338,17,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(BinaryData::voices_png,BinaryData::voices_pngSize)); voiceSwitch = addNormalButtonList(124,338,17,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(BinaryData::voices_png,BinaryData::voices_pngSize));
for (int i=1; i <= 32; i++) voiceSwitch ->addChoise("1");
voiceSwitch ->addChoise(String(i)); voiceSwitch ->addChoise("2");
voiceSwitch ->addChoise("3");
voiceSwitch ->addChoise("4");
voiceSwitch ->addChoise("5");
voiceSwitch ->addChoise("6");
voiceSwitch ->addChoise("7");
voiceSwitch ->addChoise("8");
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonList(25,338,65,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(BinaryData::legato_png,BinaryData::legato_pngSize)); legatoSwitch = addNormalButtonList(25,338,65,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(BinaryData::legato_png,BinaryData::legato_pngSize));
@ -394,8 +400,14 @@ void ObxdAudioProcessorEditor::rebuildComponents()
bendLfoRateKnob = addNormalKnobClassic(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4); bendLfoRateKnob = addNormalKnobClassic(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4);
voiceSwitch = addNormalButtonListClassic(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromFile(skinFolder.getChildFile("voices.png"))); voiceSwitch = addNormalButtonListClassic(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromFile(skinFolder.getChildFile("voices.png")));
for (int i=1; i <= 32; i++) voiceSwitch ->addChoise("1");
voiceSwitch->addChoise(String(i)); voiceSwitch ->addChoise("2");
voiceSwitch ->addChoise("3");
voiceSwitch ->addChoise("4");
voiceSwitch ->addChoise("5");
voiceSwitch ->addChoise("6");
voiceSwitch ->addChoise("7");
voiceSwitch ->addChoise("8");
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonListClassic(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromFile(skinFolder.getChildFile("legato.png"))); legatoSwitch = addNormalButtonListClassic(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromFile(skinFolder.getChildFile("legato.png")));

View file

@ -734,7 +734,6 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData)
{ {
XmlElement* xpr = new XmlElement("program"); XmlElement* xpr = new XmlElement("program");
xpr->setAttribute(S("programName"), programs.programs[i].name); xpr->setAttribute(S("programName"), programs.programs[i].name);
xpr->setAttribute(S("voiceCount"), Motherboard::MAX_VOICES);
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
@ -754,25 +753,9 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData)
copyXmlToBinary(xmlState,destData); copyXmlToBinary(xmlState,destData);
} }
void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData)
{
XmlElement xmlState = XmlElement("Datsounds");
for (int k = 0; k < PARAM_COUNT; ++k)
{
xmlState.setAttribute(String(k), programs.currentProgramPtr->values[k]);
}
xmlState.setAttribute(S("voiceCount"), Motherboard::MAX_VOICES);
xmlState.setAttribute(S("programName"), programs.currentProgramPtr->name);
copyXmlToBinary(xmlState, destData);
}
void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes) void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{ {
if (std::unique_ptr<XmlElement> xmlState = getXmlFromBinary(data,sizeInBytes)) if (XmlElement* const xmlState = getXmlFromBinary(data,sizeInBytes))
{ {
XmlElement* xprogs = xmlState->getFirstChildElement(); XmlElement* xprogs = xmlState->getFirstChildElement();
if (xprogs->hasTagName(S("programs"))) if (xprogs->hasTagName(S("programs")))
@ -780,14 +763,11 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
int i = 0; int i = 0;
forEachXmlChildElement(*xprogs, e) forEachXmlChildElement(*xprogs, e)
{ {
bool newFormat = e->hasAttribute("voiceCount");
programs.programs[i].setDefaultValues(); programs.programs[i].setDefaultValues();
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
float value = float(e->getDoubleAttribute(String(k), programs.programs[i].values[k])); programs.programs[i].values[k] = e->getDoubleAttribute(String(k), programs.programs[i].values[k]);
if (!newFormat && k == VOICE_COUNT) value *= 0.25f;
programs.programs[i].values[k] = value;
} }
programs.programs[i].name = e->getStringAttribute(S("programName"), S("Default")); programs.programs[i].name = e->getStringAttribute(S("programName"), S("Default"));
@ -809,16 +789,13 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data,int sizeInBytes) void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data,int sizeInBytes)
{ {
if (std::unique_ptr<XmlElement> e = getXmlFromBinary(data, sizeInBytes)) if (XmlElement* const e = getXmlFromBinary(data, sizeInBytes))
{ {
programs.currentProgramPtr->setDefaultValues(); programs.currentProgramPtr->setDefaultValues();
bool newFormat = e->hasAttribute("voiceCount");
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
float value = float(e->getDoubleAttribute(String(k), programs.currentProgramPtr->values[k])); programs.currentProgramPtr->values[k] = e->getDoubleAttribute(String(k), programs.currentProgramPtr->values[k]);
if (!newFormat && k == VOICE_COUNT) value *= 0.25f;
programs.currentProgramPtr->values[k] = value;
} }
programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default")); programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default"));
@ -843,7 +820,6 @@ void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData
copyXmlToBinary(xmlState, destData); copyXmlToBinary(xmlState, destData);
} }
//============================================================================== //==============================================================================
bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile) bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
{ {