summaryrefslogtreecommitdiff
path: root/plugin/drumgizmo_plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/drumgizmo_plugin.cc')
-rw-r--r--plugin/drumgizmo_plugin.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index be11753..6563dcc 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -11,16 +11,16 @@
* This file is part of DrumGizmo.
*
* DrumGizmo is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* DrumGizmo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Lesser General Public License
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
@@ -265,7 +265,26 @@ void DrumGizmoPlugin::Output::pre(size_t nsamples)
void DrumGizmoPlugin::Output::run(int ch, sample_t *samples, size_t nsamples)
{
-// assert(false);
+ assert(plugin.output_samples);
+
+ assert(sizeof(float) == sizeof(sample_t));
+
+ if((std::size_t)ch >= plugin.output_samples->size())
+ {
+ return;
+ }
+
+ if((*plugin.output_samples)[ch] == nullptr)
+ {
+ // Port not connected.
+ return;
+ }
+
+ // We are not running directly on the internal buffer: do a copy.
+ if((*plugin.output_samples)[ch] != samples)
+ {
+ memcpy((*plugin.output_samples)[ch], samples, nsamples * sizeof(sample_t));
+ }
}
void DrumGizmoPlugin::Output::post(size_t nsamples)