| Mirage Source http://www.miragesource.net/forums/ |
|
| FMod - Again http://www.miragesource.net/forums/viewtopic.php?f=201&t=3475 |
Page 1 of 2 |
| Author: | Lea [ Wed Mar 12, 2008 3:20 am ] |
| Post subject: | FMod - Again |
Hi guys, Playing with Fmod again, after a while, because someone asked me about it. Said she'd release a tutorial if I helped her... we'll see if it happens XD. I've been especially playing with the 3D audio features... finally, after some messing around, I've got this: I call it "Futari no mojipittan to headache" just because I don't know the japanese word for headache XD It's futari no mojipittan playing in a circle around your head. Those with surround sound will experience it best... listen to it for a few hours and you'll see what I mean - ugh at debugging (and tinkering!) Here's a download to it: http://www.mediafire.com/?jnpp10djodm (too lazy to put it on my webserver XD) and here's the code, written in Microsoft Visual Studio 2005. I will share the entire project with those who would want to see, but this is the vast majority of it. Code: int _tmain(int argc, _TCHAR* argv[]) { FMOD_RESULT result; FMOD::System *system; result = FMOD::System_Create(&system); // Create the main system object. if (result != FMOD_OK) { //printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); return -1; } result = system->init(100, FMOD_INIT_NORMAL, 0); // Initialize FMOD. if (result != FMOD_OK) { //printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); return -1; } FMOD::Sound* sound; result = system->createSound("mojipittan.mp3", FMOD_3D, 0, &sound); if (result != FMOD_OK) { std::cout << "Error loading file" << std::endl; if( result == FMOD_ERR_FILE_NOTFOUND ) std::cout << "File not found" << std::endl; return -1; } FMOD::Channel *channel; system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel); FMOD_VECTOR listener_pos; listener_pos.x = 0; listener_pos.y = 0; listener_pos.z = 0; FMOD_VECTOR listener_vel; listener_pos.x = 0; listener_pos.y = 0; listener_pos.z = 0; FMOD_VECTOR listener_forward; listener_forward.x = 0; listener_forward.y = 0; listener_forward.z = 1; FMOD_VECTOR listener_up; listener_up.x = 0; listener_up.y = 1; listener_up.z = 0; FMOD_VECTOR sound_pos; sound_pos.x = 0; sound_pos.y = 0; sound_pos.z = 0; FMOD_VECTOR sound_vel; sound_vel.x = 0; sound_vel.y = 0; sound_vel.z = 0; channel->set3DDopplerLevel(0); // since im not setting the velocity, this does not give nice results, so it's off :D float freq; channel->getFrequency(&freq); channel->setFrequency( freq * 1); // multiply to speed up, slow down, or reverse (negative // reverse can only be done in software, it's configured to use hardware now... so no negatives! kkthx bool isPlaying; float i = 0; do { sound_pos.z = sin(i) * 1; sound_pos.x = cos(i) * 1; sound_pos.y = 0; channel->set3DAttributes(&sound_pos, &sound_vel); system->update(); // needed to update 3d engine, once per frame // output status: if(sound_pos.z > 0) if(sound_pos.x > 0) { std::cout << "Playing in quadrant 1" << std::endl; } else { std::cout << "Playing in quadrant 2" << std::endl; } if(sound_pos.z < 0) if(sound_pos.x > 0) { std::cout << "Playing in quadrant 4" << std::endl; } else { std::cout << "Playing in quadrant 3" << std::endl; } channel->isPlaying(&isPlaying); i = i + .0005; // that's a small increment :D this sets the speed of the rotation. Smaller number makes it slower. } while(isPlaying); system->release(); // close FMod return 0; // exit } Let me know what you think <3 |
|
| Author: | Robin [ Wed Mar 12, 2008 12:10 pm ] |
| Post subject: | Re: FMod - Again |
Go re-make your VB6 FMod code so that it doesn't crash the IDE when you need to abort the testing of the program and I'll love you. |
|
| Author: | Lea [ Wed Mar 12, 2008 12:36 pm ] |
| Post subject: | Re: FMod - Again |
That's impossible because of the way FMod works... If you don't shut FMod down correctly, it crashes. Someone else is working on that though.... with a new version of FMod... i tmight be better |
|
| Author: | Lea [ Wed Mar 12, 2008 4:16 pm ] |
| Post subject: | Re: FMod - Again |
http://www.mediafire.com/?3wdxggzcdw6 Here's a download of the Linux version - it is untested on linux, but should be compiled and run on the command line like this: Code: $ g++ -Wall fmod.cpp -o fmod $ ./fmod The source code is included, but slightly different than what I posted above due to the different interface for Fmod. |
|
| Author: | William [ Wed Mar 12, 2008 6:40 pm ] |
| Post subject: | Re: FMod - Again |
Dave wrote: That's impossible because of the way FMod works... If you don't shut FMod down correctly, it crashes. Someone else is working on that though.... with a new version of FMod... i tmight be better I hate that cause I keep loosing source code since its not saved xD I hate FMod, although your thingy was sweet. |
|
| Author: | Lea [ Wed Mar 12, 2008 6:45 pm ] |
| Post subject: | Re: FMod - Again |
Im not sure if crashing will be a problem in VB or not... going to try it soon... |
|
| Author: | Asrrin29 [ Wed Mar 12, 2008 6:46 pm ] |
| Post subject: | Re: FMod - Again |
I use a custom sound dll. Fmod is so bloated and unwieldy to use, it's really designed for larger engines with 3D graphics anyways. |
|
| Author: | Lea [ Wed Mar 12, 2008 6:48 pm ] |
| Post subject: | Re: FMod - Again |
The dll file for fmod is only 319 KB, which is pretty small. My exe, with fmod linked in, is 9KB total. Given the power... it's a great trade off. Who says MS can't use positional audio =3 |
|
| Author: | Asrrin29 [ Wed Mar 12, 2008 6:51 pm ] |
| Post subject: | Re: FMod - Again |
really?! last time I tried downloading mod it was a multi megabyte download. maybe I was doing it wrong. That and I can't for the life of me find a download for the actual dll whenever I go to the site, so I just don't bother. |
|
| Author: | William [ Wed Mar 12, 2008 6:56 pm ] |
| Post subject: | Re: FMod - Again |
Dave wrote: Im not sure if crashing will be a problem in VB or not... going to try it soon... Oh yeah it crashes, all the time... |
|
| Author: | Lea [ Wed Mar 12, 2008 8:04 pm ] |
| Post subject: | Re: FMod - Again |
The FMod EX Programmer API is a larger download that comes with library files for multiple compilers, examples, documentation, includes, modules, etc. http://www.fmod.org/index.php/download AS for the crashing, it seems like the latest version doesn't cause problems... at least not in C++ - i'll try it on VB later |
|
| Author: | William [ Wed Mar 12, 2008 8:06 pm ] |
| Post subject: | Re: FMod - Again |
I would love it if the new one doesn't make vb crash. |
|
| Author: | Lea [ Sun Mar 16, 2008 9:20 pm ] |
| Post subject: | Re: FMod - Again |
A Quick "STart FMod and end" program did crash the IDE. But you know, if you close the program instead of using the "stop" button in VB, it works fine |
|
| Author: | William [ Sun Mar 16, 2008 10:23 pm ] |
| Post subject: | Re: FMod - Again |
Yeah, but if you encounter a bug. It closes down. And if you didnt save your fucked. |
|
| Author: | Lea [ Sun Mar 16, 2008 10:43 pm ] |
| Post subject: | Re: FMod - Again |
You can set VB to automatically save upon starting. |
|
| Author: | Robin [ Mon Mar 17, 2008 3:23 pm ] |
| Post subject: | Re: FMod - Again |
Yes, but then if you modify something as a test, or if some programming goes wrong it's always nice to be able to just close & re-open the project. Ah well, you can't have everything I find fmod is very... temperamental on some computers as well. I just use DirectX. Fast, simple and it works. I've had it playing since I got home and it's just elevating my existing good mood |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|