Go to the documentation of this file.
15 #define _CRT_SECURE_NO_WARNINGS
17 #define STB_VORBIS_HEADER_ONLY
18 #include "../../extras/stb_vorbis.c"
21 #if defined(ENABLE_SPEEX)
22 #define MINIAUDIO_SPEEX_RESAMPLER_IMPLEMENTATION
23 #include "../../extras/speex_resampler/ma_speex_resampler.h"
26 #define MA_NO_DEVICE_IO
27 #define MA_NO_THREADING
28 #define MINIAUDIO_IMPLEMENTATION
29 #include "../../miniaudio.h"
35 printf(
"USAGE: audioconverter [input file] [output file] [format] [channels] [rate]\n");
36 printf(
" [format] is optional and can be one of the following:\n");
37 printf(
" u8 8-bit unsigned integer\n");
38 printf(
" s16 16-bit signed integer\n");
39 printf(
" s24 24-bit signed integer (tightly packed)\n");
40 printf(
" s32 32-bit signed integer\n");
41 printf(
" f32 32-bit floating point\n");
45 printf(
"PARAMETERS:\n");
47 printf(
" --speex-quality [0..10]\n");
68 if (framesReadThisIteration == 0) {
76 if (framesReadThisIteration < framesToReadThisIteration) {
86 if (str ==
NULL || str[0] ==
'\0') {
90 while (str[0] !=
'\0') {
91 if (str[0] <
'0' || str[0] >
'9') {
110 if (x < lo || x > hi) {
114 if (pValue !=
NULL) {
125 if (strcmp(str,
"u8") == 0) {
127 }
else if (strcmp(str,
"s16") == 0) {
129 }
else if (strcmp(str,
"s24") == 0) {
131 }
else if (strcmp(str,
"s32") == 0) {
133 }
else if (strcmp(str,
"f32") == 0) {
139 if (pValue !=
NULL) {
160 if (strcmp(str,
"linear") == 0) {
162 }
else if (strcmp(str,
"speex") == 0) {
168 if (pValue !=
NULL) {
190 const char* pOutputFilePath;
196 if (strcmp(
argv[1],
"-h") == 0 || strcmp(
argv[1],
"--help") == 0) {
208 #if defined(ENABLE_SPEEX)
218 for (iarg = 3; iarg < argc; iarg += 1) {
219 if (strcmp(
argv[iarg],
"--linear-order") == 0) {
233 if (strcmp(
argv[iarg],
"--speex-quality") == 0) {
240 printf(
"Expecting a number between 0 and 10 for --speex-quality.\n");
264 printf(
"Warning: Unknown parameter \"%s\"",
argv[iarg]);
271 #if defined(ENABLE_SPEEX)
277 printf(
"Failed to open input file. Check the file exists and the format is supported. Supported input formats:\n");
278 #if defined(dr_opus_h)
281 #if defined(dr_mp3_h)
284 #if defined(dr_flac_h)
287 #if defined(STB_VORBIS_INCLUDE_STB_VORBIS_H)
290 #if defined(dr_wav_h)
297 pOutputFilePath =
argv[2];
303 printf(
"Warning: Unknown file extension \"%s\". Encoding as WAV.\n",
ma_path_extension(pOutputFilePath));
311 printf(
"Failed to open output file. Check that the directory exists and that the file is not already opened by another process. %s",
ma_result_description(result));
329 #if defined(_MSC_VER) && !defined(__clang__)
330 #pragma warning(push)
331 #pragma warning(disable:4100)
332 #pragma warning(disable:4244)
333 #pragma warning(disable:4245)
334 #pragma warning(disable:4456)
335 #pragma warning(disable:4457)
336 #pragma warning(disable:4701)
339 #undef STB_VORBIS_HEADER_ONLY
340 #include "../../extras/stb_vorbis.c"
341 #if defined(_MSC_VER) && !defined(__clang__)
static MA_INLINE ma_uint32 ma_get_bytes_per_frame(ma_format format, ma_uint32 channels)
ma_result ma_decoder_uninit(ma_decoder *pDecoder)
struct ma_decoder_config::@122 resampling
struct ma_decoder_config::@122::@123 linear
ma_decoder_config ma_decoder_config_init(ma_format outputFormat, ma_uint32 outputChannels, ma_uint32 outputSampleRate)
struct ma_decoder_config::@122::@124 speex
ma_uint64 ma_encoder_write_pcm_frames(ma_encoder *pEncoder, const void *pFramesIn, ma_uint64 frameCount)
const char * ma_result_description(ma_result result)
void ma_encoder_uninit(ma_encoder *pEncoder)
ma_result ma_encoder_init_file(const char *pFilePath, const ma_encoder_config *pConfig, ma_encoder *pEncoder)
ma_encoder_config ma_encoder_config_init(ma_resource_format resourceFormat, ma_format format, ma_uint32 channels, ma_uint32 sampleRate)
#define MA_MAX_SAMPLE_RATE
ma_uint64 ma_decoder_read_pcm_frames(ma_decoder *pDecoder, void *pFramesOut, ma_uint64 frameCount)
ma_resample_algorithm algorithm
@ ma_resample_algorithm_linear
ma_result ma_decoder_init_file(const char *pFilePath, const ma_decoder_config *pConfig, ma_decoder *pDecoder)
@ ma_resample_algorithm_speex
#define MA_MIN_SAMPLE_RATE
ma_uint32 outputSampleRate
#define MA_MAX_FILTER_ORDER