diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index ba3a969..26d52f6 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -105,6 +105,7 @@ JuceOplvstiAudioProcessor::JuceOplvstiAudioProcessor() void JuceOplvstiAudioProcessor::initPrograms() { + // these ones from the Syndicate in-game music const float i_params_0[] = { 0.000000f, 0.660000f, // waveforms 0.066667f, 0.133333f, // frq multipliers @@ -209,6 +210,68 @@ void JuceOplvstiAudioProcessor::initPrograms() }; std::vector v_i_params_97283 (i_params_97283, i_params_97283 + sizeof(i_params_97283) / sizeof(float)); programs["Instr 97283"] = std::vector(v_i_params_97283); + + // The start of the Dune 2 introduction + const float i_params_3136[] = { + 0.000000f, 0.660000f, // waveforms + 0.133333f, 0.133333f, // frq multipliers + 0.000000f, 0.333333f, // attenuation + 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.330000f, // KSR/8ve + 0.000000f, // algorithm + 0.571429f, // feedback + 1.0f, 0.1f, 0.1f, 0.3f, // adsr + 1.0f, 0.4f, 0.2f, 0.3f, // adsr + }; + std::vector v_i_params_3136 (i_params_3136, i_params_3136 + sizeof(i_params_3136) / sizeof(float)); + programs["Instr 3136"] = std::vector(v_i_params_3136); + + const float i_params_7254[] = { + 0.000000f, 0.330000f, // waveforms + 0.066667f, 0.066667f, // frq multipliers + 0.253968f, 0.476190f, // attenuation + 1.0f, 1.0f, 1.0f, 1.0f, // tre / vib / sus / ks + 1.0f, 1.0f, 0.0f, 0.0f, // tre / vib / sus / ks + 0.000000f, 0.330000f, // KSR/8ve + 0.000000f, // algorithm + 0.571429f, // feedback + 0.1f, 0.1f, 0.1f, 0.1f, // adsr + 0.2f, 0.1f, 0.1f, 0.0f, // adsr + }; + std::vector v_i_params_7254 (i_params_7254, i_params_7254 + sizeof(i_params_7254) / sizeof(float)); + programs["Instr 7254"] = std::vector(v_i_params_7254); + + const float i_params_20108[] = { + 0.000000f, 0.000000f, // waveforms + 0.400000f, 0.066667f, // frq multipliers + 0.238095f, 0.000000f, // attenuation + 1.0f, 1.0f, 1.0f, 0.0f, // tre / vib / sus / ks + 0.0f, 1.0f, 1.0f, 0.0f, // tre / vib / sus / ks + 0.000000f, 0.330000f, // KSR/8ve + 0.000000f, // algorithm + 0.000000f, // feedback + 0.1f, 0.1f, 0.1f, 0.1f, // adsr + 0.1f, 0.1f, 0.1f, 0.1f, // adsr + }; + std::vector v_i_params_20108 (i_params_20108, i_params_20108 + sizeof(i_params_20108) / sizeof(float)); + programs["Instr 20108"] = std::vector(v_i_params_20108); + + const float i_params_27550[] = { + 1.000000f, 0.000000f, // waveforms + 0.000000f, 0.066667f, // frq multipliers + 0.238095f, 0.793651f, // attenuation + 0.0f, 1.0f, 0.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.571429f, // feedback + 1.0f, 0.0f, 1.0f, 1.0f, // adsr + 0.9f, 0.1f, 0.0f, 1.0f, // adsr + }; + std::vector v_i_params_27550 (i_params_27550, i_params_27550 + sizeof(i_params_27550) / sizeof(float)); + programs["Instr 27550"] = std::vector(v_i_params_27550); + } JuceOplvstiAudioProcessor::~JuceOplvstiAudioProcessor() diff --git a/py/oplparse.py b/py/oplparse.py index f0eefc0..33b9d56 100644 --- a/py/oplparse.py +++ b/py/oplparse.py @@ -305,23 +305,28 @@ def output_instrument_vst_program(json_i, ts): try: d = json.loads(json_i) m=d[0]; c=d[1] + lines = [ + ' const float i_params_%d[] = {' % ts, + ' %.6ff, %.6ff, // waveforms' % (W2F[c['wav']], W2F[m['wav']]), + ' %.6ff, %.6ff, // frq multipliers' % (m2f(c['fm_mult']), m2f(m['fm_mult'])), + ' %.6ff, %.6ff, // attenuation' % (a2f(c['db']), a2f(m['db'])), + ' %.1ff, %.1ff, %.1ff, %.1ff, // tre / vib / sus / ks' % tuple([b2f(c[x]) for x in ['tre', 'vib', 'sus', 'ksr']]), + ' %.1ff, %.1ff, %.1ff, %.1ff, // tre / vib / sus / ks' % tuple([b2f(m[x]) for x in ['tre', 'vib', 'sus', 'ksr']]), + ' %.6ff, %.6ff, // KSR/8ve' % (D2F[c['db_oct']], D2F[m['db_oct']]), + ' %.6ff, // algorithm' % (1.0 if 'ADD'==d[2]['alg'] else 0.0), + ' %.6ff, // feedback' % (float(d[2]['feedback'])/7.0), + ' %.1ff, %.1ff, %.1ff, %.1ff, // adsr' % tuple([e2f(c[x]) for x in ['a', 'd', 's', 'r']]), + ' %.1ff, %.1ff, %.1ff, %.1ff, // adsr' % tuple([e2f(m[x]) for x in ['a', 'd', 's', 'r']]), + ' };', + ' std::vector v_i_params_%d (i_params_%d, i_params_%d + sizeof(i_params_%d) / sizeof(float));' % (ts,ts,ts,ts), + ' programs["Instr %d"] = std::vector(v_i_params_%d);' % (ts, ts), + ] print - print ' const float i_params_%d[] = {' % ts - print ' %.6ff, %.6ff, // waveforms' % (W2F[c['wav']], W2F[m['wav']]) - print ' %.6ff, %.6ff, // frq multipliers' % (m2f(c['fm_mult']), m2f(m['fm_mult'])) - print ' %.6ff, %.6ff, // attenuation' % (a2f(c['db']), a2f(m['db'])) - 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']]) - print ' };' - print ' std::vector v_i_params_%d (i_params_%d, i_params_%d + sizeof(i_params_%d) / sizeof(float));' % (ts,ts,ts,ts) - print ' programs["Instr %d"] = std::vector(v_i_params_%d);' % (ts, ts) + print '\n'.join(lines) except KeyError: - print 'incomplete instrument?' + pass + #print + #print '// incomplete instrument..' def main(argv): events = parse_opldump(sys.stdin)