Author Topic: A Mod's songlength  (Read 8684 times)

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« on: February 13, 2007, 20:40:50 »
Hello guys,

i recently did a tool (or better: frontend) for playing SID music a nice way. Now i would like the tool (or a port of it) to be used with mod music as well, but i have one problem:
To use my tools continuous and random play feature, i need to know,
how long the actual mod playing is meant to be played.
For example, i open some mod, and modplug 'knows' the mod is, lets say, 65 seconds.
How can i determine the length of a given mod ?
Is there any tool or undocumented commandline feature to retrieve the songlength in seconds, ticks or whatever from modplug ?
I looked into fmod and mikmod, but i didnt find such thing of what i read so far.

Any help is greatly appreciated.

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
A Mod's songlength
« Reply #1 on: February 13, 2007, 21:48:15 »
Although you could program it entirelly, I'm sure that using a tool like fmod or bass in your project will make things alot easier. They have a function somewhere to retreive the length.

You can always calculate it though, but its really difficult.

You need to calculate the length of a pattern with the given speed and tempo, and scan for patterns that have speed and tempo commands in them, and calculate these individually, then add up the total. There probably is an easier way, but I'm not much of a programmer. I once did a small player in VB using np_mod32.dll and later downloaded the bass.dll source but I came as far as that, and not further.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« Reply #2 on: February 14, 2007, 10:20:55 »
Yep, that kinda describes the problem nicely.
I dont know enough about mods (or sids) to do an player or emulator for them.
Most players play well, but lack ease of use imho when it comes to playlist managing and the like. Thats why i did a frontend to use the existing players nicely.
Im not the guy to re-invent the wheel  :wink:
Even more as my wheel would be more like an oktogon  :D  hehe

Ah anyway, sad thing that is. no modtool then unless i find the energy to figure that out.

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
A Mod's songlength
« Reply #3 on: February 14, 2007, 12:10:09 »
If you download the bass.dll, a very detailed example comes along for vb, c++, delphi and another language I can't think of right now.

You should be able to copy/paste it to a workable version, or just use XMPlay with the in_sid.dll installed (which is why I gave up making a player :P)
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 717
Re: A Mod's songlength
« Reply #4 on: February 14, 2007, 20:55:26 »
Maybe its of no use in this case, but if you want to see how the mod length estimate is done in OMPT, you might want to check the source file snd_fx.cpp and the function "DWORD CSoundFile::GetLength(BOOL bAdjust, BOOL bTotal)"

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« Reply #5 on: February 15, 2007, 14:45:14 »
Well i went with BASS .NET 2.0 actually now.
Its a simple 3-liner to get the songlength with bass.

Code: [Select]

Bass.BASS_Init(1, 44100, Un4seen.Bass.BASSInit.BASS_DEVICE_DEFAULT, 0, Nothing)
inthand = Bass.BASS_MusicLoad(Me.Fullpath, 0, 0, Un4seen.Bass.BASSMusic.BASS_MUSIC_PRESCAN, 44100)
Me.PlaytimeinSecs = Bass.BASS_ChannelBytes2Seconds(inthand, Bass.BASS_ChannelGetLength(inthand))


So i can now port my sidtool to a modtool somewhat easily :-)
I will let you know when its done

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« Reply #6 on: February 16, 2007, 11:44:34 »
One question left: Am i allowed to have ModPlug in the same ZIP file as my tool, so people dont have to download it seperately ?
(My tool is freeware too)

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
A Mod's songlength
« Reply #7 on: February 16, 2007, 12:23:12 »
Quote from: "Madman"
One question left: Am i allowed to have ModPlug in the same ZIP file as my tool, so people dont have to download it seperately ?
(My tool is freeware too)


Its better to put a link in your package. MODPlug is a tool thats frequently updated. The best way to keep things clean, is by putting it all on one location where updates are being done, so everyone can always find the latest version.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« Reply #8 on: February 16, 2007, 13:14:50 »
I will add a link in the about box so people can download the latest version if an update was released, that ok ?
Ofcourse you get full credits :-) Forgot to mention that before, thought it was obvious  :)

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
A Mod's songlength
« Reply #9 on: February 16, 2007, 13:48:49 »
Quote from: "Madman"
I will add a link in the about box so people can download the latest version if an update was released, that ok ?
Ofcourse you get full credits :-) Forgot to mention that before, thought it was obvious  :)


Are you talking about the np_mod32.dll or MODPlug Tracker bytheway? I assume the last one, and if so, then I strongly recommend to use a link only. Can be documented in your readme to...

If its indeed the np_mod32.dll file, then its obvious to include it in your package.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Madman

  • Shy artist
  • Posts: 6
A Mod's songlength
« Reply #10 on: February 16, 2007, 14:02:07 »
nah, just the modplug.exe, the Player :o

Its a player frontend, no tracker

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
A Mod's songlength
« Reply #11 on: February 16, 2007, 14:36:59 »
Quote from: "Madman"
nah, just the modplug.exe, the Player :o

Its a player frontend, no tracker


The player... :o Well that product isn't in production either so I guess that it'd be okay. Please leave the right credits and point to this forum also.

So http://www.modplug.com and http://lpchip.com/modplug
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs