Beatmup
Beatmup::sample16 Struct Reference

#include <sample_arithmetic.h>

Public Member Functions

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

Public Attributes

signed short int x
 

Static Public Attributes

static const int MIN_VALUE = -32768
 
static const int MAX_VALUE = +32767
 

Detailed Description

Definition at line 57 of file sample_arithmetic.h.

Member Function Documentation

◆ operator<()

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

Definition at line 59 of file sample_arithmetic.h.

59 { return x < sample.x; }
signed short int x

◆ operator sample8()

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

Definition at line 132 of file sample_arithmetic.h.

132  {
133  return sample8{ (decltype(sample8::x))( x >> 8 ) };
134  }

◆ operator sample32()

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

Definition at line 136 of file sample_arithmetic.h.

136  {
137  return sample32{ x << 16 };
138  }

◆ operator sample32f()

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

Definition at line 140 of file sample_arithmetic.h.

140  {
141  return sample32f{ x / 32767.0f };
142  }

◆ operator=() [1/3]

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

Definition at line 144 of file sample_arithmetic.h.

144  {
145  x = S.x << 8;
146  }

◆ operator=() [2/3]

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

Definition at line 148 of file sample_arithmetic.h.

148  {
149  x = (decltype(x))( S.x >> 8 );
150  }

◆ operator=() [3/3]

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

Definition at line 152 of file sample_arithmetic.h.

152  {
153  x = (decltype(x)) roundf_fast(S.x * 32767);
154  }
#define roundf_fast(X)
rounding (nearest integer)
Definition: utils.hpp:22

Member Data Documentation

◆ x

signed short int Beatmup::sample16::x

Definition at line 58 of file sample_arithmetic.h.

◆ MIN_VALUE

const int Beatmup::sample16::MIN_VALUE = -32768
static

Definition at line 67 of file sample_arithmetic.h.

◆ MAX_VALUE

const int Beatmup::sample16::MAX_VALUE = +32767
static

Definition at line 68 of file sample_arithmetic.h.


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