Beatmup
Beatmup::sample32 Struct Reference

#include <sample_arithmetic.h>

Public Member Functions

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

Public Attributes

int x
 

Static Public Attributes

static const long MIN_VALUE = -2147483647-1
 
static const long MAX_VALUE = +2147483647
 

Detailed Description

Definition at line 71 of file sample_arithmetic.h.

Member Function Documentation

◆ operator<()

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

Definition at line 73 of file sample_arithmetic.h.

73 { return x < sample.x; }

◆ operator sample8()

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

Definition at line 160 of file sample_arithmetic.h.

160  {
161  return sample8{ (decltype(sample8::x)) (x >> 24) };
162  }

◆ operator sample16()

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

Definition at line 164 of file sample_arithmetic.h.

164  {
165  return sample16{ (decltype(sample16::x)) (x >> 16) };
166  }
signed short int x

◆ operator sample32f()

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

Definition at line 168 of file sample_arithmetic.h.

168  {
169  return sample32f{ x / 2147483647.0f };
170  }

◆ operator=() [1/3]

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

Definition at line 172 of file sample_arithmetic.h.

172  {
173  x = S.x << 24;
174  }

◆ operator=() [2/3]

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

Definition at line 176 of file sample_arithmetic.h.

176  {
177  x = S.x << 16;
178  }

◆ operator=() [3/3]

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

Definition at line 180 of file sample_arithmetic.h.

180  {
181  x = roundf_fast(S.x * 2147483647);
182  }
#define roundf_fast(X)
rounding (nearest integer)
Definition: utils.hpp:22

Member Data Documentation

◆ x

int Beatmup::sample32::x

Definition at line 72 of file sample_arithmetic.h.

◆ MIN_VALUE

const long Beatmup::sample32::MIN_VALUE = -2147483647-1
static

Definition at line 81 of file sample_arithmetic.h.

◆ MAX_VALUE

const long Beatmup::sample32::MAX_VALUE = +2147483647
static

Definition at line 82 of file sample_arithmetic.h.


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