| 234 | //============================================================= |
| 235 | template <typename T> |
| 236 | struct AudioSampleConverter |
| 237 | { |
| 238 | //============================================================= |
| 239 | /** Convert a signed 8-bit integer to an audio sample */ |
| 240 | static T signedByteToSample (int8_t sample); |
| 241 | |
| 242 | /** Convert an audio sample to an signed 8-bit representation */ |
| 243 | static int8_t sampleToSignedByte (T sample); |
| 244 | |
| 245 | //============================================================= |
| 246 | /** Convert an unsigned 8-bit integer to an audio sample */ |
| 247 | static T unsignedByteToSample (uint8_t sample); |
| 248 | |
| 249 | /** Convert an audio sample to an unsigned 8-bit representation */ |
| 250 | static uint8_t sampleToUnsignedByte (T sample); |
| 251 | |
| 252 | //============================================================= |
| 253 | /** Convert a 16-bit integer to an audio sample */ |
| 254 | static T sixteenBitIntToSample (int16_t sample); |
| 255 | |
| 256 | /** Convert a an audio sample to a 16-bit integer */ |
| 257 | static int16_t sampleToSixteenBitInt (T sample); |
| 258 | |
| 259 | //============================================================= |
| 260 | /** Convert a 24-bit value (int a 32-bit int) to an audio sample */ |
| 261 | static T twentyFourBitIntToSample (int32_t sample); |
| 262 | |
| 263 | /** Convert a an audio sample to a 24-bit value (in a 32-bit integer) */ |
| 264 | static int32_t sampleToTwentyFourBitInt (T sample); |
| 265 | |
| 266 | //============================================================= |
| 267 | /** Convert a 32-bit signed integer to an audio sample */ |
| 268 | static T thirtyTwoBitIntToSample (int32_t sample); |
| 269 | |
| 270 | /** Convert a an audio sample to a 32-bit signed integer */ |
| 271 | static int32_t sampleToThirtyTwoBitInt (T sample); |
| 272 | |
| 273 | //============================================================= |
| 274 | /** Helper clamp function to enforce ranges */ |
| 275 | static T clamp (T v1, T minValue, T maxValue); |
| 276 | }; |
| 277 | |
| 278 | //============================================================= |
| 279 | struct AiffUtilities |
nothing calls this directly
no outgoing calls
no test coverage detected