0
0

Hi, I have a bib Problem and my English is bad.

When I want to open an MP3 stream my Programm crashed! I don’t know why. Can everyone help ?

My Source is simple:

include <fmodapi/fmod.h>

include <fmodapi/fmod_errors.h>

include <fmodapi/wincompat.h>

include <iostream>

include <stdio.h>

using namespace std;

define SONG "your_love.mp3"

int main()
{
cout << "tAuto Boxt" << endl;

/*******************************
 *  Code    
 *******************************/

FSOUND_STREAM *play1 = 0;

printf(&quot;File wird geöffnet...n&quot;); 
/*******************************/
// File öffnen 
/*******************************/
//play1 = FSOUND_Stream_OpenFile( &quot;your_love.mp3&quot;, FSOUND_LOOP_OFF, 0 );
FSOUND_Stream_OpenFile( &quot;your_love.mp3&quot;, FSOUND_LOADMEMORY, 4096 );
printf(&quot;File ist eröffnet...n&quot;);
/*
if(play1 == NULL)
{
    printf(&quot;Error FSOUND_Stream_OpenFile ANFANGn&quot;);
    printf(&quot;%sn&quot;, FMOD_ErrorString(FSOUND_GetError()));
    printf(&quot;Error FSOUND_Stream_OpenFile ENDEn&quot;);
    exit(1);        
}
*/  

printf(&quot;Länge wird in Bytesermittelt...n&quot;);
/*******************************/
// Länge in BYTES ermitteln 
/*******************************/
float lengthbytes = FSOUND_Stream_GetLength( play1 );
if(lengthbytes == 0)
{
    printf(&quot;Error FSOUND_Stream_GetLength ANFANGn&quot;);
    printf(&quot;%sn&quot;, FMOD_ErrorString(FSOUND_GetError()));
    printf(&quot;Error FSOUND_Stream_GetLength ENDEn&quot;);
    exit(1);        
}
else
{
    printf(&quot;Länge in Bytes:  %fn&quot;, lengthbytes);
}

/***************************************/
// Länge in MILLISEKUNDEN ermitteln
/***************************************/
float lengthmilli = FSOUND_Stream_GetLengthMs( play1 );
if(lengthmilli == 0)
{
    printf(&quot;Error FSOUND_Stream_GetLengthMS ANFANGn&quot;);
    printf(&quot;%sn&quot;, FMOD_ErrorString(FSOUND_GetError()));
    printf(&quot;Error FSOUND_Stream_GetLengthMS ENDEn&quot;);
    exit(1);        
}
else
{
    printf(&quot;Länge in Bytes:  %fn&quot;, lengthmilli);
}

// Stream schliessen
if((FSOUND_Stream_Close( play1 )) == false)
{
    printf(&quot;Error FSOUND_Stream_Close ANFANGn&quot;);
    printf(&quot;%sn&quot;, FMOD_ErrorString(FSOUND_GetError()));
    printf(&quot;Error FSOUND_Stream_Close ENDEn&quot;);
    exit(1);
}

return 0;
}

Can someone post a simple example for play mp3 ? please 😉

mfg ciever2k

  • You must to post comments
0
0

Upps !

I forget FSOUND_Init :smile:

mfg

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.