TJM - Tamanegi Jukebox Mod [Modification]

Create music and sound effects for mainline or user-made content.

Moderator: Forum Moderators

Post Reply
vghetto
Posts: 241
Joined: November 2nd, 2019, 5:12 pm

TJM - Tamanegi Jukebox Mod [Modification]

Post by vghetto »

This mod allows for the use of 'Tamanegi Jukebox' music player in any SP/MP game.

The dependency itself was written by tamanegi, and it supports UMC Music Books 1-12 and Wests Chronicles I & II.
vghetto
Posts: 241
Joined: November 2nd, 2019, 5:12 pm

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by vghetto »

The file names are hardcoded into Tamanegi Jukebox, but fortunately one of the playlists seems to be for a non-existent addon called In_Shadow_music

This patch will allow you to use that folder to play your own music.
Drop your ogg music folders into ~add-ons/In_Shadow_music/music/ and apply the following.

Code: Select all

diff --git a/lua/jukebox.lua b/lua/jukebox.lua
index 7620091..2f958c2 100644
--- a/lua/jukebox.lua
+++ b/lua/jukebox.lua
@@ -2733,6 +2733,19 @@ function tamanegi_jukebox_get_table_shadow_of_death()
                                 { file   = "valkyries.ogg",
                                   title  = _"Wagner: Die Walküre",
                                   author = "?" } )
+
+    local playlists = wesnoth.read_file("~add-ons/In_Shadow_music/music/")
+    for i=1,playlists.ndirs do
+       local music_path = "~add-ons/In_Shadow_music/music/"
+       for _, ogg_file in ipairs(wesnoth.read_file(music_path..playlists[i].."/")) do
+
+       tamanegi_jukebox_add_track( ret,  music_path,
+                                   { file   = playlists[i].."/"..ogg_file,
+                                     title  = playlists[i],
+                                     author = "?" } )
+      end
+   end
+
   end
   return ret
 end
Edit: Updated patch code.
vghetto
Posts: 241
Joined: November 2nd, 2019, 5:12 pm

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by vghetto »

Attached is my version of 'Tamanegi Jukebox' with some alterations.
Changes:
* Display filename of current playing track (Not always reliable).
* Added Next, Restart, Previous buttons.
* Allow adding entire packages to the playlist
* Added Jukebox_Music/music as the music extras directory.
Drop your folders into Jukebox_Music/music. Don't place .ogg files directly under Jukebox_Music/music/
Replace all spaces to _
Example, it should look like this : add-ons/Jukebox_Music/music/Britney_Spears/oops_i_did_it_again.ogg
Only use .ogg not mp3

Note, You do not need the patch shown in the post above.
Attachments
Jukebox_Music.zip
(7.24 KiB) Downloaded 168 times
Tamanegi_Jukebox.zip
(41.57 KiB) Downloaded 157 times
User avatar
tamanegi
Posts: 144
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by tamanegi »

The file names are hardcoded into Tamanegi Jukebox,
This is because functions like wesnoth.read_file and ndirs were not available when I wrote this first.
Also, I am nothing familiar with BfW mods (and don't have enough time and power to do it...).
So the my original style may be obsolete now. :)

I recommend you to upload your version to the addon server! :D
Discord: @tamanegi
It is true that we cannot be free from bugs, but at least let our bugs not always the same...
A Group in a War: my first campaign, An Independence War: and the sequel
vghetto
Posts: 241
Joined: November 2nd, 2019, 5:12 pm

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by vghetto »

Hi,
I didn't know you were still active on wesnoth. If, in your opinion, the changes are fine and worthwhile to have, then feel free to apply them and update TJ on the add-on server. No credits required, but I did lift tj_strip_path_ext from Wesnoth_Music_Player by Pentarctagon. That bit is shown in the comment already.
User avatar
tamanegi
Posts: 144
Joined: August 25th, 2014, 11:38 am
Location: Japan

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by tamanegi »

Ah, I am nothing active on wesnoth, actually... Constant update of TJ may not happen.
So I think you upload your version is a better way.
Or I can give you the passphrase of current TJ via PM.
Discord: @tamanegi
It is true that we cannot be free from bugs, but at least let our bugs not always the same...
A Group in a War: my first campaign, An Independence War: and the sequel
vghetto
Posts: 241
Joined: November 2nd, 2019, 5:12 pm

Re: TJM - Tamanegi Jukebox Mod [Modification]

Post by vghetto »

In my previous upload I had some changes to the shuffling that weren't meant to be part of the upload.
The changes were harmless, but started the tracks in a non shuffled state. They got shuffled after playing the first track.
This upload fixes that. It reverts back to what TJ originally was.

I couldn't get shuffle=false to work, if that flag is set for every track, then the playlist gets stuck on the first track only.
wiki says setting the flag on the last track dictates the shuffling, but that doesn't seem to work either.
If anyone knows how to fix that, let me know. Thanks.

I'm uploading both files again, but only the Tamanegi_Jukebox.zip has changed. You don't need the other one if you already have it.
Attachments
Jukebox_Music.zip
(7.24 KiB) Downloaded 150 times
Tamanegi_Jukebox.zip
(41.56 KiB) Downloaded 153 times
Post Reply