Announcement

Collapse
No announcement yet.

What's the correct method of setting music and sound effects volumes from script?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Cool yea I just read the stuff in the July build notes about the music. Guess it's time for an upgrade..

    Leave a comment:


  • replied
    HI

    I have the music and audio volumes working the way I want (for the most part) using the July 2013 UDK build. I believe a change was made in one of the last couple of builds that got some stuff working. I do everything from script and use the SetSoundMode, SetAudioGroupVolume and SetMusicVolume functions.

    Couple of things that don't work the way I want:

    If you leave the game app, launch music app, play custom music, go back to game - everything is ok you can hear user music fine at corect volumes. However, if you go back to the music app, stop music or quit music app, then go back to game - the game app calls to playmusic again are ignored/nothing happens. I don't know how to fix this.

    On mobile previewer (doesn't happen on iDevice) playing a sequence of tracks, the volume changes/resets on each new track start. I could probably fix that just by settting the volumes at each start - anyway it's inconsistent behaviour which is a bit annoying.

    All in all I found the audio volume setting setup/controls to be the worst I've ever encountered - wasted hours/days on what are essentially trivial tasks.


    Cheers
    William

    Leave a comment:


  • replied
    Hey William did you ever find a way around this?

    I'm just using the kismet method of starting music tracks, and even setting the initial volume there doesn't seem to work on the device. I'm considering making it script controlled instead but if there's no way to set music volume there either... I'm just gonna make the music track a set low-medium volume in the mp3 and be done with it :/

    Leave a comment:


  • replied
    Setting music volume still doesn't seem to work in the Nov 2012 SDK.

    The only way you can set music volume is to quit out of the game, launch up the Apple "Music" app, set the playback volume from there, quit out & launch your app again.
    On the plus side, this setting does only affect MP3/music playback volume (so sound effects can be changed independently via in-game menu & works on iDevices); however this really isn't ideal.

    I believe this change happened in the July SDK with the introduction of the "bBackgroundMusic". Is it possible to change it so that the "Music" app volume is used only when that bool is true (ie user defined music is played & volume set via "Music" app) - otherwise game soundtrack is used & volume controlled via in-game configuration? (or allow in-game configuration to be a master override if used - ie internal values are replicated from the external app).
    This would be ideal & allow easy setup in various scenarios.

    Again, if I'm missing something obvious I'd appreciate someone filling me in.

    Cheers
    William

    Leave a comment:


  • replied
    Gave up on this for a while & just came back to it as I stumbled across a post stating a change was made (a while ago) & to use SetAudioGroupVolume from the PlayerController class. I tried this and it works for SFX on previewer & iDevice.
    However, it doesn't work when trying to control music volume on a device.
    In the previewer I can get music volume to change via any of:
    • blahGetPlayerController.SetAudioGroupVolume(insert Name, volumeVal)
    • class'Engine'.static.GetAudioDevice().CurrentMode. SoundClassEffects[insertMusicIndex].VolumeAdjuster = VolumeVal;
    • class'WorldInfo'.static.GetWorldInfo().MusicComp.V olumeMultiplier = VolumeVal


    Is it possible to control MUSIC volume playback on an iDevice? Anyone?
    This really should be 1 line of code & 2 minutes of my time - not hours wasted.

    Cheers
    William

    Leave a comment:


  • replied
    HI

    Ok, willing to accept any kind of answer that's confirmed to control audio volumes - including doing it via Kismet.
    MP3/music only soultion also helpful. Preferably July 2012 SDK approved :-)

    Cheers
    William

    Leave a comment:


  • What's the correct method of setting music and sound effects volumes from script?

    HI

    The following setup works fine on the mobile previewer and has worked intermittently in the past on iDevices (seems to randomly break every so often without being changed). I can't get it to work at all now on an iDevice.
    I'm using the July 2012 SDK.


    I've added my own custom sound mode to the SoundClassesAndModes package.
    I've added 2 sound classes to the sound mode - "Music" and "SFX" - which existed already.
    My music sound cues are set to use the "Music" Sound class.
    My SFX sound cues are set to use the "SFX" Sound class.

    The SoundClassesAndModes package is included as a startup package.

    I have an audio options menu that has 2 sliders to control the desired voulme (scaled 0 to 1)
    They control VolumeMusic & VolulmeSFX float vars in the range 0 to 1



    Code:
    /** Set the music and SFX volume levels */
    /*
    function SetVolumeLevels()
    {
    	local SoundMode sMode;
     
    	// Nothing works without doing this first for some reason ????
    	class'Engine'.static.GetAudioDevice().SetSoundMode('Default'); 
    
    	sMode = SoundMode'SoundClassesAndModes.GUG_SoundMode';
    
    	class'Engine'.static.GetAudioDevice().SetSoundMode(sMode.Name);    // Use the sound mode we actually want
    
    	
    	sMode.SoundClassEffects[0].VolumeAdjuster = VolumeMusic; //  MUSIC
    	sMode.SoundClassEffects[1].VolumeAdjuster = VolumeSFX;     //  SFX
    
    }
    sMode.GetPackageName() returns "soundclassesandmodes" for the Previewer
    sMode.GetPackageName() returns "SoundClassesAndModes" on the iDevice (note caps)

    Does that matter (I've tried various combinations)?

    Is there something else I should be doing?

    This seems to be incredibly problematic/erratic for what should be a very simple task.

    Any ideas or suggestions would be greatly appreciated - it's driving me nuts.

    Cheers
    William
Working...
X