how to play wav file in C#
-
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
-
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
-
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
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 -
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 -
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
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
-
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
-
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
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 variablemyWait
. Ed -
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
-
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
searching is a great skill i can see ;]... http://www.codeproject.com/cs/media/tonysound.asp
-
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
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