libpsynth 0.2.1
Public Member Functions | Public Attributes
psynth::sound::ChannelBaseConcept< ChannelBase > Struct Template Reference

Channel Base Concepts. More...

#include <concept.hpp>

List of all members.

Public Member Functions

void constraints ()

Public Attributes

ChannelBase cb

Detailed Description

template<typename ChannelBase>
struct psynth::sound::ChannelBaseConcept< ChannelBase >

Channel Base Concepts.

A channel base is a container of channel elements (such as samples, sample references or sample pointers) The most common use of channel base is in the implementation of a frame, in which case the channel elements are sample values. The channel base concept, however, can be used in other scenarios. For example, a planar frame has samples that are not contiguous in memory. Its reference is a proxy class that uses a channel base whose elements are sample references. Its iterator uses a channel base whose elements are sample iterators.

A channel base must have an associated layout (which consists of a channel space, as well as an ordering of the samples). There are two ways to index the elements of a channel base: A physical index corresponds to the way they are ordered in memory, and a semantic index corresponds to the way the elements are ordered in their channel space. For example, in the stereo channel space the elements are ordered as {left_channel, right_channel}. For a channel base with a RL-stereo layout, the first element in physical ordering is the right element, whereas the first semantic element is the red one. Models of ChannelBaseConcept are required to provide the at_c<K>(ChannelBase) function, which allows for accessing the elements based on their physical order. Psynth provides a semantic_at_c<K>(ChannelBase) function (described later) which can operate on any model of ChannelBaseConcept and returns the corresponding semantic element.

concept ChannelBaseConcept<typename T> :
      CopyConstructible<T>, EqualityComparable<T>
{
    // a Psynth layout (the channel space and element permutation)
    typename layout_t;     
        
    // The type of K-th element
    template <int K> struct kth_element_type;
    where Metafunction<kth_element_type>;
    
    // The result of at_c
    template <int K> struct kth_element_const_reference_type;
    where Metafunction<kth_element_const_reference_type>;        
    
    template <int K> kth_element_const_reference_type<T,K>::type at_c(T);

    // Copy-constructible and equality comparable with other compatible channel bases
    template <ChannelBaseConcept T2> where { ChannelBasesCompatibleConcept<T,T2> } 
        T::T(T2);
    template <ChannelBaseConcept T2> where { ChannelBasesCompatibleConcept<T,T2> } 
        bool operator==(const T&, const T2&);
    template <ChannelBaseConcept T2> where { ChannelBasesCompatibleConcept<T,T2> } 
        bool operator!=(const T&, const T2&);

};

Member Function Documentation

template<typename ChannelBase >
void psynth::sound::ChannelBaseConcept< ChannelBase >::constraints ( ) [inline]

Member Data Documentation

template<typename ChannelBase >
ChannelBase psynth::sound::ChannelBaseConcept< ChannelBase >::cb

The documentation for this struct was generated from the following file: