1) V2Duration Usage example
'This example shows you how to calculate the exact maximum playback time of *.v2m files in seconds.
'In this example, I have named my music file "Flowers.v2m".
'If you search for these music files you can get them e.g. here:
'Start a new Winforms VB 2008 Project.
'Set a reference to the V2Duration.dll : "Project" -> "Add reference" -> browse for V2Duration.dll .
'Now setup the Import once to avoid too long declarations:
'Note: Put the following lines of code into a Sub!
'Declare a calculation class object:
Dim V2Duration = New V2Duration.V2Duration
'Now I show you 2 options to read a *.v2m music file:
'From a path or the Programs Ressources.
'Choose the suitable option for your usage!
'1) Read the *.v2m file from a path (to a Bytearray):
Dim File() As Byte = My.Computer.FileSystem.ReadAllBytes("C:\Users\Freefall\Desktop\Flowers.v2m")
'2) Read the *.v2m file out of the Programs Ressources (to a Bytearray):
'Of course you need to put it into the ressources before!
'To do this, goto "Project" -> "Properties" -> "Ressources" -> drag & drop the file in.
Dim File() As Byte = My.Resources.Flowers
'-> Finally use the calculation function to show the music duration time:
MsgBox("The duration is " & V2Duration.CalcV2Dur(File).ToString & "s.")
'Note, that you can include any .NET .dll after compiling with Ilmerge from Microsoft!!!