top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to insert an audio file in C program?

0 votes
2,588 views
How to insert an audio file in C program?
posted Aug 11, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Assuming your audio file is mp3 file, you can try FMOD (http://www.fmod.org/download/ ) for the same purpose.

#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();
}

Credit: http://stackoverflow.com/questions/428884/how-to-play-mp3-files-in-c

answer Aug 11, 2014 by Salil Agrawal
...