Advertisement

fmod output speed

Started by September 29, 2007 07:50 AM
-1 comments, last by attahollander 17 years, 1 month ago
I've an program which uses FMOD to play an mp3 file, but its very slow on this computer. (it isn't on the other one). It takes 5 seconds before it finally starts playing. I'm using windows 2000 and have direct sound installed.


#include <iostream>
#include <string>

// Include FMOD
#include <FMOD/fmod.h>
#include <FMOD/fmod_errors.h> // Optional

#define SOUNDFILE "D:/r.mp3" // These must exist inside the project directory


int main()
{
	/*
		CHECK IF FMOD DLL VERSION IS OLD
	*/
    if (FSOUND_GetVersion() < FMOD_VERSION)
    {
        std::cout << "Error: You are using the wrong DLL version.  You should be using FMOD " << FMOD_VERSION << "\n";
		std::cin.get();
        return 1;
    }
    

    /*
        INITIALIZE FMOD
    */
    if (!FSOUND_Init(32000, 64, 0))
    {
        std::cout << "Error: " << FMOD_ErrorString(FSOUND_GetError()) << "\n";
		std::cin.get();
        return 1;
    }

  
	/*
		SET VOLUME AND PLAY MIDI IF LOADED CORRECTLY
	*/	
	
    std::cout << "Loading\n";

	/*
		LOAD SOUND
	*/
	FSOUND_SAMPLE* sound = FSOUND_Sample_Load(
			FSOUND_FREE|FSOUND_UNMANAGED, SOUNDFILE, 0, 0, 0);
	if (!sound)
	{
        std::cout << "Error: " << FMOD_ErrorString(FSOUND_GetError()) << "\n";
	}

	FSOUND_PlaySound(FSOUND_FREE, sound);

    /*
        MAIN LOOP
    */
	while(std::cin.get() != 'q'){
	
	}
	

    /*
        FREE SOUND AND MUSIC (ONLY IF LOADED) AND SHUT DOWN
    */
	if(sound)
		FSOUND_Sample_Free(sound);


    FSOUND_Close();

    return 0;
}

This topic is closed to new replies.

Advertisement