* U K I Y A H O N P O *
Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura,
che la diritta via era smarrita.
Front page
List of pages
Search
Recent changes
リンク
Help
Source
New
リンク
手動リンク
自動相互リンク
駄でべWiki:FrontPage
Referer
Search Key List
Link List
Help
整形ルール
プラグインマニュアル
浮子屋商店もよろしく。
Edit of
C#コード断片/1.1/メモリからWAVを再生
Top
>
C#コード断片
>
1.1
> メモリからWAVを再生
事前にメモリ内にByte配列としてWAVデータが読み込まれているものとする。 [[C#コード断片/1.1/EXEに埋め込んだリソースをバイナリで取得する]]等で確保したメモリに対して実行。 #code(Csharp,nooutline){{ [DllImport("winmm.dll",CallingConvention=CallingConvention.Winapi,EntryPoint="PlaySound")] private static extern int PlaySound(byte[] pszSound, int hmod, int flags); private static int SND_SYNC = 0x0000;/* play synchronously (default) */ private static int SND_ASYNC = 0x0001;/* play asynchronously */ private static int SND_NODEFAULT = 0x0002;/* silence (!default) if sound not found */ private static int SND_MEMORY = 0x0004;/* pszSound points to a memory file */ private static int SND_LOOP = 0x0008;/* loop the sound until next sndPlaySound */ private static int SND_NOSTOP = 0x0010;/* don't stop any currently playing sound */ private static int SND_NOWAIT = 0x2000;/* don't wait if the driver is busy */ private static int SND_ALIAS = 0x10000;/* name is a registry alias */ private static int SND_ALIAS_ID = 0x110000;/* alias is a pre d ID */ private static int SND_FILENAME = 0x20000;/* name is file name */ private static int SND_RESOURCE = 0x40004;/* name is resource name or atom */ private static int SND_PURGE = 0x0040;/* purge non-static events for task */ private static int SND_APPLICATION = 0x0080;/* look for application specific association */ PlaySound(buf,0,SND_MEMORY|SND_LOOP|SND_ASYNC); }} -これは.NET2.0ではMedia名前空間の機能でサポートされている筈。後で調べてみる。 -- 浮子屋 &new{2006-02-21 22:35:26 (火)};
Do not change timestamp
事前にメモリ内にByte配列としてWAVデータが読み込まれているものとする。 [[C#コード断片/1.1/EXEに埋め込んだリソースをバイナリで取得する]]等で確保したメモリに対して実行。 #code(Csharp,nooutline){{ [DllImport("winmm.dll",CallingConvention=CallingConvention.Winapi,EntryPoint="PlaySound")] private static extern int PlaySound(byte[] pszSound, int hmod, int flags); private static int SND_SYNC = 0x0000;/* play synchronously (default) */ private static int SND_ASYNC = 0x0001;/* play asynchronously */ private static int SND_NODEFAULT = 0x0002;/* silence (!default) if sound not found */ private static int SND_MEMORY = 0x0004;/* pszSound points to a memory file */ private static int SND_LOOP = 0x0008;/* loop the sound until next sndPlaySound */ private static int SND_NOSTOP = 0x0010;/* don't stop any currently playing sound */ private static int SND_NOWAIT = 0x2000;/* don't wait if the driver is busy */ private static int SND_ALIAS = 0x10000;/* name is a registry alias */ private static int SND_ALIAS_ID = 0x110000;/* alias is a pre d ID */ private static int SND_FILENAME = 0x20000;/* name is file name */ private static int SND_RESOURCE = 0x40004;/* name is resource name or atom */ private static int SND_PURGE = 0x0040;/* purge non-static events for task */ private static int SND_APPLICATION = 0x0080;/* look for application specific association */ PlaySound(buf,0,SND_MEMORY|SND_LOOP|SND_ASYNC); }} -これは.NET2.0ではMedia名前空間の機能でサポートされている筈。後で調べてみる。 -- 浮子屋 &new{2006-02-21 22:35:26 (火)};