Hello
I create a new thread because when I try to open the other thread it causes an error ("error on page,try again") and I dont know why.
When I added the function of Mark Heath to Frogleg's code it works for me,I changes a little things on the code of each code and now I can hear sound from any speaker :)
Loading

FroglegRank #1,020 · 1.9K reputationPosted May 4, 2011, 9:37 AM EDT
So every thing is working now ?
I don't know what happened to the other thread -not that it matters
nicole castel163 reputationPosted May 4, 2011, 12:09 PM EDT
Now I'll try to ameliorate the code using data bases.
I'll post the code when I find something new and when I complete the project I'll post the final code here in csharp corner
nicole castel163 reputationPosted May 5, 2011, 6:56 AM EDT
Please can you give me the code that allows me to read a file.wav ("alarme.wav") stored in a database, I tried the following code:
private void button1_Click (object sender, EventArgs e)
{
OdbcConnection cn = new OdbcConnection ("DSN = cp1");
cn.Open ();
OdbcCommand cmd1 = new OdbcCommand ("select path from WHERE Code Alarm alarm = 32 ", cn);
cmd1.Connection = cn;
fileName = cmd1.ToString ();
WaveOut wave = new ();
wave.DeviceNumber = 0;
playSound (0);
But he gave me the following error:
"Could not find file 'C: \ Users \ wafa \ Documents \ Visual Studio 2010 \ Projects \ ALARMED \ ALARMED \ bin \ Debug \ System.Data.Odbc.OdbcCommand'."
At the line:
"waveReader = new NAudio.Wave.WaveFileReader (fileName);" in my "playSound" function:
public void PlaySound (int deviceNumber)
{
disposeWave ();// stop previous sounds Before Starting
waveReader = new NAudio.Wave.WaveFileReader (fileName);
var waveOut NAudio.Wave.WaveOut = new ();
waveOut.DeviceNumber = deviceNumber;
var output = waveOut;
output.Init (waveReader);
output.Play ();
}
Thank you in advance
Sam HobbsRank #107 · 20.5K reputationPosted May 5, 2011, 8:02 PM EDT
There are many articles in this web site to help you; read some of them. When you have a specific question, create a new thread for your database question.
I am sorry if this sounds unfriendly, but it is the answer that I and other members are likely to provide in this situation.
FroglegRank #1,020 · 1.9K reputationPosted May 6, 2011, 12:26 AM EDT
nicole castel163 reputationPosted May 6, 2011, 11:40 AM EDT
Thank you Frogleg for replying :)
Thak you Sam,I understand and I'm sorry.
nicole castel163 reputationPosted May 6, 2011, 11:40 AM EDT
Thank you Frogleg for replying :)
Thak you Sam,I understand and I'm sorry.