Jump to content
  • Advertisement
Sign in to follow this  
Daivuk

FMOD, how to play a non 3d sound!?!

This topic is 5465 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 think the question is quite simple lol Ok, here is my problem : I'm playing 3d sounds in my game, using the user config like : mono, stereo, dolby digital 5.1, all that with Fmod, what a great API ;) But my player (top view game) can buy objet or clic on menu item. In these cases I want to play a sound, but not in 3d. Like I can ear it everywhere. I dont know how :S If I dont set my listener all my sound will be like that I think, but I want 3D sounds, and no 3d sounds. thanks for help ;)

Share this post


Link to post
Share on other sites
Advertisement
I dont know FMOD, but one technique is to set the sound to the same location as the player, whereever the player moves the sound moves and it appears to be everywhere.

Share this post


Link to post
Share on other sites
Here is my first stab at using fmod, and it worked, and its not 3d, im sure you could tweak it and optimize, but it works...




// Note: the lines that are commented out are to load the sound into memory and then play them
// currently it just streams the audio file
#include <windows.h>
#include <fmod.h>
#include <fstream.h>

int InitOK;
//FSOUND_SAMPLE *trance;
FSOUND_STREAM *trance;

int done=0;

int main(int argc, char *argv[])
{
cout << "Nicks' Bitchin FMOD test\n\n";

cout << "Initializing FMOD...\t";

InitOK = FSOUND_Init(48000, 32, 0);

if(!InitOK)
{
cout << "FAILED\n";
exit(1);
}
else
{
cout << "SUCCESS\n";
}

cout << "Buffering Sound File...\t";

//trance = FSOUND_Sample_Load(FSOUND_FREE, "trance.ogg", FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 0, 0);
trance = FSOUND_Stream_Open("trance.ogg", FSOUND_LOOP_NORMAL, 0, 0);

if( trance==NULL )
{
cout << "FAILED\n";
exit(1);
}
else
{
cout << "SUCCESS\n";
}

//FSOUND_PlaySound(0, trance);
FSOUND_Stream_Play(0, trance);

while(!done)
{
cin >> done;
}


return 0;
}

Share this post


Link to post
Share on other sites
ok thanks, what I was looking for was the flag : FSOUND_2D
It's not clearly explained in the Fmod API doc for that. All the rest of the doc is perfectly explained :)

Share this post


Link to post
Share on other sites
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!