|
libpsynth 0.2.1
|
A sample adaptor that modifies the range of the source sample. More...
Classes | |
| struct | psynth::sound::scoped_sample_value< BaseSampleValue, MinVal, MaxVal, ZeroVal > |
| A sample adaptor that modifies the range of the source sample. More... | |
A sample adaptor that modifies the range of the source sample.
Models: SampleValueConcept
Example:
// Create a double sample with range [-0.5 .. 0.5] struct double_minus_half { static double apply() { return -0.5; } }; struct double_plus_half { static double apply() { return 0.5; } }; typedef scoped_sample_value<double, double_minus_half, double_plus_half> bits64custom_t; // sample_convert its maximum should map to the maximum bits64custom_t x = sample_traits<bits64custom_t>::max_value(); assert(x == 0.5); bits16 y = sample_convert<bits16>(x); assert(y == 65535);
1.7.4