using System ;
using System.Collections.Generic ;
using System.Runtime.InteropServices ;
using System.Text ;


namespace DxLibDLL
{


	public static partial class DX
	{


		/// <summary> 新しいサウンドデータ領域を確保する </summary>
		public static Sound AddSoundData()
		{
			lock( locker )
			{
				int result = dx_AddSoundData( -1 ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

		/// <summary> 新しいサウンドデータ領域を確保する </summary>
		public static void AddSoundData( Sound SoundHandle )
		{
			lock( locker )
			{
				if( SoundHandle == null ) { throw new ArgumentException() ; }
				int result = dx_AddSoundData( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddSoundData( int Handle ) ;


		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMem( IStream Stream , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType , out bool CanStreamCloseFlag )
		{
			AddStreamSoundMem( Stream , LoopNum , SoundHandle , StreamDataType , out CanStreamCloseFlag , null ) ;
		}

		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMem( IStream Stream , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType , out bool CanStreamCloseFlag , Sound UnionHandle )
		{
			lock( locker )
			{
				STREAMDATA Stream_ = new STREAMDATA( Stream ) ;
				int result = dx_AddStreamSoundMem( ref Stream_ , LoopNum , Sound.ToHandle( SoundHandle ) , StreamDataType , out CanStreamCloseFlag , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddStreamSoundMem( [ In ] ref STREAMDATA Stream , int LoopNum , int SoundHandle , DX_SOUNDDATATYPE StreamDataType , out bool CanStreamCloseFlag , int UnionHandle ) ;


		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMemToMem( IntPtr FileImageBuffer , int ImageSize , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType )
		{
			AddStreamSoundMemToMem( FileImageBuffer , ImageSize , LoopNum , SoundHandle , StreamDataType , null ) ;
		}

		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMemToMem( IntPtr FileImageBuffer , int ImageSize , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_AddStreamSoundMemToMem( FileImageBuffer , ImageSize , LoopNum , Sound.ToHandle( SoundHandle ) , StreamDataType , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddStreamSoundMemToMem( IntPtr FileImageBuffer , int ImageSize , int LoopNum , int SoundHandle , DX_SOUNDDATATYPE StreamDataType , int UnionHandle ) ;


		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMemToFile( string WaveFile , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType )
		{
			AddStreamSoundMemToFile( WaveFile , LoopNum , SoundHandle , StreamDataType , null ) ;
		}

		/// <summary> ストリーム風サウンドデータにサウンドデータを追加する </summary>
		public static void AddStreamSoundMemToFile( string WaveFile , int LoopNum , Sound SoundHandle , DX_SOUNDDATATYPE StreamDataType , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_AddStreamSoundMemToFile( WaveFile , LoopNum , Sound.ToHandle( SoundHandle ) , StreamDataType , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddStreamSoundMemToFile( string WaveFile , int LoopNum , int SoundHandle , DX_SOUNDDATATYPE StreamDataType , int UnionHandle ) ;


		/// <summary> ストリーム風サウンドデータの再生準備を行う </summary>
		public static void SetupStreamSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetupStreamSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetupStreamSoundMem( int SoundHandle ) ;


		/// <summary> ストリーム風サウンドデータの再生開始 </summary>
		public static void PlayStreamSoundMem( Sound SoundHandle , DX_PLAYTYPE PlayType )
		{
			PlayStreamSoundMem( SoundHandle , PlayType , true ) ;
		}

		/// <summary> ストリーム風サウンドデータの再生開始 </summary>
		public static void PlayStreamSoundMem( Sound SoundHandle )
		{
			PlayStreamSoundMem( SoundHandle , DX_PLAYTYPE.LOOP ) ;
		}

		/// <summary> ストリーム風サウンドデータの再生開始 </summary>
		public static void PlayStreamSoundMem( Sound SoundHandle , DX_PLAYTYPE PlayType , bool TopPositionFlag )
		{
			lock( locker )
			{
				int result = dx_PlayStreamSoundMem( Sound.ToHandle( SoundHandle ) , PlayType , TopPositionFlag ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayStreamSoundMem( int SoundHandle , DX_PLAYTYPE PlayType , bool TopPositionFlag ) ;


		/// <summary> ストリーム風サウンドデータの再生状態を得る </summary>
		public static bool CheckStreamSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_CheckStreamSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckStreamSoundMem( int SoundHandle ) ;


		/// <summary> ストリーム風サウンドデータの再生終了 </summary>
		public static void StopStreamSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_StopStreamSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopStreamSoundMem( int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をバイト単位で変更する(再生が止まっている時のみ有効) </summary>
		public static void SetStreamSoundCurrentPosition( int Byte , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetStreamSoundCurrentPosition( Byte , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetStreamSoundCurrentPosition( int Byte , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をバイト単位で取得する </summary>
		public static int GetStreamSoundCurrentPosition( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetStreamSoundCurrentPosition( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetStreamSoundCurrentPosition( int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をミリ秒単位で設定する(圧縮形式の場合は正しく設定されない場合がある) </summary>
		public static void SetStreamSoundCurrentTime( int Time , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetStreamSoundCurrentTime( Time , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetStreamSoundCurrentTime( int Time , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をミリ秒単位で取得する(圧縮形式の場合は正しい値が返ってこない場合がある) </summary>
		public static int GetStreamSoundCurrentTime( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetStreamSoundCurrentTime( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetStreamSoundCurrentTime( int SoundHandle ) ;


		/// <summary> ストリームサウンドの再生処理関数 </summary>
		public static void ProcessStreamSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_ProcessStreamSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ProcessStreamSoundMem( int SoundHandle ) ;


		/// <summary> 有効なストリームサウンドのすべて再生処理関数にかける </summary>
		public static void ProcessStreamSoundMemAll()
		{
			lock( locker )
			{
				int result = dx_ProcessStreamSoundMemAll() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ProcessStreamSoundMemAll() ;


		/// <summary> 前奏部とループ部に分かれたサウンドデータの作成 </summary>
		public static Sound LoadSoundMem2( string WaveName1 , string WaveName2 )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMem2( WaveName1 , WaveName2 ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMem2( string WaveName1 , string WaveName2 ) ;


		/// <summary> 主にＢＧＭを読み込むのに適した関数 </summary>
		public static Sound LoadBGM( string WaveName )
		{
			lock( locker )
			{
				int result = dx_LoadBGM( WaveName ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadBGM( string WaveName ) ;


		/// <summary> サウンドデータを追加する </summary>
		public static Sound LoadSoundMemBase( string WaveName , int BufferNum )
		{
			return LoadSoundMemBase( WaveName , BufferNum , null ) ;
		}

		/// <summary> サウンドデータを追加する </summary>
		public static Sound LoadSoundMemBase( string WaveName , int BufferNum , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemBase( WaveName , BufferNum , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemBase( string WaveName , int BufferNum , int UnionHandle ) ;


		/// <summary> サウンドデータを追加する </summary>
		public static Sound LoadSoundMem( string WaveName )
		{
			return LoadSoundMem( WaveName , 3 ) ;
		}

		/// <summary> サウンドデータを追加する </summary>
		public static Sound LoadSoundMem( string WaveName , int BufferNum )
		{
			return LoadSoundMem( WaveName , BufferNum , null ) ;
		}

		/// <summary> サウンドデータを追加する </summary>
		public static Sound LoadSoundMem( string WaveName , int BufferNum , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMem( WaveName , BufferNum , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMem( string WaveName , int BufferNum , int UnionHandle ) ;


		/// <summary> 同時再生数指定型サウンド追加関数 </summary>
		public static Sound LoadSoundMemToBufNumSitei( string WaveName , int BufferNum )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemToBufNumSitei( WaveName , BufferNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemToBufNumSitei( string WaveName , int BufferNum ) ;


		/// <summary> サウンドをリソースから読み込む </summary>
		public static Sound LoadSoundMemByResource( string ResourceName , string ResourceType )
		{
			return LoadSoundMemByResource( ResourceName , ResourceType , 1 ) ;
		}

		/// <summary> サウンドをリソースから読み込む </summary>
		public static Sound LoadSoundMemByResource( string ResourceName , string ResourceType , int BufferNum )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemByResource( ResourceName , ResourceType , BufferNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemByResource( string ResourceName , string ResourceType , int BufferNum ) ;


		/// <summary> 同じサウンドデータを使用するサウンドハンドルを作成する( DX_SOUNDDATATYPE_MEMNOPRESS タイプのみ ) </summary>
		public static Sound DuplicateSoundMem( Sound SrcSoundHandle )
		{
			return DuplicateSoundMem( SrcSoundHandle , 3 ) ;
		}

		/// <summary> 同じサウンドデータを使用するサウンドハンドルを作成する( DX_SOUNDDATATYPE_MEMNOPRESS タイプのみ ) </summary>
		public static Sound DuplicateSoundMem( Sound SrcSoundHandle , int BufferNum )
		{
			lock( locker )
			{
				int result = dx_DuplicateSoundMem( Sound.ToHandle( SrcSoundHandle ) , BufferNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_DuplicateSoundMem( int SrcSoundHandle , int BufferNum ) ;


		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する(ベース関数) </summary>
		public static Sound LoadSoundMemByMemImageBase( IntPtr FileImageBuffer , int ImageSize , int BufferNum )
		{
			return LoadSoundMemByMemImageBase( FileImageBuffer , ImageSize , BufferNum , null ) ;
		}

		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する(ベース関数) </summary>
		public static Sound LoadSoundMemByMemImageBase( IntPtr FileImageBuffer , int ImageSize , int BufferNum , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemByMemImageBase( FileImageBuffer , ImageSize , BufferNum , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemByMemImageBase( IntPtr FileImageBuffer , int ImageSize , int BufferNum , int UnionHandle ) ;


		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する(バッファ数指定あり)  </summary>
		public static Sound LoadSoundMemByMemImage( IntPtr FileImageBuffer , int ImageSize )
		{
			return LoadSoundMemByMemImage( FileImageBuffer , ImageSize , null ) ;
		}

		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する(バッファ数指定あり)  </summary>
		public static Sound LoadSoundMemByMemImage( IntPtr FileImageBuffer , int ImageSize , Sound UnionHandle )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemByMemImage( FileImageBuffer , ImageSize , Sound.ToHandle( UnionHandle ) ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemByMemImage( IntPtr FileImageBuffer , int ImageSize , int UnionHandle ) ;


		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する2 </summary>
		/// <param name="UFormat"> WAVEFORMATEX * </param>
		public static Sound LoadSoundMemByMemImage2( IntPtr UData , int UDataSize , IntPtr UFormat , int UHeaderSize )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemByMemImage2( UData , UDataSize , ref UFormat , UHeaderSize ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemByMemImage2( IntPtr UData , int UDataSize , [ In ] ref IntPtr UFormat , int UHeaderSize ) ;


		/// <summary> メモリ上に展開されたファイルイメージからハンドルを作成する </summary>
		public static Sound LoadSoundMemByMemImageToBufNumSitei( IntPtr FileImageBuffer , int ImageSize , int BufferNum )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemByMemImageToBufNumSitei( FileImageBuffer , ImageSize , BufferNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemByMemImageToBufNumSitei( IntPtr FileImageBuffer , int ImageSize , int BufferNum ) ;


		/// <summary> メモリ上に展開されたファイルイメージから前奏部とループ部に分かれたハンドルを作成する </summary>
		public static Sound LoadSoundMem2ByMemImage( IntPtr FileImageBuffer1 , int ImageSize1 , IntPtr FileImageBuffer2 , int ImageSize2 )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMem2ByMemImage( FileImageBuffer1 , ImageSize1 , FileImageBuffer2 , ImageSize2 ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMem2ByMemImage( IntPtr FileImageBuffer1 , int ImageSize1 , IntPtr FileImageBuffer2 , int ImageSize2 ) ;


		/// <summary> ソフトウエアで波形を制御するサウンドデータからサウンドハンドルを作成する </summary>
		public static Sound LoadSoundMemFromSoftSound( SoftSound SoftSoundHandle )
		{
			return LoadSoundMemFromSoftSound( SoftSoundHandle , 3 ) ;
		}

		/// <summary> ソフトウエアで波形を制御するサウンドデータからサウンドハンドルを作成する </summary>
		public static Sound LoadSoundMemFromSoftSound( SoftSound SoftSoundHandle , int BufferNum )
		{
			lock( locker )
			{
				int result = dx_LoadSoundMemFromSoftSound( SoftSound.ToHandle( SoftSoundHandle ) , BufferNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Sound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoundMemFromSoftSound( int SoftSoundHandle , int BufferNum ) ;


		/// <summary> メモリに読みこんだWAVEデータを再生する </summary>
		public static void PlaySoundMem( Sound SoundHandle , DX_PLAYTYPE PlayType )
		{
			PlaySoundMem( SoundHandle , PlayType , true ) ;
		}

		/// <summary> メモリに読みこんだWAVEデータを再生する </summary>
		public static void PlaySoundMem( Sound SoundHandle , DX_PLAYTYPE PlayType , bool TopPositionFlag )
		{
			lock( locker )
			{
				int result = dx_PlaySoundMem( Sound.ToHandle( SoundHandle ) , PlayType , TopPositionFlag ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlaySoundMem( int SoundHandle , DX_PLAYTYPE PlayType , bool TopPositionFlag ) ;


		/// <summary> メモリに読み込んだWAVEデータの再生を止める </summary>
		public static void StopSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_StopSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopSoundMem( int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータが再生中か調べる </summary>
		public static bool CheckSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_CheckSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckSoundMem( int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの再生にパンを設定する </summary>
		public static void SetPanSoundMem( int PanPal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetPanSoundMem( PanPal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetPanSoundMem( int PanPal , int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの再生にボリュームを設定する( 100分の1デシベル単位 ) </summary>
		public static void SetVolumeSoundMem( int VolumePal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetVolumeSoundMem( VolumePal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetVolumeSoundMem( int VolumePal , int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの再生にボリュームを設定する( パーセント指定 ) </summary>
		public static void ChangeVolumeSoundMem( int VolumePal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_ChangeVolumeSoundMem( VolumePal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ChangeVolumeSoundMem( int VolumePal , int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの再生のボリュームを取得する </summary>
		public static int GetVolumeSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetVolumeSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetVolumeSoundMem( int SoundHandle ) ;


		/// <summary> メモリに読み込んだWAVEデータの再生周波数を設定する </summary>
		public static void SetFrequencySoundMem( int FrequencyPal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetFrequencySoundMem( FrequencyPal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetFrequencySoundMem( int FrequencyPal , int SoundHandle ) ;


		/// <summary> メモリに読み込んだWAVEデータの再生周波数を取得する </summary>
		public static int GetFrequencySoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetFrequencySoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetFrequencySoundMem( int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの次の再生にのみ使用するパンを設定する </summary>
		public static void SetNextPlayPanSoundMem( int PanPal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetNextPlayPanSoundMem( PanPal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetNextPlayPanSoundMem( int PanPal , int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの次の再生にのみ使用するボリュームを設定する( 100分の1デシベル単位 ) </summary>
		public static void SetNextPlayVolumeSoundMem( int VolumePal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetNextPlayVolumeSoundMem( VolumePal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetNextPlayVolumeSoundMem( int VolumePal , int SoundHandle ) ;


		/// <summary> メモリに読みこんだWAVEデータの次の再生にのみ使用するボリュームを設定する( パーセント指定 ) </summary>
		public static void ChangeNextPlayVolumeSoundMem( int VolumePal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_ChangeNextPlayVolumeSoundMem( VolumePal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ChangeNextPlayVolumeSoundMem( int VolumePal , int SoundHandle ) ;


		/// <summary> メモリに読み込んだWAVEデータの次の再生にのみ使用する再生周波数を設定する </summary>
		public static void SetNextPlayFrequencySoundMem( int FrequencyPal , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetNextPlayFrequencySoundMem( FrequencyPal , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetNextPlayFrequencySoundMem( int FrequencyPal , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をサンプル単位で変更する(再生が止まっている時のみ有効) </summary>
		public static void SetCurrentPositionSoundMem( int SamplePosition , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetCurrentPositionSoundMem( SamplePosition , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetCurrentPositionSoundMem( int SamplePosition , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をサンプル単位で取得する </summary>
		public static void GetCurrentPositionSoundMem( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetCurrentPositionSoundMem( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetCurrentPositionSoundMem( int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をバイト単位で変更する(再生が止まっている時のみ有効) </summary>
		public static void SetSoundCurrentPosition( int Byte , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetSoundCurrentPosition( Byte , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetSoundCurrentPosition( int Byte , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をバイト単位で取得する </summary>
		public static int GetSoundCurrentPosition( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetSoundCurrentPosition( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoundCurrentPosition( int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をミリ秒単位で設定する(圧縮形式の場合は正しく設定されない場合がある) </summary>
		public static void SetSoundCurrentTime( int Time , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetSoundCurrentTime( Time , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetSoundCurrentTime( int Time , int SoundHandle ) ;


		/// <summary> サウンドハンドルの再生位置をミリ秒単位で取得する(圧縮形式の場合は正しい値が返ってこない場合がある) </summary>
		public static int GetSoundCurrentTime( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetSoundCurrentTime( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoundCurrentTime( int SoundHandle ) ;


		/// <summary> サウンドハンドルの音の総時間を取得する(単位はサンプル) </summary>
		public static int GetSoundTotalSample( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetSoundTotalSample( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoundTotalSample( int SoundHandle ) ;


		/// <summary> サウンドハンドルの音の総時間を取得する(単位はミリ秒) </summary>
		public static int GetSoundTotalTime( Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetSoundTotalTime( Sound.ToHandle( SoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoundTotalTime( int SoundHandle ) ;


		/// <summary> サウンドハンドルにループ位置を設定する </summary>
		public static void SetLoopPosSoundMem( int LoopTime , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetLoopPosSoundMem( LoopTime , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetLoopPosSoundMem( int LoopTime , int SoundHandle ) ;


		/// <summary> サウンドハンドルにループ位置を設定する </summary>
		public static void SetLoopTimePosSoundMem( int LoopTime , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetLoopTimePosSoundMem( LoopTime , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetLoopTimePosSoundMem( int LoopTime , int SoundHandle ) ;


		/// <summary> サウンドハンドルにループ位置を設定する </summary>
		public static void SetLoopSamplePosSoundMem( int LoopSamplePosition , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetLoopSamplePosSoundMem( LoopSamplePosition , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetLoopSamplePosSoundMem( int LoopSamplePosition , int SoundHandle ) ;


		/// <summary> サウンドハンドルにループ開始位置を設定する </summary>
		public static void SetLoopStartTimePosSoundMem( int LoopStartTime , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetLoopStartTimePosSoundMem( LoopStartTime , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetLoopStartTimePosSoundMem( int LoopStartTime , int SoundHandle ) ;


		/// <summary> サウンドハンドルにループ開始位置を設定する </summary>
		public static void SetLoopStartSamplePosSoundMem( int LoopStartSamplePosition , Sound SoundHandle )
		{
			lock( locker )
			{
				int result = dx_SetLoopStartSamplePosSoundMem( LoopStartSamplePosition , Sound.ToHandle( SoundHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetLoopStartSamplePosSoundMem( int LoopStartSamplePosition , int SoundHandle ) ;


		/// <summary> 作成するサウンドのデータ形式を設定する( DX_SOUNDDATATYPE_MEMNOPRESS 等 ) </summary>
		public static void SetCreateSoundDataType( DX_SOUNDDATATYPE SoundDataType )
		{
			lock( locker )
			{
				int result = dx_SetCreateSoundDataType( SoundDataType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetCreateSoundDataType( DX_SOUNDDATATYPE SoundDataType ) ;


		/// <summary> 作成するサウンドのデータ形式を取得する( DX_SOUNDDATATYPE_MEMNOPRESS 等 ) </summary>
		public static DX_SOUNDDATATYPE GetCreateSoundDataType()
		{
			lock( locker )
			{
				DX_SOUNDDATATYPE result = dx_GetCreateSoundDataType() ;
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern DX_SOUNDDATATYPE dx_GetCreateSoundDataType() ;


		/// <summary> サウンドキャプチャを前提とした動作をするかどうかを設定する </summary>
		public static void SetEnableSoundCaptureFlag( bool Flag )
		{
			lock( locker )
			{
				int result = dx_SetEnableSoundCaptureFlag( Flag ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetEnableSoundCaptureFlag( bool Flag ) ;


		/// <summary> サウンドの処理をソフトウエアで行うかどうかを設定する( TRUE:ソフトウエア  FALSE:ハードウエア( デフォルト ) ) </summary>
		public static void SetUseSoftwareMixingSoundFlag( bool Flag )
		{
			lock( locker )
			{
				int result = dx_SetUseSoftwareMixingSoundFlag( Flag ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetUseSoftwareMixingSoundFlag( bool Flag ) ;


		/// <summary> ＤＸライブラリが使用している DirectSound オブジェクトを取得する </summary>
		/// <returns> 戻り値を IDirectSound * にキャストして下さい </returns>
		public static IntPtr GetDSoundObj()
		{
			lock( locker )
			{
				IntPtr result = dx_GetDSoundObj() ;
				if( !( result != IntPtr.Zero ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern IntPtr dx_GetDSoundObj() ;


		/// <summary> ビープ音周波数設定関数 </summary>
		public static void SetBeepFrequency( int Freq )
		{
			lock( locker )
			{
				int result = dx_SetBeepFrequency( Freq ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetBeepFrequency( int Freq ) ;


		/// <summary> ビープ音を再生する </summary>
		public static void PlayBeep()
		{
			lock( locker )
			{
				int result = dx_PlayBeep() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayBeep() ;


		/// <summary> ビープ音を止める </summary>
		public static void StopBeep()
		{
			lock( locker )
			{
				int result = dx_StopBeep() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopBeep() ;


		/// <summary> WAVEファイルを再生する </summary>
		public static void PlaySoundFile( string FileName , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlaySoundFile( FileName , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlaySoundFile( string FileName , DX_PLAYTYPE PlayType ) ;


		/// <summary> PlaySoundFile の旧名称 </summary>
		public static void PlaySound( string FileName , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlaySound( FileName , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlaySound( string FileName , DX_PLAYTYPE PlayType ) ;


		/// <summary> WAVEファイルの再生中か調べる </summary>
		public static bool CheckSoundFile()
		{
			lock( locker )
			{
				int result = dx_CheckSoundFile() ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckSoundFile() ;


		/// <summary> CheckSoundFile の旧名称 </summary>
		public static bool CheckSound()
		{
			lock( locker )
			{
				int result = dx_CheckSound() ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckSound() ;


		/// <summary> WAVEファイルの再生を止める </summary>
		public static void StopSoundFile()
		{
			lock( locker )
			{
				int result = dx_StopSoundFile() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopSoundFile() ;


		/// <summary> StopSoundFile の旧名称 </summary>
		public static void StopSound()
		{
			lock( locker )
			{
				int result = dx_StopSound() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopSound() ;


		/// <summary> WAVEファイルの音量をセットする </summary>
		public static void SetVolumeSoundFile( int VolumePal )
		{
			lock( locker )
			{
				int result = dx_SetVolumeSoundFile( VolumePal ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetVolumeSoundFile( int VolumePal ) ;


		/// <summary> SetVolumeSound の旧名称 </summary>
		public static void SetVolumeSound( int VolumePal )
		{
			lock( locker )
			{
				int result = dx_SetVolumeSound( VolumePal ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetVolumeSound( int VolumePal ) ;


		/// <summary> ソフトウエアで扱う波形データをすべて解放する </summary>
		public static void InitSoftSound()
		{
			lock( locker )
			{
				int result = dx_InitSoftSound() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_InitSoftSound() ;


		/// <summary> ソフトウエアで扱う波形データをファイルから作成する </summary>
		public static SoftSound LoadSoftSound( string FileName )
		{
			lock( locker )
			{
				int result = dx_LoadSoftSound( FileName ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoftSound( string FileName ) ;


		/// <summary> ソフトウエアで扱う波形データをメモリ上に展開されたファイルイメージから作成する </summary>
		public static SoftSound LoadSoftSoundFromMemImage( IntPtr FileImageBuffer , int FileImageSize )
		{
			lock( locker )
			{
				int result = dx_LoadSoftSoundFromMemImage( FileImageBuffer , FileImageSize ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadSoftSoundFromMemImage( IntPtr FileImageBuffer , int FileImageSize ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( フォーマットは引数のソフトウエアサウンドハンドルと同じものにする ) </summary>
		public static SoftSound MakeSoftSound( SoftSound UseFormat_SoftSoundHandle , int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound( SoftSound.ToHandle( UseFormat_SoftSoundHandle ) , SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound( int UseFormat_SoftSoundHandle , int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:2 量子化ビット数:16bit サンプリング周波数:44KHz ) </summary>
		public static SoftSound MakeSoftSound2Ch16Bit44KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound2Ch16Bit44KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound2Ch16Bit44KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:2 量子化ビット数:16bit サンプリング周波数:22KHz ) </summary>
		public static SoftSound MakeSoftSound2Ch16Bit22KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound2Ch16Bit22KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound2Ch16Bit22KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:2 量子化ビット数:8bit サンプリング周波数:44KHz ) </summary>
		public static SoftSound MakeSoftSound2Ch8Bit44KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound2Ch8Bit44KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound2Ch8Bit44KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:2 量子化ビット数:8bit サンプリング周波数:22KHz ) </summary>
		public static SoftSound MakeSoftSound2Ch8Bit22KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound2Ch8Bit22KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound2Ch8Bit22KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:1 量子化ビット数:16bit サンプリング周波数:44KHz ) </summary>
		public static SoftSound MakeSoftSound1Ch16Bit44KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound1Ch16Bit44KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound1Ch16Bit44KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:1 量子化ビット数:16bit サンプリング周波数:22KHz ) </summary>
		public static SoftSound MakeSoftSound1Ch16Bit22KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound1Ch16Bit22KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound1Ch16Bit22KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:1 量子化ビット数:8bit サンプリング周波数:44KHz ) </summary>

		public static SoftSound MakeSoftSound1Ch8Bit44KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound1Ch8Bit44KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound1Ch8Bit44KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う空の波形データを作成する( チャンネル数:1 量子化ビット数:8bit サンプリング周波数:22KHz ) </summary>
		public static SoftSound MakeSoftSound1Ch8Bit22KHz( int SampleNum )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSound1Ch8Bit22KHz( SampleNum ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSound.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSound1Ch8Bit22KHz( int SampleNum ) ;


		/// <summary> ソフトウエアで扱う波形データのサンプル数を取得する </summary>
		public static int GetSoftSoundSampleNum( SoftSound SoftSoundHandle )
		{
			lock( locker )
			{
				int result = dx_GetSoftSoundSampleNum( SoftSound.ToHandle( SoftSoundHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoftSoundSampleNum( int SoftSoundHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのフォーマットを取得する </summary>
		public static void GetSoftSoundFormat( SoftSound SoftSoundHandle , out int Channels , out int BitsPerSample , out int SamplesPerSec )
		{
			lock( locker )
			{
				int result = dx_GetSoftSoundFormat( SoftSound.ToHandle( SoftSoundHandle ) , out Channels , out BitsPerSample , out SamplesPerSec ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoftSoundFormat( int SoftSoundHandle , out int Channels , out int BitsPerSample , out int SamplesPerSec ) ;


		/// <summary> ソフトウエアで扱う波形データのサンプルを読み取る </summary>
		public static void ReadSoftSoundData( SoftSound SoftSoundHandle , int SamplePosition , out int Channel1 , out int Channel2 )
		{
			lock( locker )
			{
				int result = dx_ReadSoftSoundData( SoftSound.ToHandle( SoftSoundHandle ) , SamplePosition , out Channel1 , out Channel2 ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ReadSoftSoundData( int SoftSoundHandle , int SamplePosition , out int Channel1 , out int Channel2 ) ;


		/// <summary> ソフトウエアで扱う波形データのサンプルを書き込む </summary>
		public static void WriteSoftSoundData( SoftSound SoftSoundHandle , int SamplePosition , int Channel1 , int Channel2 )
		{
			lock( locker )
			{
				int result = dx_WriteSoftSoundData( SoftSound.ToHandle( SoftSoundHandle ) , SamplePosition , Channel1 , Channel2 ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_WriteSoftSoundData( int SoftSoundHandle , int SamplePosition , int Channel1 , int Channel2 ) ;


		/// <summary> ソフトウエアで扱う波形データの波形イメージが格納されているメモリアドレスを取得する </summary>
		public static IntPtr GetSoftSoundDataImage( SoftSound SoftSoundHandle )
		{
			lock( locker )
			{
				IntPtr result = dx_GetSoftSoundDataImage( SoftSound.ToHandle( SoftSoundHandle ) ) ;
				if( !( result != IntPtr.Zero ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern IntPtr dx_GetSoftSoundDataImage( int SoftSoundHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーをすべて解放する </summary>
		public static void InitSoftSoundPlayer()
		{
			lock( locker )
			{
				int result = dx_InitSoftSoundPlayer() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_InitSoftSoundPlayer() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( フォーマットは引数のソフトウエアサウンドハンドルと同じものにする ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer( SoftSound UseFormat_SoftSoundHandle )
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer( SoftSound.ToHandle( UseFormat_SoftSoundHandle ) ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer( int UseFormat_SoftSoundHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:2 量子化ビット数:16bit サンプリング周波数:44KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer2Ch16Bit44KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer2Ch16Bit44KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer2Ch16Bit44KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:2 量子化ビット数:16bit サンプリング周波数:22KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer2Ch16Bit22KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer2Ch16Bit22KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer2Ch16Bit22KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:2 量子化ビット数:8bit サンプリング周波数:44KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer2Ch8Bit44KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer2Ch8Bit44KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer2Ch8Bit44KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:2 量子化ビット数:8bit サンプリング周波数:22KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer2Ch8Bit22KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer2Ch8Bit22KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer2Ch8Bit22KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:1 量子化ビット数:16bit サンプリング周波数:44KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer1Ch16Bit44KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer1Ch16Bit44KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer1Ch16Bit44KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:1 量子化ビット数:16bit サンプリング周波数:22KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer1Ch16Bit22KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer1Ch16Bit22KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer1Ch16Bit22KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:1 量子化ビット数:8bit サンプリング周波数:44KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer1Ch8Bit44KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer1Ch8Bit44KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer1Ch8Bit44KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーを作成する( チャンネル数:1 量子化ビット数:8bit サンプリング周波数:22KHz ) </summary>
		public static SoftSoundPlayer MakeSoftSoundPlayer1Ch8Bit22KHz()
		{
			lock( locker )
			{
				int result = dx_MakeSoftSoundPlayer1Ch8Bit22KHz() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return SoftSoundPlayer.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_MakeSoftSoundPlayer1Ch8Bit22KHz() ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーに波形データを追加する( フォーマットが同じではない場合はエラー ) </summary>
		public static void AddDataSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle , SoftSound SoftSoundHandle , int AddSamplePosition , int AddSampleNum )
		{
			lock( locker )
			{
				int result = dx_AddDataSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) , SoftSound.ToHandle( SoftSoundHandle ) , AddSamplePosition , AddSampleNum ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

		#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddDataSoftSoundPlayer( int SSoundPlayerHandle , int SoftSoundHandle , int AddSamplePosition , int AddSampleNum ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーにプレイヤーが対応したフォーマットの生波形データを追加する </summary>
		public static void AddDirectDataSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle , IntPtr SoundData , int AddSampleNum )
		{
			lock( locker )
			{
				int result = dx_AddDirectDataSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) , SoundData , AddSampleNum ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddDirectDataSoftSoundPlayer( int SSoundPlayerHandle , IntPtr SoundData , int AddSampleNum ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーに波形データを一つ追加する </summary>
		public static void AddOneDataSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle , int Channel1 , int Channel2 )
		{
			lock( locker )
			{
				int result = dx_AddOneDataSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) , Channel1 , Channel2 ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddOneDataSoftSoundPlayer( int SSoundPlayerHandle , int Channel1 , int Channel2 ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーが扱うデータフォーマットを取得する </summary>
		public static void GetSoftSoundPlayerFormat( SoftSoundPlayer SSoundPlayerHandle , out int Channels , out int BitsPerSample , out int SamplesPerSec )
		{
			lock( locker )
			{
				int result = dx_GetSoftSoundPlayerFormat( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) , out Channels , out BitsPerSample , out SamplesPerSec ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetSoftSoundPlayerFormat( int SSoundPlayerHandle , out int Channels , out int BitsPerSample , out int SamplesPerSec ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーの再生処理を開始する </summary>
		public static void StartSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle )
		{
			lock( locker )
			{
				int result = dx_StartSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StartSoftSoundPlayer( int SSoundPlayerHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーの再生処理が開始されているか取得する( TRUE:開始している  FALSE:停止している ) </summary>
		public static bool CheckStartSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle )
		{
			lock( locker )
			{
				int result = dx_CheckStartSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) ) ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckStartSoftSoundPlayer( int SSoundPlayerHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーの再生処理を停止する </summary>
		public static void StopSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle )
		{
			lock( locker )
			{
				int result = dx_StopSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopSoftSoundPlayer( int SSoundPlayerHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーに追加した波形データでまだ再生用サウンドバッファに転送されていない波形データのサンプル数を取得する </summary>
		public static int GetStockDataLengthSoftSoundPlayer( SoftSoundPlayer SSoundPlayerHandle )
		{
			lock( locker )
			{
				int result = dx_GetStockDataLengthSoftSoundPlayer( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetStockDataLengthSoftSoundPlayer( int SSoundPlayerHandle ) ;


		/// <summary> ソフトウエアで扱う波形データのプレイヤーに再生用サウンドバッファに転送していない波形データが無く、再生用サウンドバッファにも無音データ以外無いかどうかを取得する( TRUE:無音データ以外無い  FALSE:有効データがある ) </summary>
		public static bool CheckSoftSoundPlayerNoneData( SoftSoundPlayer SSoundPlayerHandle )
		{
			lock( locker )
			{
				int result = dx_CheckSoftSoundPlayerNoneData( SoftSoundPlayer.ToHandle( SSoundPlayerHandle ) ) ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckSoftSoundPlayerNoneData( int SSoundPlayerHandle ) ;


		/// <summary> 新しいＭＩＤＩハンドルを取得する </summary>
		public static Music AddMusicData()
		{
			lock( locker )
			{
				int result = dx_AddMusicData() ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Music.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_AddMusicData() ;


		/// <summary> ＭＩＤＩファイルを読み込む </summary>
		public static Music LoadMusicMem( string FileName )
		{
			lock( locker )
			{
				int result = dx_LoadMusicMem( FileName ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Music.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadMusicMem( string FileName ) ;


		/// <summary> メモリ上に展開されたＭＩＤＩファイルを読み込む </summary>
		public static Music LoadMusicMemByMemImage( IntPtr FileImageBuffer , int FileImageSize )
		{
			lock( locker )
			{
				int result = dx_LoadMusicMemByMemImage( FileImageBuffer , FileImageSize ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Music.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadMusicMemByMemImage( IntPtr FileImageBuffer , int FileImageSize ) ;


		/// <summary> リソース上のＭＩＤＩファイルを読み込む </summary>
		public static Music LoadMusicMemByResource( string ResourceName , string ResourceType )
		{
			lock( locker )
			{
				int result = dx_LoadMusicMemByResource( ResourceName , ResourceType ) ;
				if( !( result != -1 ) ) { throw new DX.Exception(); }
				return Music.FromHandle( result ) ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_LoadMusicMemByResource( string ResourceName , string ResourceType ) ;


		/// <summary> 読み込んだＭＩＤＩデータの演奏を開始する </summary>
		public static void PlayMusicMem( Music MusicHandle , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlayMusicMem( Music.ToHandle( MusicHandle ) , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayMusicMem( int MusicHandle , DX_PLAYTYPE PlayType ) ;


		/// <summary> ＭＩＤＩデータの演奏を停止する </summary>
		public static void StopMusicMem( Music MusicHandle )
		{
			lock( locker )
			{
				int result = dx_StopMusicMem( Music.ToHandle( MusicHandle ) ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopMusicMem( int MusicHandle ) ;


		/// <summary> ＭＩＤＩデータが演奏中かどうかを取得する( TRUE:演奏中  FALSE:停止中 ) </summary>
		public static bool CheckMusicMem( Music MusicHandle )
		{
			lock( locker )
			{
				int result = dx_CheckMusicMem( Music.ToHandle( MusicHandle ) ) ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckMusicMem( int MusicHandle ) ;


		/// <summary> ＭＩＤＩデータの現在の再生位置を取得する </summary>
		public static int GetMusicMemPosition( Music MusicHandle )
		{
			lock( locker )
			{
				int result = dx_GetMusicMemPosition( Music.ToHandle( MusicHandle ) ) ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetMusicMemPosition( int MusicHandle ) ;


		/// <summary> ＭＩＤＩデータの周期的処理 </summary>
		public static void ProcessMusicMem()
		{
			lock( locker )
			{
				int result = dx_ProcessMusicMem() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_ProcessMusicMem() ;


		/// <summary> ＭＩＤＩファイルを演奏する </summary>
		public static void PlayMusic( string FileName , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlayMusic( FileName , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayMusic( string FileName , DX_PLAYTYPE PlayType ) ;


		/// <summary> メモリ上に展開されているＭＩＤＩファイルを演奏する </summary>
		public static void PlayMusicByMemImage( IntPtr FileImageBuffer , int FileImageSize , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlayMusicByMemImage( FileImageBuffer , FileImageSize , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayMusicByMemImage( IntPtr FileImageBuffer , int FileImageSize , DX_PLAYTYPE PlayType ) ;


		/// <summary> リソースからＭＩＤＩファイルを読み込んで演奏する </summary>
		public static void PlayMusicByResource( string ResourceName , string ResourceType , DX_PLAYTYPE PlayType )
		{
			lock( locker )
			{
				int result = dx_PlayMusicByResource( ResourceName , ResourceType , PlayType ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_PlayMusicByResource( string ResourceName , string ResourceType , DX_PLAYTYPE PlayType ) ;


		/// <summary> ＭＩＤＩの再生音量をセットする </summary>
		public static void SetVolumeMusic( int Volume )
		{
			lock( locker )
			{
				int result = dx_SetVolumeMusic( Volume ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SetVolumeMusic( int Volume ) ;


		/// <summary> ＭＩＤＩファイルの演奏停止 </summary>
		public static void StopMusic()
		{
			lock( locker )
			{
				int result = dx_StopMusic() ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_StopMusic() ;


		/// <summary> ＭＩＤＩファイルが演奏中か否か情報を取得する </summary>
		public static bool CheckMusic()
		{
			lock( locker )
			{
				int result = dx_CheckMusic() ;
				if( result == 0 ) { return false ; }
				else if( result == 1 ) { return true ; }
				else { throw new DX.Exception() ; }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_CheckMusic() ;


		/// <summary> ＭＩＤＩの現在の再生位置を取得する </summary>
		public static int GetMusicPosition()
		{
			lock( locker )
			{
				int result = dx_GetMusicPosition() ;
				if( !( result >= 0 ) ) { throw new DX.Exception(); }
				return result ;
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_GetMusicPosition() ;


		/// <summary> ＭＩＤＩの再生形式をセットする </summary>
		public static void SelectMidiMode( DX_MIDIMODE Mode )
		{
			lock( locker )
			{
				int result = dx_SelectMidiMode( Mode ) ;
				if( !( result == 0 ) ) { throw new DX.Exception(); }
			}
		}

	#if UNICODE
		[ DllImport( "DxLibW.dll" , CharSet = CharSet.Unicode , ExactSpelling = true ) ]
	#else
		[ DllImport( "DxLib.dll" , CharSet = CharSet.Ansi , ExactSpelling = true ) ]
	#endif
		private static extern int dx_SelectMidiMode( DX_MIDIMODE Mode ) ;
	}
}
