0
0

Hello, I am very new to C++ and even more new to fmod. I am taking a c++ class and my teacher refuses to advance at a reasonable a pace or help me with my ‘more advanced’ programs (which are not advanced at all and you would laugh at what I call advanced). Anyways point being I have been searching for oh about 2 hours now and I cannot get background music to work on my c++ console aplication. Could someone please write a simple program to add a looping background music to a game I am making. Also, tell me where I need to put my files (aka music / .dll/ .h) for the compiler to find them. The name of the .wav file for testing this is demo.wav. THX SO MUCH FOR YOUR HELP!!! You are saving my life.

  • You must to post comments
0
0

Use FSOUND_LOOP_NORMAL :

[code:2wxy3i1g]FSOUND_STREAM *stream = FSOUND_Stream_OpenFile("whatever.mp3", FSOUND_NORMAL | FSOUND_LOOP_NORMAL, 0);
[/code:2wxy3i1g]

  • You must to post comments
0
0

oooooooo well thats sexy. Thats right I find code sexy! Anyways,
I am trying to find a good background song for my game, do you think it would be lame to use music used by other games? Because some of the music rocks…

  • You must to post comments
0
0

You have a trillion of excellent mod, xm, s3m, it and remixes in mp3/ogg out there and for free, just to note some few soundtrackers : 4mat, jogeir, scorpik, 5musicians, jester (of sanity), maf, david witthacker, stereoman, necros, Chris Huelbeck, Allister Brimble, cyrex, andromeda …

  • You must to post comments
0
0

Well that doesn’t really sound right…. Allow me to clarify.
I need source code to start a .wav and loop it in the background.
whoa, thats much better.

  • You must to post comments
0
0

Hey do you guys know how to make the music fade out? I am using background music for the storyline (damn I wish I knew how to make it slowly scroll up..anyway) and it stops pretty abruptly…

  • You must to post comments
0
0

You have to read the documentation and the samples source code, we are not here to code for you 😆

  • You must to post comments
0
0

I did this to fade in the music:
[updated: #include <windows.h> // Header File For Sleep]

[code:2opihx7c]

include <windows.h> // Header File For Sleep

include <process.h> // Header File For _beginthread, _endthread

void FmodStreamFadingIn(void* dummy)
{
int volume = 0;

do
{
    volume += 5;
    FSOUND_SetVolume(int_sound_mp3, volume);
    Sleep(30);
}
while(volume &lt;= 255);

_endthread();

}

int main(void)
{
...
my_music = FSOUND_Stream_Open(stringMp3, FSOUND_NORMAL, 0, 0);
int_sound_mp3 = FSOUND_Stream_Play(FSOUND_FREE, my_music);
FSOUND_SetVolume(int_sound_mp3, 0);
_beginthread( FmodStreamFadingIn, 0, NULL );
...
}[/code:2opihx7c]

  • You must to post comments
0
0

I knew someone would say that, and I also thought it was at least remotely obvious that I had read the documentation in that two hours, but if not let me clarify.

I don’t get it, if you do and are willing, will you help me?
(remember I R C++ n00b, not just lazy)

  • You must to post comments
0
0

Intresting…
I was trying to think of a way to do a ‘for’ statement that loops lowering the volume. Problem is I am re-writing my program right now because of a disk error so it’s takin a while.
If anyone has tried a fade out with a ‘while’ or ‘for’, post it up

  • You must to post comments
0
0

Put this at the start of your program:

[code:1cjpw9p4]FSOUND_Init(44100, 32, 0);
FSOUND_STREAM *stream = FSOUND_Stream_OpenFile("whatever.mp3", FSOUND_NORMAL, 0);
int channel = FSOUND_Stream_Play(FSOUND_FREE, stream);[/code:1cjpw9p4]

And this at the end:

[code:1cjpw9p4]FSOUND_Stream_Close(stream);
FSOUND_Close();[/code:1cjpw9p4]

And go study the example programs some more.

  • You must to post comments
0
0

If anyone cares I did make it:

            //Music Fade Out
for (int i=255; i&gt;=0; i-=3)
{ 
    FSOUND_SetVolumeAbsolute(0,i); 
        Sleep(1);
}

system ("CLS");

//Music Stop
FSOUND_Stream_Close(stream); 
FSOUND_Close();
  • You must to post comments
0
0

thanks to you andrew!!! And admin or not Brett, your still a bastard. Ban me if you must, but ill take that hit in order to give my opinion = P

  • You must to post comments
0
0

I get these errors:

——————–Configuration: Music – Win32 Debug——————–
Compiling…
Music.cpp
Linking…
Music.obj : error LNK2001: unresolved external symbol _FSOUND_Close@0
Music.obj : error LNK2001: unresolved external symbol _FSOUND_Stream_Close@4
Music.obj : error LNK2001: unresolved external symbol _FSOUND_Stream_Play@8
Music.obj : error LNK2001: unresolved external symbol _FSOUND_Stream_OpenFile@12
Music.obj : error LNK2001: unresolved external symbol _FSOUND_Init@12
Debug/Music.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.

Music.exe – 6 error(s), 0 warning(s)

  • You must to post comments
0
0

Well it looks like Brett redeamed himself, and better yet, I’m not banned. I really need to learn to respect authority, but I doubt i will (concrete random people hate authority and love sarcasm).
😮 I really like this smiley.

I put the .LIB file EVERYWHERE in all the folders (just so no matter WHERE it thinks it should look, it will find it) and put #import <fmodvc.lib>
and this is what I get…

——————–Configuration: Music – Win32 Debug——————–
Compiling…
Music.cpp
c:\program files\microsoft visual studio\myprojects\music\music.cpp(6) : fatal error C1083: Cannot open type library file: ‘fmodvc.lib’: Error loading type library/DLL.
Error executing cl.exe.

Music.exe – 1 error(s), 0 warning(s)

figure this one out and ill buy u a pony

  • You must to post comments
0
0

First of all, you guys ****ing rock my pants off. And second, how do I make it continue to loop? It is only playin once.

  • You must to post comments
Showing 15 results
Your Answer

Please first to submit.