Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a template primitive-typed sound sample. More...
#include <omSoundSample.h>
Public Types | |
typedef T | BaseType |
The underlying type used to represent this sample. More... | |
Public Member Functions | |
Sample () | |
Create a new Sample with value equal to 0. More... | |
Sample (const T &newSample) | |
Create a new Sample with the specified value. More... | |
Sample (Float32 newSample) | |
Create a new Sample with the specified floating-point value, converted to the sample type. More... | |
Sample (Float64 newSample) | |
Create a new Sample with the specified floating-point value, converted to the sample type. More... | |
template<typename U > | |
Sample (const Sample< U > &other) | |
Convert a sample of another templated type to this sample type. More... | |
template<typename U > | |
operator U () const | |
Convert this sample's internal primitive type to the templated primitive type. More... | |
Sample | operator+ (const Sample &other) const |
Mix this sample with another and return the result. More... | |
Sample & | operator+= (const Sample &other) |
Mix another sample with this sample and overwrite this sample. More... | |
Sample | operator- (const Sample &other) const |
Subtract another sample from this sample and return the result. More... | |
Sample & | operator-= (const Sample &other) |
Subtract another sample from this sample and overwrite this sample. More... | |
Sample | operator* (Float gain) const |
Scale this sample by a linear gain factor and return the result. More... | |
Sample | operator* (Double gain) const |
Scale this sample by a linear gain factor and return the result. More... | |
Sample & | operator*= (Float gain) |
Scale this sample by a linear gain factor and overwite this sample. More... | |
Sample & | operator*= (Double gain) |
Scale this sample by a linear gain factor and overwite this sample. More... | |
template<> | |
Int8 | convert (Int8 sample) |
template<> | |
Int8 | convert (Int16 sample) |
template<> | |
Int8 | convert (Int24 sample) |
template<> | |
Int8 | convert (Int32 sample) |
template<> | |
Int8 | convert (Int64 sample) |
template<> | |
Int8 | convert (Float32 sample) |
template<> | |
Int8 | convert (Float64 sample) |
template<> | |
Int16 | convert (Int8 sample) |
template<> | |
Int16 | convert (Int16 sample) |
template<> | |
Int16 | convert (Int24 sample) |
template<> | |
Int16 | convert (Int32 sample) |
template<> | |
Int16 | convert (Int64 sample) |
template<> | |
Int16 | convert (Float32 sample) |
template<> | |
Int16 | convert (Float64 sample) |
template<> | |
Int24 | convert (Int8 sample) |
template<> | |
Int24 | convert (Int16 sample) |
template<> | |
Int24 | convert (Int24 sample) |
template<> | |
Int24 | convert (Int32 sample) |
template<> | |
Int24 | convert (Int64 sample) |
template<> | |
Int24 | convert (Float32 sample) |
template<> | |
Int24 | convert (Float64 sample) |
template<> | |
Int32 | convert (Int8 sample) |
template<> | |
Int32 | convert (Int16 sample) |
template<> | |
Int32 | convert (Int24 sample) |
template<> | |
Int32 | convert (Int32 sample) |
template<> | |
Int32 | convert (Int64 sample) |
template<> | |
Int32 | convert (Float32 sample) |
template<> | |
Int32 | convert (Float64 sample) |
template<> | |
Int64 | convert (Int8 sample) |
template<> | |
Int64 | convert (Int16 sample) |
template<> | |
Int64 | convert (Int24 sample) |
template<> | |
Int64 | convert (Int32 sample) |
template<> | |
Int64 | convert (Int64 sample) |
template<> | |
Int64 | convert (Float32 sample) |
template<> | |
Int64 | convert (Float64 sample) |
template<> | |
Float32 | convert (Int8 sample) |
template<> | |
Float32 | convert (Int16 sample) |
template<> | |
Float32 | convert (Int24 sample) |
template<> | |
Float32 | convert (Int32 sample) |
template<> | |
Float32 | convert (Int64 sample) |
template<> | |
Float32 | convert (Float32 sample) |
template<> | |
Float32 | convert (Float64 sample) |
template<> | |
Float64 | convert (Int8 sample) |
template<> | |
Float64 | convert (Int16 sample) |
template<> | |
Float64 | convert (Int24 sample) |
template<> | |
Float64 | convert (Int32 sample) |
template<> | |
Float64 | convert (Int64 sample) |
template<> | |
Float64 | convert (Float32 sample) |
template<> | |
Float64 | convert (Float64 sample) |
template<> | |
Sample< Int8 > | operator+ (const Sample< Int8 > &other) const |
template<> | |
Sample< Int16 > | operator+ (const Sample< Int16 > &other) const |
template<> | |
Sample< Int24 > | operator+ (const Sample< Int24 > &other) const |
template<> | |
Sample< Int32 > | operator+ (const Sample< Int32 > &other) const |
template<> | |
Sample< Int64 > | operator+ (const Sample< Int64 > &other) const |
template<> | |
Sample< Int8 > | operator- (const Sample< Int8 > &other) const |
template<> | |
Sample< Int16 > | operator- (const Sample< Int16 > &other) const |
template<> | |
Sample< Int24 > | operator- (const Sample< Int24 > &other) const |
template<> | |
Sample< Int32 > | operator- (const Sample< Int32 > &other) const |
template<> | |
Sample< Int64 > | operator- (const Sample< Int64 > &other) const |
template<> | |
Sample< Int8 > | operator* (Gain gain) const |
template<> | |
Sample< Int16 > | operator* (Gain gain) const |
template<> | |
Sample< Int24 > | operator* (Gain gain) const |
template<> | |
Sample< Int32 > | operator* (Gain gain) const |
template<> | |
Sample< Int64 > | operator* (Gain gain) const |
Static Public Member Functions | |
template<typename U > | |
static T | convert (U sample) |
Convert a sample value with the specified underlying primitive type to the templated primitive type. More... | |
A class that represents a template primitive-typed sound sample.
This class provides a wrapper for basic primitive types which provides automatic sample saturation and proper conversion between different sample types using standard arithmetic and cast operators.
Floating-point template instantiations do not do saturating sample arithmetic because of their much greater dynamic range.
typedef T om::sound::base::Sample< T >::BaseType |
The underlying type used to represent this sample.
|
inline |
Create a new Sample with value equal to 0.
|
inline |
Create a new Sample with the specified value.
|
inline |
Create a new Sample with the specified floating-point value, converted to the sample type.
|
inline |
Create a new Sample with the specified floating-point value, converted to the sample type.
|
inline |
Convert a sample of another templated type to this sample type.
This method applies the best conversion from the specified sample type to this sample type. For conversions to the 8-bit sample type, a simple dither is performed to improve the audio quality. One might want to implement a higher quality dither for these conversions, depending on the application.
|
inline |
Convert this sample's internal primitive type to the templated primitive type.
|
inline |
Mix this sample with another and return the result.
|
inline |
Mix another sample with this sample and overwrite this sample.
|
inline |
Subtract another sample from this sample and return the result.
|
inline |
Subtract another sample from this sample and overwrite this sample.
|
inline |
Scale this sample by a linear gain factor and return the result.
|
inline |
Scale this sample by a linear gain factor and return the result.
|
inline |
Scale this sample by a linear gain factor and overwite this sample.
|
inline |
Scale this sample by a linear gain factor and overwite this sample.
|
inlinestatic |
Convert a sample value with the specified underlying primitive type to the templated primitive type.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |