git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@8 b1f601f4-4f45-0410-8980-aecacb008692

This commit is contained in:
kbinani
2009-07-29 17:03:20 +00:00
parent 0453ea1636
commit 8ab2a598b3
49 changed files with 3567 additions and 1370 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C8AAE632-9C6C-4372-8175-811528A66742}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -12,6 +12,9 @@
<AssemblyName>bocoree</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View File

@@ -1,6 +1,6 @@
CP=cp
RM=rm
SRC=cp932.cs fft.cs math.cs windows.cs wingdi.cs
bocoree.dll: *.cs
gmcs -recurse:*.cs -unsafe+ -target:library -out:bocoree.dll -r:System,System.Drawing,System.Windows.Forms

View File

@@ -122,24 +122,43 @@ namespace bocoree {
private static string s_path = "";
public static void force_logfile_path( string path ) {
try {
if ( s_debug_out != null ) {
s_debug_out.Close();
s_debug_out = new StreamWriter( path );
}
} catch {
}
s_path = path;
}
public static void push_log( string s ) {
if ( s_debug_out == null ) {
if ( s_path == "" ) {
s_debug_out = new StreamWriter( Path.Combine( System.Windows.Forms.Application.StartupPath, "run.log" ) );
} else {
s_debug_out = new StreamWriter( s_path );
try {
if ( s_debug_out == null ) {
if ( s_path == "" ) {
s_debug_out = new StreamWriter( Path.Combine( System.Windows.Forms.Application.StartupPath, "run.log" ) );
} else {
s_debug_out = new StreamWriter( s_path );
}
s_debug_out.AutoFlush = true;
s_debug_out.WriteLine( "************************************************************************" );
s_debug_out.WriteLine( " Date: " + DateTime.Now.ToString() );
s_debug_out.WriteLine( "------------------------------------------------------------------------" );
}
s_debug_out.AutoFlush = true;
s_debug_out.WriteLine( "************************************************************************" );
s_debug_out.WriteLine( " Date: " + DateTime.Now.ToString() );
s_debug_out.WriteLine( "------------------------------------------------------------------------" );
s_debug_out.WriteLine( s );
} catch ( Exception ex ) {
Console.WriteLine( "bocoree.debug.push_log; log file I/O Exception" );
}
s_debug_out.WriteLine( s );
Console.WriteLine( s );
}
public static void close() {
if ( s_debug_out != null ) {
s_debug_out.Close();
s_debug_out = null;
s_path = "";
}
}
}
}

View File

@@ -36,7 +36,7 @@ namespace bocoree {
public const int LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x00000040;
[DllImport( "kernel32.dll" )]
public static extern IntPtr LoadLibraryExW( [MarshalAs( UnmanagedType.LPWStr)]string lpFileName, IntPtr hFile, uint dwFlags );
public static extern IntPtr LoadLibraryExW( [MarshalAs( UnmanagedType.LPWStr )]string lpFileName, IntPtr hFile, uint dwFlags );
[DllImport( "kernel32.dll", CharSet = CharSet.Ansi, EntryPoint = "GetProcAddress", ExactSpelling = true )]
public static extern IntPtr GetProcAddress( IntPtr hModule, string lpProcName );
@@ -158,8 +158,29 @@ namespace bocoree {
#region windef.h
public const int MAX_PATH = 260;
#endregion
}
#region winuser.h
public const int WM_MOUSEMOVE = 512;
public const int WM_LBUTTONDOWN = 513;
public const int WM_LBUTTONUP = 514;
public const int WM_LBUTTONDBLCLK = 515;
public const int WM_RBUTTONDOWN = 516;
public const int WM_RBUTTONUP = 517;
public const int WM_RBUTTONDBLCLK = 518;
public const int WM_MBUTTONDOWN = 519;
public const int WM_MBUTTONUP = 520;
public const int WM_MBUTTONDBLCLK = 521;
public const int WM_MOUSEWHEEL = 522;
#endregion
public const uint SHGFI_ICON = 0x100;
public const uint SHGFI_LARGEICON = 0x0; // 'Large icon
public const uint SHGFI_SMALLICON = 0x1; // 'Small icon
[DllImport( "shell32.dll" )]
public static extern IntPtr SHGetFileInfo( string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags );
}
#region windef.h
public struct FILETIME {
@@ -168,4 +189,14 @@ namespace bocoree {
}
#endregion
[StructLayout( LayoutKind.Sequential )]
public struct SHFILEINFO {
public IntPtr hIcon;
public IntPtr iIcon;
public uint dwAttributes;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 260 )]
public string szDisplayName;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 80 )]
public string szTypeName;
}
}

View File

@@ -30,6 +30,54 @@ namespace bocoree {
public Int32 biYPelsPerMeter;
public UInt32 biClrUsed;
public UInt32 biClrImportant;
public static BITMAPINFOHEADER Read( Stream stream ) {
BITMAPINFOHEADER bifh = new BITMAPINFOHEADER();
byte[] buf = new byte[4];
bifh.biSize = readUInt32( stream );
bifh.biWidth = readInt32( stream );
bifh.biHeight = readInt32( stream );
bifh.biPlanes = readInt16( stream );
bifh.biBitCount = readInt16( stream );
bifh.biCompression = readUInt32( stream );
bifh.biSizeImage = readUInt32( stream );
bifh.biXPelsPerMeter = readInt32( stream );
bifh.biYPelsPerMeter = readInt32( stream );
bifh.biClrUsed = readUInt32( stream );
bifh.biClrImportant = readUInt32( stream );
return bifh;
}
private static uint readUInt32( Stream fs ){
byte[] buf = new byte[4];
fs.Read( buf, 0, 4 );
return BitConverter.ToUInt32( buf, 0 );
}
private static int readInt32( Stream fs ){
byte[] buf = new byte[4];
fs.Read( buf, 0, 4 );
return BitConverter.ToInt32( buf, 0 );
}
private static ushort readUInt16( Stream fs ){
byte[] buf = new byte[2];
fs.Read( buf, 0, 2 );
return BitConverter.ToUInt16( buf, 0 );
}
private static short readInt16( Stream fs ){
byte[] buf = new byte[2];
fs.Read( buf, 0, 2 );
return BitConverter.ToInt16( buf, 0 );
}
public override string ToString() {
return "{biSize=" + biSize + ", biWidth=" + biWidth + ", biHeight=" + biHeight + ", biPlanes=" + biPlanes + ", biBitCount=" + biBitCount +
", biCompression=" + biCompression + ", biSizeImage=" + biSizeImage + ", biXPelsPerMeter=" + biXPelsPerMeter + ", biYPelsPerMeter=" + biYPelsPerMeter +
", biClrUsed=" + biClrUsed + ", biClrImportant=" + biClrImportant + "}";
}
public void Write( BinaryWriter bw ) {
bw.Write( biSize );
bw.Write( (uint)biWidth );

View File

@@ -13,6 +13,7 @@
*/
using System;
using System.Runtime.InteropServices;
using bocoree;
namespace bocoree {
@@ -131,138 +132,38 @@ namespace bocoree {
public uint reserved; // reserved for driver
}
/*typedef struct mmtime_tag
{
UINT wType; // indicates the contents of the union
union
{
DWORD ms; // milliseconds
DWORD sample; // samples
DWORD cb; // byte count
DWORD ticks; // ticks in MIDI stream
// SMPTE
struct
{
BYTE hour; // hours
BYTE min; // minutes
BYTE sec; // seconds
BYTE frame; // frames
BYTE fps; // frames per second
BYTE dummy; // pad
#ifdef _WIN32
BYTE pad[2];
#endif
} smpte;
// MIDI
struct
{
DWORD songptrpos; // song pointer position
} midi;
} u;
}*/
[StructLayout( LayoutKind.Explicit )]
public struct MMTIME {
[FieldOffset( 0 )]
public UInt32 wType;
[FieldOffset( 4 )]
public UInt32 ms;
[FieldOffset( 4 )]
public UInt32 sample;
[FieldOffset( 4 )]
public UInt32 cb;
[FieldOffset( 4 )]
public UInt32 ticks;
[FieldOffset( 4 )]
public Byte smpteHour;
[FieldOffset( 5 )]
public Byte smpteMin;
[FieldOffset( 6 )]
public Byte smpteSec;
[FieldOffset( 7 )]
public Byte smpteFrame;
[FieldOffset( 8 )]
public Byte smpteFps;
[FieldOffset( 9 )]
public Byte smpteDummy;
[FieldOffset( 10 )]
public Byte smptePad0;
[FieldOffset( 11 )]
public Byte smptePad1;
[FieldOffset( 4 )]
public UInt32 midiSongPtrPos;
}
[StructLayout(LayoutKind.Sequential, Pack = 1 )]
public unsafe struct _MMTIME {
public UINT wType;
byte b1;
byte b2;
byte b3;
byte b4;
byte b5;
byte b6;
byte b7;
byte b8;
public struct SMPTE {
public BYTE hour; // hours
public BYTE min; // minutes
public BYTE sec; // seconds
public BYTE frame; // frames
public BYTE fps; // frames per second
public BYTE dummy; // pad
public fixed BYTE pad[2];
}
public SMPTE smpte {
get {
SMPTE ret = new SMPTE();
ret.hour = b1;
ret.min = b2;
ret.sec = b3;
ret.frame = b4;
ret.fps = b5;
ret.dummy = b6;
ret.pad[0] = b7;
ret.pad[1] = b8;
return ret;
}
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct MIDI {
public DWORD songptrpos; // song pointer position
}
public MIDI midi {
get {
MIDI ret = new MIDI();
ret.songptrpos = ms;
return ret;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public unsafe struct SMPTE {
public BYTE hour; // hours
public BYTE min; // minutes
public BYTE sec; // seconds
public BYTE frame; // frames
public BYTE fps; // frames per second
public BYTE dummy; // pad
public fixed BYTE pad[2];
}
public uint ms {
get {
return (uint)b1 | (uint)(b2 << 8) | (uint)(b3 << 16) | (uint)(b4 << 32);
}
}
public uint sample {
get {
return ms;
}
}
public uint cb {
get {
return ms;
}
}
public uint ticks {
get {
return ms;
}
}
[FieldOffset( 0 )]
public uint wType;
[FieldOffset( 4 )]
public SMPTE smpte;
[FieldOffset( 4 )]
public MIDI midi;
[FieldOffset( 4 )]
public uint ms;
[FieldOffset( 4 )]
public uint sample;
[FieldOffset( 4 )]
public uint cb;
[FieldOffset( 4 )]
public uint ticks;
}
[StructLayout( LayoutKind.Sequential, CharSet = CharSet.Ansi )]
@@ -279,7 +180,40 @@ namespace bocoree {
}
}
[StructLayout( LayoutKind.Sequential )]
public unsafe struct MIDIHDR {
public byte* lpData;
public DWORD dwBufferLength;
public DWORD dwBytesRecorded;
public DWORD dwUser;
public DWORD dwFlags;
public MIDIHDR* lpNext;
public DWORD reserved;
public DWORD dwOffset;
public fixed DWORD dwReserved[8];
}
[StructLayout( LayoutKind.Sequential )]
public struct MIDIOUTCAPSA {
public WORD wMid;
public WORD wPid;
public uint vDriverVersion;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = windows.MAXPNAMELEN )]
public string szPname;
public WORD wTechnology;
public WORD wVoices;
public WORD wNotes;
public WORD wChannelMask;
public DWORD dwSupport;
}
public static partial class windows {
private enum DllStatus {
Unknown,
Found,
NotFound,
}
public const uint JOYERR_NOERROR = 0;
public const ushort JOY_RETURNX = 0x00000001;
public const ushort JOY_RETURNY = 0x00000002;
@@ -336,40 +270,496 @@ namespace bocoree {
public const int WHDR_ENDLOOP = 0x00000008; /* loop end block */
public const int WHDR_INQUEUE = 0x00000010; /* reserved for driver */
public const int TIME_MS = 0x0001; /* time in milliseconds */
public const int TIME_SAMPLES= 0x0002; /* number of wave samples */
public const int TIME_BYTES= 0x0004; /* current byte offset */
public const int TIME_SMPTE = 0x0008; /* SMPTE time */
public const int TIME_MIDI = 0x0010; /* MIDI time */
public const int TIME_MS = 0x0001; /* time in milliseconds */
public const int TIME_SAMPLES = 0x0002; /* number of wave samples */
public const int TIME_BYTES = 0x0004; /* current byte offset */
public const int TIME_SMPTE = 0x0008; /* SMPTE time */
public const int TIME_MIDI = 0x0010; /* MIDI time */
public const int TIME_TICKS = 0x0020; /* Ticks within MIDI stream */
public const int MAXPNAMELEN = 32;
public const int MAX_JOYSTICKOEMVXDNAME = 260;
public const uint MMSYSERR_NOERROR = 0;
public const uint MMSYSERR_ERROR = 1;
public const uint MMSYSERR_BADDEVICEID = 2;
public const uint MMSYSERR_NOTENABLED = 3;
public const uint MMSYSERR_ALLOCATED = 4;
public const uint MMSYSERR_INVALHANDLE = 5;
public const uint MMSYSERR_NODRIVER = 6;
public const uint MMSYSERR_NOMEM = 7;
public const uint MMSYSERR_NOTSUPPORTED = 8;
public const uint MMSYSERR_BADERRNUM = 9;
public const uint MMSYSERR_INVALFLAG = 10;
public const uint MMSYSERR_INVALPARAM = 11;
public const uint MMSYSERR_HANDLEBUSY = 12;
public const uint MMSYSERR_INVALIDALIAS = 13;
public const uint MMSYSERR_BADDB = 14;
public const uint MMSYSERR_KEYNOTFOUND = 15;
public const uint MMSYSERR_READERROR = 16;
public const uint MMSYSERR_WRITEERROR = 17;
public const uint MMSYSERR_DELETEERROR = 18;
public const uint MMSYSERR_VALNOTFOUND = 19;
public const uint MMSYSERR_NODRIVERCB = 20;
public const uint MMSYSERR_LASTERROR = 20;
private static DllStatus status_winmm = DllStatus.Unknown;
private static DllStatus status_winmm_so = DllStatus.Unknown;
#region midi
[DllImport( "winmm.dll" )]
public static extern UINT midiInGetNumDevs();
[DllImport( "winmm.dll" )]
public static unsafe extern MMRESULT midiInOpen( HMIDIIN* lphMidiIn,
UINT uDeviceID,
DWORD dwCallback,
DWORD dwCallbackInstance,
DWORD dwFlags );
[DllImport( "winmm", EntryPoint = "midiInGetDevCaps", CharSet = CharSet.Ansi )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiInGetDevCaps( [MarshalAs( UnmanagedType.U4 )]uint uDeviceID, ref MIDIINCAPS lpMidiInCaps, [MarshalAs( UnmanagedType.U4 )]uint cbMidiInCaps );
[DllImport( "winmm.dll.so", EntryPoint = "midiInGetDevCaps", CharSet = CharSet.Ansi )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiInGetDevCaps( [MarshalAs( UnmanagedType.U4 )]uint uDeviceID, ref MIDIINCAPS lpMidiInCaps, [MarshalAs( UnmanagedType.U4 )]uint cbMidiInCaps );
public static uint midiInGetDevCaps( uint uDeviceID, ref MIDIINCAPS lpMidiInCaps, uint cbMidiInCaps ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInGetDevCaps( uDeviceID, ref lpMidiInCaps, cbMidiInCaps );
status_winmm = DllStatus.Found;
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInGetDevCaps( uDeviceID, ref lpMidiInCaps, cbMidiInCaps );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiInClose" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiInClose( uint hMidiIn );
[DllImport( "winmm.dll.so", EntryPoint = "midiInClose" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiInClose( uint hMidiIn );
public static uint midiInClose( uint hMidiIn ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInClose( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInClose( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiInStart" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiInStart( uint hMidiIn );
[DllImport( "winmm.dll.so", EntryPoint = "midiInStart" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiInStart( uint hMidiIn );
public static uint midiInStart( uint hMidiIn ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInStart( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInStart( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiInReset" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiInReset( uint hMidiIn );
[DllImport( "winmm.dll.so", EntryPoint = "midiInReset" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiInReset( uint hMidiIn );
public static uint midiInReset( uint hMidiIn ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInReset( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInReset( hMidiIn );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiInGetNumDevs" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiInGetNumDevs();
[DllImport( "winmm.dll.so", EntryPoint = "midiInGetNumDevs" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiInGetNumDevs();
public static uint midiInGetNumDevs() {
uint ret = 0;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInGetNumDevs();
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInGetNumDevs();
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiInOpen" )]
private static extern uint __midiInOpen( ref uint lphMidiIn,
int uDeviceID,
IntPtr dwCallback,
int dwCallbackInstance,
int dwFlags );
[DllImport( "winmm.dll.so", EntryPoint = "midiInOpen" )]
private static extern uint __so_midiInOpen( ref uint lphMidiIn,
int uDeviceID,
IntPtr dwCallback,
int dwCallbackInstance,
int dwFlags );
public static uint midiInOpen( ref uint lphMidiIn,
int uDeviceID,
IntPtr dwCallback,
int dwCallbackInstance,
int dwFlags ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiInOpen( ref lphMidiIn, uDeviceID, dwCallback, dwCallbackInstance, dwFlags );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiInOpen( ref lphMidiIn, uDeviceID, dwCallback, dwCallbackInstance, dwFlags );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutGetNumDevs" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutGetNumDevs();
[DllImport( "winmm.dll.so", EntryPoint = "midiOutGetNumDevs" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutGetNumDevs();
public static uint midiOutGetNumDevs() {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutGetNumDevs();
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutGetNumDevs();
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutGetDevCapsA", CharSet = CharSet.Ansi )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutGetDevCapsA( [MarshalAs( UnmanagedType.U4 )] uint uDeviceID,
ref MIDIOUTCAPSA pMidiOutCaps,
[MarshalAs( UnmanagedType.U4 )] uint cbMidiOutCaps );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutGetDevCapsA", CharSet = CharSet.Ansi )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutGetDevCapsA( [MarshalAs( UnmanagedType.U4 )] uint uDeviceID,
ref MIDIOUTCAPSA pMidiOutCaps,
[MarshalAs( UnmanagedType.U4 )] uint cbMidiOutCaps );
public static uint midiOutGetDevCapsA( uint uDeviceID, ref MIDIOUTCAPSA pMidiOutCaps, uint cbMidiOutCaps ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutGetDevCapsA( uDeviceID, ref pMidiOutCaps, cbMidiOutCaps );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutGetDevCapsA( uDeviceID, ref pMidiOutCaps, cbMidiOutCaps );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutOpen" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutOpen( [MarshalAs( UnmanagedType.SysUInt )] ref IntPtr lphMidiOut,
[MarshalAs( UnmanagedType.U4 )] uint uDeviceID,
[MarshalAs( UnmanagedType.FunctionPtr )] Delegate dwCallback,
[MarshalAs( UnmanagedType.U4 )] uint dwInstance,
[MarshalAs( UnmanagedType.U4 )] uint dwFlags );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutOpen" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutOpen( [MarshalAs( UnmanagedType.SysUInt )] ref IntPtr lphMidiOut,
[MarshalAs( UnmanagedType.U4 )] uint uDeviceID,
[MarshalAs( UnmanagedType.FunctionPtr )] Delegate dwCallback,
[MarshalAs( UnmanagedType.U4 )] uint dwInstance,
[MarshalAs( UnmanagedType.U4 )] uint dwFlags );
public static uint midiOutOpen( ref IntPtr lphMidiOut,
uint uDeviceID,
Delegate dwCallback,
uint dwInstance,
uint dwFlags ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutOpen( ref lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutOpen( ref lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutClose" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutClose( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutClose" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutClose( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut );
public static uint midiOutClose( IntPtr hMidiOut ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutClose( hMidiOut );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutClose( hMidiOut );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutShortMsg" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutShortMsg( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, [MarshalAs( UnmanagedType.U4 )] uint dwMsg );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutShortMsg" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutShortMsg( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, [MarshalAs( UnmanagedType.U4 )] uint dwMsg );
public static uint midiOutShortMsg( IntPtr hMidiOut, uint dwMsg ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutShortMsg( hMidiOut, dwMsg );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutShortMsg( hMidiOut, dwMsg );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutLongMsg" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutLongMsg( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutLongMsg" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutLongMsg( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
public static uint midiOutLongMsg( IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, uint uSize ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutLongMsg( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutLongMsg( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutPrepareHeader" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutPrepareHeader( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutPrepareHeader" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutPrepareHeader( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
public static uint midiOutPrepareHeader( IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, uint uSize ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutPrepareHeader( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutPrepareHeader( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "midiOutUnprepareHeader" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __midiOutUnprepareHeader( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
[DllImport( "winmm.dll.so", EntryPoint = "midiOutUnprepareHeader" )]
[return: MarshalAs( UnmanagedType.U4 )]
private static extern uint __so_midiOutUnprepareHeader( [MarshalAs( UnmanagedType.SysUInt )] IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, [MarshalAs( UnmanagedType.U4 )] uint uSize );
public static uint midiOutUnprepareHeader( IntPtr hMidiOut, ref MIDIHDR lpMidiOutHdr, uint uSize ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __midiOutUnprepareHeader( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
} else if ( status_winmm_so != DllStatus.NotFound ) {
try {
ret = __so_midiOutUnprepareHeader( hMidiOut, ref lpMidiOutHdr, uSize );
} catch ( DllNotFoundException ex ) {
status_winmm_so = DllStatus.NotFound;
}
}
return ret;
}
#endregion
#region joy
[DllImport( "winmm.dll" )]
[DllImport( "winmm", EntryPoint = "joyGetNumDevs" )]
[return: MarshalAs( UnmanagedType.U4 )]
public static extern uint joyGetNumDevs();
private static extern uint __joyGetNumDevs();
[DllImport( "winmm.dll" )]
public static extern uint joyGetPos( uint uJoyID, ref JOYINFO pji );
public static uint joyGetNumDevs() {
uint ret = 0;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __joyGetNumDevs();
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm.dll" )]
public static extern uint joyGetDevCapsW( uint uJoyID, ref JOYCAPSW pjc, uint cbjc );
[DllImport( "winmm", EntryPoint = "joyGetPos" )]
private static extern uint __joyGetPos( uint uJoyID, ref JOYINFO pji );
[DllImport( "winmm.dll" )]
public static extern uint joyGetPosEx( uint uJoyID, ref JOYINFOEX pji );
public static uint joyGetPos( uint uJoyID, ref JOYINFO pji ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __joyGetPos( uJoyID, ref pji );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "joyGetDevCapsW" )]
private static extern uint __joyGetDevCapsW( uint uJoyID, ref JOYCAPSW pjc, uint cbjc );
public static uint joyGetDevCapsW( uint uJoyID, ref JOYCAPSW pjc, uint cbjc ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __joyGetDevCapsW( uJoyID, ref pjc, cbjc );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
}
return ret;
}
[DllImport( "winmm", EntryPoint = "joyGetPosEx" )]
private static extern uint __joyGetPosEx( uint uJoyID, ref JOYINFOEX pji );
public static uint joyGetPosEx( uint uJoyID, ref JOYINFOEX pji ) {
uint ret = MMSYSERR_ERROR;
if ( status_winmm != DllStatus.NotFound ) {
try {
ret = __joyGetPosEx( uJoyID, ref pji );
} catch ( DllNotFoundException ex ) {
status_winmm = DllStatus.NotFound;
}
}
return ret;
}
#endregion
#region wave
@@ -384,16 +774,16 @@ namespace bocoree {
IntPtr dwInstance,
uint dwFlags );
//public static extern uint waveOutOpen( ref IntPtr phwo, UINT uDeviceID, ref WAVEFORMATEX pwfx, delegateWaveOutProc dwCallback, IntPtr dwInstance, uint fdwOpen );
[DllImport("winmm.dll")]
public static extern uint waveOutPrepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh);
[DllImport( "winmm.dll")]
public static extern uint waveOutGetPosition( IntPtr hwo, ref MMTIME pmmt, UINT cbmmt);
[DllImport("winmm.dll")]
public static extern uint waveOutReset( IntPtr hwo);
[DllImport("winmm.dll")]
public static extern uint waveOutUnprepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh);
[DllImport("winmm.dll")]
public static extern uint waveOutClose( IntPtr hwo);
[DllImport( "winmm.dll" )]
public static extern uint waveOutPrepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh );
[DllImport( "winmm.dll" )]
public static extern uint waveOutGetPosition( IntPtr hwo, ref MMTIME pmmt, UINT cbmmt );
[DllImport( "winmm.dll" )]
public static extern uint waveOutReset( IntPtr hwo );
[DllImport( "winmm.dll" )]
public static extern uint waveOutUnprepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh );
[DllImport( "winmm.dll" )]
public static extern uint waveOutClose( IntPtr hwo );
#endregion
#region mci