![]() |
* 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. |
C#コード断片/1.1/メモリからWAVを再生 のバックアップ(No.3)
事前にメモリ内にByte配列としてWAVデータが読み込まれているものとする。 C#コード断片/EXEに埋め込んだリソースをバイナリで取得する?等で確保したメモリに対して実行。 [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);
|