Sign in to follow this  

fmod output speed

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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;
}

Share this post


Link to post
Share on other sites

This topic is 3728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this