0
0

Importing Markers as SyncPoints from wma files.

FmodEx documentation say:
[quote:jxmajwnv][b:jxmajwnv]Sound::addSyncPoint[/b:jxmajwnv]
Adds a sync point at a specific time within the sound. These points can be user generated or can come from a wav file with embedded markers.
Remarks

[i:jxmajwnv]In sound forge, a marker can be added a wave file by clicking on the timeline / ruler, and right clicking then selecting ‘Insert Marker/Region’.
Riff wrapped mp3 files are also supported. [/i:jxmajwnv]
[/quote:jxmajwnv]

Maybe you can append support markers/syncpoint functionality into asf codec?

I using code below in my applications – all work fine. I think not bad
add this funtionality into fmod.

[code:jxmajwnv]
private ulong[] GetMarkers(byte[] data)
{
IWMSyncReader Reader; // Windows Media Format SDK 9.5 interface
IWMHeaderInfo3 HdrInfo; // Windows Media Format SDK 9.5 interface

// Get SyncReader interface. PInvoke
WMFSDKFunctions.WMCreateSyncReader(IntPtr.Zero, 0, out Reader);

// Create IStream
System.Runtime.InteropServices.ComTypes.IStream Stream;
WMFSDKFunctions.CreateStreamOnHGlobal(IntPtr.Zero, true, out Stream);

// Loading wma data into IStream
Stream.Write(data, data.Length, IntPtr.Zero);
Stream.Seek(0, 0, IntPtr.Zero);

// Load data into SyncReader
Reader.OpenStream(Stream);

// Query IWMHeaderInfo3 interface from reader object
HdrInfo = (IWMHeaderInfo3)Reader;     

ushort mcount; // Markers counter

// Get number of markers
HdrInfo.GetMarkerCount(out mcount);

ulong[] markers = new ulong[mcount]; // 100ns units

for (ushort i = 0; i < mcount; i++)
{
     ushort len = 100; // Marker name length
     string mName = new string((char)0,len); // Marker name
     HdrInfo.GetMarker(i, mName, ref len, out markers[i]);
}
Marshal.ReleaseComObject(HdrInfo);
Reader.Close();
Marshal.ReleaseComObject(Reader);    
return markers;

}

public void Load(byte[] data)
{
ulong[] markers = GetMarkers(data);
CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO();
exinfo.cbsize = Marshal.SizeOf(exinfo);
exinfo.length = (uint)data.Length;
ERRCHECK(fSystem.createSound(data, (FMod.MODE.HARDWARE | FMod.MODE.OPENMEMORY), ref exinfo, ref fSound));
int en = 0;
foreach (ulong l in markers)
{
uint i = (uint)l / 10000; // Convert to milliseconds
IntPtr point = new IntPtr();
ERRCHECK(fSound.addSyncPoint(i, TIMEUNIT.MS, "ss" + en.ToString(), ref point));
en++;
}
}

public void Play()
{
if (fSound != null)
{
ERRCHECK(fSystem.playSound(CHANNELINDEX.FREE, fSound, true, ref fChannel));
ERRCHECK(fChannel.setCallback(CHANNEL_CALLBACKTYPE.SYNCPOINT, ENDCALLBACK, 0));
ERRCHECK(fChannel.setPaused(false));
}
}

[/code:jxmajwnv]

  • You must to post comments
0
0

LG Electronics uses wma markers in the new consoles dvd karaoke 😉
Markers in wma files are used by them for synchronization of the text of a song.

I develop the applications for reproduction of disks of these consoles on PC.

I think these markers can it is useful and for save a sounds in a format wma as have similar structure with used in fmod.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.