|
Post by hurleybird on Jun 1, 2020 8:26:16 GMT
Eg. Rather than looking for a file with specific name, is there some way to load any number of clips? For example, all clips that are in a folder, or all clips that begin with a specific suffix (eg. gameplay_0, gameplay_1... gameplay_x) into a playlist?
Thanks.
|
|
|
Post by DarkTonic Dev on Jun 1, 2020 15:54:55 GMT
You can use an Asset Bundle or Addressables. A wild card is not supported, you need to know the name.
|
|
|
Post by hurleybird on Jun 1, 2020 17:32:43 GMT
Can that name be supplied at runtime, say, from a text file?
|
|
|
Post by DarkTonic Dev on Jun 1, 2020 17:41:16 GMT
It's possible, but you'd need to code it all yourself. Due to the number of fields in a Playlist I wouldn't recommend it.
You can always load up a Playlist with a certain asset name and not care what songs are in it, and tell it to play, right? From a bundle.
|
|
|
Post by hurleybird on Jun 1, 2020 17:57:37 GMT
Unfortunately, that wouldn't be practical for Dominus Galaxia. A huge chunk of the content is data driven and moddable. So, for instance, each faction in the game is loaded from plain text files, and users can easily create their own custom factions with bespoke graphics. Before now, all factions have been using the same placeholder tracks, but now I'm looking to get more serious with music. Players being able to create their own factions without the ability to create bespoke theme music would be pretty lame. There are a few other areas, but another big one is that, I want to be able to expose the background music that plays during the strategic and tactical portions of the game so that players can create their own playlists. For example, overriding the default music with, say, The Planets.
|
|
|
Post by DarkTonic Dev on Jun 1, 2020 18:22:33 GMT
Ok, well you'll need to code all that yourself. Basically you'd be newing up a Playlist object and everything in it, then adding it somehow to Master Audio. There's a CreatePlaylist method I believe that takes that as a parameter and is used by the DynamicSoundGroupCreator.cs
-B
|
|
|
Post by hurleybird on Jun 4, 2020 2:24:09 GMT
So, some feedback. It doesn't look like there's any way to add a song to a playlist and assign it a song id. It's easy to edit the actual method to add this parameter, but that shouldn't be necessary, and means extra work if one ever upgrades master audio and the file changes.
*All* functionality that's available in the UI should be exposed by default in the API, without needing to edit the API, period. In this case it could be with extra parameters, or alternatively an overload might just take in a MusicSetting.
I haven't really delved super deep into MasterAudio, but my overriding impression so far is that it isn't that programmer friendly. In an ideal world, the autocomplete and a pinch of intuition should get a person 90% of the way there, but in my experience this isn't the case. I had the same issues with Pool Boss when I looked into it, and ended up using PoolManager because it was significantly more straightforward to work with.
|
|
|
Post by DarkTonic Dev on Jun 4, 2020 3:20:04 GMT
Thanks for the feedback. If you say it's not programmer friendly, I guess it's true that that is not the focus. The focus of this product was always to make it so that in the vast majority of cases, there is simply no need to write any code. It's done for you.
Now as far as you statement that "*All* functionality that's available in the UI should be exposed by default in the API, without needing to edit the API, period" - that's easy to say, but not to do. If I add one parameter, which is fine, sooner or later someone is going to ask for another, and sooner or later all 30 parameters (or whatever) will be in the method call. Might as well just pass in the MusicSetting object as you said. Now the problem with either of those (and not the UI) is that a lot of the parameters are not used depending on the setting of other parameters. So there's going to be a ton of people getting confused if I expose all that, even with fully complete and documented API website (which we do have). Using the UI, the fields not used are always hidden so you can't do anything wrong.
So I don't have a good solution for you. If you think just adding 1 field will satisfy you, cool, I'll do it.
Let me know what you want to do.
PoolManager I used to have until I wrote my own. Good product, but IMHO it has "features" that just make things more complicated and problematic, and require extra steps. So I eliminated all of those with Pool Boss. I'm not sure what your specific complaints are about Pool Boss, but you could write us an email or PM about that if you like.
Thanks, -Brian
|
|
|
Post by hurleybird on Jun 4, 2020 3:56:09 GMT
Thanks for the response given that I was a bit harsh. I don't fully agree mind you, but it's your product and your prerogative. Personally, I'd do both. I'd add this parameter, because the ID is something that is likely to be needed when you add a clip programmatically, and the the MusicSetting in case anyone needs to change something that is more obscure.
In general, I agree that having 30 parameters would be confusing, but where we disagree is that I think having overload that takes in parameters like MusicSetting is a good compromise where most users will end up ignoring it, but when a user does need to change something that isn't exposed elsewhere it's still available without needing to go in and modify the API itself.
Since I have you, I believe my first post here was concerning difficulty in changing to a playlist and then changing to a specific song. Might be specific to having a fade in/out. Basically, a clip would play when switching to a different playlist before finally switching to the correct clip. I never ended up solving that problem. Because I only had a few placeholder songs my duct tape solution was to use one song-per-playlist.
Now that I'm finally getting more songs composed, that solution doesn't work. I was able to modify the API so that I can both change the current playlist and specify which clip to change to in a single call. While I'm still doing some testing, is this something I can submit to you? I think it's very important functionality that is conspicuously missing, and although it's not a huge change it isn't trivial. If possible, I'd like to avoid having to re-implement it whenever I go to update Master Audio.
|
|
|
Post by DarkTonic Dev on Jun 4, 2020 7:48:09 GMT
Cool, it's simple so I did both. You can change the AddSongToPlaylist method to these 2 methods in MasterAudio.cs now to get both options: /// <summary> /// This method will allow you to add a song to a Playlist by code. /// </summary> /// <param name="playlistName">The name of the Playlist to add the song to.</param> /// <param name="song">The Audio clip of the song.</param> /// <param name="loopSong">Optional - whether or not to loop the song.</param> /// <param name="songPitch">Optional - the pitch of the song.</param> /// <param name="songVolume">Optional - The volume of the song.</param> /// <param name="alias">Optional - The alias for the song.</param> public static void AddSongToPlaylist(string playlistName, AudioClip song, bool loopSong = false, float songPitch = 1f, float songVolume = 1f, string alias = null) { var newSong = new MusicSetting() { clip = song, alias = alias, isExpanded = true, isLoop = loopSong, pitch = songPitch, volume = songVolume };
AddSongToPlaylist(playlistName, newSong); }
/// <summary> /// This method will allow you to add a song to a Playlist by code. /// </summary> /// <param name="playlistName">The name of the Playlist to add the song to.</param> /// <param name="newSong">The fully populated MusicSetting object for the song.</param> public static void AddSongToPlaylist(string playlistName, MusicSetting newSong) { var pl = GrabPlaylist(playlistName);
if (pl == null) { return; }
pl.MusicSettings.Add(newSong); }
I will need to update the API website describing all the fields of MusicSetting but this should get you going. About your other (original) problem, that's this thread I believe: darktonic.freeforums.net/thread/1062/start-playlist-on-specific-songNow if you're using a "Playlist of 1 song", I wouldn't even consider that a Play "list" at all (a little levity). I see you abandoned that thread after my last post and didn't write back. We can pick that up again if you like, in that thread, as it sounds like it's still an issue for you. -Brian
|
|
|
Post by hurleybird on Jun 4, 2020 9:47:47 GMT
Coolio. Yeah, the "playlist of 1" was just a duct tape solution to the problem. I never was able to get it to work properly that isn't viable anymore. It wasn't that it played two different clips right after one another on awake, but during runtime. I think it's because of the fade settings, where if there wasn't a fade you wouldn't notice the first clip.
In any case, the method I added seems to work. There's the side benefit that only one clip is ever loaded instead of two, and that seems more elegant in general. I'm assuming that you wouldn't want me posting a dropbox link to some of the Master Audio source on a publicly visible forum, so I'll send you a PM with my solution and you can let me know what you think.
|
|
|
Post by DarkTonic Dev on Jun 4, 2020 15:42:03 GMT
Correct, thank you. I'll take a look.
|
|