Jump to content
  • Advertisement
Sign in to follow this  
attahollander

fmod output speed

This topic is 4097 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!