Renamed PortBase to TypedPort

git-svn-id: http://svn.drobilla.net/lad@60 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-06-19 00:42:15 +00:00
parent 521e4601ef
commit 4fb7a9ecf8
27 changed files with 77 additions and 77 deletions

View File

@ -25,7 +25,7 @@
#include "Maid.h"
#include "AudioDriver.h"
#include "MidiMessage.h"
#include "PortBase.h"
#include "TypedPort.h"
#ifdef HAVE_LASH
#include "LashDriver.h"
#endif
@ -36,7 +36,7 @@ namespace Om {
//// AlsaMidiPort ////
AlsaMidiPort::AlsaMidiPort(AlsaMidiDriver* driver, PortBase<MidiMessage>* port)
AlsaMidiPort::AlsaMidiPort(AlsaMidiDriver* driver, TypedPort<MidiMessage>* port)
: DriverPort(),
ListNode<AlsaMidiPort*>(this),
m_driver(driver),

View File

@ -27,7 +27,7 @@ namespace Om {
class Node;
class SetPortValueEvent;
class AlsaMidiDriver;
template <typename T> class PortBase;
template <typename T> class TypedPort;
static const int MAX_MIDI_EVENT_SIZE = 3;
@ -39,7 +39,7 @@ static const int MAX_MIDI_EVENT_SIZE = 3;
class AlsaMidiPort : public DriverPort, public ListNode<AlsaMidiPort*>
{
public:
AlsaMidiPort(AlsaMidiDriver* driver, PortBase<MidiMessage>* port);
AlsaMidiPort(AlsaMidiDriver* driver, TypedPort<MidiMessage>* port);
virtual ~AlsaMidiPort();
void event(snd_seq_event_t* const ev);
@ -51,7 +51,7 @@ public:
void set_name(const string& name);
int port_id() const { return m_port_id; }
PortBase<MidiMessage>* patch_port() const { return m_patch_port; }
TypedPort<MidiMessage>* patch_port() const { return m_patch_port; }
private:
// Prevent copies (undefined)
@ -59,7 +59,7 @@ private:
AlsaMidiPort& operator=(const AlsaMidiPort&);
AlsaMidiDriver* m_driver;
PortBase<MidiMessage>* m_patch_port;
TypedPort<MidiMessage>* m_patch_port;
int m_port_id;
unsigned char** m_midi_pool; ///< Pool of raw MIDI events for MidiMessage::buffer
Queue<snd_seq_event_t> m_events;
@ -86,7 +86,7 @@ public:
void prepare_block(const samplecount block_start, const samplecount block_end);
DriverPort* create_port(PortBase<MidiMessage>* patch_port)
DriverPort* create_port(TypedPort<MidiMessage>* patch_port)
{ return new AlsaMidiPort(this, patch_port); }
snd_seq_t* seq_handle() const { return m_seq_handle; }

View File

@ -25,7 +25,7 @@ namespace Om {
class Patch;
class AudioDriver;
template <typename T> class PortBase;
template <typename T> class TypedPort;
/** Audio driver abstract base class.

View File

@ -26,7 +26,7 @@
#include "Patch.h"
#include "Node.h"
#include "Plugin.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "Connection.h"
#include "AudioDriver.h"
#include "ObjectSender.h"

View File

@ -71,7 +71,7 @@ template <>
inline Buffer<sample>*
ConnectionBase<sample>::buffer(size_t voice) const
{
PortBase<sample>* const src_port = (PortBase<sample>*)m_src_port;
TypedPort<sample>* const src_port = (TypedPort<sample>*)m_src_port;
if (m_is_poly_to_mono) {
return m_local_buffer;
@ -92,7 +92,7 @@ ConnectionBase<MidiMessage>::buffer(size_t voice) const
assert(m_src_port->poly() == 1);
assert(m_dst_port->poly() == 1);
PortBase<MidiMessage>* const src_port = (PortBase<MidiMessage>*)m_src_port;
TypedPort<MidiMessage>* const src_port = (TypedPort<MidiMessage>*)m_src_port;
return src_port->buffer(0);
}

View File

@ -108,7 +108,7 @@ void
DSSINode::set_control(size_t port_num, sample val)
{
assert(port_num < _descriptor->PortCount);
((PortBase<sample>*)_ports->at(port_num))->set_value(val, 0);
((TypedPort<sample>*)_ports->at(port_num))->set_value(val, 0);
}
@ -242,7 +242,7 @@ DSSINode::send_update()
// send "control"s
for (size_t i=0; i < _ports->size(); ++i)
if (_ports->at(i)->type() == DataType::FLOAT && _ports->at(i)->buffer_size() == 1)
send_control(_ports->at(i)->num(), ((PortBase<sample>*)_ports->at(i))->buffer(0)->value_at(0));
send_control(_ports->at(i)->num(), ((TypedPort<sample>*)_ports->at(i))->buffer(0)->value_at(0));
// send "show" FIXME: not to spec
send_show();

View File

@ -22,7 +22,7 @@ using std::string;
namespace Om {
template <typename T> class PortBase;
template <typename T> class TypedPort;
/** Representation of a system (outside Om, ie hardware) audio port.
@ -77,7 +77,7 @@ public:
*
* May return NULL if the Driver can not drive the port for some reason.
*/
virtual DriverPort* create_port(PortBase<T>* patch_port) = 0;
virtual DriverPort* create_port(TypedPort<T>* patch_port) = 0;
};
@ -102,7 +102,7 @@ public:
void enable() {}
void disable() {}
DriverPort* create_port(PortBase<sample>* patch_port) { return NULL; }
DriverPort* create_port(TypedPort<sample>* patch_port) { return NULL; }
};
#endif

View File

@ -32,7 +32,7 @@ namespace Om {
template <typename T>
InputPort<T>::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size)
: PortBase<T>(parent, name, index, poly, type, buffer_size)
: TypedPort<T>(parent, name, index, poly, type, buffer_size)
{
}
template InputPort<sample>::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);

View File

@ -20,7 +20,7 @@
#include <string>
#include <cstdlib>
#include <cassert>
#include "PortBase.h"
#include "TypedPort.h"
#include "List.h"
#include "MidiMessage.h"
using std::string;
@ -44,7 +44,7 @@ class Node;
* \ingroup engine
*/
template <typename T>
class InputPort : public PortBase<T>
class InputPort : public TypedPort<T>
{
public:
InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
@ -75,13 +75,13 @@ private:
List<ConnectionBase<T>*> m_connections;
// This is just stupid...
using PortBase<T>::m_is_tied;
using PortBase<T>::m_tied_port;
using PortBase<T>::m_buffers;
using PortBase<T>::_poly;
using PortBase<T>::_index;
using PortBase<T>::_buffer_size;
using PortBase<T>::m_fixed_buffers;
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;
using TypedPort<T>::_buffer_size;
using TypedPort<T>::m_fixed_buffers;
};

View File

@ -32,7 +32,7 @@
#include "Port.h"
#include "MidiDriver.h"
#include "List.h"
#include "PortBase.h"
#include "TypedPort.h"
#ifdef HAVE_LASH
#include "LashDriver.h"
#endif
@ -45,7 +45,7 @@ namespace Om {
//// JackAudioPort ////
JackAudioPort::JackAudioPort(JackAudioDriver* driver, PortBase<sample>* patch_port)
JackAudioPort::JackAudioPort(JackAudioDriver* driver, TypedPort<sample>* patch_port)
: DriverPort(),
ListNode<JackAudioPort*>(this),
m_driver(driver),
@ -241,7 +241,7 @@ JackAudioDriver::remove_port(JackAudioPort* port)
DriverPort*
JackAudioDriver::create_port(PortBase<sample>* patch_port)
JackAudioDriver::create_port(TypedPort<sample>* patch_port)
{
if (patch_port->buffer_size() == m_buffer_size)
return new JackAudioPort(this, patch_port);

View File

@ -27,7 +27,7 @@ namespace Om {
class Patch;
class Port;
template <typename T> class PortBase;
template <typename T> class TypedPort;
class JackAudioDriver;
typedef jack_default_audio_sample_t jack_sample_t;
@ -39,7 +39,7 @@ typedef jack_default_audio_sample_t jack_sample_t;
class JackAudioPort : public DriverPort, public ListNode<JackAudioPort*>
{
public:
JackAudioPort(JackAudioDriver* driver, PortBase<sample>* patch_port);
JackAudioPort(JackAudioDriver* driver, TypedPort<sample>* patch_port);
~JackAudioPort();
void add_to_driver();
@ -51,7 +51,7 @@ public:
jack_port_t* jack_port() const { return m_jack_port; }
DriverBuffer<sample>* buffer() const { return m_jack_buffer; }
void jack_buffer(jack_sample_t* s) { m_jack_buffer->set_data(s); }
PortBase<sample>* patch_port() const { return m_patch_port; }
TypedPort<sample>* patch_port() const { return m_patch_port; }
private:
// Prevent copies (undefined)
@ -61,7 +61,7 @@ private:
JackAudioDriver* m_driver;
jack_port_t* m_jack_port;
DriverBuffer<sample>* m_jack_buffer;
PortBase<sample>* m_patch_port;
TypedPort<sample>* m_patch_port;
};
@ -88,7 +88,7 @@ public:
void process_events(jack_nframes_t block_start, jack_nframes_t block_end);
DriverPort* create_port(PortBase<sample>* patch_port);
DriverPort* create_port(TypedPort<sample>* patch_port);
Patch* root_patch() { return m_root_patch; }
void set_root_patch(Patch* patch) { m_root_patch = patch; }

View File

@ -26,7 +26,7 @@
#include "Maid.h"
#include "AudioDriver.h"
#include "MidiMessage.h"
#include "PortBase.h"
#include "TypedPort.h"
#ifdef HAVE_LASH
#include "LashDriver.h"
#endif
@ -37,7 +37,7 @@ namespace Om {
//// JackMidiPort ////
JackMidiPort::JackMidiPort(JackMidiDriver* driver, PortBase<MidiMessage>* patch_port)
JackMidiPort::JackMidiPort(JackMidiDriver* driver, TypedPort<MidiMessage>* patch_port)
: DriverPort(),
ListNode<JackMidiPort*>(this),
m_driver(driver),

View File

@ -29,7 +29,7 @@ namespace Om {
class Node;
class SetPortValueEvent;
class JackMidiDriver;
template <typename T> class PortBase;
template <typename T> class TypedPort;
/** Representation of an JACK MIDI port.
@ -39,7 +39,7 @@ template <typename T> class PortBase;
class JackMidiPort : public DriverPort, public ListNode<JackMidiPort*>
{
public:
JackMidiPort(JackMidiDriver* driver, PortBase<MidiMessage>* port);
JackMidiPort(JackMidiDriver* driver, TypedPort<MidiMessage>* port);
virtual ~JackMidiPort();
void prepare_block(const samplecount block_start, const samplecount block_end);
@ -48,7 +48,7 @@ public:
void remove_from_driver();
void set_name(const string& name) { jack_port_set_name(m_jack_port, name.c_str()); };
PortBase<MidiMessage>* patch_port() const { return m_patch_port; }
TypedPort<MidiMessage>* patch_port() const { return m_patch_port; }
private:
// Prevent copies (undefined)
@ -57,7 +57,7 @@ private:
JackMidiDriver* m_driver;
jack_port_t* m_jack_port;
PortBase<MidiMessage>* m_patch_port;
TypedPort<MidiMessage>* m_patch_port;
};
@ -84,7 +84,7 @@ public:
void prepare_block(const samplecount block_start, const samplecount block_end);
JackMidiPort* create_port(PortBase<MidiMessage>* patch_port)
JackMidiPort* create_port(TypedPort<MidiMessage>* patch_port)
{ return new JackMidiPort(this, patch_port); }
jack_client_t* jack_client() { return m_client; }

View File

@ -119,9 +119,9 @@ LADSPANode::instantiate()
// Set default control val
if (port->buffer_size() == 1)
((PortBase<sample>*)port)->set_value(default_val, 0);
((TypedPort<sample>*)port)->set_value(default_val, 0);
else
((PortBase<sample>*)port)->set_value(0.0f, 0);
((TypedPort<sample>*)port)->set_value(0.0f, 0);
}
return true;
@ -142,12 +142,12 @@ LADSPANode::activate()
{
NodeBase::activate();
PortBase<sample>* port = NULL;
TypedPort<sample>* port = NULL;
for (size_t i=0; i < _poly; ++i) {
for (unsigned long j=0; j < _descriptor->PortCount; ++j) {
port = static_cast<PortBase<sample>*>(_ports->at(j));
set_port_buffer(i, j, ((PortBase<sample>*)_ports->at(j))->buffer(i)->data());
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)
port->set_value(0.0f, 0); // FIXME
else if (port->type() == DataType::FLOAT && port->buffer_size() > 1)

View File

@ -114,9 +114,9 @@ LV2Node::instantiate()
// Set default control val
/*if (pi->is_control())
((PortBase<sample>*)port)->set_value(pi->default_val(), 0);
((TypedPort<sample>*)port)->set_value(pi->default_val(), 0);
else
((PortBase<sample>*)port)->set_value(0.0f, 0);*/
((TypedPort<sample>*)port)->set_value(0.0f, 0);*/
}
return true;
}
@ -136,12 +136,12 @@ LV2Node::activate()
{
NodeBase::activate();
PortBase<sample>* port = NULL;
TypedPort<sample>* port = NULL;
for (size_t i=0; i < _poly; ++i) {
for (unsigned long j=0; j < num_ports(); ++j) {
port = static_cast<PortBase<sample>*>(_ports->at(j));
set_port_buffer(i, j, ((PortBase<sample>*)_ports->at(j))->buffer(i)->data());
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)
port->set_value(0.0f, 0); // FIXME
else if (port->type() == DataType::FLOAT && port->buffer_size() > 1)

View File

@ -41,8 +41,8 @@ libom_la_SOURCES = \
Buffer.cpp \
Port.h \
Port.cpp \
PortBase.h \
PortBase.cpp \
TypedPort.h \
TypedPort.cpp \
InputPort.h \
InputPort.cpp \
OutputPort.h \

View File

@ -66,7 +66,7 @@ public:
void enable() {}
void disable() {}
DriverPort* create_port(PortBase<MidiMessage>* patch_port) { return NULL; }
DriverPort* create_port(TypedPort<MidiMessage>* patch_port) { return NULL; }
void prepare_block(const samplecount block_start, const samplecount block_end) {}
};

View File

@ -26,7 +26,7 @@
#include "Patch.h"
#include "Node.h"
#include "Plugin.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "Connection.h"
#include "AudioDriver.h"
#include "interface/ClientInterface.h"
@ -278,7 +278,7 @@ void OSCClient::new_node(const string& plugin_type,
// Send control values
for (size_t i=0; i < node->ports().size(); ++i) {
PortBase<sample>* port = (PortBase<sample>*)node->ports().at(i);
TypedPort<sample>* port = (TypedPort<sample>*)node->ports().at(i);
if (port->port_info()->is_input() && port->port_info()->is_control())
control_change(port->path(), port->buffer(0)->value_at(0));
}

View File

@ -22,7 +22,7 @@
#include "Patch.h"
#include "Node.h"
#include "Port.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "Connection.h"
#include "NodeFactory.h"
@ -72,7 +72,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch)
// Control port, send value
if (port->type() == DataType::FLOAT && port->buffer_size() == 1)
client->control_change(port->path(), ((PortBase<sample>*)port)->buffer(0)->value_at(0));
client->control_change(port->path(), ((TypedPort<sample>*)port)->buffer(0)->value_at(0));
}
// Send metadata

View File

@ -22,7 +22,7 @@ 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)
: PortBase<T>(parent, name, index, poly, type, 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);
@ -35,11 +35,11 @@ OutputPort<T>::set_tied_port(InputPort<T>* port)
{
assert(!m_is_tied);
assert(m_tied_port == NULL);
assert(static_cast<PortBase<T>*>(port) != static_cast<PortBase<T>*>(this));
assert(static_cast<TypedPort<T>*>(port) != static_cast<TypedPort<T>*>(this));
assert(port != NULL);
m_is_tied = true;
m_tied_port = (PortBase<T>*)port;
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);

View File

@ -19,7 +19,7 @@
#include <string>
#include <cstdlib>
#include "PortBase.h"
#include "TypedPort.h"
#include "types.h"
namespace Om {
@ -39,7 +39,7 @@ template <typename T> class InputPort;
* \ingroup engine
*/
template <typename T>
class OutputPort : public PortBase<T>
class OutputPort : public TypedPort<T>
{
public:
OutputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size);
@ -55,8 +55,8 @@ private:
OutputPort(const OutputPort& copy);
OutputPort<T>& operator=(const OutputPort<T>&);
using PortBase<T>::m_is_tied;
using PortBase<T>::m_tied_port;
using TypedPort<T>::m_is_tied;
using TypedPort<T>::m_tied_port;
};

View File

@ -26,7 +26,7 @@
#include "Connection.h"
#include "Om.h"
#include "OmApp.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "ObjectStore.h"
#include "InputPort.h"
#include "OutputPort.h"
@ -169,7 +169,7 @@ Patch::send_creation_messages(ClientInterface* client) const
// If this is a bridge (input/output) node, send the patch control value as well
if (port != NULL && port->port_info()->is_control())
om->client_broadcaster()->send_control_change_to(client, port->path(),
((PortBase<sample>*)port)->buffer(0)->value_at(0));
((TypedPort<sample>*)port)->buffer(0)->value_at(0));
}
for (List<Connection*>::const_iterator j = _connections.begin(); j != _connections.end(); ++j) {
@ -187,7 +187,7 @@ Patch::send_creation_messages(ClientInterface* client) const
if (port->port_info()->is_control())
om->client_broadcaster()->send_control_change_to(client, port->path(),
((PortBase<sample>*)port)->buffer(0)->value_at(0));
((TypedPort<sample>*)port)->buffer(0)->value_at(0));
}*/
}
#endif

View File

@ -20,7 +20,7 @@
#include "Om.h"
#include "OmApp.h"
#include "interface/ClientInterface.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
@ -53,7 +53,7 @@ void
RequestPortValueEvent::execute(samplecount offset)
{
if (m_port != NULL && m_port->type() == DataType::FLOAT)
m_value = ((PortBase<sample>*)m_port)->buffer(0)->value_at(offset);
m_value = ((TypedPort<sample>*)m_port)->buffer(0)->value_at(offset);
else
m_port = NULL; // triggers error response

View File

@ -18,7 +18,7 @@
#include "Responder.h"
#include "Om.h"
#include "OmApp.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "ClientBroadcaster.h"
#include "Node.h"
#include "ObjectStore.h"
@ -62,10 +62,10 @@ SetPortValueEvent::execute(samplecount offset)
m_error = TYPE_MISMATCH;
} else {
if (m_voice_num == -1)
((PortBase<sample>*)m_port)->set_value(m_val, offset);
((TypedPort<sample>*)m_port)->set_value(m_val, offset);
else
((PortBase<sample>*)m_port)->set_value(m_voice_num, m_val, offset);
//((PortBase<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
((TypedPort<sample>*)m_port)->set_value(m_voice_num, m_val, offset);
//((TypedPort<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
}
}

View File

@ -18,7 +18,7 @@
#include "Responder.h"
#include "Om.h"
#include "OmApp.h"
#include "PortBase.h"
#include "TypedPort.h"
#include "ClientBroadcaster.h"
#include "Plugin.h"
#include "Node.h"
@ -75,9 +75,9 @@ SetPortValueQueuedEvent::execute(samplecount offset)
if (m_error == NO_ERROR) {
assert(m_port != NULL);
if (m_voice_num == -1)
((PortBase<sample>*)m_port)->set_value(m_val, offset);
((TypedPort<sample>*)m_port)->set_value(m_val, offset);
else
((PortBase<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
((TypedPort<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range
}
}