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
  1. Home
  2. General Programming
  3. C#
  4. how to play wav file in C#

how to play wav file in C#

Scheduled Pinned Locked Moved C#
helpcsharpcomtutorialquestion
10 Posts 6 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.
  • N Offline
    N Offline
    nauty
    wrote on last edited by
    #1

    hi friends i am having a problem.I am not able to play wav/mp3 file in C#. I downloaded an activeX component "RSP MP3 Player OCX 2.7.5" but it was in vb.I tried convert it into dll.but then also it had a problem. one of its method was PlayFile(string path,ref bool wait). Could anyone just tell me what is ref bool or from where i can get a wav file activeX control which can be used in C#. please help me its really urgent. thanx in advance. nauty

    E V S N 4 Replies Last reply
    0
    • N nauty

      hi friends i am having a problem.I am not able to play wav/mp3 file in C#. I downloaded an activeX component "RSP MP3 Player OCX 2.7.5" but it was in vb.I tried convert it into dll.but then also it had a problem. one of its method was PlayFile(string path,ref bool wait). Could anyone just tell me what is ref bool or from where i can get a wav file activeX control which can be used in C#. please help me its really urgent. thanx in advance. nauty

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      nauty wrote:

      ref bool

      is essentially a reference or pointer to a boolean data type.

      nauty wrote:

      from where i can get a wav file activeX control which can be used in C#.

      .NET 2.0 has one in the framework. Ed

      G N 2 Replies Last reply
      0
      • E Ed Poore

        nauty wrote:

        ref bool

        is essentially a reference or pointer to a boolean data type.

        nauty wrote:

        from where i can get a wav file activeX control which can be used in C#.

        .NET 2.0 has one in the framework. Ed

        G Offline
        G Offline
        Graham Nimbley
        wrote on last edited by
        #3

        If you are .NET 2.0 System.Media.SoundPlayer is the class you need. It will only play wav files. It's very basic in functionality, but if you only need to play wav files, then it should do. E.g. using System.Media; ... SoundPlayer sound=new SoundPlayer(@"C:\Path To\WaveSound.wav"); sound.Play(); If you are creating lots of instances of SoundPlayer don't forget to call Dispose() or use "using" Graham -- modified at 16:51 Wednesday 5th April, 2006

        E 1 Reply Last reply
        0
        • G Graham Nimbley

          If you are .NET 2.0 System.Media.SoundPlayer is the class you need. It will only play wav files. It's very basic in functionality, but if you only need to play wav files, then it should do. E.g. using System.Media; ... SoundPlayer sound=new SoundPlayer(@"C:\Path To\WaveSound.wav"); sound.Play(); If you are creating lots of instances of SoundPlayer don't forget to call Dispose() or use "using" Graham -- modified at 16:51 Wednesday 5th April, 2006

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          I think you meant to reply to nauty not me :doh: Ed

          1 Reply Last reply
          0
          • E Ed Poore

            nauty wrote:

            ref bool

            is essentially a reference or pointer to a boolean data type.

            nauty wrote:

            from where i can get a wav file activeX control which can be used in C#.

            .NET 2.0 has one in the framework. Ed

            N Offline
            N Offline
            nauty
            wrote on last edited by
            #5

            Hi ed and grahan thanx for the help but i am using 1.1 and there is no such namespace.i used mci32.ocx in my project but it was also not playing the files.So if you people have some winamp plugin or some winamp ocx files then do tell me. and also what value is to be passed in the "ref bool wait" variable.i am really confused. its reaally urgent nauty

            B E 2 Replies Last reply
            0
            • N nauty

              Hi ed and grahan thanx for the help but i am using 1.1 and there is no such namespace.i used mci32.ocx in my project but it was also not playing the files.So if you people have some winamp plugin or some winamp ocx files then do tell me. and also what value is to be passed in the "ref bool wait" variable.i am really confused. its reaally urgent nauty

              B Offline
              B Offline
              Bob_Sun
              wrote on last edited by
              #6

              I met the same problem and I wrote a sound lib myself in C++. Form C++, you can easily access mixer funcs provided in winmm.lib. Of causeif DirectX is a shortcut if it can be installed in you system.

              1 Reply Last reply
              0
              • N nauty

                Hi ed and grahan thanx for the help but i am using 1.1 and there is no such namespace.i used mci32.ocx in my project but it was also not playing the files.So if you people have some winamp plugin or some winamp ocx files then do tell me. and also what value is to be passed in the "ref bool wait" variable.i am really confused. its reaally urgent nauty

                E Offline
                E Offline
                Ed Poore
                wrote on last edited by
                #7

                ref bool is a reference to a boolean value (like a pointer in C), it is used if the function needs to change one of the calling parameters, like in C. So just declare a boolean, e.g.:

                bool myWait = false;

                and then pass it as, e.g.:

                library.function(parm1, parm2, ref myWait);

                This allows library.function to change the value of your variable myWait. Ed

                1 Reply Last reply
                0
                • N nauty

                  hi friends i am having a problem.I am not able to play wav/mp3 file in C#. I downloaded an activeX component "RSP MP3 Player OCX 2.7.5" but it was in vb.I tried convert it into dll.but then also it had a problem. one of its method was PlayFile(string path,ref bool wait). Could anyone just tell me what is ref bool or from where i can get a wav file activeX control which can be used in C#. please help me its really urgent. thanx in advance. nauty

                  V Offline
                  V Offline
                  V 0
                  wrote on last edited by
                  #8

                  Did you search here on CP? I found someting here lately. Coulda, woulda, shoulda doesn't matter if you don't.

                  1 Reply Last reply
                  0
                  • N nauty

                    hi friends i am having a problem.I am not able to play wav/mp3 file in C#. I downloaded an activeX component "RSP MP3 Player OCX 2.7.5" but it was in vb.I tried convert it into dll.but then also it had a problem. one of its method was PlayFile(string path,ref bool wait). Could anyone just tell me what is ref bool or from where i can get a wav file activeX control which can be used in C#. please help me its really urgent. thanx in advance. nauty

                    S Offline
                    S Offline
                    scoroop
                    wrote on last edited by
                    #9

                    searching is a great skill i can see ;]... http://www.codeproject.com/cs/media/tonysound.asp

                    1 Reply Last reply
                    0
                    • N nauty

                      hi friends i am having a problem.I am not able to play wav/mp3 file in C#. I downloaded an activeX component "RSP MP3 Player OCX 2.7.5" but it was in vb.I tried convert it into dll.but then also it had a problem. one of its method was PlayFile(string path,ref bool wait). Could anyone just tell me what is ref bool or from where i can get a wav file activeX control which can be used in C#. please help me its really urgent. thanx in advance. nauty

                      N Offline
                      N Offline
                      nauty
                      wrote on last edited by
                      #10

                      Hi buddies Thanx for your wonderfull support.without your help i could'nt have done that. I used "RSP MP3Player OCX 2.7.5" . just using it, the task became a kids play. if someone else need it can download it from net. Simply add its components and use its method. its the most easiest of all. Thanx to all ones again and especially to Ed.Poore. bye nauty

                      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