GOOGLE ADS

martes, 19 de abril de 2022

¿Cómo reproducir archivos MP3 en C?

Estoy buscando la forma más fácil de reproducir un archivo MP3 en C. Estoy buscando una biblioteca, en la que pueda simplemente llamar a la función en el nombre del archivo, o un ejecutable que simplemente se ejecute y se cierre. Por favor recomiende.


Solución del problema

Usando FMOD (plataforma cruzada), esto debería ser tan simple como esto:

#include <conio.h>
#include "inc/fmod.h"
FSOUND_SAMPLE* handle;
int main ()
{
// init FMOD sound system
FSOUND_Init (44100, 32, 0);
// load and play mp3
handle=FSOUND_Sample_Load (0,"my.mp3",0, 0, 0);
FSOUND_PlaySound (0,handle);
// wait until the users hits a key to end the app
while (!_kbhit())
{
}
// clean up
FSOUND_Sample_Free (handle);
FSOUND_Close();
}

Como nota al margen, le sugiero que use C++ sobre C.

No hay comentarios.:

Publicar un comentario

Flutter: error de rango al acceder a la respuesta JSON

Estoy accediendo a una respuesta JSON con la siguiente estructura. { "fullName": "FirstName LastName", "listings...