Would really help for jukebox scripts when using mods that add more records
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Get Length Of Song In Disk Drive
Started by Shaun, 09 November 2013 - 09:57 AMPosted 09 November 2013 - 10:57 AM
Could we get something like disc.getAudioLength(string side) to get the length of a song in seconds?
Would really help for jukebox scripts when using mods that add more records
Would really help for jukebox scripts when using mods that add more records
Posted 09 November 2013 - 11:25 AM
I Don't know if there is one but i can give you this:
EDIT: O wait this is suggestions sub-forum not Ask a Pro…. Wopse.
Timinigs= {
["C418 - 13"]=178,
["C418 - cat"]=185,
["C418 - blocks"]=345,
["C418 - chirp"]=185,
["C418 - far"]=174,
["C418 - mall"]=197,
["C418 - mellohi"]=96,
["C418 - stal"]=150,
["C418 - strad"]=183,
["C418 - ward"]=251,
["C418 - 11"]=71,
["C418 - wait"]=238,
}
That table contains time each song plays. So you can use disk.getAudioTitle(string side) to get name of disc and take time from my list. Made it some time ago for Dj turtle on a server. Times are based on Minecraft-Wiki and should be close to correct (I think i rounded them up to seconds from the look of it)EDIT: O wait this is suggestions sub-forum not Ask a Pro…. Wopse.
Edited on 09 November 2013 - 10:29 AM
Posted 10 November 2013 - 09:02 AM
Eh, When ever there is an already implementable solution people do post them here.
You did make the suggestion seem some what less useful. I guess if its possible to make it work with moded music disc it would be more useful.
You did make the suggestion seem some what less useful. I guess if its possible to make it work with moded music disc it would be more useful.
Posted 11 November 2013 - 11:37 PM
Also resource packs and their added music …
Say if your vanilla "cat" was 2:20 (140 sec) and your resource pack one was 1:49 (109 sec). On servers would use the server resource pack
Say if your vanilla "cat" was 2:20 (140 sec) and your resource pack one was 1:49 (109 sec). On servers would use the server resource pack
Posted 12 November 2013 - 09:43 AM
Actually, I don't think this sounds like a bad idea. It would be nice to have this simple function. I don't think it would even be too difficult to implement, but I'm not a dev, so I don't know.
Posted 13 November 2013 - 02:09 AM
The server doesn't have sounds. Lua code runs on the server. No way to get the length!
Posted 13 November 2013 - 09:11 AM
Well that's unfortunate.
Posted 13 November 2013 - 09:49 PM
Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?
Thanks,
awsmazinggenius
Thanks,
awsmazinggenius
Posted 13 November 2013 - 09:55 PM
Ok to expand on what Cloudy said… Servers HAVE the music files… Servers do not have ACCESS to the music files…Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?
Posted 13 November 2013 - 10:13 PM
Ok to expand on what Cloudy said… Servers HAVE the music files… Servers do not have ACCESS to the music files…Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?
They don't have by default. Even if a server sends a resource pack with music to the client - the client doesn't have to use it.
Posted 16 November 2013 - 09:28 AM
Well that does cause discrepancies, the server should choose the song length because
a) It's the same for everyone
B)/> Technical reasons
c) They are the ones putting effort into server hosting, anyways.
edit: my browser screwed up this post. Sorry!
a) It's the same for everyone
B)/> Technical reasons
c) They are the ones putting effort into server hosting, anyways.
edit: my browser screwed up this post. Sorry!
Edited on 16 November 2013 - 08:30 AM
Posted 16 November 2013 - 02:28 PM
There could be hardcoded lengths of the songs. But then you are limited to vanilla disks, which don't make sense in the end.
I am not necessarily against hardcoded disk lengths, but it is very limited. I don't think the devs would add this just because of that.
Note that I haven't spoken to a developer, this all comes from me so don't quote me on this.
I am not necessarily against hardcoded disk lengths, but it is very limited. I don't think the devs would add this just because of that.
Note that I haven't spoken to a developer, this all comes from me so don't quote me on this.
Posted 16 November 2013 - 10:17 PM
In addition, if it's hardcover lengths just do it in your program.
Posted 16 November 2013 - 11:29 PM
Exactly. Just use a table in your program if it will be hard-coded. The whole point of this suggestion is to support resource packs and disks from mods.In addition, if it's hardcover lengths just do it in your program.
Posted 17 November 2013 - 12:20 AM
Yeh but it's just not possible with the game engine structure that Mojang has chosen.The whole point of this suggestion is to support resource packs and disks from mods.