2
0
Fork 0

FM / Additive selectable.

This commit is contained in:
bruce 2013-09-15 00:29:54 +08:00
parent 755c24b3ca
commit fd1b40182a
2 changed files with 15 additions and 2 deletions

View file

@ -73,6 +73,11 @@ JuceOplvstiAudioProcessor::JuceOplvstiAudioProcessor()
StringArray(ksrs, sizeof(ksrs)/sizeof(String)))
);
const String algos[] = {"Frequency Modulation", "Additive"};
params.push_back(new EnumFloatParameter("Algorithm",
StringArray(algos, sizeof(algos)/sizeof(String)))
);
params.push_back(new IntFloatParameter("Modulator Feedback", 0, 7));
params.push_back(new IntFloatParameter("Carrier Attack", 0, 15));
params.push_back(new IntFloatParameter("Carrier Decay", 0, 15));
@ -100,7 +105,6 @@ JuceOplvstiAudioProcessor::JuceOplvstiAudioProcessor()
void JuceOplvstiAudioProcessor::initPrograms()
{
const float i_params_0[] = {
0.000000f, 0.660000f, // waveforms
0.066667f, 0.133333f, // frq multipliers
@ -108,6 +112,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 1.0f, 0.0f, // tre / vib / sus / ks
0.0f, 0.0f, 1.0f, 1.0f, // tre / vib / sus / ks
0.000000f, 0.000000f, // KSR/8ve
0.000000f, // algorithm
0.000000f, // feedback
0.5f, 0.3f, 0.3f, 0.3f, // adsr
0.5f, 0.3f, 0.1f, 0.6f, // adsr
@ -122,6 +127,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 0.0f, 1.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 1.0f, // tre / vib / sus / ks
0.000000f, 0.000000f, // KSR/8ve
0.000000f, // algorithm
0.571429f, // feedback
1.0f, 1.0f, 0.0f, 0.3f, // adsr
1.0f, 0.5f, 0.2f, 0.3f, // adsr
@ -136,6 +142,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 0.0f, 0.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 0.0f, // tre / vib / sus / ks
0.000000f, 0.000000f, // KSR/8ve
0.000000f, // algorithm
0.000000f, // feedback
1.0f, 0.3f, 0.5f, 0.5f, // adsr
1.0f, 0.1f, 0.9f, 1.0f, // adsr
@ -150,6 +157,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 1.0f, 0.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 0.0f, // tre / vib / sus / ks
0.000000f, 0.000000f, // KSR/8ve
0.000000f, // algorithm
0.000000f, // feedback
0.1f, 0.1f, 0.7f, 0.1f, // adsr
0.1f, 0.9f, 0.1f, 0.1f, // adsr
@ -164,6 +172,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 0.0f, 0.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 1.0f, // tre / vib / sus / ks
0.000000f, 1.000000f, // KSR/8ve
0.000000f, // algorithm
0.571429f, // feedback
1.0f, 0.3f, 0.1f, 0.3f, // adsr
1.0f, 0.7f, 0.0f, 0.4f, // adsr
@ -178,6 +187,7 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 1.0f, 0.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 0.0f, // tre / vib / sus / ks
0.000000f, 0.000000f, // KSR/8ve
0.000000f, // algorithm
0.000000f, // feedback
1.0f, 0.3f, 0.4f, 0.4f, // adsr
1.0f, 0.4f, 0.5f, 0.3f, // adsr
@ -192,13 +202,13 @@ void JuceOplvstiAudioProcessor::initPrograms()
0.0f, 0.0f, 0.0f, 1.0f, // tre / vib / sus / ks
0.0f, 0.0f, 0.0f, 1.0f, // tre / vib / sus / ks
0.000000f, 0.660000f, // KSR/8ve
0.000000f, // algorithm
0.000000f, // feedback
0.6f, 0.7f, 0.0f, 0.2f, // adsr
0.6f, 0.7f, 0.1f, 0.1f, // adsr
};
std::vector<float> v_i_params_97283 (i_params_97283, i_params_97283 + sizeof(i_params_97283) / sizeof(float));
programs["Instr 97283"] = std::vector<float>(v_i_params_97283);
}
JuceOplvstiAudioProcessor::~JuceOplvstiAudioProcessor()
@ -272,6 +282,8 @@ void JuceOplvstiAudioProcessor::setParameter (int index, float newValue)
for(int c=1;c<=Hiopl::CHANNELS;c++) Opl->EnableTremolo(c, osc, ((EnumFloatParameter*)p)->getParameterIndex() > 0);
} else if (name.endsWith("Vibrato")) {
for(int c=1;c<=Hiopl::CHANNELS;c++) Opl->EnableVibrato(c, osc, ((EnumFloatParameter*)p)->getParameterIndex() > 0);
} else if (name.endsWith("Algorithm")) {
for(int c=1;c<=Hiopl::CHANNELS;c++) Opl->EnableAdditiveSynthesis(c, ((EnumFloatParameter*)p)->getParameterIndex() > 0);
}
}

View file

@ -313,6 +313,7 @@ def output_instrument_vst_program(json_i, ts):
print ' %.1ff, %.1ff, %.1ff, %.1ff, // tre / vib / sus / ks' % tuple([b2f(c[x]) for x in ['tre', 'vib', 'sus', 'ksr']])
print ' %.1ff, %.1ff, %.1ff, %.1ff, // tre / vib / sus / ks' % tuple([b2f(m[x]) for x in ['tre', 'vib', 'sus', 'ksr']])
print ' %.6ff, %.6ff, // KSR/8ve' % (D2F[c['db_oct']], D2F[m['db_oct']])
print ' %.6ff, // algorithm' % (1.0 if 'ADD'==d[2]['alg'] else 0.0)
print ' %.6ff, // feedback' % (float(d[2]['feedback'])/7.0)
print ' %.1ff, %.1ff, %.1ff, %.1ff, // adsr' % tuple([e2f(c[x]) for x in ['a', 'd', 's', 'r']])
print ' %.1ff, %.1ff, %.1ff, %.1ff, // adsr' % tuple([e2f(m[x]) for x in ['a', 'd', 's', 'r']])