Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am doing an Audio editor, my recording is working but im not being able to start the timer and stop it when the recording is on. I got this so far

C#
private void Record()
       {
           mciSendString("Open new type waveaudio alias Sound", null, 0, 0);
           mciSendString("Record Sound", null, 0, 0)
           this.Rectimer.Enabled = true;
           Status_Label.Text = "Recording.....";
       }



C#
private void StopRecording()
     {
         mciSendString("pause Sound", null, 0, 0);
         this.Rectimer.Enabled = false;
         Status_Label.Text = "Stop Recording.....";
     }


im using one components which is the RecTimer

C#
private void Rectimer_Tick(object sender, EventArgs e)
        {
            int TimeRec = (MicRec.IsRecording);
            this.lbl_timeControl.Text = string.Format("{0}", DisplayTime(Sp.PositionInMS));
        }
        private string DisplayTime(int ch)
        {
            DateTime ry = new DateTime((long) 1000);
            return ry.ToString("T");
        }



What is my error there that is no enabling me to start the timer when the recording starts?
Thanks in advance guys
Posted

1 solution

Have you set the timer interval?
Can't see that in your code.

RecTimer.Interval is the property you want to set.
Its unit is in milli seconds so for one second you'd
do the following (e.g. in InitializeComponent())

Rectimer.Interval = 1000; //1000 milli seconds == one second

Hope this is a little bit clearer. ;)
Cheers

Manfred
 
Share this answer
 
v2
Comments
Chirry 16-Nov-10 10:35am    
My timer interval is the Rectimer. isnt this setting it??

private void Rectimer_Tick(object sender, EventArgs e)
{
int TimeRec = (MicRec.IsRecording);
this.lbl_timeControl.Text = string.Format("{0}", DisplayTime(Sp.PositionInMS));
}
private string DisplayTime(int ch)
{
DateTime ry = new DateTime((long) 1000);
return ry.ToString("T");
}


Chirry 16-Nov-10 10:36am    
Thanks for ur help. Be aware that i am a C# beginer , thankss!!
Chirry 16-Nov-10 10:55am    
Thanks for your help and understanding, i will try now what you said hope it will work with me
Manfred Rudolf Bihy 16-Nov-10 10:57am    
What was the "one" vote for? (If it was you who did this)
Chirry 16-Nov-10 11:00am    
i didnt vote, i just accept ur answer.. well i think thats what i did

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900