Search Unity

[20% off!] Master Audio - AAA Sound Solution. #1 audio plugin on Asset Store!

Discussion in 'Assets and Asset Store' started by dark_tonic, Jan 28, 2013.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    I believe that instead of the script you are using and the setting you're storing, you should use the Persistent Settings feature that's built in. It will automatically set the music to the last volume every time it starts up. Let me know if that doesn't work.

    I'm not sure you how got that particular message though. You'd have to send me your script.
     
  2. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio is on sale for $19.95 for a limited time!
     
  3. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Are there any known issues with the Doppler effect? I get an issue whenever I try to use it where the sound is just all over the place - it sounds terrible. For any sound effect I mark as a 3D sound and then use PlaySound3DFollowTransform, I get that behavior. I can make the sound normal if I set the sound effect to Doppler = 0, but there are a few places I'd like to actually have a Doppler effect.

    I'm on Unity 4.6 and Master Audio v3.4.
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    I have only heard people complain about Doppler, never liking it.

    You could ask on the Unity "AUDIO" forum and maybe someone knows.
     
  5. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    OK, will do. So this is likely 100% a Unity issue then?

    I had Doppler working in an XNA game and it was actually very cool. I found a YouTube video of a Unity 5 game with a speedboat going by the camera and it sounded great. Maybe Unity 5 is better is that area.
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Definitely a Unity issue. Nothing to do with Master Audio code.

    I don't think Unity 5 has fixed doppler to be unproblematic. We already had a couple people report problems that were eliminated by turning off doppler with Unity 5.

    You will probably need to play with it for awhile.
     
  7. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I did a test project with one scene using plain Unity and another using Master Audio with a looping 3D sound whizzing by the camera. Even cranking up the Doppler value to 5 on the sound effect, it was perfect in plain Unity and sounded bad in Master Audio. I couldn't get it to sound nearly as bad as in my real game (perhaps because the camera is also moving in that?), but it's bad enough to be an example. I can attach it to a PM or send a link to it in a PM if you want.
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    First you should try changing the Update method in SoundGroupVariationUpdater.cs to be FixedUpdate instead. If that doesn't fix it, I'm pretty sure there's no way to fix it but I wouldn't know exactly why it's happening.

    Master Audio's Audio Sources don't attach to game objects "making" the sounds, but update their location every frame (or fixed frame if you try FixedUpdate) to the location of the game object making the sound. Actually attaching led to several unfixable bugs when objects are destroyed so we got out of that business a long time ago. Doppler may somehow have an edge case that isn't fixable. You can try FixedUpdate and let me know if that works or not.

    -Brian
     
  9. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,567
    Hi Jerotas.

    This may be trivial question, but how can I check if certain sound group is being played? I want to play some looping clip of music in say dangerous situation and have playlist duck volume automatically for me.
     
  10. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Here it is.
    Code (csharp):
    1.  
    2. if (MasterAudio.GetGroupInfo("Arrow").Group.ActiveVoices == 0) {
    3.    // not being played, so play one.
    4.    MasterAudio.PlaySound3DAndForget("Arrow");
    5. }
    6.  
    If you'd like a way to do it with less typing, I can add that in the next version. Let me know!
     
  11. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    98
    Hey there,

    I'm using your plugin for a research project featuring simple AI characters that communicate with one another. Before playing a line of diaglogue, I would like to obtain the duration/length of the clip being used. What is the easiest way to achieve this? Each dialogue group only contains one variation.

    Many thanks and amazing work, aswell - one satisfied customer here! :)
     
  12. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    106
    Hi, I'm getting this error when trying to build for Windows Store Universal 8.1:

    Code (CSharp):
    1. Assets\DarkTonic\MasterAudio\Scripts\Events\EventSounds.cs(1708,38): error CS1061: 'System.Collections.Generic.List<DarkTonic.MasterAudio.AudioEventGroup>' does not contain a definition for 'AsReadOnly' and no extension method 'AsReadOnly' accepting a first argument of type 'System.Collections.Generic.List<DarkTonic.MasterAudio.AudioEventGroup>' could be found (are you missing a using directive or an assembly reference?)
     
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Code (csharp):
    1.  
    2. var clip = MasterAudio.GetGroupInfo("Arrow").Group.groupVariations[0].GetComponent<AudioSource>().clip;
    3. var len = clip.length;
    4.  
    Note that if you're using Resource files (which is usually a good idea for ALL dialogue to save memory), this will not work and I can't think of a good way to accomplish it, since you would need to actually load the Resource file to get that. Which is a bad idea.
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Ok, reproduced and fixed on my Win8 laptop. Change the following method at the bottom of EventSounds.cs to this and it will work.

    Code (csharp):
    1.  
    2. publicIList<AudioEventGroup>GetAllEvents() {
    3.    #if UNITY_WSA
    4.      return userDefinedSounds; // can't compile the one below
    5.    #else
    6.      return userDefinedSounds.AsReadOnly();
    7.    #endif
    8. }
    9.  
     
  15. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I went ahead and updated to the latest version first, and it looks like SoundGroupVariationUpdater.cs is already using FixedUpdate in that version. It seemed like it sounded a little better with that version, but not exactly nice. I get that the design of Master Audio has to focus on certain features and I don't imagine a ton of people are screaming for Doppler effect support.

    I love the asset and it's clear that it will need the needs of the VAST number of games. I think for my current game, I may try stepping it up a notch. I had my heart set on surround sound support, but it seems that Unity is pretty flaky with supporting that on a variety of hardware. I couldn't get it to go to 5.1 on my home theater setup in vanilla Unity 4.6 or Unity 5.0. Then I tried FMOD and it worked. I know the surround sound issue is definitely not a Master Audio issue, but do you have a feel for how robust surround sound support is on PC's in Unity? I was disappointed that even Unity 5 can't support that on a PC that runs every commercial game in 5.1 just fine.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Actually in the version on my computer, LateUpdate is what's used. See if that works any better if you still want to try things out.

    FMod is great especially if you've used it previously. It has a learning curve and workflow is not exactly optimal, but it has improved in that regard recently is what I hear.

    As far as 5.1 or surround sound, we support what Unity supports, since we are using Unity Audio Sources. We don't have our own audio engine or anything - but you already know that. I've never tried to use surround sound in game and for whatever reason am not very interested in it right now. If FMod works well where Unity audio does not and you need that, I would go for it :)
     
  17. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Ah, you're right of course. Brain fart on my part. FixedUpdate didn't help though.

    I had not used it before and the 250 page manual for just FMOD Studio is a bit daunting. :) I did get a basic 5.1 test going pretty quickly, but yeah, it's a whole different world for sure. I'm sure it's overkill for what most indies are doing.

    It would seem you are not alone, as hardly anyone is talking about surround sound in Unity. For a 3D space game (especially one that supports VR), it's a must though, in my opinion.

    Anyway, thanks for the reply!
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Agreed, for VR it's an absolute must! I hope Unity gets surround sound working much better soon so we all can have it.
     
  19. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    765
    Hi, I've a question about BGM(playlist) loop.

    I have BGM that loops from the middle ( 1~10sec is the intro, and 10~90sec is the loop part ), I've searched the doc for this part but not founded it.

    Do I have to cut the clip into two separate clips or there is support in MA?

    Thanks,
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Yeah you need to split it. The part that loops needs to be an entire clip. There is a feature on the roadmap to enable this without splitting, but it's probably a few months out at a minimum. Plus it would only be accurate up to the frame rate (read: I wouldn't use it), so it might get moved off the roadmap if it's not as exact as it would need to be when I try it.
     
  21. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    765
    Thanks, I Got it, just to make sure not miss it.
     
    jerotas likes this.
  22. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    389
    Hey Brian

    I has a small problem where using MasterAudio.PlaySound3DAtVector3AndForget() was sometimes dropping sounds and I could not figure out why.

    I logged the messages and the sounds were being queued (just 1 in the group) but occasionally sounds would still drop.

    Then I moved the code to Update() instead of FixedUpdate() where it was originally and the problem did not recur, so I thought I would let you know.

    Has anyone experienced this before (Unity5) ?

    cheers

    Nalin
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Follow code is in LateUpdate not Update...haven't heard about that not working. What do you mean "sounds would drop"? Fixed Update may be needed sometimes if you're following a Physics object since that's when they move. If you're doing PlaySoundAtVector, there's no following going on, so that makes no sense.

    Sorry for the late reply, never got an email on my subscription to this thread :(
     
  24. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio V 3.5.7.8 has been submitted to the Asset Store. Changelog:

    • Now Sound Groups from any Dynamic Sound Group Creator game objects in the Scene appear in the dropdown list in our custom Inspectors for Event Sounds, Button Clicker and other scripts!
    • Renamed UndoHelper to AudioUndoHelper to match the code class.
    • Fixed bug: Fire Items Created Event in Dynamic SGC would hide the rest of Inspector below that when Master Audio not in Scene.
    • Fixed bug with manual Master Audio prefab creation and order of scripts not allowing Playlist to play.
    • Fixed compile error for Windows Store platform.
    • Fixed a bug with FadeOutNow not working when called immediately after PlaySound.
    • Updated BehaviorDesigner package with their latest updates.
    • Moved AudioUndoHelper into main Editor folder. No need for extra folder when it can't be shared with our other plugins. Please delete the old one in DarkTonic\Editor folder when updating.
    • Fixed compilation for all versions of Unity 5, future, beta and present.
    • Added 4th Spatial Blend Rule to Sound Groups: "Use Curve From Audio Source". This allows you set to a graph (green line) for Spatial Blend based on distance in the Audio Source. Choices are only visible when Spatial Blend Rule is set to "Allow Different Per Group" on mixer.
     
  25. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    138
    Hey Brian - is there a way to play a sound starting at a specified time in the sound? I've got a clip that I want to play at about 4 seconds in. Thanks!
     
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    You could set random start time to the same value for min / max in the Variation. But you'd have to calculate the percentage first. Or you can play it then immediately call JumpToTime on the Variation, which takes a float for seconds. Let me know if you need code for that, but it's on the API website.
     
  27. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    138
    That'll work, thanks!
     
    jerotas likes this.
  28. SmiggsGDog

    SmiggsGDog

    Joined:
    May 8, 2015
    Posts:
    4
    Hi Jerotas,
    I purchased master audio about around this time a year ago in a sale and just started using it. So far I'm really impressed by it, and wish I looked at it sooner.

    I do have a question, is there any chance there is a way to export master audio settings to another project? I took a look at the organizer but it only appears to export to the current project.

    Cheers.
     
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Correct. Just use normal Unity functionality for this. Make prefabs out of your all the game objects in your Scenes (Master Audio / Playlist Controller / etc) and export a package with those that you will import to your other project.
     
  30. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Hi, I'm considering making the example scenes folder of Master Audio a separate download since the audio is so large. This would make the "core" download about 20% of the current size.

    Good or bad idea? Currently, you can always uncheck the example scenes folder when you install it, but it still has to be downloaded. I'm thinking that some people think it's too big and don't want to buy it.
     
  31. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Thanks for the feedback. I don't look at size, but I'm sure some people do. Maybe it's only a small percentage.
     
  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio API website has been updated to Doxygen! It's much nicer and more full-featured. Here's a peek.

    upload_2015-5-10_17-46-47.png

    Link: http://bit.ly/1bkiRei
     
  33. Nekotika

    Nekotika

    Joined:
    Jan 31, 2014
    Posts:
    17
    Hi,

    I've found a bug in MasterAudio related to the Polyphony configuration. If you activate it and set Polyphony Voice Limit to 2, then try to reproduce 20 sounds in the same update it will let you do it, since it only uses "isPlaying" from the AudioSource to verify how many sounds are playing (and since they're called from the same update they're still not considered as playing).
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Thanks for reporting! Could you kindly point out the section of code and I'll fix it.
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio V3.5.7.9 has been submitted to the Asset Store. Changelog:

    • Added MusicMuted and SfxMuted properties to PersistentAudioSettings. Added these to EventSounds for no-code activation from various events.
    • Fixed bug where Event Sounds Inspector would log errors in Console when Master Audio prefab not in the Scene.
    • Made "Spatial Blend Rule" changes switch all Audio Sources when you select it at edit time too, so you can preview better. Does not do anything on Dynamic SGC's though.
    • Added option in Master Audio Manager window to update the installation folder. This setting uses PlayerPrefs so it won't need to be changed again every time you download an update to Master Audio.
    • Updated API Website to Doxygen!
    • Added code to put Script Execution Order of PlaylistController, MasterAudio and EventSounds scripts in the right order automatically.
    • Eliminated CoRoutine from EventSounds. Now Start events all fire correctly no matter what, due to the Script Execution item above.
    • Added MasterAudioBusGetProps Playmaker custom action to get voice limit, volume, etc of a bus and store them in variables.
    • Added MasterAudioGroupSetPitch Playmaker custom action.
    • Fixed bug with TriggerNextPlaylistClip that happened with auto-start in some cases.
     
  36. bosone

    bosone

    Joined:
    Sep 13, 2011
    Posts:
    375
    hi!
    i'm working on a a new audio asset concept:
    "rock construction kit"

    do you think that master audio will be able to handle the possibility offered by such a collection?

    here a video demo to explain the concept:



    the pack will include:
    - several seamless loops in rock style. All with the same tempo (90 bpm) and sound/mix
    - several intro clips
    - several end clips

    the clips are made so that you can:
    - use any intro clip to start any loop
    - use any end clip to end any loop
    - connect together different loops
    - use intro clips to connect different loops
    - use end clips as standalone stinger for win/lose events in the game

    in the video I show how these concepts are applied to the clips. You will be able either to build new clips using audio software or to manage clips connections with code (but code will not be included as I'm not a programmer, and here is where master audio could be useful!)

    right now i have made 6 audio loops, 14 end clips, 7 intro clips.
    I will need several weeks to complete the work and to refine the mix but i think it will be a nice pack.

    I can place a link to master audio in my collection to promote it, if you think it can be useful!

    thanx!
     
  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Yes I think we can handle all that functionality. To advance from one looped clip to another requires "telling" the Playlist Controller to go to next song, or it will loop infinite times. Which is one line of code. Let us know when the pack is ready! Thank you.
     
  38. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    For the next version we're adding a new Audio Origin of "File in Internet". This allows you to put in URL's like https://dl.dropboxusercontent.com/u/40293802/arrow.wav into a Variation. During the Awake event, Master Audio will start downloading the audio for any Variations set up like this. The mixer now has an icon showing the ready status of each Group (loading / ready / failed), shown below.

    upload_2015-5-26_23-9-5.png


    This has been on the to do list for a long time. Finally found some time to get it working properly. This is NOT Asset Bundles, it's single files. I think that it's more useful than Asset Bundles as far as being practical and easy to set up. At this time, we now have no plans to implement Asset Bundles as it seems not needed.

    -Brian
     
  39. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    123
    hey Brian! got an issue with MA that recently cropped up. we were using Unity 4.6 but upgraded to 5.01 and also upgraded MA per your instructions (so I'm told. i did not upgrade MA personally). the basic setup is we have a single persistent MA instance in the Bootstrap scene which then loads DSGs in other scenes. the issue that is now bothering us is that i am unable to see the contents of any Event Sound script which is not being additively loaded at runtime (whether it's calling the MA events in the Bootstrap or the DSG events that get added - doesn't matter). so i cannot open other scenes and edit the settings for Event sound scripts it seems. but i can see them when the game is running and i look at the loaded objects. unfortunately any changes i make are lost because the objects are loaded and even save on runtime can't propagate changes made to objects loaded with Load Additive back to the scene they came from.

    any ideas coming to mind? maybe this is a bug that got fixed? we're on 3.5.7.8.

    EDIT: i am able to edit the contents of the Event Sounds scripts if i switch to Debug mode, so it definitely appears to be some kind of Inspector bug interfering in this case...
     
    Last edited: May 28, 2015
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Actually I believe that did get fixed right after that. It was due to an issue with EventSounds code to show Dynamic SGC Groups too in the version before that. Please upgrade and let me know if you still see an issue.
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio V 3.5.8 has been submitted to the Asset Store. Now you can specify URL's for audio files to be downloaded! Release notes:

    • Moved "Inspector Width" control from under the Group Mixer to Advanced / Visual Settings where it belongs.
    • Changed the default of Inspector Width to "narrow" so it's usable by default with a normal width Inspector. Change it to "normal" if you like the old wider setting.
    • Fixed Languages section to fit on "narrow" width.
    • Added Playmaker custom action "MasterAudioPlaylistControllerGetProps", to get Playlist Controller's volume, current audio clip pitch, current audio clip volume and store them in variables.
    • Added Playmaker custom action "MasterAudioVariationGetProps", to get a specific variation's audio source pitch and volume and store them in variables.
    • Fixed bug with spamming of Console window when you have no Audio Listener in the Scene.
    • Fixed bug: Couldn't click 2 mute buttons up top in the MA Inspector when on narrow mode at runtime.
    • Fixed rare bug with Event Sounds not displaying anything.
    • Added 3rd Audio Origin type of "File on Internet" for Sound Groups only, not Playlists. Allows you to specify a URL for an audio file. During the Awake event, Master Audio will start downloading the audio for any Variations set up like this. The mixer now has an icon next the yellow voice count showing the ready status of each Group (loading / ready / failed).
    • Added method "ReDownloadAllInternetFiles" to unload all Internet audio files from memory, then redownload them in case they have changed since downloading. Good to call every week or so if you want to do holiday sound skins and things like that!
     
  42. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    Is there a way to play sounds from MasterAudio without using strings? I would really appreciate the ability to pass a soundgroup directly into the PlaySound functions.

    And on scene organization, is there a way to have it so the MasterAudio manager doesn't have a huge list of audio groups under it? I would love to be able to organize them within subfolders by attaching them to empty named gameobjects, as it becomes pretty troublesome to dig through and find that one group you know you made but can't quite remember its name
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    There is currently no way other than strings. It may be possible to add what you want. I assume you're worried about garbage collection, for which there is 0 bytes of allocation currently for most calls in Master Audio, including PlaySound method. But, how would you get the SoundGroup object to pass in to PlaySound? I'm asking because it wouldn't necessarily work for all types (Dynamic Sound Groups would not be usable this way I think since the Group doesn't exist when Master Audio prefab makes its list on startup).

    Scene, organization - no, but there is an item on the stickied product roadmap thread (on our support forum) to have bus game objects to act as parents. Currently, if you attempt reorganization you will get errors as this is not a supported scenario.

    To help find your unknown Sound Group, you can use the Group filter by name (if you remember part of it) and the Filter by bus options in the mixer section. Those are already there. Also, if you can't remember the name of a Sound Group but you know one of the Audio Clips you used in it, you can right-click one of the clips in Project view and pick "find references in Scene". It will locate the Variation with that clip. Of course that doesn't work for Resource files since no clip is stored, only the name. These tips make Master "scale" for our game which has over 120 Sound Groups.
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    Master Audio is now on sale for 65% off. That's only $15! For a limited time only.
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    I take it back. I now have had a chance to look at the code. If you were to pass in a Sound Group, it doesn't really help. We'll still need to look up the fully populated / cloned Variations from the dictionary, which uses a string for key (Sound Group name). So if you passed in the Sound Group, I'd pull the name from it. Doesn't save on any allocations. But like I said there are zero bytes allocated from PlaySound.
     
  46. Nielsww

    Nielsww

    Joined:
    Jun 25, 2013
    Posts:
    10
    Thanks for adding the ability to specify a URL as audio source. This will help keep the size of WebGL builds manageable. I think it would be very useful if Master Audio is be able to cache audio files it has downloaded from a URL very much like you currently can do using Asset Bundles: http://docs.unity3d.com/ScriptReference/WWW.LoadFromCacheOrDownload.html

    It seems that writing files to Application.persistentDataPath would even work for WebGL:
    http://forum.unity3d.com/threads/webgl-filesystem.294358/
     
    Last edited: Jun 3, 2015
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    I will look into it. Thanks!
     
  48. Nielsww

    Nielsww

    Joined:
    Jun 25, 2013
    Posts:
    10
    You're welcome. When publishing a game to both iOS, Android and WebGL (and possibly other platforms), it might be unlikely that in all these cases you would want to stream audio from a URL on the internet. In our case we have placed all audio files in the StreamingAssets folder. Using the code below the audio is streamed from local disk in all cases except WebGL. Caching the audio locally would only be required for the WebGL version as the files are already on a local disk for all other platforms.

    Code (CSharp):
    1. public static string GetRelativePath()
    2. {
    3.   if (Application.isEditor) {
    4.     return "file://" + System.Environment.CurrentDirectory.Replace ("\\", "/") +
    5.     "/Assets/StreamingAssets";
    6.   } else {
    7.     RuntimePlatform activePlatform = Application.platform;
    8.     switch (activePlatform) {
    9.     case RuntimePlatform.WebGLPlayer:
    10.       //We need to use absoluteURL.LastIndexOf("/") to strip away
    11.       //garbage characters that are at the end of the URL in Unity 5.1.0f2
    12.       return Application.absoluteURL.Substring (0,
    13.       Application.absoluteURL.LastIndexOf ("/")) + "/StreamingAssets";
    14.     case RuntimePlatform.Android:
    15.       //Already starts with jar:file://
    16.       return Application.streamingAssetsPath.Replace("\\", "/");
    17.     default:
    18.        return "file://" +  Application.streamingAssetsPath.Replace("\\", "/");
    19.     }
    20.   }
    21. }
    In PopulateSourceWithInternetFile() you could do the following to make this work:
    Code (CSharp):
    1. using (var fileRequest = new WWW(GetRelativePath() + fileUrl)) {
    Only the final part of the path is placed in the 'Internet File URL' field:
    /Audio/mysound.mp3
    /Audio/sfx.mp3

    I am not saying this solution is ideal but it might be a good starting point for something better?

    Now if you use WWW.GetAudioClip() which supports playing audio before all data has been loaded into memory, this solution will have an advantage over using Asset Bundles which does support audio but does not support streaming (playing before all data is in memory).
     
    Last edited: Jun 4, 2015
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,110
    So this is not really "Internet file" at all, but loading a local file, right? This would be a 4th Audio Origin? I wouldn't want to remove any options already there (non-streaming download of internet files), but with more detail we can discuss adding functionality. Maybe we should continue the conversation on email (brianh@darktonic.com).
     
  50. Nielsww

    Nielsww

    Joined:
    Jun 25, 2013
    Posts:
    10
    Well, the files would be local for all sources except WebGL which streams them through from the same server over HTTP as the one which is hosting the WebGL build of the game. But yes, let's continue this by e-mail.
     
unityunity