* 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.
リロード   新規 下位ページ作成 編集 凍結 差分 添付 コピー 名前変更   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
浮子屋商店もよろしく。

C#コード断片/1.1/メモリからWAVを再生 のバックアップ差分(No.3)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
* メモリからWAVを再生 [#we69f016]

事前にメモリ内に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);
-これは.NET2.0ではMedia名前空間の機能でサポートされている筈。後で調べてみる。 -- 浮子屋 &new{2006-02-21 22:35:26 (火)};

#comment