Beatmup
Beatmup::sample32f Struct Reference

#include <sample_arithmetic.h>

Public Member Functions

bool operator< (const sample32f &sample) const
 
 operator sample8 () const
 
 operator sample16 () const
 
 operator sample32 () const
 
void operator= (const sample8 S)
 
void operator= (const sample16 S)
 
void operator= (const sample32 S)
 

Public Attributes

float x
 

Static Public Attributes

static const float MIN_VALUE = -1.0f
 
static const float MAX_VALUE = +1.0f
 

Detailed Description

Definition at line 85 of file sample_arithmetic.h.

Member Function Documentation

◆ operator<()

bool Beatmup::sample32f::operator< ( const sample32f sample) const
inline

Definition at line 87 of file sample_arithmetic.h.

87 { return x < sample.x; }

◆ operator sample8()

Beatmup::sample32f::operator sample8 ( ) const
inline

Definition at line 188 of file sample_arithmetic.h.

188  {
189  return sample8{ (decltype(sample8::x)) roundf_fast(x *127) };
190  }
#define roundf_fast(X)
rounding (nearest integer)
Definition: utils.hpp:22

◆ operator sample16()

Beatmup::sample32f::operator sample16 ( ) const
inline

Definition at line 192 of file sample_arithmetic.h.

192  {
193  return sample16{ (decltype(sample16::x)) roundf_fast(x * 32767) };
194  }
signed short int x

◆ operator sample32()

Beatmup::sample32f::operator sample32 ( ) const
inline

Definition at line 196 of file sample_arithmetic.h.

196  {
197  return sample32{ roundf_fast(x * 2147483647) };
198  }

◆ operator=() [1/3]

void Beatmup::sample32f::operator= ( const sample8  S)
inline

Definition at line 200 of file sample_arithmetic.h.

200  {
201  x = S.x / 128.0f;
202  }

◆ operator=() [2/3]

void Beatmup::sample32f::operator= ( const sample16  S)
inline

Definition at line 204 of file sample_arithmetic.h.

204  {
205  x = S.x / 32768.0f;
206  }

◆ operator=() [3/3]

void Beatmup::sample32f::operator= ( const sample32  S)
inline

Definition at line 208 of file sample_arithmetic.h.

208  {
209  x = S.x / 2147483648.0f;
210  }

Member Data Documentation

◆ x

float Beatmup::sample32f::x

Definition at line 86 of file sample_arithmetic.h.

◆ MIN_VALUE

const float sample32f::MIN_VALUE = -1.0f
static

Definition at line 95 of file sample_arithmetic.h.

◆ MAX_VALUE

const float sample32f::MAX_VALUE = +1.0f
static

Definition at line 96 of file sample_arithmetic.h.


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