LADSPA port default value loading (engine side)
git-svn-id: http://svn.drobilla.net/lad@77 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
parent
e689045616
commit
a9c2f87953
|
@ -57,8 +57,6 @@ public:
|
|||
|
||||
void process(samplecount nframes);
|
||||
|
||||
//void tie(OutputPort<T>* const port);
|
||||
|
||||
bool is_connected() const { return (m_connections.size() > 0); }
|
||||
bool is_connected_to(const OutputPort<T>* const port) const;
|
||||
|
||||
|
@ -75,8 +73,6 @@ private:
|
|||
List<TypedConnection<T>*> m_connections;
|
||||
|
||||
// This is just stupid...
|
||||
//using TypedPort<T>::m_is_tied;
|
||||
//using TypedPort<T>::m_tied_port;
|
||||
using TypedPort<T>::m_buffers;
|
||||
using TypedPort<T>::_poly;
|
||||
using TypedPort<T>::_index;
|
||||
|
|
|
@ -114,10 +114,11 @@ LADSPANode::instantiate()
|
|||
sample default_val = default_port_value(j);
|
||||
|
||||
// Set default control val
|
||||
if (port->buffer_size() == 1)
|
||||
if (port->buffer_size() == 1) {
|
||||
((TypedPort<sample>*)port)->set_value(default_val, 0);
|
||||
else
|
||||
} else {
|
||||
((TypedPort<sample>*)port)->set_value(0.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -144,10 +145,10 @@ LADSPANode::activate()
|
|||
for (unsigned long j=0; j < _descriptor->PortCount; ++j) {
|
||||
port = static_cast<TypedPort<sample>*>(_ports->at(j));
|
||||
set_port_buffer(i, j, ((TypedPort<sample>*)_ports->at(j))->buffer(i)->data());
|
||||
if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
|
||||
/* if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
|
||||
port->set_value(0.0f, 0); // FIXME
|
||||
else if (port->type() == DataType::FLOAT && port->buffer_size() > 1)
|
||||
port->set_value(0.0f, 0);
|
||||
port->set_value(0.0f, 0);*/
|
||||
}
|
||||
if (_descriptor->activate != NULL)
|
||||
_descriptor->activate(_instances[i]);
|
||||
|
@ -328,6 +329,7 @@ LADSPANode::default_port_value(ulong port_index)
|
|||
}
|
||||
}
|
||||
|
||||
cerr << path() << " Port " << port_index << " LADSPA Default value: " << normal << endl;
|
||||
// FIXME: set min/max as metadata
|
||||
return normal;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ libingen_la_SOURCES = \
|
|||
InputPort.h \
|
||||
InputPort.cpp \
|
||||
OutputPort.h \
|
||||
OutputPort.cpp \
|
||||
DuplexPort.h \
|
||||
DuplexPort.cpp \
|
||||
MidiMessage.h \
|
||||
|
|
|
@ -88,17 +88,6 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch)
|
|||
void
|
||||
ObjectSender::send_node(ClientInterface* client, const Node* node)
|
||||
{
|
||||
// Don't send node notification for bridge nodes, from the client's
|
||||
// perspective they don't even exist (just the ports they represent)
|
||||
// FIXME: hack, these nodes probably shouldn't even exist in the
|
||||
// engine anymore
|
||||
/*if (const_cast<Node*>(node)->as_port()) { // bridge node if as_port() returns non-NULL
|
||||
// FIXME: remove this whole thing. shouldn't be any bridge nodes anymore
|
||||
assert(false);
|
||||
send_port(client, const_cast<Node*>(node)->as_port());
|
||||
return;
|
||||
}*/
|
||||
|
||||
const Plugin* const plugin = node->plugin();
|
||||
|
||||
int polyphonic =
|
||||
|
@ -163,9 +152,12 @@ ObjectSender::send_port(ClientInterface* client, const Port* port)
|
|||
client->new_port(port->path(), type, port->is_output());
|
||||
|
||||
// Send control value
|
||||
if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
|
||||
client->control_change(port->path(),
|
||||
dynamic_cast<const TypedPort<sample>*>(port)->buffer(0)->value_at(0));
|
||||
if (port->type() == DataType::FLOAT && port->buffer_size() == 1) {
|
||||
sample default_value = dynamic_cast<const TypedPort<sample>*>(
|
||||
port)->buffer(0)->value_at(0);
|
||||
cerr << port->path() << " sending default value " << default_value << endl;
|
||||
client->control_change(port->path(), default_value);
|
||||
}
|
||||
|
||||
// Send metadata
|
||||
const map<string, string>& data = port->metadata();
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard.
|
||||
*
|
||||
* Om is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* Om 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 details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "OutputPort.h"
|
||||
#include "InputPort.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Om {
|
||||
|
||||
template<typename T>
|
||||
OutputPort<T>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size)
|
||||
: TypedPort<T>(parent, name, index, poly, type, buffer_size)
|
||||
{
|
||||
}
|
||||
template OutputPort<sample>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
|
||||
template OutputPort<MidiMessage>::OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
|
||||
|
||||
#if 0
|
||||
template<typename T>
|
||||
void
|
||||
OutputPort<T>::set_tied_port(InputPort<T>* port)
|
||||
{
|
||||
//assert(!m_is_tied);
|
||||
//assert(m_tied_port == NULL);
|
||||
assert(static_cast<TypedPort<T>*>(port) != static_cast<TypedPort<T>*>(this));
|
||||
assert(port != NULL);
|
||||
|
||||
//m_is_tied = true;
|
||||
//m_tied_port = (TypedPort<T>*)port;
|
||||
}
|
||||
template void OutputPort<sample>::set_tied_port(InputPort<sample>* port);
|
||||
template void OutputPort<MidiMessage>::set_tied_port(InputPort<MidiMessage>* port);
|
||||
#endif
|
||||
|
||||
} // namespace Om
|
||||
|
|
@ -42,11 +42,14 @@ template <typename T>
|
|||
class OutputPort : virtual public TypedPort<T>
|
||||
{
|
||||
public:
|
||||
OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
|
||||
OutputPort(Node* parent, const string& name,
|
||||
size_t index, size_t poly,
|
||||
DataType type, size_t buffer_size)
|
||||
: TypedPort<T>(parent, name, index, poly, type, buffer_size)
|
||||
{}
|
||||
|
||||
virtual ~OutputPort() {}
|
||||
|
||||
//void set_tied_port(InputPort<T>* port);
|
||||
|
||||
bool is_input() const { return false; }
|
||||
bool is_output() const { return true; }
|
||||
|
||||
|
@ -54,9 +57,6 @@ private:
|
|||
// Prevent copies (undefined)
|
||||
OutputPort(const OutputPort& copy);
|
||||
OutputPort<T>& operator=(const OutputPort<T>&);
|
||||
|
||||
//using TypedPort<T>::m_is_tied;
|
||||
//using TypedPort<T>::m_tied_port;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@ template <typename T>
|
|||
TypedPort<T>::TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size)
|
||||
: Port(parent, name, index, poly, type, buffer_size)
|
||||
, m_fixed_buffers(false)
|
||||
/*, m_is_tied(false)
|
||||
, m_tied_port(NULL)*/
|
||||
{
|
||||
allocate_buffers();
|
||||
clear_buffers();
|
||||
|
@ -66,6 +64,8 @@ TypedPort<sample>::set_value(sample val, size_t offset)
|
|||
if (offset >= _buffer_size)
|
||||
offset = 0;
|
||||
assert(offset < _buffer_size);
|
||||
|
||||
cerr << path() << " setting value " << val << endl;
|
||||
|
||||
for (size_t v=0; v < _poly; ++v)
|
||||
m_buffers.at(v)->set(val, offset);
|
||||
|
@ -80,6 +80,8 @@ TypedPort<sample>::set_value(size_t voice, sample val, size_t offset)
|
|||
if (offset >= _buffer_size)
|
||||
offset = 0;
|
||||
assert(offset < _buffer_size);
|
||||
|
||||
cerr << path() << " setting voice value " << val << endl;
|
||||
|
||||
m_buffers.at(voice)->set(val, offset);
|
||||
}
|
||||
|
|
|
@ -52,9 +52,6 @@ public:
|
|||
virtual void process(samplecount nframes);
|
||||
virtual void clear_buffers();
|
||||
|
||||
//TypedPort* tied_port() const { return m_tied_port; }
|
||||
//void untie() { m_is_tied = false; m_tied_port = NULL; }
|
||||
|
||||
/** Used by drivers to prevent port from changing buffers */
|
||||
void fixed_buffers(bool b) { m_fixed_buffers = b; }
|
||||
bool fixed_buffers() { return m_fixed_buffers; }
|
||||
|
@ -68,9 +65,7 @@ protected:
|
|||
|
||||
void allocate_buffers();
|
||||
|
||||
bool m_fixed_buffers;
|
||||
//bool m_is_tied;
|
||||
//TypedPort* m_tied_port;
|
||||
bool m_fixed_buffers;
|
||||
|
||||
Array<Buffer<T>*> m_buffers;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue