/* * maplay.dll Wrapper * $Id$ */ using System; using System.Text; using System.Runtime.InteropServices; using MaplayWrapper.Plugin; namespace MaplayWrapper { using MaplayHANDLE = IntPtr; using MaplayPlugin = IntPtr; public class Maplay : IDisposable { private MaplayHANDLE handle = IntPtr.Zero; private const int MAX_TAG_STR = 255; private const int MAX_PATH = 260; public Maplay() { this.handle = NativeMethods.MAP_Initialize(); if ( this.handle == IntPtr.Zero) { throw new NullReferenceException("Maplay Initialize Error"); } } public void Dispose() { NativeMethods.MAP_Uninitialize(this.handle); } public bool Open(string filename) { return NativeMethods.MAP_Open(this.handle, filename); } public void Close() { NativeMethods.MAP_Close(this.handle); } public bool Play() { return NativeMethods.MAP_Play(this.handle); } public void Stop() { NativeMethods.MAP_Stop(this.handle); } public void Pause() { NativeMethods.MAP_Pause(this.handle); } public bool FastForward(int skip) { return NativeMethods.MAP_Ff(this.handle, skip); } public bool Rewind(int skip) { return NativeMethods.MAP_Rew(this.handle, skip); } public bool Seek(int time) { return NativeMethods.MAP_Seek(this.handle, time); } public int GetDuration() { return NativeMethods.MAP_GetDuration(this.handle); } public bool IsValidStream(string filename) { return NativeMethods.MAP_IsValidStream(this.handle, filename); } public void SetMessageWindow(IntPtr hwndMessage) { NativeMethods.MAP_SetMessageWindow(this.handle, hwndMessage); } public int GetCurrent() { return NativeMethods.MAP_GetCurrent(this.handle); } public void SetEqualizer(ref EQUALIZER eq) { NativeMethods.MAP_SetEqualizer(this.handle, ref eq); } public void GetEqualizer(ref EQUALIZER eq) { NativeMethods.MAP_GetEqualizer(this.handle, ref eq); } public void SetEffect(EffectType type, ref EFFECT value) { NativeMethods.MAP_SetEffect(this.handle, (int)type, ref value); } public void GetEffect(EffectType type, ref EFFECT value) { NativeMethods.MAP_GetEffect(this.handle, (int)type, ref value); } public void SetBassBoostLevel(int level) { NativeMethods.MAP_SetBassBoostLevel(this.handle, level); } public int GetBassBoostLevel() { return NativeMethods.MAP_GetBassBoostLevel(this.handle); } public void GetFileInfo(ref MAP_INFORMATION info) { NativeMethods.MAP_GetFileInfo(this.handle, ref info); } public void GetId3Tag(ref ID3Tag tag) { NativeMethods.MAP_GetId3Tag(this.handle, ref tag); } public bool SetId3Tag(ref ID3Tag tag) { return NativeMethods.MAP_SetId3Tag(this.handle, ref tag); } public bool GetId3TagFile(string filename, ref ID3Tag tag) { return NativeMethods.MAP_GetId3TagFile(this.handle, filename, ref tag); } public bool SetId3TagFile(string filename, ref ID3Tag tag) { return NativeMethods.MAP_SetId3TagFile(this.handle, filename, ref tag); } public string GetGenreString(int genre) { StringBuilder str = new StringBuilder(Maplay.MAX_TAG_STR); NativeMethods.MAP_GetGenreString(this.handle, genre, str); return str.ToString(); } public MAP_STATUS GetStatus() { return NativeMethods.MAP_GetStatus(this.handle); } public bool SetOptions(ref MAP_OPTIONS options) { return NativeMethods.MAP_SetOptions(this.handle, ref options); } public void GetOptions(ref MAP_OPTIONS options) { NativeMethods.MAP_GetOptions(this.handle, ref options); } public bool GetScanPeek() { return NativeMethods.MAP_GetScanPeek(this.handle); } public void SetScanPeek(bool scan) { NativeMethods.MAP_SetScanPeek(this.handle, scan); } public void AudioDeviceClose() { NativeMethods.MAP_AudioDeviceClose(this.handle); } public void GetBufferInfo(ref uint TotalAudio, ref uint BufferedAudio, ref uint TotalStream, ref uint BufferedStream) { NativeMethods.MAP_GetBufferInfo(this.handle, ref TotalAudio, ref BufferedAudio, ref TotalStream, ref BufferedStream); } /** for streaming **/ public bool OpenURL(string url) { return NativeMethods.MAP_OpenURL(this.handle, url); } public bool GetStreamInfo(ref string name, ref string genre, ref string url) { StringBuilder str1 = new StringBuilder(Maplay.MAX_PATH); StringBuilder str2 = new StringBuilder(Maplay.MAX_TAG_STR); StringBuilder str3 = new StringBuilder(Maplay.MAX_PATH); bool ret = NativeMethods.MAP_GetStreamInfo(this.handle, str1, str2, str3); name = str1.ToString(); genre = str2.ToString(); url = str3.ToString(); return ret; } public bool GetStreamTitle(ref string title) { StringBuilder str = new StringBuilder(); bool ret = NativeMethods.MAP_GetStreamTitle(this.handle, str); title = str.ToString(); return ret; } public bool SetStreamingOptions(ref MAP_STREAMING_OPTIONS options) { return NativeMethods.MAP_SetStreamingOptions(this.handle, ref options); } public void GetStreamingOptions(ref MAP_STREAMING_OPTIONS options) { NativeMethods.MAP_GetStreamingOptions(this.handle, ref options); } public int GetStreamingBufferingCount() { return NativeMethods.MAP_GetStreamingBufferingCount(this.handle); } /** plug-in **/ public int GetDecoderPlugInCount() { return NativeMethods.MAP_GetDecoderPlugInCount(this.handle); } public MAP_DEC_PLUGIN GetDecoderPlugin(int index) { MaplayPlugin ptr = NativeMethods.MAP_GetDecoderPlugIn(this.handle, index); //uint* ptrtest = (uint*)ptr.ToPointer(); //return NativeMethods.MAP_GetDecoderPlugIn(this.handle, index); return new MAP_DEC_PLUGIN(ptr); } public class MAP_DEC_PLUGIN { readonly private MaplayPlugin plugin; readonly public uint dwVersion; readonly public uint dwChar; readonly public uint dwUser; public MAP_DEC_PLUGIN(MaplayPlugin plugin) { if (plugin == IntPtr.Zero) { throw new NullReferenceException(); } _MAP_DEC_PLUGIN _plugin = (_MAP_DEC_PLUGIN)System.Runtime.InteropServices.Marshal.PtrToStructure(plugin, typeof(_MAP_DEC_PLUGIN)); this.plugin = plugin; this.dwVersion = _plugin.dwVersion; this.dwChar = _plugin.dwChar; this.dwUser = _plugin.dwUser; } public void Init() { NativeMethods.MAP_PlugIn_Init(this.plugin); } public void Quit() { NativeMethods.MAP_PlugIn_Quit(this.plugin); } public uint GetFunc() { return NativeMethods.MAP_PlugIn_GetFunc(this.plugin); } public bool GetPluginName(out string name) { StringBuilder strb = new StringBuilder(Maplay.MAX_TAG_STR); bool ret = NativeMethods.MAP_PlugIn_GetPluginName(this.plugin, strb); name = strb.ToString(); return ret; } public bool SetEqualizer(ref MAP_PLUGIN_EQ eq) { return NativeMethods.MAP_PlugIn_SetEqualizer(this.plugin, ref eq); } public void ShowConfigDlg(IntPtr hwndParent) { NativeMethods.MAP_PlugIn_ShowConfigDlg(this.plugin, hwndParent); } //for file public bool GetFileExtCount() { return NativeMethods.MAP_PlugIn_GetFileExtCount(this.plugin); } public bool GetFileExt(int nIndex, out string pszExt, out string pszExtDesc) { StringBuilder str1 = new StringBuilder(Maplay.MAX_PATH); StringBuilder str2 = new StringBuilder(Maplay.MAX_PATH); bool ret = NativeMethods.MAP_PlugIn_GetFileExt(this.plugin, nIndex, str1, str2); pszExt = str1.ToString(); pszExtDesc = str2.ToString(); return ret; } public bool IsValidFile(string pszFile) { return NativeMethods.MAP_PlugIn_IsValidFile(this.plugin, pszFile); } public bool OpenFile(MaplayPlugin pPlugin, string pszFile, ref MAP_PLUGIN_FILE_INFO te) { return NativeMethods.MAP_PlugIn_OpenFile(pPlugin, pszFile, ref te); } public int SeekFile(int lTime) { return NativeMethods.MAP_PlugIn_SeekFile(this.plugin, lTime); } public bool StartDecodeFile() { return NativeMethods.MAP_PlugIn_StartDecodeFile(this.plugin); } public int DecodeFile(ref MaplayWrapper.Plugin.WAVEHDR pHdr) { return NativeMethods.MAP_PlugIn_DecodeFile(this.plugin, ref pHdr); } public void StopDecodeFile() { NativeMethods.MAP_PlugIn_StopDecodeFile(this.plugin); } public void CloseFile() { NativeMethods.MAP_PlugIn_CloseFile(this.plugin); } public bool GetTag(ref MaplayWrapper.Plugin.MAP_PLUGIN_FILETAG pTag) { return NativeMethods.MAP_PlugIn_GetTag(this.plugin, ref pTag); } public bool GetFileTag(string filename, ref MAP_PLUGIN_FILETAG pTag) { return NativeMethods.MAP_PlugIn_GetFileTag(this.plugin, filename, ref pTag); } public bool OpenStreaming(ref byte pbBuf, uint cbBuf, ref MAP_PLUGIN_STREMING_INFO pInfo) { return NativeMethods.MAP_PlugIn_OpenStreaming(this.plugin, ref pbBuf, cbBuf, ref pInfo); } public int DecodeStreaming(ref byte pbInBuf, uint cbInBuf, ref uint pcbInUsed, ref MaplayWrapper.Plugin.WAVEHDR pHdr) { return NativeMethods.MAP_PlugIn_DecodeStreaming(this.plugin, ref pbInBuf, cbInBuf, ref pcbInUsed, ref pHdr); } public void CloseStreaming() { NativeMethods.MAP_PlugIn_CloseStreaming(this.plugin); } } /** P/Invoke **/ private static class NativeMethods { /// Return Type: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Initialize")] public static extern System.IntPtr MAP_Initialize(); /// Return Type: void ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Uninitialize")] public static extern void MAP_Uninitialize(MaplayHANDLE hLib); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Open")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_Open(MaplayHANDLE hLib, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile); /// Return Type: void ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Close")] public static extern void MAP_Close(MaplayHANDLE hLib); /// Return Type: BOOL->int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Play")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_Play(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Stop")] public static extern void MAP_Stop(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Pause")] public static extern void MAP_Pause(MaplayHANDLE hLib); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///lSkip: int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Ff")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_Ff(MaplayHANDLE hLib, int lSkip); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///lSkip: int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Rew")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_Rew(MaplayHANDLE hLib, int lSkip); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///lTime: int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_Seek")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_Seek(MaplayHANDLE hLib, int lTime); /// Return Type: int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetDuration")] public static extern int MAP_GetDuration(MaplayHANDLE hLib); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_IsValidStream")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_IsValidStream(MaplayHANDLE hLib, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile); /// Return Type: void ///hLib: HANDLE->void* ///hwndMessage: HWND->HWND__* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetMessageWindow")] public static extern void MAP_SetMessageWindow(MaplayHANDLE hLib, System.IntPtr hwndMessage); /// Return Type: int (ms) ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetCurrent")] public static extern int MAP_GetCurrent(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* ///value: EQUALIZER* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetEqualizer")] public static extern void MAP_SetEqualizer(MaplayHANDLE hLib, ref EQUALIZER value); /// Return Type: void ///hLib: HANDLE->void* ///value: EQUALIZER* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetEqualizer")] public static extern void MAP_GetEqualizer(MaplayHANDLE hLib, ref EQUALIZER value); /// Return Type: void ///hLib: HANDLE->void* ///nEffect: int ///value: EFFECT* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetEffect")] public static extern void MAP_SetEffect(MaplayHANDLE hLib, int nEffect, ref EFFECT value); /// Return Type: void ///hLib: HANDLE->void* ///nEffect: int ///value: EFFECT* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetEffect")] public static extern void MAP_GetEffect(MaplayHANDLE hLib, int nEffect, ref EFFECT value); /// Return Type: void ///hLib: HANDLE->void* ///nLevel: int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetBassBoostLevel")] public static extern void MAP_SetBassBoostLevel(MaplayHANDLE hLib, int nLevel); /// Return Type: int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetBassBoostLevel")] public static extern int MAP_GetBassBoostLevel(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* ///pInfo: MAP_INFORMATION* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetFileInfo")] public static extern void MAP_GetFileInfo(MaplayHANDLE hLib, ref MAP_INFORMATION pInfo); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pTag: ID3TAGV1* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetId3Tag")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_GetId3Tag(MaplayHANDLE hLib, ref ID3Tag pTag); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pTag: ID3TAGV1* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetId3Tag")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_SetId3Tag(MaplayHANDLE hLib, ref ID3Tag pTag); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* ///pTag: ID3TAGV1* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetId3TagFile")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_GetId3TagFile(MaplayHANDLE hLib, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile, ref ID3Tag pTag); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* ///pTag: ID3TAGV1* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetId3TagFile")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_SetId3TagFile(MaplayHANDLE hLib, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile, ref ID3Tag pTag); /// Return Type: void ///hLib: HANDLE->void* ///nGenre: int ///pszGenre: LPTSTR->LPWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetGenreString")] public static extern void MAP_GetGenreString(MaplayHANDLE hLib, int nGenre, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszGenre); /// Return Type: MAP_STATUS ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetStatus")] public static extern MAP_STATUS MAP_GetStatus(MaplayHANDLE hLib); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pOptions: MAP_OPTIONS* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetOptions")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_SetOptions(MaplayHANDLE hLib, ref MAP_OPTIONS pOptions); /// Return Type: void ///hLib: HANDLE->void* ///pOptions: MAP_OPTIONS* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetOptions")] public static extern void MAP_GetOptions(MaplayHANDLE hLib, ref MAP_OPTIONS pOptions); /// Return Type: BOOL->int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetScanPeek")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_GetScanPeek(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* ///fScan: BOOL->int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetScanPeek")] public static extern void MAP_SetScanPeek(MaplayHANDLE hLib, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool fScan); /// Return Type: void ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_AudioDeviceClose")] public static extern void MAP_AudioDeviceClose(MaplayHANDLE hLib); /// Return Type: void ///hLib: HANDLE->void* ///pcbTotalAudio: DWORD* ///pcbBufferedAudio: DWORD* ///pcbTotalStream: DWORD* ///pcbBufferedStream: DWORD* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetBufferInfo")] public static extern void MAP_GetBufferInfo(MaplayHANDLE hLib, ref uint pcbTotalAudio, ref uint pcbBufferedAudio, ref uint pcbTotalStream, ref uint pcbBufferedStream); /** for streaming **/ /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszURL: LPCTSTR->LPCWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_OpenURL")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_OpenURL(MaplayHANDLE hLib, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszURL); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszName: LPTSTR->LPWSTR->WCHAR* ///pszGenre: LPTSTR->LPWSTR->WCHAR* ///pszURL: LPTSTR->LPWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetStreamInfo")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_GetStreamInfo(MaplayHANDLE hLib, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszName, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszGenre, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszURL); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pszTitle: LPTSTR->LPWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetStreamTitle")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_GetStreamTitle(MaplayHANDLE hLib, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszTitle); /// Return Type: BOOL->int ///hLib: HANDLE->void* ///pOptions: MAP_STREAMING_OPTIONS* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_SetStreamingOptions")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_SetStreamingOptions(MaplayHANDLE hLib, ref MAP_STREAMING_OPTIONS pOptions); /// Return Type: void ///hLib: HANDLE->void* ///pOptions: MAP_STREAMING_OPTIONS* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetStreamingOptions")] public static extern void MAP_GetStreamingOptions(MaplayHANDLE hLib, ref MAP_STREAMING_OPTIONS pOptions); /// Return Type: int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetStreamingBufferingCount")] public static extern int MAP_GetStreamingBufferingCount(MaplayHANDLE hLib); /** plug-in **/ /// Return Type: int ///hLib: HANDLE->void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetDecoderPlugInCount")] public static extern int MAP_GetDecoderPlugInCount(MaplayHANDLE hLib); [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_GetDecoderPlugIn")] //[return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Struct)] public static extern IntPtr MAP_GetDecoderPlugIn(MaplayHANDLE hLib, int nIndex); /*** plug-in callback wrapper ***/ /// Return Type: void ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_Init")] public static extern void MAP_PlugIn_Init(MaplayPlugin pPlugin); /// Return Type: void ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_Quit")] public static extern void MAP_PlugIn_Quit(MaplayPlugin pPlugin); /// Return Type: DWORD->unsigned int ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetFunc")] public static extern uint MAP_PlugIn_GetFunc(MaplayPlugin pPlugin); /// Return Type: BOOL->int ///pPlugin: void* ///pszName: LPTSTR->LPWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetPluginName")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_GetPluginName(MaplayPlugin pPlugin, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszName); ///// MAP_PlugIn_SetEqualizer [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_SetEqualizer")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_SetEqualizer(MaplayPlugin pPlugin, ref MaplayWrapper.Plugin.MAP_PLUGIN_EQ pER); /// Return Type: void ///pPlugin: void* ///hwndParent: HWND->HWND__* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_ShowConfigDlg")] public static extern void MAP_PlugIn_ShowConfigDlg(MaplayPlugin pPlugin, System.IntPtr hwndParent); // for file /// Return Type: BOOL->int ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetFileExtCount")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_GetFileExtCount(MaplayPlugin pPlugin); /// Return Type: BOOL->int ///pPlugin: void* ///nIndex: int ///pszExt: LPTSTR->LPWSTR->WCHAR* ///pszExtDesc: LPTSTR->LPWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetFileExt")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_GetFileExt(MaplayPlugin pPlugin, int nIndex, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszExt, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder pszExtDesc); /// Return Type: BOOL->int ///pPlugin: void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_IsValidFile")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_IsValidFile(MaplayPlugin pPlugin, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile); ///// MAP_PlugIn_OpenFile // MAPLIBEXPORT(BOOL) MAP_PlugIn_OpenFile(MAP_DEC_PLUGIN* pPlugin, LPCTSTR pszFile, MAP_PLUGIN_FILE_INFO* pInfo); [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_OpenFile")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_OpenFile(MaplayPlugin pPlugin, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile, ref MaplayWrapper.Plugin.MAP_PLUGIN_FILE_INFO pInfo); /// Return Type: int ///pPlugin: void* ///lTime: int [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_SeekFile")] public static extern int MAP_PlugIn_SeekFile(MaplayPlugin pPlugin, int lTime); /// Return Type: BOOL->int ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_StartDecodeFile")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_StartDecodeFile(MaplayPlugin pPlugin); /// Return Type: int ///pPlugin: void* ///pHdr: WAVEHDR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_DecodeFile")] public static extern int MAP_PlugIn_DecodeFile(MaplayPlugin pPlugin, ref MaplayWrapper.Plugin.WAVEHDR pHdr); /// Return Type: void ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_StopDecodeFile")] public static extern void MAP_PlugIn_StopDecodeFile(MaplayPlugin pPlugin); /// Return Type: void ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_CloseFile")] public static extern void MAP_PlugIn_CloseFile(MaplayPlugin pPlugin); /// Return Type: BOOL->int ///pPlugin: void* ///pTag: MAP_PLUGIN_FILETAG* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetTag")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_GetTag(MaplayPlugin pPlugin, ref MaplayWrapper.Plugin.MAP_PLUGIN_FILETAG pTag); /// Return Type: BOOL->int ///pPlugin: void* ///pszFile: LPCTSTR->LPCWSTR->WCHAR* ///pTag: MAP_PLUGIN_FILETAG* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_GetFileTag")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_GetFileTag(MaplayPlugin pPlugin, [System.Runtime.InteropServices.InAttribute()] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pszFile, ref MaplayWrapper.Plugin.MAP_PLUGIN_FILETAG pTag); //for streaming /// Return Type: BOOL->int ///pPlugin: void* ///pbBuf: LPBYTE->BYTE* ///cbBuf: DWORD->unsigned int ///pInfo: MAP_PLUGIN_STREMING_INFO [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_OpenStreaming")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool MAP_PlugIn_OpenStreaming(MaplayPlugin pPlugin, ref byte pbBuf, uint cbBuf, ref MaplayWrapper.Plugin.MAP_PLUGIN_STREMING_INFO pInfo); /// Return Type: int ///pPlugin: void* ///pbInBuf: LPBYTE->BYTE* ///cbInBuf: DWORD->unsigned int ///pcbInUsed: DWORD* ///pHdr: WAVEHDR* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_DecodeStreaming")] public static extern int MAP_PlugIn_DecodeStreaming(MaplayPlugin pPlugin, ref byte pbInBuf, uint cbInBuf, ref uint pcbInUsed, ref MaplayWrapper.Plugin.WAVEHDR pHdr); /// Return Type: void ///pPlugin: void* [System.Runtime.InteropServices.DllImportAttribute("maplay.dll", EntryPoint = "MAP_PlugIn_CloseStreaming")] public static extern void MAP_PlugIn_CloseStreaming(MaplayPlugin pPlugin); } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct EQUALIZER { /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fEnable; public int preamp; /// int[10] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I4)] public int[] data; } public enum EffectType : int { EFFECT_REVERB = 0, EFFECT_ECHO = 1, EFFECT_SURROUND = 2, EFFECT_3DCHORUS = 3 }; [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct EFFECT { /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fEnable; public int nDelay; public int nRate; } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct MAP_INFORMATION { public int nVersion; public int nLayer; public int nChannels; public int nSamplingRate; public int nBitRate; public int nDuration; } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct MAP_OPTIONS { public int nThreadPriority; public int nOutputBufferLen; public int nOutputPrebuffer; /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fScanMpegCompletely; /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fFadeIn; /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fSuppressZeroSamples; /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fAlwaysOpenDevice; } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)] public struct MAP_STREAMING_OPTIONS { public int nBuf; public int nPreBuf; /// BOOL->int [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public bool fUseProxy; /// TCHAR[260] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 260)] public string szProxy; /// TCHAR[260] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 260)] public string szUserAgent; } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)] public struct ID3Tag { /// TCHAR[255] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 255)] public string szTrack; /// TCHAR[255] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 255)] public string szArtist; /// TCHAR[255] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 255)] public string szAlbum; /// TCHAR[255] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 255)] public string szComment; /// TCHAR[255] [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 255)] public string szGenre; public int nYear; public int nTrackNum; } public enum MAP_STATUS { MAP_STATUS_STOP, MAP_STATUS_PLAY, MAP_STATUS_PAUSE, MAP_STATUS_WAIT } public enum MAP_STREAMING_STATUS { MAP_STREAMING_DISABLED, MAP_STREAMING_DISCONNECTED, MAP_STREAMING_CONNECTING, MAP_STREAMING_BUFFERING, MAP_STREAMING_CONNECTED }; }