libpsynth 0.2.1
Public Member Functions | Public Attributes
psynth::sound::SampleConcept< T > Struct Template Reference

A sample is the building block of a channel. More...

#include <concept.hpp>

Collaboration diagram for psynth::sound::SampleConcept< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void constraints ()

Public Attributes

T c

Detailed Description

template<typename T>
struct psynth::sound::SampleConcept< T >

A sample is the building block of a channel.

Channel is defined as a mixture of primary channels and a sample defines the degree to which each primary channel is used in the mixture. For example, in the stereo channel space, using 8-bit unsigned samples, the "left channel" is defined as [255 0 ], which means maximum of left, and no right.

Built-in scalar types, such as int and float, are valid Psynth samples. In more complex scenarios, samples may be represented as bit ranges or even individual bits. In such cases special classes are needed to represent the value and reference to a sample.

Samples have a traits class, sample_traits, which defines their associated types as well as their operating ranges.

concept SampleConcept<typename T> : EqualityComparable<T> {
    typename value_type      = T;
    // use sample_traits<T>::value_type to access it
    typename reference       = T&;
    // use sample_traits<T>::reference to access it
    typename pointer         = T*;
    // use sample_traits<T>::pointer to access it
    typename const_reference = const T&;
    // use sample_traits<T>::const_reference to access it
    typename const_pointer   = const T*;
    // use sample_traits<T>::const_pointer to access it
    static const bool is_mutable;
    // use sample_traits<T>::is_mutable to access it

    static T min_value(); // use sample_traits<T>::min_value to accessit
    static T zero_value(); // use sample_traits<T>::zero_value to access it
    static T max_value(); // use sample_traits<T>::min_value to access it
};

Member Function Documentation

template<typename T >
void psynth::sound::SampleConcept< T >::constraints ( ) [inline]

Member Data Documentation

template<typename T >
T psynth::sound::SampleConcept< T >::c

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