libpsynth 0.2.1
Classes | Functions
channel_element_type,

channel_element_reference_type, channel_element_const_reference_type, get_channel, contains_channel More...

Classes

struct  psynth::sound::contains_channel< ChannelBase, Channel >
 A predicate metafunction determining whether a given channel base contains a given channel. More...
struct  psynth::sound::channel_element_type< ChannelBase, Channel >
 Specifies the type of the element associated with a given channel tag. More...
struct  psynth::sound::channel_element_reference_type< ChannelBase, Channel >
 Specifies the return type of the mutable element accessor by channel name, get_channel(channel_base, Channel());. More...
struct  psynth::sound::channel_element_const_reference_type< ChannelBase, Channel >
 Specifies the return type of the constant element accessor by channel name, get_channel(channel_base, Channel());. More...

Functions

template<typename ChannelBase , typename Channel >
channel_element_reference_type
< ChannelBase, Channel >::type 
psynth::sound::get_channel (ChannelBase &cb, Channel=Channel())
 Mutable accessor to the element associated with a given channel name.
template<typename ChannelBase , typename Channel >
channel_element_const_reference_type
< ChannelBase, Channel >::type 
psynth::sound::get_channel (const ChannelBase &cb, Channel=Channel())
 Constant accessor to the element associated with a given channel name.

Detailed Description

channel_element_reference_type, channel_element_const_reference_type, get_channel, contains_channel

Support for accessing the elements of a channel base by channel name

Example: A function that takes a generic frame containing a red sample and sets it to 100%:

   template <typename Frame>
   void set_red_to_max(Frame& frame) {
       boost::function_requires<MutableFrameConcept<Frame> >();
       BOOST_STATIC_ASSERT((contains_channel<Frame, red_t>::value));

       typedef typename channel_element_type<Frame, red_t>::type red_sample_t;
       get_channel(frame, red_t()) = sample_traits<red_sample_t>::max_value(); 
   }

Function Documentation

template<typename ChannelBase , typename Channel >
channel_element_reference_type<ChannelBase,Channel>::type psynth::sound::get_channel ( ChannelBase &  cb,
Channel  = Channel() 
)

Mutable accessor to the element associated with a given channel name.

template<typename ChannelBase , typename Channel >
channel_element_const_reference_type<ChannelBase,Channel>::type psynth::sound::get_channel ( const ChannelBase &  cb,
Channel  = Channel() 
)

Constant accessor to the element associated with a given channel name.