Skip to content

Commit 89a106a

Browse files
committed
FloatAudio int24
1 parent 3c396f8 commit 89a106a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/AudioTools/CoreAudio/AudioBasic/FloatAudio.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace audio_tools {
55

66
/***
7-
* A simple float number (in the range of -1.0 to 1.0) the supports the conversion to
7+
* A simple float number (in the range of -1.0 to 1.0) that supports the conversion to
88
* it's corresponding scaled int values.
99
*/
1010

@@ -13,15 +13,19 @@ class FloatAudio {
1313
FloatAudio() = default;
1414
FloatAudio(float in) { this->value = in; }
1515

16+
inline operator float() { return value; }
17+
1618
explicit inline operator int8_t() { return value * 127; }
1719

1820
explicit inline operator int16_t() { return value * 32767; }
1921

20-
inline operator float() { return value; }
22+
explicit inline operator int24_3bytes_t() {
23+
return value * 8388607;
24+
}
2125

22-
// explicit inline operator int24_t() {
23-
// return value * 8388607;
24-
// }
26+
explicit inline operator int24_4bytes_t() {
27+
return value * 8388607;
28+
}
2529

2630
explicit inline operator int32_t() { return value * 2147483647; }
2731

0 commit comments

Comments
 (0)