[SOLVED] Doubt about the sound (Config ini)

  • #1, by juansirlinkSunday, 07. May 2017, 16:30 7 years ago
    Hello, there!

    I'm here this time because I have a doubt about to the code for writing and reading the config ini file and keep the game volume. I have a pause screen where all volumes turn off, and when I return to the main menu I read the config ini using the command read_ini() at beginning of scene. However, the volumes don't turn on.

    I wonder if it is necessary to do anything else where I call read_ini()...

    Thanks, guys!

    Newbie

    46 Posts


  • #2, by sebastianSunday, 07. May 2017, 17:26 7 years ago
    Hey juansirling,

    first of all: which config script do you use ?

    How do you turn off the game sounds (and music)? Just turning down the volumes of each possible channel (music, sounds, speech, movie or even only global)?



    Thread Captain

    2346 Posts

  • #3, by juansirlinkSunday, 07. May 2017, 17:32 7 years ago
    Hey juansirling,

    first of all: which config script do you use ?

    How do you turn off the game sounds (and music)? Just turning down the volumes of each possible channel (music, sounds, speech, movie or even only global)?




    Hey! Thanks to reply, sebastian.

    I'm using the code Written by AFRLme on VS 4.2.5 for now. I turn down the volumes individually using the VS commands in a pause screen I did (menu scene). The next thing I want to get is that when I push the exit buttom of this creen (Which makes you to return to the menu screen) and i return to the main menu, the volumes turn up back to the configuratin I have written in the config ini file.

    Newbie

    46 Posts

  • #4, by sebastianSunday, 07. May 2017, 18:05 7 years ago
    did you overwrite the values for the volumes when opening the pause screen? if not you can easily use these values to set the volumes back with Lua (execute script action part):

    setVolume(eMusicVolume, Values["my_music_volume_value_name"].Int)
    setVolume(eSoundVolume, Values["my_sound_volume_value_name"].Int)

    Thread Captain

    2346 Posts

  • #5, by afrlmeSunday, 07. May 2017, 18:24 7 years ago
    Quick note: adjusting any of the volumes with the setVolume() Lua function will automatically overwrite the volume values in the config.ini file. I've no idea why, but volumes are the only entries in the config.ini that are automatially read & written.

    As Sebastian said, you can temp store the volume values inside of some values in the editor or inside of some Lua variables.

    Imperator

    7278 Posts

  • #6, by juansirlinkSunday, 07. May 2017, 19:41 7 years ago
    I think I understand you, guys.

    I have to create one variable for each kind of volumen on the main menu with a value between 0 and 100, for example:

    volumen_music = 100 (max. vol.)
    volumen_sound = 100 (max. vol.)
    volumen_speech = 100 (max. vol.)
    volumen_video = 100 (max. vol.)
    volumen_global = 100 (max. vol.)

    And when I want to re-establish the volumes, I have to call this Lua functions:

    setVolume(eMusicVolume, Values["volumen_music"].Int)
    setVolume(eSoundVolume, Values["volumen_sound"].Int)
    setVolume(eSpeechVolume, Values["volumen_speech"].Int)
    setVolume(eVideoVolume, Values["volumen_video"].Int)
    setVolume(eGlobalVolume, Values["volumen_global"].Int)

    Is this okay?

    PD. If I want to do the user can modify the volume, I would have to save these values in the ini config, wouldn't it?

    Newbie

    46 Posts

  • #7, by afrlmeSunday, 07. May 2017, 20:00 7 years ago
    Yes, the volume automatically gets written to the config.ini whenever you edit them.

    -- store
    vol_music = getVolume(eMusicVolume)
    vol_sound = getVolume(eSoundVolume)
    vol_speech = getVolume(eSpeechVolume)
    vol_movie = getVolume(eMovieVolume)
    vol_global = getVolume(eGlobalVolume)

    -- retrieve
    setVolume(eMusicVolume, vol_music) 
    setVolume(eSoundVolume, vol_sound)
    setVolume(eSpeechVolume, vol_speech)
    setVolume(eMovieVolume, vol_movie)
    setVolume(eGlobalVolume, vol_global)


    By the way, you do know that you could just set Global volume to 0 & back to 100 rather than messing with all the other volume channels? Global = master volume. grin

    Imperator

    7278 Posts

  • #8, by juansirlinkSunday, 07. May 2017, 21:59 7 years ago
    I think I have to create these values in my VS game file: vol_music, vol_sound,  vol_speech, vol_movie and vol_global (with a value bewteen 0 and 100). Then, I have to create a command at beginning of scene and execute a script with this lines, no?

    vol_music = getVolume(eMusicVolume)
    vol_sound = getVolume(eSoundVolume)
    vol_speech = getVolume(eSpeechVolume)
    vol_movie = getVolume(eMovieVolume)
    vol_global = getVolume(eGlobalVolume)

    PD. Is true... I can use the global volume to keep the other volumes... Thanks, thanks!!


    Newbie

    46 Posts

  • #9, by afrlmeSunday, 07. May 2017, 22:19 7 years ago
    Aye, global volume is the master volume channel. Think about a stereo system where you can tweak the bass, treble & volume. The volume knob obviously turns down the volume of the stereo system whereas the bass & treble knobs only affect the bass & treble amount that is pumping out of your speakers.

    I wanted to use a mixer as a reference, but I don't know if you have any experience with music production or DJing. Nearly everyone owns or has owned a stereo/hi-fi system at one time or another though. smile

    Imperator

    7278 Posts

  • #10, by juansirlinkSunday, 07. May 2017, 22:40 7 years ago
    Aye, global volume is the master volume channel. Think about a stereo system where you can tweak the bass, treble & volume. The volume knob obviously turns down the volume of the stereo system whereas the bass & treble knobs only affect the bass & treble amount that is pumping out of your speakers.

    I wanted to use a mixer as a reference, but I don't know if you have any experience with music production or DJing. Nearly everyone owns or has owned a stereo/hi-fi system at one time or another though. smile
    I understand now  better the idea with your explanation. Sometimes I'm a bit ¿clueless?...

    I just tried with your code and now this works perfectly. Next I want to make a mini setting to modify game volumes.

    Really thanks to you both guys, for the help. The people of this community are really nice.

    Thanks!!!!!!!!!

    Newbie

    46 Posts