Hi,
I want to add foll logic in my project:
On a certain the condition i want to play the buzzer continuously until stopped by the user.
Please give me some clue
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Oct 16, 2013, 2:55 PM
using System.Media;
namespace SimpleSound
{
public partial class Form1 : Form
{
SoundPlayer mySound = new SoundPlayer("sound.wav");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
mySound.PlayLooping();
}
private void button2_Click(object sender, EventArgs e)
{
mySound.Stop();
}
}
}
VulpesPosted Oct 26, 2013, 10:08 AM
20 x 60 * 1000 = 1200000 milliseconds.
and its Enabled property to false.
Now start the timer when you start playback:
Finally, handle the timer's Tick event as follows:
private void timer1_Tick(object sender, EventArgs e)
{
mySound.Stop();
timer1.Stop();
}
Pravin GhadgePosted Oct 26, 2013, 3:49 AM
But how can i play that file for particular interval.
For eg: i want to playlooping for 20 minutes and after that completion of interval sound should stop.
Plz give me some suggestion
VulpesPosted Oct 16, 2013, 3:27 PM