trying to make music fade out when I change rooms! [SOLVED]

Discussion in 'Programming' started by pixeltroid, Jun 12, 2019.

  1. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    597
    I specify the music for each room in the room creation code.

    So a typical room would have this code in its creation code:

    Code:
    audio_stop_all();
    audio_play_sound(ost_5, 8, true);
    
    This code works in that it stops the previous rooms music and plays the present rooms music (ost_5). The problem is that the previous rooms music stops abruptly and feels "off".

    How do I make it so that the previous rooms music slowly fades out?

    Any help would be appreciated! thanks!
     
  2. marasovec

    marasovec Member

    Joined:
    Sep 15, 2016
    Posts:
    307
    Use audio_sound_gain();
    Code:
    audio_sound_gain(prev_song, 0, 1000); // 1000ms = 1 second
    
     
    pixeltroid likes this.
  3. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    597
    hey that worked! thanks!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice