Music Manager



Users browsing this forum: No registered users and 1 guest

Next topic
Previous topic
Post new topic Reply to topic  NeoAxis Forum Index » Additional » Community Projects, Add-ons & Code Samples
Search for:
Author Message
New Professional License
New Professional License
User avatar

Joined: Tue Sep 16, 2008
Posts: 1342
Location: Imatra
Country: Finland (fi)
PostPosted: Wed Jan 21, 2015 8:43 am Post subject: Music Manager
Bottom of Page Back to top
Simple map entity that allows you to make playlists.

In order to use you need to comment out the default game map values in ProjectEntities/GameMap.cs
Code: Select all   Expand view
      [FieldSerialize]
      string gameMusic = "";
      //string gameMusic = "Sounds\\Music\\Game.ogg";

and more below comment out the default value
Code: Select all   Expand view
//[DefaultValue( "Sounds\\Music\\Game.ogg" )]
Otherwise the original map game music will loop like normal and the playlist will never get it's chance.


Now just add your music files into the playlist of the MusicManager.



Developer note: it is a bit wasteful to Tick music manager thirty times a second.
This logic could be implemented inside some other entity, or have some other entity call CheckCurrentMusic()


Have fun!



File comment: Playlist music player entity.
MusicManager.zip [2.46 KiB]
Downloaded 56 times
 
 Profile  

Joined: Tue Nov 01, 2011
Posts: 90
Country: Cuba (cu)
PostPosted: Wed Jan 21, 2015 10:50 am 
Bottom of Page Back to top
The CheckCurrentMusic() dont contains much overhead anyway, however the better logic would be to have an event raised by the engine related to the game music when a file has been reproduced completely, and only then start reproducing the next track. I haven't taken a look into NA for this subject, maybe this event or something related exist, and if not, it should.

Is game music internally executed in a background thread from the process thread pool or just in the main thread? Creating/Destroying those sound/channels resources in the rendering thread is not a good idea.

Nice addon!

 
 Profile  
New Professional License
New Professional License
User avatar

Joined: Tue Sep 16, 2008
Posts: 1342
Location: Imatra
Country: Finland (fi)
PostPosted: Wed Jan 21, 2015 11:44 pm 
Bottom of Page Back to top
Unfortunately there is no event to call for when sound has stopped playing.

Yea the overhead is very minimal.
It's just my pietism making a cringe every time something is inefficient :)

Dunno about the internal workings of the engine, but I think sound channel are managed in separate threads.

 
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  NeoAxis Forum Index » Additional » Community Projects, Add-ons & Code Samples

Jump to:  

Next topic
Previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


All times are UTC




Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group