33 lines
No EOL
719 B
C++
33 lines
No EOL
719 B
C++
#include "audio.hpp"
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <fmt123.h>
|
|
#include <portaudio.h>
|
|
|
|
|
|
namespace drp::util {
|
|
|
|
|
|
std::uint32_t encoding_mpg123_to_PulseAudio(const int encoding_mpg123) {
|
|
switch (encoding_mpg123) {
|
|
case MPG123_ENC_UNSIGNED_8:
|
|
return paUInt8;
|
|
case MPG123_ENC_SIGNED_8:
|
|
return paInt8;
|
|
case MPG123_ENC_SIGNED_16:
|
|
return paInt16;
|
|
case MPG123_ENC_SIGNED_24:
|
|
return paInt24;
|
|
case MPG123_ENC_SIGNED_32:
|
|
return paInt32;
|
|
case MPG123_ENC_FLOAT:
|
|
case MPG123_ENC_FLOAT_32:
|
|
return paFloat32;
|
|
default:
|
|
throw std::runtime_error("Invalid encoding value.");
|
|
}
|
|
}
|
|
|
|
|
|
} |