arduino-audio-tools
Loading...
Searching...
No Matches
src
AudioTools
CoreAudio
AudioBasic
Float32.h
Go to the documentation of this file.
1
#pragma once
2
#include "
AudioToolsConfig.h
"
3
4
namespace
audio_tools
{
5
12
class
float32
{
13
public
:
14
float32
() =
default
;
15
float32
(
float
value
){
16
this->value =
float32::as_uint
(
value
);
17
}
18
float32
(
const
float32
&
value
){
19
this->value =
value
.
value
;
20
}
21
inline
operator
float
() {
22
return
as_float
(
value
);
23
}
24
explicit
inline
operator
double
() {
25
return
(
double
)
float32::as_float
(
value
);
26
}
27
explicit
inline
operator
int
() {
28
return
(
int
)
float32::as_float
(
value
);
29
}
30
explicit
inline
operator
int
()
const
{
31
return
(
int
)
float32::as_float
(
value
);
32
}
33
inline
bool
operator<
(
float32
other
)
const
{
34
return
float
() < (
float
)
other
;
35
}
36
inline
bool
operator<=
(
float32
other
)
const
{
37
return
float
() <= (
float
)
other
;
38
}
39
inline
bool
operator>
(
float32
other
)
const
{
40
return
float
() > (
float
)
other
;
41
}
42
inline
bool
operator>=
(
float32
other
)
const
{
43
return
float
() >= (
float
)
other
;
44
}
45
inline
bool
operator==
(
float32
other
)
const
{
46
return
float
() == (
float
)
other
;
47
}
48
inline
bool
operator!=
(
float32
other
)
const
{
49
return
float
() != (
float
)
other
;
50
}
51
52
protected
:
53
uint32_t
value
=0;
54
55
static
uint32_t
as_uint
(
float
x) {
56
return
*(
uint32_t
*)&x;
57
}
58
static
float
as_float
(
uint32_t
x) {
59
return
*(
float
*)&x;
60
}
61
62
};
63
64
inline
float
operator+
(
float32
one
,
float32
two
)
65
{
66
return
(
float
)
one
+ (
float
)
two
;
67
}
68
inline
float
operator-
(
float32
one
,
float32
two
)
69
{
70
return
(
float
)
one
- (
float
)
two
;
71
}
72
inline
float
operator*
(
float32
one
,
float32
two
)
73
{
74
return
(
float
)
one
* (
float
)
two
;
75
}
76
inline
float
operator/
(
float32
one
,
float32
two
)
77
{
78
return
(
float
)
one
/ (
float
)
two
;
79
}
80
inline
float
operator+
(
float32
one
,
float
two
)
81
{
82
return
(
float
)
one
+
two
;
83
}
84
inline
float
operator-
(
float32
one
,
float
two
)
85
{
86
return
(
float
)
one
-
two
;
87
}
88
inline
float
operator*
(
float32
one
,
float
two
)
89
{
90
return
(
float
)
one
*
two
;
91
}
92
inline
float
operator/
(
float32
one
,
float
two
)
93
{
94
return
(
float
)
one
/
two
;
95
}
96
inline
float
operator+
(
float
one
,
float32
two
)
97
{
98
return
two
+
float
(
one
);
99
}
100
inline
float
operator-
(
float
one
,
float32
two
)
101
{
102
return
two
-
float
(
one
);
103
}
104
inline
float
operator*
(
float
one
,
float32
two
)
105
{
106
return
two
*
float
(
one
);
107
}
108
inline
float
operator/
(
float
one
,
float32
two
)
109
{
110
return
two
/
float
(
one
);
111
}
112
113
}
114
115
namespace
std
{
116
117
inline
float
floor
( float32 arg ) {
return
std::floor
((
float
)arg);}
118
inline
float
fabs
( float32 arg ) {
return
std::fabs
((
float
)arg);}
119
120
}
AudioToolsConfig.h
audio_tools::float32
Stores float values as uint32_t so that we can use memory allocated with MALLOC_CAP_32BIT.
Definition
Float32.h:12
audio_tools::float32::operator>=
bool operator>=(float32 other) const
Definition
Float32.h:42
audio_tools::float32::operator>
bool operator>(float32 other) const
Definition
Float32.h:39
audio_tools::float32::operator<=
bool operator<=(float32 other) const
Definition
Float32.h:36
audio_tools::float32::operator!=
bool operator!=(float32 other) const
Definition
Float32.h:48
audio_tools::float32::as_uint
static uint32_t as_uint(float x)
Definition
Float32.h:55
audio_tools::float32::float32
float32(const float32 &value)
Definition
Float32.h:18
audio_tools::float32::float32
float32()=default
audio_tools::float32::operator<
bool operator<(float32 other) const
Definition
Float32.h:33
audio_tools::float32::operator==
bool operator==(float32 other) const
Definition
Float32.h:45
audio_tools::float32::float32
float32(float value)
Definition
Float32.h:15
audio_tools::float32::as_float
static float as_float(uint32_t x)
Definition
Float32.h:58
audio_tools::float32::value
uint32_t value
Definition
Float32.h:53
audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition
AudioCodecsBase.h:10
audio_tools::operator+
float operator+(float16 one, float16 two)
Definition
Float16.h:87
audio_tools::operator/
float operator/(float16 one, float16 two)
Definition
Float16.h:96
audio_tools::operator-
float operator-(float16 one, float16 two)
Definition
Float16.h:90
audio_tools::writeData
size_t writeData(Print *p_out, T *data, int samples, int maxSamples=512)
Definition
AudioTypes.h:512
audio_tools::operator*
float operator*(float16 one, float16 two)
Definition
Float16.h:93
std
Definition
FFTReal.h:488
std::floor
float floor(float16 arg)
Definition
Float16.h:112
std::fabs
float fabs(float16 arg)
Definition
Float16.h:113
Generated by
1.9.8