Beatmup
Beatmup::sample8 Struct Reference

#include <sample_arithmetic.h>

Public Member Functions

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

Public Attributes

signed char x
 

Static Public Attributes

static const int MIN_VALUE = -128
 
static const int MAX_VALUE = +127
 

Detailed Description

Definition at line 43 of file sample_arithmetic.h.

Member Function Documentation

◆ operator<()

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

Definition at line 45 of file sample_arithmetic.h.

45 { return x < sample.x; }

◆ operator sample16()

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

Definition at line 103 of file sample_arithmetic.h.

103  {
104  return sample16{ (decltype(sample16::x)) (x << 8) };
105  }
signed short int x

◆ operator sample32()

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

Definition at line 107 of file sample_arithmetic.h.

107  {
108  return sample32{ x << 2 };
109  }

◆ operator sample32f()

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

Definition at line 111 of file sample_arithmetic.h.

111  {
112  return sample32f{ x / 127.0f };
113  }

◆ operator=() [1/3]

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

Definition at line 115 of file sample_arithmetic.h.

115  {
116  x = (decltype(x))( S.x >> 8 );
117  }

◆ operator=() [2/3]

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

Definition at line 119 of file sample_arithmetic.h.

119  {
120  x = (decltype(x))( S.x >> 24 );
121  }

◆ operator=() [3/3]

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

Definition at line 123 of file sample_arithmetic.h.

123  {
124  x = (decltype(x)) roundf_fast(S.x * 127);
125  }
#define roundf_fast(X)
rounding (nearest integer)
Definition: utils.hpp:22

Member Data Documentation

◆ x

signed char Beatmup::sample8::x

Definition at line 44 of file sample_arithmetic.h.

◆ MIN_VALUE

const int Beatmup::sample8::MIN_VALUE = -128
static

Definition at line 53 of file sample_arithmetic.h.

◆ MAX_VALUE

const int Beatmup::sample8::MAX_VALUE = +127
static

Definition at line 54 of file sample_arithmetic.h.


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