summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-18 18:14:26 +0000
committerDavid Robillard <d@drobilla.net>2006-06-18 18:14:26 +0000
commit00c8938a79d9e24547420d2a39421bcb7d8cc165 (patch)
treee6ee1db6077d443b84cf62b6fccb7d15112101c7 /src/libs
parente43b05b410d8dddcacbcbbdf34c3679ae3bc983a (diff)
downloadingen-00c8938a79d9e24547420d2a39421bcb7d8cc165.tar.gz
ingen-00c8938a79d9e24547420d2a39421bcb7d8cc165.tar.bz2
ingen-00c8938a79d9e24547420d2a39421bcb7d8cc165.zip
Commit to allow move (broken revision)
git-svn-id: http://svn.drobilla.net/lad/grauph@55 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/DSSIPlugin.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libs/engine/DSSIPlugin.cpp b/src/libs/engine/DSSIPlugin.cpp
index ade48d82..8876f797 100644
--- a/src/libs/engine/DSSIPlugin.cpp
+++ b/src/libs/engine/DSSIPlugin.cpp
@@ -38,9 +38,6 @@ DSSIPlugin::DSSIPlugin(const string& name, size_t poly, Patch* parent, DSSI_Desc
_alsa_events(new snd_seq_event_t[_buffer_size]),
_alsa_encoder(NULL)
{
- if (has_midi_input())
- _num_ports = descriptor->LADSPA_Plugin->PortCount + 1;
-
snd_midi_event_new(3, &_alsa_encoder);
}
@@ -62,16 +59,19 @@ DSSIPlugin::~DSSIPlugin()
bool
DSSIPlugin::instantiate()
{
- if (!LADSPAPlugin::instantiate())
- return false;
+ assert(!_ports);
if (has_midi_input()) {
- assert(_num_ports == _descriptor->PortCount + 1);
- assert(_ports->size() == _descriptor->PortCount + 1);
-
- _midi_in_port = new InputPort<MidiMessage>(this, "MIDI In", _num_ports-1, 1, DataType::MIDI, _buffer_size);
- _ports->at(_num_ports-1) = _midi_in_port;
+ _ports = new Array<Port*>(_descriptor->PortCount + 1);
+ _midi_in_port = new InputPort<MidiMessage>(this, "MIDI In", _ports->size()-1, 1, DataType::MIDI, _buffer_size);
+ _ports->at(_ports->size()-1) = _midi_in_port;
}
+
+ // LADSPAPlugin::instantiate checks if _ports is already allocated
+ if (!LADSPAPlugin::instantiate()) {
+ delete _ports;
+ return false;
+ }
return true;
}