1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Audio Toolkit v3.0 - major update RELEASED

Discussion in 'Assets and Asset Store' started by clockstone, Apr 4, 2012.

  1. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Audio Toolkit - the number one professional audio managing and scripting solution on the Unity Asset Store score has undergone a major update to v3.0, including a number of important new features.
    At this point - thanks to all of you guys supporting the development of the toolkit with your valuable user feedback (and full version purchases;))

    Get it here on the Asset Store!

    AudioToolkit v3.0 features include:
    • extremely simple scripting interface: play audio files with a simple static function call such as AudioController.Play("MyFX");, creation of required AudioSource objects is handled automatically
    • conveniently define audio assets in categories using the customized inspector view
    • set properties such as the volume for the entire category
    • change the volume of all playing audio objects of a certain category at runtime in a mixer-like user interface or per script
    • define alternative audio clips that get played with a specified probability or order
    • advanced audio pick modes such as "RandomNotSameTwice", "TwoSimultaneously", etc. *new*
    • uses audio object pools for optimized performance on iOS and Android
    • set audio playing parameters conveniently, such as:
      o random pitch volume
      o minimum time difference between play calls
      o delay
      o looping
      o fade out / in
      o maximum simultaneous instance count *new*
    • special functions for music including cross-fading
    • delegate event call if audio was completely played
    • playlist management with shuffle, loop, etc.
    • play audios from within the inspector *new*
    • audio event log *new*
    • audio overview window *new*
    • well designed, easy-to-use user interface to manage and overview music sounds even for large projects

    BONUS: If you buy the Audio Toolkit you get our generic and extremely simple to use object pooling class for free! It can be used on any type of game object such as visual effects, etc.

    Please visit our ClockStone Unity Assets Website for code examples and the full (MSDN style!) documentation of the classes.

    Also check the Video Tutorial.

    Buy the Audio Toolkit on the Unity Asset Store here!

    There is also a free version available on the Asset Store.

    As a promotion for the v3.0 we currently offer a 31% discount for a limited time!
     
  2. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    116
    Hi I upgraded to the new version and now it seems that some audio has lost positioning info. Did something change with that? for instance, my theme music starts correctly with the main camera but as we move away it stays behind. I thought music would automatically not be positional
     
  3. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    If you have "3D sound" checked in Unity's audio asset import settings the sound will be positional, even it is played as music (in some cases this might be desired). We did not change anything in v3.0, so I suspect you changed the music to a clip having "3D sound" enabled. Just disable 3D for all of your music assets and the problem should be solved.

    For your information: If you play a 3D audio clip without specifying a parent object or position - e.g. by calling AudioController.Play("MySFX") - then the audio object will get placed just in front of the current audio listener which is usually on the main camera. That's why the movement of the camera changes the music in your situation.
     
  4. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    116
    All I did was delete the old Audiotoolkit and re-import the new. For some reason the music isn't following the player object that it's being called from. Odd. I checked the import settings and they are set to 3d sound. I checked the instantiated audio controller object and it thinks the music is a 2d sound so it leaves the instantiated sound object behind. Seems to be a disconnect from the audio import settings and what AT thinks it is.
     
  5. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    116
    I was able to fix by re-importing the audio tracks again. Probably just weirdness with Unity when deleting libs and bringing them back in.
     
  6. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Good to hear you worked it out. I suspected something like that. If an audio clip is configured as 2D in the import settings the position really shouldn't have any effect.
     
  7. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Audio Toolkit update v3.2 is now available on the asset store! We restructured the GUI so it is now easier to read and understand.
    Thanks guys for all your feedback that constantly improves the toolkit!
     
  8. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    943
    Hi,
    Great toolkit!
    Could you please include some release notes in the updates so we know exactly what has changed? ty!
     
  9. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    update v3.3 was just released on the Asset Store. You can read the change log if you click on the version number on the Asset Store.

    v3.0
    - maximum instance count
    - audio log
    - audio overview
    - new subitem pick modes: random-not-same-twice, sequence, all, two
    - subitem modes: CLIP (play audio clip) or ITEM (play audio item)
    - reworked GUI design
    - play audio assets from within the Unity inspector

    v3.1
    - refined GUI design
    - new subitem feature: Random Start Position
    - new subitem feature: Start / End Position
    - bugfix: audio log refreshed correctly

    v3.2
    - bugfix: inspector null reference errors on audio controllers without categories or items
    - playlist can still be resumed after StopMusic()

    v3.3
    - new subitem feature: Random Delay, Fade-in, Fade-out
    - pooling system: bugfix for poolable object parented to other poolable object
    - bugfix: probability not working with 'RandomNotSameTwice'-mode
    - inspector: keyboard input focus released when changing items
     
  10. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    943
    A1. ty!
     
  11. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,074
    Is it possible to make the AudioController a singleton instance, so that it can remain inbetween scenes or does that cause issues?
     
  12. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Sure! That's what one should do in most types of projects. Only when you have a large number of different audios you should think about splitting up audio controllers e.g. for each level of your game, so you only have to have those sounds included that are really needed int the respective scene. This may reduce loading time and memory consumption.

    I think I will add a checkbox to the AudioController in the upcoming update to to this. During the meantime you can use this little script component to make the AudioController persist level loads:

    public class Persistent : MonoBehaviour
    {
    void Awake()
    {
    DontDestroyOnLoad( gameObject );
    }
    }
     
  13. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,074
    Also can you have more than one Audio Controller that won't conflict with each other. Such as a singleton AudioController that goes between scenes and an Audio Controller that exists in a specific scene. So that the singleton can play music while the scene specific Audio Controller just plays sound effects? Thank you.
     
  14. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    By design you must have only one AudioController as it is implemented as a singleton. Why would it make sense to have several AudioControllers? That's what categories are for - to separate different types of audios. If you had several controllers, scripts would have to call explicitly either of the controllers, which doesn't make much sense in my opinion.
     
  15. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,074
    The instance I was talking about was having a persistent Music playing through all my scenes even during load screens, and only have the specific sound effects I need to be loaded in the scenes I want, to reduce loading time and memory consumption like you said. In this case I thought it'd be best to have a persistent Audio Controller that handles the music while having another Audio Controller that is only created per scene for that scene's audio sound effects, but perhaps I was wrong. Is it possible with Audio Toolkit to have persistent Music playing between scenes if you have to have a new AudioController in every scene? Thank you for the quick replies.
     
  16. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    If you have the "Stop When Scene Loads" option disabled on your Audio Item this audio will keep on playing even when the scene changes. So you can keep the music running during level loading. Yet, I just discovered a bug in the current version 3.3, so that the new AudioController does not recognize the music played in the previous level. We will fix that in the upcoming release.
     
  17. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,074
    Ok, sounds good. We'll probably buy your toolkit as long as that bug is fixed. Do you know when the new upcoming release will be out? Thanks you.
     
  18. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    probably beginning of next week
     
  19. Sarus

    Sarus

    Joined:
    Sep 4, 2009
    Posts:
    6
    Picked up the Toolkit and really like using it. It's saving us a ton of time so I highly recommend it to anyone sitting on the fence.

    One helper function that could be useful for us is the ability to pause a sound category and then play that category again.

    So for example if I have a "Music" and "Effects" category

    AudioController.PauseCategory("Effects")
    AudioController.PlayCategory("Effects)

    It's not a required feature though since we can always loop over the results of GetCategory("category").AudioItems and run the command on each AudioItem but just a little shortcut.


    One problem we're having is when trying to play sounds from within the inspector we get the following warning:

    "Can not play a disabled audio source"
    UnityEngine.AudioSource:playOneShot(AudioClip, Single)

    Also, there needs to be a stop button in the inspector to stop the audio. Especially for long music tracks heh.
     
    Last edited: May 13, 2012
  20. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    I think PauseCategory / PlayCategory will really be useful - we will make them in the upcoming version (will probably be available in the next few days)
    Playing from within the inspector is tricky though. In fact it should not even be possible. By trial and error we found out that (in Windows) sounds are played even though this "Can not play a disabled audio source" message shows up. Unfortunately, there is no way to stop sounds played in this way. At least we don't know any better way to do it. If anybody has an idea - please let me know!
     
  21. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Audio Toolkit update v3.4 released! Changelog:

    - Flash support
    - new AudioController option: Persist Scene Load
    - new AudioController functions: GetPlayingAudioObjectsInCategory, PauseAll, UnpauseAll,
    PauseCategory, UnpauseCategory, IsValidAudioID
    - add new categories and audio items per script functions:
    NewCategory, RemoveCategory,AddToCategory
    - high precision system time used instead of Unity's game time ( e.g. for fading)
    - Object Pooling System: poolable objects parented to poolable objects now correctly handled
    - bugfix: music correctly handled when changing scene with none-persistent AudioController
     
  22. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Audio Toolkit update v3.5:
    - AudioObject.Stop() fades out audio with sub item "Fade-Out" parameter
    - bugfix: FadeIn start volume
     
  23. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    A Question:

    What is the recommended way to dynamically control the volume of a sound effect.

    I have a skier. I want the volume of the skiing sound effect to be tied to the speed of the skier. I already know how to compute the volume I want based on the speed, but I'm not sure the best way to dynamically set the volume.

    I tried putting the ski sound effect in it's own category and use SetCategoryVolume in the "Update" method, but it seems a bit flaky especially when I'm starting and stopping the sound effect when the ski's leave the ground.

    Any direction you can give would be great.

    Awesome tool by the way.
     
  24. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    What exactly do you mean by "flaky"? You might consider smoothing your volume function. By the way: You could also set the volume of the AudioObject directly instead of using the category (which might also be a nice solution though) with e.g. audioObject.volume = 0.5
     
  25. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    While adjusting the volume of the category dynamically, if I stopped and then started the sound it would not play after the re-start... or so it seemed. I'd have to look at it more to give you more detail.

    I will attempt to adjust the AudioObject itself as that seems like a better solution then creating a category with a single item in it.

    I'm still learning the API so that solution didn't come to mind. So far I've mostly just been doing AudioController.Play(..)

    -Jeff
     
    Last edited: May 25, 2012
  26. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    Another general question.

    I have a lot of collisions in my game and for each collision I play a sound. (I usually don't let any one sound play back to back more frequently then 1 sec)

    So far I've just been using AudioController.Play("SomeSound") to play all my sounds. Is this the most efficient way to play sounds? Does it use pooling "under the covers"? Or do I need to explicitly set things up to use pooling?

    Thanks.
     
  27. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    this package looks interesting, I just want to know if there is an option for streaming?... as far as I know too much audio files in unity could make the webplayer heavier
     
    Last edited: May 25, 2012
  28. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @JeffWeber:
    1) The audio engine can automatically take care that not too many sounds of the same type are played simultaneously. Use the "Min Time Between Play" and "Max Instance Count" paramters for that.
    2) Pooling is done automatically "under the cover". Just enable it in the AudioController. There is just one thing you must watch out. The AudioObject returned by the Play functions may - some time later - not belong to the original audio effect anymore. If you access a poolable AudioObject use PoolableReference to check if it is still valid. See AudioObject reference

    @hjupter:
    Yes, you can use streaming with the AudioToolkit. Stream with the WWW.GetAudioClip function and then add the AudioClip to the Toolkits AudioController using AudioController.AddToCategory
     
  29. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    I'm trying that right now but no luck, what I'm doing wrong?

    Code (csharp):
    1. www = new WWW(filePath);
    2. audio.clip = www.GetAudioClip(false, true, AudioType.OGGVORBIS);
    3. AudioCategory cat = new AudioCategory();
    4. cat.Name = "Music";
    5. AudioController.AddToCategory(cat, audio.clip, "Theme");
    6.  
     
  30. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @hjupter: You have to create new AudioCategory instances with the AudioController. So instead of
    Code (csharp):
    1. AudioCategory cat = new AudioCategory();
    write
    Code (csharp):
    1. AudioCategory cat =AudioController.NewCategory("customCategoryName");
    or
    Code (csharp):
    1. AudioCategory cat =AudioController.GetCategory("existingCategoryName");
     
    Last edited: May 26, 2012
  31. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    Thanks for the help so far. I'm still a little unclear how to structure things for my particular situation.

    Here is some pseudo-code so you can maybe guide me in the right direction.

    I have a component called "KrashlanderSkiSoundEmitter". The idea is it will play a LOOPING (I checked the looping checkbox) skiing sound whenever the skis are on the ground. The volume will be proportional to the speed.

    I have all the collision logic working fine so I'm really just looking for how best to play/stop the ski sound dynamically while at the same time controlling the volume.

    Here is the pseudo-code:

    Code (csharp):
    1.  
    2. private PoolableReference<AudioObject> skiSoundFXPool;
    3.  
    4. void Start()
    5. {
    6.      //Get poolable reference to the skiSoundFXPool Audio Object without actually playing the sound yet????
    7.      //HOW??
    8. }
    9.  
    10.  
    11. void Update
    12. {
    13.      if(SkiTouchingSnow)
    14.      {
    15.           volume = GetVolumeFromSpeed(speed); //some value between 0 and 1
    16.  
    17.          //SET SKI SOUND VOLUME HERE (How do I do this with poolable reference?)
    18.  
    19.           if(!_skiSoundAlreadyPlaying)
    20.           {
    21.                 //PLAY SKI SOUND HERE (How do I do this with poolable reference?))
    22.           }          
    23.       }
    24.       else if(!SkiTouchingSnow)
    25.       {
    26.             //STOP PLAYING SOUND HERE (How do I do this with poolable reference?)
    27.       }
    28. }
    29.  
    As I mentioned, I already have the logic for determining when the ski is or is not touching the ground. I'm just not sure how to structure the references to the skiSoundFX audio object in the places I show in the code.

    I have looked at the sample code for the AudioObject in the documentation, but it doesn't seem to fully address the situation where I'm playing and stopping a looping sound effect.

    Any guidance is very welcome.
     
    Last edited: May 26, 2012
  32. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    I cant see those methods, I'm testing the free version so I guess thats a feature for paid version only?
     
  33. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @hjupter: those functions should be in the free version too. I just noticed I accidentally wrote AudioCategory.NewCategory instead of AudioController.NewCategory. I edited my post, it's now correct. Sorry for my mistake.

    @JeffWeber: have a look at the example in the reference. Use the PoolableReference.Get() function to retrieve the AudioObject (or null if it is not valid anmore). If you are only working on a PC game then you can also turn off audio object pooling, as pooling only makes a noticable performance difference on mobile platform. Then you could use the AudioObject itself directly without the PoolableReference. Look here here for a reference of AudioObject functions to fade out or adjust the volume, etc.
     
  34. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    I have looked at the code example, but it only shows logic for Playing --> Checking For Null Ref --> Stoping a audio object.

    My questions are:

    When do I do:
    Code (csharp):
    1. var soundFX = new PoolableReference( AudioController.Play( "someSFX" ) );
    Do I do this the first time I need to play the sound? Do I do this at Start()? I don't think I want to do it at start because I don't want to play the sound at Start().

    When I want to PLAY the sound and I already have my poolable reference do I have to do this:
    Code (csharp):
    1. AudioObject audioObject = soundFX.Get();
    2. if( audioObject != null )
    3. {
    4.     // it is safe to access audioObject here
    5.     audioObject.Play();
    6. }
    What if audioObject comes back null. Do I then have to get another poolable reference before I can play the sound again?

    When I want to change the volume, which I may potentially do on every call to Update to I need to use the same kinda logic?
    Code (csharp):
    1. AudioObject audioObject = soundFX.Get();
    2. if( audioObject != null )
    3. {
    4.     // it is safe to access audioObject here
    5.     audioObject.Volume = _volume;
    6. }
    Again, what if audioObject is null.

    Seems like things would be much easier for me if I just had something like:

    AudioController.SetVolume("SkiSoundEffect", volume);

    This way I could just use AudioController.Play() and AudioController.Stop() to start and stop the sound and AudioController.SetVolume(...) to adjust the volume dynamically.

    BTW, this is for mobile so I want to use the pooling for perf reasons.

    -Jeff
     
  35. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    I looks like I should write a more detailed info page in the reference manual about the AudioObject and the PoolableReference, as a few people seem to get confused by this. I think the problem is a misunderstanding of the concept. I'll try to explain now:

    Whenever you call a play function such as AudioController.Play(...) a game object gets instantiated which has the AudioObject component and also Unity's AudioSource component. This object is actually playing the sound until the sound has finished. You can see it in the Hierarchy view of the Unity editor. If you have pooling disabled this game object will get destroys once finished playing. If pooling is enabled the object is not destroyed, but only moved to a pool of inactive game objects (the grayed objects in the Hierarchy view).
    Each play function returns a reference to the instantiated AudioObject. This way you can e.g. adjust the volume of a specific playing audio effect at any time. With disabled pooling the following code is correct:
    Code (csharp):
    1.  
    2. audioObj = AudioController.Play( "someAudioID" );
    3. // some time later
    4. if( audioObj != null ) // check if audio is still there and playing
    5. {
    6.     audioObj.volume = 0.5f;
    7. }
    8.  
    However, if you use pooling the if( audioObj != null ) check is not sufficient because the AudioObject may have stopped playing and was deactivated and moved to the pool for later reuse. That's why you have to use the PoolableReference to handle this case. So you should do the following instead like :

    Code (csharp):
    1.  
    2. var soundFX = new PoolableReference( AudioController.Play( "someAudioID" ) );
    3.  
    4. // some other part of the code executed later when the sound may have stopped playing
    5. // and was moved back to the pool
    6. AudioObject audioObject = soundFX.Get(); // checks if the poolable object is still valid and returns null if it is not valid
    7. if( audioObject != null )
    8. {
    9.     // it is safe to access audioObject here
    10.     audioObject.volume = 0.5f;
    11. }
    I hope it's now better understandable what the PoolableReference is all about.

    @JeffWeber:
    For your SkiSoundEffect you could also do it with the following way (not 100% performance optimal, but I don't think it will matter):
    Code (csharp):
    1.  
    2. var audioObjArray = AudioController.GetPlayingAudioObjects( "SkiSoundEffect" );
    3. if( audioObjArray.Length > 0 )
    4. {
    5.    audioObjArray[0].volume = myCalculatedVolume;
    6. }
    7.  
     
  36. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    Hey clockstone,

    Thanks for the patience. I understand the pooling logic, it just seems in my particular instance where the sound will be played and stopped very frequently and the volume will be set even more frequently, the code involved would become pretty cumbersome.

    I guess I'd still like to see some of this logic sit behind a AudioController.SetVolume(string sound, float volume) method.

    Anyway, I think I have a better, simpler solution.

    My Ski sound effect is looped and really needs to play almost constantly. It'll only be "off" when the skier is in the air or stopped. For this reason, I think I will just "Play" the ski sound effect constantly, then just adjust the volume as needed. So, I should only need the logic for changing volume and not have to worry about playing and stopping the effect.

    Can I assume the AudioObject reference from the pool will never be released if the sound effect is looped and never stopped?

    Also, I assume I'll need to check the "Play with zero volume" box for this to work. That true?

    -Jeff
     
  37. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    Thank that did it :)... now when I add it to a Category I want to set music to loop when I play it, I cant find how to do that on the documentation
     
  38. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    I just figured out how:

    AudioItem a = AudioController.AddToCategory(cat, audio.clip, "Theme");
    a.Loop = true

    But is not looping it, after finish its just destroying the object, what I'm doing wrong?
     
  39. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @hjupter: This is actually the right way to do it. The problem is that Unity does not seem to support looping with streamed audio files. Have a look at this post.
     
  40. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    I know about that issue, what I do is check in an update if the sound is not playing if not then play it again, perhaps you could add some event system or something like that to make this easier... OnSoundComplete(){ AudioController.Play....
     
  41. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    There is the delegate AudioController.completelyPlayedDelegate which you could use for that
     
  42. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    596
    Awesome thanks, I was looking for it, maybe you need a better documentation :)

    I will definitely going buy this package soon!
     
  43. Tapgames

    Tapgames

    Joined:
    Dec 1, 2009
    Posts:
    242
    Hi all,

    Did someone manage to get this working for javascript? I tried to move the audiotoolkit folder to the plugins folder but getting errors.

    Roy
     
  44. sebrk

    sebrk

    Joined:
    Mar 20, 2012
    Posts:
    6
    I'm looking to fade out any existing audio and then play a new audio clip. So basically upon a certain event that triggers the new audio to be played, the old one should fade out first. So queue and fade. How would this be done? I'm not really sure I have grasped the playlist/category difference quite.
     
  45. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @sebrk: This code snipped does what you want:
    Code (csharp):
    1.  
    2. class PlayAudioAndFadeOutPrevious
    3. {
    4.     PoolableReference<AudioObject> _audioObject;
    5.  
    6.     const float fadeOutTime = 1;
    7.  
    8.     public void Play( string audioID )
    9.     {
    10.         if ( _audioObject != null )
    11.         {
    12.             AudioObject audioObj = _audioObject.Get();
    13.             if ( audioObj )
    14.             {
    15.                 audioObj.Stop( fadeOutTime );
    16.             }
    17.         }
    18.         _audioObject = new PoolableReference<AudioObject>( AudioController.Play( audioID ) );
    19.     }
    20. }
    21.  
     
  46. helios

    helios

    Joined:
    Oct 5, 2009
    Posts:
    290
    I can't get playlists to work for some reason. When I items to the playlist, they appear in the dropdown as expected. However, as soon as I run the game the playlist items disappear. Is there a setting I'm forgetting or something? Thanks.
     
  47. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    Might be a Unity inspector bug. I have already seen something similar in a different situation. Try the following as a workaround: After you add tracks to the playlist also change another value in the AudioToolkit, e.g. the global volume. Then save your project and/or scene.
     
  48. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    When I set the volume to some lower than default value either by using the sliders in the inspector or calling Play() with the volume overload, everything works as expected in the editor... the volume plays at a lower volume.

    However, when I deploy to my iOS device, the volume plays at it's normal volume. Is there anything simple I could be forgetting to do to make this work on the device?

    Ideas?
     
  49. clockstone

    clockstone

    Joined:
    Jan 18, 2012
    Posts:
    83
    @Jeffwber: That's really strange. Adjusting the volume certainly works for our iOS / Android projects. Does it happen with all sounds and all the time?
     
  50. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    451
    As I mentioned in my email, I will see if this happens when I load you demos. I'll also try it with other sounds in my app. Must be something simple I'm missing.