libpsynth 0.2.1
Classes | Functions
sample_multiply

Multiplying unsigned sample values of the same type. More...

Classes

struct  psynth::sound::sample_multiplier_unsigned< SampleValue >
 This is the default implementation. Performance specializatons are provided. More...
struct  psynth::sound::sample_multiplier_unsigned< bits8 >
 Specialization of sample_multiply for 8-bit unsigned samples. More...
struct  psynth::sound::sample_multiplier_unsigned< bits16 >
 Specialization of sample_multiply for 16-bit unsigned samples. More...
struct  psynth::sound::sample_multiplier_unsigned< bits32f >
 Specialization of sample_multiply for float 0..1 samples. More...
struct  psynth::sound::sample_multiplier< SampleValue >
 A function object to multiply two samples. More...
struct  psynth::sound::sample_multiplier< bits32f >

Functions

template<typename Sample >
sample_traits< Sample >::value_type psynth::sound::sample_multiply (Sample a, Sample b)
 A function multiplying two samples.

Detailed Description

Multiplying unsigned sample values of the same type.

Performs scaled multiplication result = a * b / max_value

Example:

    bits8 x=128;
    bits8 y=128;
    bits8 mul = sample_multiply(x,y);
    assert(mul == 64);    // 64 = 128 * 128 / 255

Function Documentation

template<typename Sample >
sample_traits<Sample>::value_type psynth::sound::sample_multiply ( Sample  a,
Sample  b 
) [inline]

A function multiplying two samples.

result = a * b / max_value