mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Work in progress on C89 support.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#define DR_FLAC_IMPLEMENTATION
|
||||
#include "../extras/dr_flac.h" // Enables FLAC decoding.
|
||||
#include "../extras/dr_flac.h" /* Enables FLAC decoding. */
|
||||
#define DR_MP3_IMPLEMENTATION
|
||||
#include "../extras/dr_mp3.h" // Enables MP3 decoding.
|
||||
#include "../extras/dr_mp3.h" /* Enables MP3 decoding. */
|
||||
#define DR_WAV_IMPLEMENTATION
|
||||
#include "../extras/dr_wav.h" // Enables WAV decoding.
|
||||
#include "../extras/dr_wav.h" /* Enables WAV decoding. */
|
||||
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#include "../miniaudio.h"
|
||||
@@ -24,25 +24,28 @@ void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uin
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ma_result result;
|
||||
ma_decoder decoder;
|
||||
ma_device_config config;
|
||||
ma_device device;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("No input file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ma_decoder decoder;
|
||||
ma_result result = ma_decoder_init_file(argv[1], NULL, &decoder);
|
||||
result = ma_decoder_init_file(argv[1], NULL, &decoder);
|
||||
if (result != MA_SUCCESS) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
ma_device_config config = ma_device_config_init(ma_device_type_playback);
|
||||
config = ma_device_config_init(ma_device_type_playback);
|
||||
config.playback.format = decoder.outputFormat;
|
||||
config.playback.channels = decoder.outputChannels;
|
||||
config.sampleRate = decoder.outputSampleRate;
|
||||
config.dataCallback = data_callback;
|
||||
config.pUserData = &decoder;
|
||||
|
||||
ma_device device;
|
||||
if (ma_device_init(NULL, &config, &device) != MA_SUCCESS) {
|
||||
printf("Failed to open playback device.\n");
|
||||
ma_decoder_uninit(&decoder);
|
||||
|
||||
Reference in New Issue
Block a user