Search Unity

[RELEASED] SoundManagerPro: Easy Game Music Plugin

Discussion in 'Assets and Asset Store' started by AntiLunchBox, Jun 12, 2013.

  1. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey retox,

    I'm aware that there are issues with the Playmaker actions in the new 4.5

    I'll be able to get to this on Friday unfortunately. But I'll have the fix up then!

    Pat
     
  2. MochiBits

    MochiBits

    Joined:
    Mar 11, 2014
    Posts:
    30
    Hey Pat,

    Did you post a work-around for this? I just saw this error, and couldn't find any other posts related.

    I'm also doing the suggested way for a random song, create multiple custom soundconnections and then just...
    Code (csharp):
    1. SoundManager.PlayConnection("Song"+Random.Range(1, 4).ToString());
    Would one workaround just be to include the song twice in each soundconnection?

    Thanks!
     
  3. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey all,

    The latest update fixes the playmaker bugs in Unity 4.5
     
  4. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey Mochi,

    I fixed that bug a long time ago. Have you updated since then? If you are still seeing it in the latest, let me know. Also if you are upgrading from 2.x to 3.x, you have to remove all SMP from your project and scenes first.

    As for playing a random song, there are better ways to do that. You can just use SoundManager.Play, or create one soundconnection with all the songs and have it set to ShufflePlayThrough.

    I don't know much more about your setup or what you're trying to do, so if you're still having issues let me know some more info! Thanks,

    ALB
     
  5. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I'm new to Sound Manager pro and I'm having a bit of a problem Playing sounds.

    I have added a bunch of sfx to the sfx section of Sound Manager pro. When I call Play using the overloaded method that receives a string the sound is always played when I trigger it (I hear it). Doesn't happen the same if I use an audioclip istead of the sfx name. When using an Audioclip the sound is played randomly (For example if I trigger it 5 times only once is played (I hear it just once out of 5 triggers)). I would like to use Audioclips because it is more efficient than the string version. Is there any possiblity to guess what is hapenning here?

    On the other hand is there any way to set sfx volume on the editor? Haven't found a way to do this. It would be nice to let the user set the sfx volumen there instead of setting when playing the sound in code.

    Thanks in advance.
     
    Last edited: Jun 1, 2014
  6. realghetto

    realghetto

    Joined:
    Jan 21, 2014
    Posts:
    112
    So, after a year using my own sound solutions, I bought this. It took only a couple days to implement into a current project of mine. But I'm having a problem.

    I'm using NGUI version 3.6.1.

    I've replaced the contents of NGUITools.cs with the following line of code:
    return SoundManager.PlaySFX(mListener.gameObject, clip, false, volume, pitch);

    Due to frequent NGUi updates, I understand your NGUITools.cs is out of date. But reviewing the code, it appears that the fix you provided in the readme file should be sufficient, which is what I did.

    In a scene while the game is running, when I click an NGUI button that has UIPlaySound, I can see, that SoundManager adds the component of audiosource "instantly" to the only AudioListener in the scene. The component is added, and PlayOnAwake is checked by default on that component, as well, the audioclip supposed to play is also changed instantly to the correct one.

    The problem is, when the sound is played, there is a 2-3 second delay from when the sound is actually played.

    As well, I noted, all ngui sounds do not conform to the current SoundManager.SetVolumeSFX(value);

    Everything else, "but" NGUI works fine as expected. Music plays, and at at proper levels, I have reconfigured all my soundfx from my custom scripts, and they play on time and at expected volume level, but when I interact with the latest version of NGUI, this returned audiosource is not acting as expected, nor is it conforming to the universal volume for SFX.

    Can you assist?
     
  7. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Hi,

    First, let me say been enjoying your asset for awhile now its really nice.

    Just an FYI that with the latest version that there are several compile errors when targeting windows store apps. It looks like the conditional statements for UNITY_METRO don't encapsulate all the lines that aren't available on that platform with the current version.
     
  8. realghetto

    realghetto

    Joined:
    Jan 21, 2014
    Posts:
    112
    Thanks for the quick email reply! I should have started typing the line inside nguitools.cs instead of copy pasting.

    Changing:

    Code (CSharp):
    1. return SoundManager.PlaySFX(mListener.gameObject, clip, false, volume, pitch);
    to

    Code (csharp):
    1.  
    2. // no volume conformity to SoundManager
    3. return SoundManager.PlaySFX(mListener.gameObject, clip.name, false, 0f, volume, pitch);
    Code (csharp):
    1.  
    2. // conforms to volume conformity of SoundManager
    3. // but Iose independent control of NGUI sounds pitch and volume.
    4. return SoundManager.PlaySFX(mListener.gameObject, clip.name);
    Code (csharp):
    1.  
    2. // conforms to SoundManager volume control and
    3. // respects independent NGUI sound volume control.  
    4. // Also incorporates and respects NGUI specific pitch
    5. // along with SoundManager.GetPitchSFX()
    6. return SoundManager.PlaySFX(mListener.gameObject, clip.name, false, 0f, volume * SoundManager.GetVolumeSFX(), pitch * SoundManager.GetPitchSFX());
     
  9. MochiBits

    MochiBits

    Joined:
    Mar 11, 2014
    Posts:
    30
    I downloaded and first used it on May 15th. I'll see if the latest update helps.

    Also, I'm looking to choose a random song, then loop that song. Will try out that option.

    Thanks.

    (The ALB website seems to be down at the moment)
     
  10. realghetto

    realghetto

    Joined:
    Jan 21, 2014
    Posts:
    112
    When using the AudioSourcePro component, why is the volume not relative to the SoundManager.GetVolume() or GetVolumeSFX() or GetVolumeMusic() ? Is there an easy way to implement this?
     
  11. Alanj2007

    Alanj2007

    Joined:
    Aug 22, 2013
    Posts:
    17
    Hey, I just noticed that your website seems dead .. It shows me just a blank page. I wanted to see the documentation :(

    EDIT : Never mind, it's working now
     
    Last edited: Jun 4, 2014
  12. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I am ready to use your package, but I wanted to check whether there are any new features regarding localizations for already-recorded voiceovers in multiple languages but also whether you support windows store and windows phone.

    Thanks again!


     
  13. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Just for clarity I'm attaching the errors recieved in the latest version when you target windows store app. Looks like a few platform dependent statements are misplaced. GetMember and IsAssignable from aren't available on that platforms runtime.

    error.jpg
     
  14. hexdump

    hexdump

    Joined:
    Dec 29, 2008
    Posts:
    443
    Hi,

    I'm a bit disappointed with Sound Manager PRO support. Almost a week after I did my first question on the package related to a core functionality of the asset and no response... Is this always the case?.

    Cheers.
     
  15. Dosetsu

    Dosetsu

    Joined:
    Dec 22, 2011
    Posts:
    39
    Edit : latest version fixed my issue.
     
    Last edited: Jun 11, 2014
  16. jhample

    jhample

    Joined:
    Jul 7, 2012
    Posts:
    47
    Not sure if this is mentioned anywhere here, but is there a way to start a SFX at a certain time into the clip? For example I have a clip that is 5 seconds long, but I want to start it at the 2 second mark.
     
  17. Hazzius

    Hazzius

    Joined:
    Jun 21, 2014
    Posts:
    11
    Hello guys!
    Tell me plz, how to stop or mute only one SFX?
     
  18. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey guys,

    Sorry I haven't looked at this thread. It still doesn't alert me of posts here and I've been traveling a lot this month! It's much easier to just email me, I see that some of you have. I'll try and get through the feedback I missed now.

    In the meantime,

    Here's whats available in SMP 3.6 that just came out:

    Changelog in v3.6
    • Revamped UFPS integration.
    • Added SoundPocket functionality, in editor control loaded SFX at certain points in your game.
    • Added ability to add base volumes to SFX and individual tracks in SoundConnections.
    • Added tooltips to help understand SMP. Each variable in the editor is explained.
    ALB
     
  19. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Sorry hexdump,

    This is most definitely not always the case, sorry I haven't gotten back to you. I've been traveling a lot this month and it's been hard to keep up with this thread, especially with the issues mentioned above. Also feel free to email me as it is much faster for me to respond. Through email I usually answer within the hour.

    To respond to your question, using the AudioClip version should definitely not do that. I tested it out in the Demo Scene by referencing an AudioClip and I'm not seeing that behavior. Is it possible that the sound you are playing it set to a 3D sound? So sometimes, depending on where it's playing, you won't hear it? Set it to a 2D sound and let me know.

    As for the volume of each SFX, this was a recent request and is available in the update that went up tonight!

    Just pull the update.

    ALB
     
  20. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey realghetto, I believe I answered all your questions in email. Let me know if there's anything else!
     
  21. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey Gegagome,

    No this is not implemented, but you can use that code in the quote. It should work.

    ALB
     
  22. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey gregg,

    Is this still an issue? I know I got an email from somebody about this and ended up fixing it, but I'm not sure if it was you. Let me know and I'll investigate.

    ALB
     
  23. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey jhample,

    All the SFX functions return the resulting audiosource, so you can just use that to set the time.

    You might be able to even do this:
    SoundManager.PlaySFX(thisSFX).time = 2f;

    I would suggest using the timeSamples/samples variables instead though, they're more accurate.

    ALB
     
  24. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    You can just do SoundManager.StopSFXObject

    or just mute the resulting audiosource returned from the PlaySFX function.

    ALB
     
  25. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Yes, its still present in 3.6 when targeting windows store. GetMember and IsAssignableFrom is not available on that platform and those two calls aren't wrapped in the platform dependent statements.
     
  26. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Ah, ok I see that. I'll post a fix tonight.

    ALB
     
  27. Hazzius

    Hazzius

    Joined:
    Jun 21, 2014
    Posts:
    11
    Thx, i try this method later.
    I have one more question.
    How play sound only once at this function?

    void Update ()
    if(Physics.Raycast(ray1, out r_Hit1, 1.2f) == true || Physics.Raycast(ray2, out r_Hit2, 1.2f) == true)
    {
    b_GroundChecked = true;
    !!!What i must to place here to play sound only once???!!! i try this:
    SoundManager.PlaySFXLoop(gameObject, "minecart landing", true, 0.4f, 1.3f, 1.43f);
    }
    else
    {
    b_GroundChecked = false;
    }
     
  28. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey Hazzius,

    PlaySFXLoop plays a loop, which is why it's playing more than once. Just use PlaySFX

    ALB
     
  29. vicenterusso

    vicenterusso

    Joined:
    Jan 8, 2013
    Posts:
    130
  30. Hazzius

    Hazzius

    Joined:
    Jun 21, 2014
    Posts:
    11
    But if i make like this:

    void Update ()
    if(Physics.Raycast(ray1, out r_Hit1, 1.2f) == true || Physics.Raycast(ray2, out r_Hit2, 1.2f) == true)
    {
    b_GroundChecked = true;
    SoundManager.PlaySFX("minecart landing", false, 1f, 0f);
    }
    else
    {
    b_GroundChecked = false;
    }

    he start spam the sound, couse he check it in every frame.

    For the understanding, both raycast hit from minecart and if it on the ground, he start spaming the sound of landing "dzing".
    I need to play sound only once, at the moment then b_GroundCheked became true. I need only one shot function or something like this.
     
  31. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Well that's because the code is running every frame because it's in the Update function. You can do:
    void Update ()
    if(Physics.Raycast(ray1, out r_Hit1, 1.2f) == true || Physics.Raycast(ray2, out r_Hit2, 1.2f) == true)
    {
    if(b_GroundChecked)
    SoundManager.PlaySFX("minecart landing", false, 1f, 0f);
    b_GroundChecked = true;
    }
    else
    {
    b_GroundChecked = false;
    }
     
  32. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hello, I haven't used SoundManagerPro for the past six months, but I started using it again this week for a brand new project. I have a simple SoundConnection set up to play 5 music tracks in "Repeat All In Order" Continuous Play Through mode. I intermittently get this error and all music stops whenever a new level is loaded:

    The cross duration is longer than the track length! Stopping the SoundConnection. TO FIX: Change the cross duration beforehand.
    UnityEngine.Debug:LogError(Object)
    <PlaySoundConnection>c__Iterator38:MoveNext() (at Assets/SoundManagerPro/Scripts/Managers/SoundManager_Internal.cs:825)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    SoundManager:HandleLevel(Int32) (at Assets/SoundManagerPro/Scripts/Managers/SoundManager_Internal.cs:160)
    SoundManager:OnLevelWasLoaded(Int32) (at Assets/SoundManagerPro/Scripts/Managers/SoundManager.cs:26)

    The Cross Duration is set at 5 seconds and all of the 5 tracks are from 30 seconds to 1 minute long. It looks like another permutation of the bug from six months ago? I am using the latest version of SoundManager.

    Sometimes the error message simply states "Nothing is playing" and the SoundConnection won't even fire up on the first level. The SoundManager looks fine and all 5 tracks are loaded and ready to go, just nothing starts playing. "Music Always Off" and "Ignore Level Load" are unchecked.

    It seems to help and "reset" things if I close and restart Unity, and then everything works fine again for a while. Please look into this and find out what is causing this issue. Thanks!
     
  33. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Also, playing a sound seems to temporarily lower the volume of other sounds for a few seconds. Is there a way to have all sounds play at full volume always? All sounds are 2D, all ducking settings are off (and I thought ducking only affected music). Thank you
     
  34. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey eridani,

    I was just able to reproduce the bug, I know what the problem is. I'm looking into a fix now.

    For the lowering volume bug, can you post the code you are using the play the sound? Ducking can effect sfx, music, or both--depending on the setting set. It would be good to get a look at what you're using exactly.
     
  35. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Cool ALB thanks so much for tracking down the first issue.

    Regarding the second issue, it's weird but it only happens when playing the game in the editor. I'm just using SoundManager.Play("soundName")... When I build it to an actual android apk it works perfectly, with no ducking at all.

    Any idea why it would happen only in the editor but not in a build? Obviously I can totally live with this as long as it doesn't affect the actual build, but maybe there is some minor bug crawling around in the background somewhere.
     
  36. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hi,

    First off, love this asset, it's a pleasure working with it in my game, thanks for creating it. I actually came to this thread to ask a question about playing different sounds based on distance, but then did a bit more digging and ended up making a new script that changes the audio group on awake based on the audio listeners distance! The only thing I had to do was turn off pre-pooling for those groups, as the pooled ASPros are instantiated with clips already set.

    Really happy with the result, this asset makes audio so easy to do properly, I can't imagine going back to default Unity audio.
     
  37. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey eridani,

    So I fixed the bug. I basically had to add that behavior when it's requesting to play a song that is currently crossing out. But it's handled now. I'm going to bundle it in with other fixes and features I'm going to be posting this weekend. The update will be available soon.

    ALB
     
  38. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Changelog in v3.6.1
    • Fixed crossout bug
    • Organized generated SFX Objects underneath the SoundManager
    • Further fix to Win 8 Phone/Windows Store Apps builds
    • DF-GUI integration update to include clip type (like ngui integration)
    • NGUI integration update
     
  39. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey eridani,

    That's weird. I'm not seeing it on my end. And none of the editor scripts change the volume. Would love to get more details + code + setup.

    As for your other bugs, they are fixed in the update I just put up.

    ALB
     
  40. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey gregg,

    This is fixed in the latest update.

    ALB
     
  41. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,782
    Hi,

    I just downloaded and installed 3.6.1, in a new project and am getting the following error. My project is targeted as a standard windows build ie not W8 store etc..

    Is there a workaround for this?

    Ta,
    Adam.

    PS Love this asset.. its my go to for audio.

    2014-07-01_7-17-59-SMPROBUG.jpg
     
  42. AntiLunchBox

    AntiLunchBox

    Joined:
    Jun 6, 2013
    Posts:
    470
    Hey Adam, it looks like you're missing the SoundManagerTools file. I would reimport so you can get that extension.

    ALB
     
  43. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,782
    Hmm... did it and it worked fine.. weird. Thanks for your prompt response ALB :)
     
  44. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hi there,

    Two questions:

    • Is there a way to determine if a sound effect is currently playing using the Sound Manager?
    • Is there an easy way to stop a single sound effect from playing without using the StopSFXObject() method? i.e. I have started playing a sound effect using PlaySfx("clipname") - the string overload version, and would like to be able to do something like StopSfx("clipname").
    *edit, I see that PlayCappedSfx for example returns an AudioSource instance of the sfx, so I could do returnValue.Stop(), but is there a way of using the manager to do this by referencing the string clip name? So that I don't need to keep variables that have scopes outside of the method to reference the audio clip for example...

    Thanks!
     
    Last edited: Jul 2, 2014
  45. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks ALB for the latest bug fixes. Regarding the music ducking in the editor but not a build... I still have no idea and will keep looking for clues as a low priority.

    What's the best way to update SoundManager to the latest version? Just overwrite all the scripts? I would like to keep my current SoundManager settings because I loaded up a lot of audio files and groups and don't want to do that all over again.

    Or to be safe, if you could just point out which script fixes the music suddenly stopping (the "cross duration" bug), I would really just like to put in that fix for now. Thanks again!
     
  46. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I also have a question about prepool amounts.

    Right now I can set up individual prepool amounts for individual sounds in the SoundManager prefab using the Unity editor. But is there an easy way to prepool sounds through code at runtime, so the code can pick and choose which sounds to prepool for a scene depending on certain game conditions?

    For example, let's say my player can choose one of thirty uniquely sounding guns every time the player loads a level, and each gun can shoot 10 times per second, so I want to prepool ten sounds of the specific gun that the player chooses when he starts the level.

    Right now to ensure that there are 10 sounds prepooled for the proper gun chosen, I have to prepool 10 sounds for all thirty guns, meaning always having 300 prepooled sounds every time, because I don't know which gun the player will choose after the level starts. So 290 sounds will be prepooled for nothing every time, wasting memory.

    Please advise on the best way to handle this prepool situation. Thanks ALB!
     
  47. Dj_Zuczyslaw

    Dj_Zuczyslaw

    Joined:
    Mar 20, 2014
    Posts:
    31
    Hello, help me, i'm very bad with coding :D.

    I don't know how to check (by using code) that MuteMusic is (true) or (false)

    I'm using soundmanager pro and igui. First, when my game is loading i declares this:
    SoundManager.MuteMusic (true);
    SoundManager.MuteSFX (false);

    Because I want to mute music at start, and turn on sfx at start.

    I use igui switch - there are two position/value: on and off.

    I don't know what kind of code use to check mute staus. I want a code that will change switch value depend of music is mute or no mute.

    I trying this but this not work :D:


    void Start()
    {
    if (SoundManager.MuteMusic = false); /// <-- I don't know what kind of correct c# code type here
    {
    switch1.setValue(false); // <- this code is ok
    }
    }
     
  48. PeterHann

    PeterHann

    Joined:
    Apr 9, 2013
    Posts:
    22
    Hi
    is there any option to make a soundconnection be played from a 3D Audio Source? I try to set up an 3D positioned Radio in my scene that acts as a music source but can't figure out how to do this with SM Pro + Playmaker using Unity 4.5 Free.

    greets
    Peter
     
  49. Gaviathan2

    Gaviathan2

    Joined:
    May 23, 2013
    Posts:
    13
    Every time I buy a product and find that their forum is on the unity forums a little piece of me dies LOL I'd love to search and see if my issue has already been addressed but on here that's not gonna happen,and google is useless for it. Anyhoo I've set up a playlist (soundConnection) and put it on shuffle,for the most part it plays through great fading in and out etc,but on semingly random occasions the debug thing says
    If clip == clip in audio1, then just switch them
    and plays another track.The trouble is,when that happens the song it plays starts somewhere in the middle eg. a song that is 2 mins long might start at 1min. Other sound manager things I have going on in the scene are a volume slider and pause thing.Is there a setting I'm missing or is this a bug?
     
  50. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Could someone explain the Sound Pocket functionality please? The documentation I can see is being update, but really needs an overhaul and to be brought inline with the latest release.