Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,454 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Musik ausfaden / Fade out Music #139191
07/02/07 19:56
07/02/07 19:56
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
Ich möchte gerne das die Musik sobald das Hauptmenü erscheint ausfadet und nicht abrupt abbricht.

Das steht in der Music.wdl:

Code:

function intro_music()
{
intromusic = media_play("fx/intro.mp3", NULL,volume_music);
}



Und das steht in der Hauptmenue.wdl:

Code:

media_stop(intromusic);



Ich dachte an irgendwas mit:

Code:

while(media_playing(intromusic) == 1)
{
volume -= 1;
media_tune...
}



Aber das geht nich ganz auf.

Was könnte ich tun?

Danke im Vorraus
Gruß

----------------

I want that my music fades out when the main menu appears. At the moment it stop s suddenly during its played.

Here´s the code who stars music in Music.wdl:

Code:

function intro_music()
{
intromusic = media_play("fx/intro.mp3", NULL,volume_music);
}



An thats the code who stops it. Hauptmenue.wdl:

Code:

media_stop(intromusic);



I thought of an solution like this:

Code:

while(media_playing(intromusic) == 1)
{
volume -= 1;
media_tune...
}



but thats not really working
What can i do?

Thank you and greetings

Last edited by Moerk; 07/02/07 19:57.

"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.
Re: Musik ausfaden / Fade out Music [Re: Moerk] #139192
07/03/07 10:04
07/03/07 10:04
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
I've had a look at your problem and I once had the same problem with media_play so I gave snd_play a try which worked perfectly for me. I guess media_play is better to show a video and stuff like that. Fading out music with media_play isn't the best option I guess so you better try snd_play.
Here's the code I tried using snd_play:
Code:


sound test = <yourmusic.file>;

var_nsave music_handle; // handle a given sound

var testsound; // test variable
var tempvolume; // volume

function sound_fade_out()
{
if(snd_playing(music_handle)==0)
{
tempvolume = 100; // the starting volume
music_handle = snd_play(test,tempvolume,0); // handle the music file with a given volume
while(testsound <= 100) // test instruction, change this to your needs which I guess was when a sertain inventory shows up.
{
snd_tune(music_handle,tempvolume,0,0); // define a new volume relative to tempvolume
wait(1);
tempvolume - = 0.5 * time_step; // fade out here, change '0.5' to suit your needs
}
}
}



Hope that helps you out
Btw, you can change snd_play to snd_loop if you need to have a sertain music file played over and over.

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Musik ausfaden / Fade out Music [Re: frazzle] #139193
07/03/07 10:45
07/03/07 10:45
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
Thank you very much for your help. But can snd_play play mp3 files? I dont think so but i will give it a try!


"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.
Re: Musik ausfaden / Fade out Music [Re: Moerk] #139194
07/03/07 10:52
07/03/07 10:52
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline
Member
SurudoiRyu  Offline
Member

Joined: May 2007
Posts: 185
Netherlands
Let it know if it works
I can use it also ^-^ if it works.

Greetzzz,


-The Dragon's Eye is alway's watching you!-
Re: Musik ausfaden / Fade out Music [Re: SurudoiRyu] #139195
07/03/07 11:37
07/03/07 11:37
Joined: Apr 2006
Posts: 58
Moerk Offline OP
Junior Member
Moerk  Offline OP
Junior Member

Joined: Apr 2006
Posts: 58
Thank you again frazzle i found a way to do it with media_play. You only need 2 variables for this.

Check it out:

// The Variables

var intromusic; // Is saved to the played mp3
var volume_music_intro = 100; // volume of the mp3



// Start to play the mp3

function intro_music()
{
intromusic = media_play("fx/intro.mp3", NULL, volume_music_intro); // You see the 2 variables?
}



// The function. Call it when the time is come to fade out.

function sound_fade_out() // the function
{
if (media_playing(intromusic) == 1)
{
while(1) // Its and endless loop if you want to end tte loop write: while (volume_music_intro > 0)
{
media_tune(intromusic, volume_music_intro, 0, 0); // This changes the volume because volume_music_intro -= 2 * time;
wait(1);
volume_music_intro -= 2 * time; // Thats the fade out command
if (volume_music_intro <= 0) // If volume_music_intro´s value get 0 or lower the media stops.
{
media_stop(intromusic);
}
}
}
}

Last edited by Moerk; 07/03/07 11:40.
Re: Musik ausfaden / Fade out Music [Re: Moerk] #139196
07/03/07 11:55
07/03/07 11:55
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Np, glad to see it worked

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1