WavPlayer.cs :  » Business-Application » Tea-Timer-for-Windows » WavPlay » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Business Application » Tea Timer for Windows 
Tea Timer for Windows » WavPlay » WavPlayer.cs
using System;
using System.Runtime.InteropServices;

namespace WavPlay{
  /// <summary>
  /// DEPRECATED.
  /// </summary>
  public class WavPlayer
  {
    [DllImport("WinMM.dll")]
    protected static extern bool  PlaySound(byte[]wfname, int fuSound);

    public static void Play(string sFile) 
    {
      Play(sFile,(int)SoundFlags.SND_ASYNC);
    }
    public static void Play(string sFile,int iSoundFlags)
    {
      byte[] bName = new Byte[256];    //Max path length
      bName = System.Text.Encoding.ASCII.GetBytes(sFile);
      PlaySound(bName,iSoundFlags);
    }
    public static void StopPlay()
    {
      PlaySound(null,(int)SoundFlags.SND_PURGE);
    }

    public enum SoundFlags : int 
    {
      SND_SYNC = 0x0000,  // play synchronously (default) 
      SND_ASYNC = 0x0001,  // play asynchronously 
      SND_NODEFAULT = 0x0002,  // silence (!default) if sound not found 
      SND_MEMORY = 0x0004,  // pszSound points to a memory file
      SND_LOOP = 0x0008,  // loop the sound until next sndPlaySound 
      SND_NOSTOP = 0x0010,  // don't stop any currently playing sound 
      SND_NOWAIT = 0x00002000, // don't wait if the driver is busy 
      SND_ALIAS = 0x00010000, // name is a registry alias 
      SND_ALIAS_ID = 0x00110000, // alias is a predefined ID
      SND_FILENAME = 0x00020000, // name is file name 
      SND_RESOURCE = 0x00040004,  // name is resource name or atom
      SND_PURGE = 0x0040
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.