128
129
//---------------------------------------------------------
130
// createSynthInstance
130
131
// create a synthesizer instance of class "label"
131
132
//---------------------------------------------------------
133
134
//static SynthI* createSynthI(const QString& sclass)
134
static SynthI* createSynthI(const QString& sclass, const QString& label)
135
static SynthI* createSynthInstance(const QString& sclass, const QString& label)
136
137
//Synth* s = findSynth(sclass);
137
138
Synth* s = findSynth(sclass, label);
285
291
//---------------------------------------------------------
293
//---------------------------------------------------------
295
void SynthI::currentProg(unsigned long *prog, unsigned long *bankL, unsigned long *bankH)
305
//---------------------------------------------------------
287
307
//---------------------------------------------------------
300
320
return _mess->channels();
323
int MessSynthIF::totalOutChannels() const
325
return _mess->channels();
328
int MessSynthIF::totalInChannels() const
303
333
//SynthIF* MessSynth::createSIF() const
304
334
SynthIF* MessSynth::createSIF(SynthI* si)
327
357
setIName(instanceName); // set instrument name
328
358
_sif = s->createSIF(this);
330
AudioTrack::setChannels(_sif->channels());
361
//AudioTrack::setChannels(_sif->channels());
362
AudioTrack::setTotalOutChannels(_sif->totalOutChannels());
363
AudioTrack::setTotalInChannels(_sif->totalInChannels());
332
365
//---------------------------------------------------
333
366
// read available controller from synti
334
367
//---------------------------------------------------
415
unsigned long idx = 0;
383
416
for (std::vector<float>::iterator i = initParams.begin(); i != initParams.end(); ++i, ++idx)
384
417
_sif->setParameter(idx, *i);
419
// p3.3.40 Since we are done with the (sometimes huge) initial parameters list, clear it.
420
// TODO: Decide: Maybe keep them around for a 'reset to previously loaded values' (revert) command? ...
531
569
//SynthI* Song::createSynthI(const QString& sclass)
532
570
SynthI* Song::createSynthI(const QString& sclass, const QString& label)
534
// Added by Tim. p3.3.13
535
572
//printf("Song::createSynthI calling ::createSynthI class:%s\n", sclass.latin1());
537
574
//SynthI* si = ::createSynthI(sclass);
538
SynthI* si = ::createSynthI(sclass, label);
575
//SynthI* si = ::createSynthI(sclass, label);
576
SynthI* si = createSynthInstance(sclass, label);
541
// Added by Tim. p3.3.13
542
579
//printf("Song::createSynthI created SynthI. Before insertTrack1...\n");
544
581
insertTrack1(si, -1);
545
// Added by Tim. p3.3.13
546
582
//printf("Song::createSynthI after insertTrack1. Before msgInsertTrack...\n");
548
584
msgInsertTrack(si, -1, true); // add to instance list
549
// Added by Tim. p3.3.13
550
585
//printf("Song::createSynthI after msgInsertTrack. Before insertTrack3...\n");
552
587
insertTrack3(si, -1);
554
// Added by Tim. p3.3.13
555
589
//printf("Song::createSynthI after insertTrack3. Adding default routes...\n");
557
591
OutputList* ol = song->outputs();
558
592
// add default route to master (first audio output)
559
593
if (!ol->empty()) {
560
594
AudioOutput* ao = ol->front();
561
audio->msgAddRoute(Route(si, -1), Route(ao, -1));
596
//audio->msgAddRoute(Route(si, -1), Route(ao, -1));
597
//audio->msgAddRoute(Route((AudioTrack*)si, -1), Route(ao, -1));
598
// Make sure the route channel and channels are valid.
599
audio->msgAddRoute(Route((AudioTrack*)si, 0, ((AudioTrack*)si)->channels()), Route(ao, 0, ((AudioTrack*)si)->channels()));
562
601
audio->msgUpdateSoloStates();
604
// Now that the track has been added to the lists in insertTrack2(),
605
// if it's a dssi synth, OSC can find the synth, and initialize (and show) its native gui.
606
// No, initializing OSC without actually showing the gui doesn't work, at least for
607
// dssi-vst plugins - without showing the gui they exit after ten seconds.
596
642
xml.qrectTag(level, "geometry", QRect(x, y, w, h));
645
_stringParamMap.write(level, xml, "stringParam");
647
xml.tag(level, "curProgram bankH=\"%ld\" bankL=\"%ld\" prog=\"%ld\"/", _curBankH, _curBankL, _curProgram);
599
649
_sif->write(level, xml);
600
650
xml.etag(level, "SynthI");
630
680
//---------------------------------------------------------
681
// SynthI::readProgram
682
//---------------------------------------------------------
684
void SynthI::readProgram(Xml& xml, const QString& name)
688
Xml::Token token = xml.parse();
689
const QString tag = xml.s1();
700
_curBankH = xml.s2().toUInt();
703
_curBankL = xml.s2().toUInt();
706
_curProgram = xml.s2().toUInt();
719
//---------------------------------------------------------
632
721
//---------------------------------------------------------
655
744
else if (tag == "port")
656
745
port = xml.parseInt();
657
746
else if (tag == "guiVisible")
658
startGui = xml.parseInt();
747
startgui = xml.parseInt();
659
748
else if (tag == "midistate")
660
749
readMidiState(xml);
661
750
else if (tag == "param") {
662
751
float val = xml.parseFloat();
663
752
initParams.push_back(val);
754
else if (tag == "stringParam")
755
_stringParamMap.read(xml, tag);
756
else if (tag == "curProgram")
757
readProgram(xml, tag);
665
758
else if (tag == "geometry")
666
759
r = readGeometry(xml, tag);
667
760
else if (AudioTrack::readProperties(xml, tag))
678
771
song->insertTrack0(this, -1);
679
772
if (port != -1 && port < MIDI_PORTS)
680
773
midiPorts[port].setMidiDevice(this);
775
// Now that the track has been added to the lists in insertTrack2(),
776
// if it's a dssi synth, OSC can find the synth, and initialize (and show) its native gui.
777
// No, initializing OSC without actually showing the gui doesn't work, at least for
778
// dssi-vst plugins - without showing the gui they exit after ten seconds.
682
781
setGeometry(r.x(), r.y(), r.width(), r.height());
684
783
mapRackPluginsToControllers();
785
// Now that the track has been added to the lists in insertTrack2(), if it's a dssi synth
786
// OSC can find the track and its plugins, and start their native guis if required...
787
showPendingPluginNativeGuis();