Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. audio

audio

Scheduled Pinned Locked Moved C#
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    treah
    wrote on last edited by
    #1

    hi i need to attach a audio file in my application:confused:.plz help me how can i do this

    B 1 Reply Last reply
    0
    • T treah

      hi i need to attach a audio file in my application:confused:.plz help me how can i do this

      B Offline
      B Offline
      blackjack2150
      wrote on last edited by
      #2

      If it's a wav file you can use the classes of System.Media.

      T 1 Reply Last reply
      0
      • B blackjack2150

        If it's a wav file you can use the classes of System.Media.

        T Offline
        T Offline
        treah
        wrote on last edited by
        #3

        plz tell me is this necessary that there must be an audio player in my application.or without an audio player i can play a wave file(only by giving the path of that wavefile):~ ? thanks

        L 1 Reply Last reply
        0
        • T treah

          plz tell me is this necessary that there must be an audio player in my application.or without an audio player i can play a wave file(only by giving the path of that wavefile):~ ? thanks

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, you can play a sound file using P/Invoke:

          public static void PlaySoundFile(string fileSpec) {
          	int res=PlaySound(fileSpec, 0, 0);
          	if (res==0) log("Failed to play sound "+fileSpec);
          }
          
          \[DllImport("Winmm.dll", CharSet=CharSet.Ansi,
          	 CallingConvention=CallingConvention.Cdecl)\]
          static extern int PlaySound(string filespec, int hModule, int dwFlags); 
          

          :) -- modified at 7:20 Thursday 14th June, 2007

          Luc Pattyn [My Articles] [Forum Guidelines]

          B 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, you can play a sound file using P/Invoke:

            public static void PlaySoundFile(string fileSpec) {
            	int res=PlaySound(fileSpec, 0, 0);
            	if (res==0) log("Failed to play sound "+fileSpec);
            }
            
            \[DllImport("Winmm.dll", CharSet=CharSet.Ansi,
            	 CallingConvention=CallingConvention.Cdecl)\]
            static extern int PlaySound(string filespec, int hModule, int dwFlags); 
            

            :) -- modified at 7:20 Thursday 14th June, 2007

            Luc Pattyn [My Articles] [Forum Guidelines]

            B Offline
            B Offline
            blackjack2150
            wrote on last edited by
            #5

            This "sounds" cool. :) I can't wait to get home and try it. If it works, you got my five. :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups