License from €75
DE EN FR ES IT CZ

[SOLVED] Doubt about the sound (Config ini)

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 10 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!
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 10 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)?



  4. · 10 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.
  5. · 10 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)

  6. · 10 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.
  7. · 10 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?
  8. · 10 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
  9. · 10 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!!


  10. · 10 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
  11. · 10 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!!!!!!!!!

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?