Thread: SFML Audio Problems...

  1. #1
    Registered User JM1082's Avatar
    Join Date
    Mar 2011
    Posts
    51

    SFML Audio Problems...

    Hi all,

    My program, audioTest, is intended as a practise so that I can see how ths feature works!

    However, I'm being plagued by errors!

    My code, shown below, should be all I need to play an mp3 file; nothing more!

    Code:
    #include "SFML/Audio.hpp"
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	sf::Music Music1( 44100 );									// create Music instance
    
    	if ( !Music1.OpenFromFile( "Kalimba.mp3" ) )				// if the file doesn't open
    		cout << "\n\nMusic file can't be opened!\n\n" << endl;	// display error message
    
    	Music1.Play();												// play music
    
    	system( "pause" );											// pause to stop console window closing
    
    } // end main
    I'm getting errors in the console window saying, "Failed to open "Kalimba.mp3" for reading"


    Music file can't be opened!


    Failed to play audio stream : sound parameters have not been initialized (call Initialize first)
    press any key to continue...

    Please help if you have any ideas of how to rectify this error!

  2. #2
    Registered User
    Join Date
    Nov 2011
    Posts
    48
    That is because SFML doesn't support mp3. It is a license encumbered format ( aka, SFML would have to pay money to support it ), so they didn't.


    Either find an .ogg file, or convert your mp3 to .ogg ( Ogg Vorbis ) format.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. )': Visual C++ & SFML compilation problems! :'(
    By JM1082 in forum Game Programming
    Replies: 12
    Last Post: 02-20-2012, 08:48 AM
  2. Audio
    By fighter92 in forum Game Programming
    Replies: 9
    Last Post: 04-04-2009, 03:01 PM
  3. Problems saving audio files
    By JoeJTaylor in forum C++ Programming
    Replies: 0
    Last Post: 04-23-2006, 03:10 PM
  4. Problems with audio functions, tray icons + more!
    By face_master in forum Windows Programming
    Replies: 0
    Last Post: 10-08-2002, 10:35 PM
  5. SDL audio
    By DavidP in forum Game Programming
    Replies: 1
    Last Post: 02-02-2002, 09:13 AM