DQ-SoundPlay

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using Microsoft.DirectX;
 6 using Microsoft.DirectX.DirectSound;
 7 using Microsoft.DirectX.AudioVideoPlayback;
 8 
 9 namespace DQ
10 {
11     class SoundPlay
12     {
13  
14         public void SoundPlay_mp3(string spath)
15         {
16             Audio audio = new Audio(spath);
17             audio.Play();
18         }
19         public void SoundPlay_wav(string spath)
20         {
21             Device GetDevice = new Device();
22             GetDevice.SetCooperativeLevel((new Form_main()), CooperativeLevel.Priority);
23             SecondaryBuffer snd = new SecondaryBuffer(spath, GetDevice);
24             snd.Play(0, BufferPlayFlags.Looping);
25         }
26     }
27 }

 

posted @ 2018-04-04 14:33  DDWK  阅读(140)  评论(0编辑  收藏  举报