ardour
Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ARDOUR::Bundle Class Reference

#include <bundle.h>

Inheritance diagram for ARDOUR::Bundle:
PBD::ScopedConnectionList ARDOUR::AutoBundle ARDOUR::UserBundle

Classes

struct  Channel
 

Public Types

enum  Change {
  NameChanged = 0x1, ConfigurationChanged = 0x2, PortsChanged = 0x4, TypeChanged = 0x8,
  DirectionChanged = 0x10
}
 
typedef std::vector< std::string > PortList
 

Public Member Functions

 Bundle (bool i=true)
 
 Bundle (std::string const &, bool i=true)
 
 Bundle (boost::shared_ptr< Bundle >)
 
virtual ~Bundle ()
 
ChanCount nchannels () const
 
PortList const & channel_ports (uint32_t) const
 
void add_channel (std::string const &, DataType)
 
void add_channel (std::string const &, DataType, std::string const &)
 
void add_channel (std::string const &, DataType, PortList)
 
std::string channel_name (uint32_t) const
 
DataType channel_type (uint32_t) const
 
void set_channel_name (uint32_t, std::string const &)
 
void add_port_to_channel (uint32_t, std::string)
 
void set_port (uint32_t, std::string)
 
void remove_port_from_channel (uint32_t, std::string)
 
void remove_ports_from_channel (uint32_t)
 
void remove_ports_from_channels ()
 
bool port_attached_to_channel (uint32_t, std::string)
 
bool offers_port (std::string) const
 
bool offers_port_alone (std::string) const
 
void remove_channel (uint32_t)
 
void remove_channels ()
 
void add_channels_from_bundle (boost::shared_ptr< Bundle >)
 
void connect (boost::shared_ptr< Bundle >, AudioEngine &)
 
void disconnect (boost::shared_ptr< Bundle >, AudioEngine &)
 
bool connected_to (boost::shared_ptr< Bundle >, AudioEngine &)
 
bool connected_to_anything (AudioEngine &)
 
bool has_same_ports (boost::shared_ptr< Bundle >) const
 
uint32_t type_channel_to_overall (DataType, uint32_t) const
 
uint32_t overall_channel_to_type (DataType, uint32_t) const
 
void set_name (std::string const &)
 
std::string name () const
 
void set_ports_are_inputs ()
 
void set_ports_are_outputs ()
 
bool ports_are_inputs () const
 
bool ports_are_outputs () const
 
void suspend_signals ()
 
void resume_signals ()
 
bool operator== (Bundle const &other)
 
- Public Member Functions inherited from PBD::ScopedConnectionList
 ScopedConnectionList ()
 
virtual ~ScopedConnectionList ()
 
void add_connection (const UnscopedConnection &c)
 
void drop_connections ()
 

Public Attributes

PBD::Signal1< void, ChangeChanged
 

Protected Attributes

Glib::Threads::Mutex _channel_mutex
 
std::vector< Channel_channel
 

Private Member Functions

int set_channels (std::string const &)
 
int parse_io_string (std::string const &, std::vector< std::string > &)
 
void emit_changed (Change)
 

Private Attributes

std::string _name
 
bool _ports_are_inputs
 
bool _signals_suspended
 
Change _pending_change
 

Detailed Description

A set of `channels', each of which is associated with 0 or more ports. Each channel has a name which can be anything useful, and a data type. Intended for grouping things like, for example, a buss' outputs. `Channel' is a rather overloaded term but I can't think of a better one right now.

Definition at line 43 of file bundle.h.

Member Typedef Documentation

typedef std::vector<std::string> ARDOUR::Bundle::PortList

List of ports associated with a channel. We can't use a PortSet because we might want to involve non-Ardour ports (ie those without a Port object)

Definition at line 50 of file bundle.h.

Member Enumeration Documentation

Things that might change about this bundle

Enumerator
NameChanged 

the bundle name or a channel name has changed

ConfigurationChanged 

the number of channels has changed

PortsChanged 

the port list associated with one of our channels has changed

TypeChanged 

the data type has changed

DirectionChanged 

the direction (whether ports are inputs or outputs) has changed

Definition at line 123 of file bundle.h.

Constructor & Destructor Documentation

Bundle::Bundle ( bool  i = true)

Construct an audio bundle.

Parameters
itrue if ports are inputs, otherwise false.

Definition at line 35 of file bundle.cc.

Bundle::Bundle ( std::string const &  n,
bool  i = true 
)

Construct an audio bundle.

Parameters
nName.
itrue if ports are inputs, otherwise false.

Definition at line 48 of file bundle.cc.

Bundle::Bundle ( boost::shared_ptr< Bundle other)

Definition at line 57 of file bundle.cc.

virtual ARDOUR::Bundle::~Bundle ( )
inlinevirtual

Definition at line 72 of file bundle.h.

Member Function Documentation

void Bundle::add_channel ( std::string const &  n,
DataType  t 
)
Parameters
nChannel name

Definition at line 155 of file bundle.cc.

void Bundle::add_channel ( std::string const &  n,
DataType  t,
std::string const &  p 
)
Parameters
nChannel name

Definition at line 179 of file bundle.cc.

void Bundle::add_channel ( std::string const &  n,
DataType  t,
PortList  p 
)
Parameters
nChannel name

Definition at line 167 of file bundle.cc.

void Bundle::add_channels_from_bundle ( boost::shared_ptr< Bundle other)

Take the channels from another bundle and add them to this bundle, so that channels from other are added to this (with their ports) and are named "<other_bundle_name> <other_channel_name>".

Definition at line 296 of file bundle.cc.

void Bundle::add_port_to_channel ( uint32_t  ,
std::string   
)

Add an association between one of our channels and a port.

Parameters
chChannel index.
portnamefull port name to associate with (including prefix).

Definition at line 94 of file bundle.cc.

std::string Bundle::channel_name ( uint32_t  ch) const
Parameters
chChannel.
Returns
Channel name.

Definition at line 266 of file bundle.cc.

Bundle::PortList const & Bundle::channel_ports ( uint32_t  c) const
Parameters
Channelindex.
Returns
Ports associated with this channel.

Definition at line 81 of file bundle.cc.

DataType Bundle::channel_type ( uint32_t  c) const

Definition at line 521 of file bundle.cc.

void Bundle::connect ( boost::shared_ptr< Bundle other,
AudioEngine engine 
)

Connect the ports associated with our channels to the ports associated with another bundle's channels.

Parameters
otherOther bundle.
engineAudioEngine to use to make the connections.

Definition at line 320 of file bundle.cc.

bool Bundle::connected_to ( boost::shared_ptr< Bundle other,
AudioEngine engine 
)

Definition at line 414 of file bundle.cc.

bool Bundle::connected_to_anything ( AudioEngine engine)

This must not be called in code executed as a response to a backend event, as it uses the backend port_get_all_connections().

Returns
true if any of this bundle's channels are connected to anything.

Definition at line 451 of file bundle.cc.

void Bundle::disconnect ( boost::shared_ptr< Bundle other,
AudioEngine engine 
)

Definition at line 338 of file bundle.cc.

void Bundle::emit_changed ( Change  c)
private

Definition at line 404 of file bundle.cc.

bool Bundle::has_same_ports ( boost::shared_ptr< Bundle b) const
Parameters
bOther bundle.
Returns
true if b has the same number of channels as this bundle, and those channels have corresponding ports.

Definition at line 501 of file bundle.cc.

std::string ARDOUR::Bundle::name ( ) const
inline
Returns
Bundle name

Definition at line 110 of file bundle.h.

ChanCount Bundle::nchannels ( ) const
Returns
Number of channels that this Bundle has

Definition at line 68 of file bundle.cc.

bool Bundle::offers_port ( std::string  p) const
Parameters
pPort name.
Returns
true if any channel is associated with p.

Definition at line 229 of file bundle.cc.

bool Bundle::offers_port_alone ( std::string  p) const
Parameters
pPort name.
Returns
true if this bundle offers this port on its own on a channel.

Definition at line 248 of file bundle.cc.

bool Bundle::operator== ( Bundle const &  other)

Definition at line 546 of file bundle.cc.

uint32_t Bundle::overall_channel_to_type ( DataType  t,
uint32_t  c 
) const

Perform the reverse of type_channel_to_overall

Definition at line 600 of file bundle.cc.

int ARDOUR::Bundle::parse_io_string ( std::string const &  ,
std::vector< std::string > &   
)
private
bool Bundle::port_attached_to_channel ( uint32_t  ch,
std::string  portname 
)

Definition at line 190 of file bundle.cc.

bool ARDOUR::Bundle::ports_are_inputs ( ) const
inline

Definition at line 114 of file bundle.h.

bool ARDOUR::Bundle::ports_are_outputs ( ) const
inline

Definition at line 115 of file bundle.h.

void Bundle::remove_channel ( uint32_t  ch)

Remove a channel.

Parameters
chChannel.

Definition at line 202 of file bundle.cc.

void Bundle::remove_channels ( )

Remove all channels

Definition at line 215 of file bundle.cc.

void Bundle::remove_port_from_channel ( uint32_t  ,
std::string   
)

Disassociate a port from one of our channels.

Parameters
chChannel index.
portnameport name to disassociate from.

Definition at line 112 of file bundle.cc.

void Bundle::remove_ports_from_channel ( uint32_t  ch)

Remove all ports from a given channel.

Parameters
chChannel.

Definition at line 374 of file bundle.cc.

void Bundle::remove_ports_from_channels ( )

Remove all ports from all channels

Definition at line 357 of file bundle.cc.

void Bundle::resume_signals ( )

Definition at line 393 of file bundle.cc.

void Bundle::set_channel_name ( uint32_t  ch,
std::string const &  n 
)

Set the name of a channel.

Parameters
chChannel.
nNew name.

Definition at line 279 of file bundle.cc.

int ARDOUR::Bundle::set_channels ( std::string const &  )
private
void Bundle::set_name ( std::string const &  )

Set the name.

Parameters
nNew name.

Definition at line 491 of file bundle.cc.

void Bundle::set_port ( uint32_t  ,
std::string   
)

Set a single port to be associated with a channel, removing any others.

Parameters
chChannel.
portnameFull port name, including prefix.

Definition at line 139 of file bundle.cc.

void Bundle::set_ports_are_inputs ( )

Definition at line 474 of file bundle.cc.

void Bundle::set_ports_are_outputs ( )

Definition at line 481 of file bundle.cc.

void Bundle::suspend_signals ( )

Definition at line 387 of file bundle.cc.

uint32_t Bundle::type_channel_to_overall ( DataType  t,
uint32_t  c 
) const

Given an index of a channel as the nth channel of a particular type, return an index of that channel when considering channels of all types.

e.g. given a bundle with channels: fred [audio] jim [audio] sheila [midi]

If t == MIDI and c == 0, then we would return 2, as 2 is the index of the 0th MIDI channel.

If t == NIL, we just return c.

Definition at line 566 of file bundle.cc.

Member Data Documentation

std::vector<Channel> ARDOUR::Bundle::_channel
protected

Definition at line 138 of file bundle.h.

Glib::Threads::Mutex ARDOUR::Bundle::_channel_mutex
mutableprotected

mutex for _channel_ports and _channel_names XXX: is this necessary?

Definition at line 137 of file bundle.h.

std::string ARDOUR::Bundle::_name
private

Definition at line 145 of file bundle.h.

Change ARDOUR::Bundle::_pending_change
private

Definition at line 149 of file bundle.h.

bool ARDOUR::Bundle::_ports_are_inputs
private

Definition at line 146 of file bundle.h.

bool ARDOUR::Bundle::_signals_suspended
private

Definition at line 148 of file bundle.h.

PBD::Signal1<void,Change> ARDOUR::Bundle::Changed

Definition at line 131 of file bundle.h.


The documentation for this class was generated from the following files: