メモリからWAVを再生
事前にメモリ内にByte配列としてWAVデータが読み込まれているものとする。
C#コード断片/EXEに埋め込んだリソースをバイナリで取得する?等で確保したメモリに対して実行。
C#コード断片/1.1/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 */
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| | #spanend
#spanadd
[DllImport("winmm.dll",CallingConvention=CallingConvention.Winapi,EntryPoint="PlaySound")]
#spanend
#spanadd
private static extern int PlaySound(byte[] pszSound, int hmod, int flags);
#spanend
#spanadd
private static int SND_SYNC = 0x0000;
#spanend
#spanadd
private static int SND_ASYNC = 0x0001;
#spanend
#spanadd
private static int SND_NODEFAULT = 0x0002;
#spanend
#spanadd
private static int SND_MEMORY = 0x0004;
#spanend
#spanadd
private static int SND_LOOP = 0x0008;
#spanend
#spanadd
private static int SND_NOSTOP = 0x0010;
#spanend
#spanadd
private static int SND_NOWAIT = 0x2000;
#spanend
#spanadd
private static int SND_ALIAS = 0x10000;
#spanend
#spanadd
private static int SND_ALIAS_ID = 0x110000;
#spanend
#spanadd
private static int SND_FILENAME = 0x20000;
#spanend
#spanadd
private static int SND_RESOURCE = 0x40004;
#spanend
#spanadd
private static int SND_PURGE = 0x0040;
#spanend
#spanadd
private static int SND_APPLICATION = 0x0080;
#spanend
PlaySound(buf,0,SND_MEMORY|SND_LOOP|SND_ASYNC);
-これは.NET2.0ではMedia名前空間の機能でサポートされている筈。後で調べてみる。 -- [[浮子屋]] &new{2006-02-21 22:35:26 (火)};
#spanadd
PlaySound(buf,0,SND_MEMORY|SND_LOOP|SND_ASYNC);
#spanend
#spanadd
|
- これは.NET2.0ではMedia名前空間の機能でサポートされている筈。後で調べてみる。 -- 浮子屋