Jason Jason - 4 months ago 31
C# Question

How can I programmatically switch between sound and a muted mode?

I made beeps using

extern public static void Beep(int freq, int dur);

// and

Beep(2222, 55);
Beep(3333, 55);

I have planted this code ( Beep( freq, dura) ) almost a hundread times here and there(with various frequency, duration and times).

Now, I want to switch between Sound and Mute programtically.

I could do it with something like

if ( my_Flag )
Beep( 2222, 55);
Beep( 3333, 55);

It should be tedious work to do.
Is there any better ideas ?



If everything is defined as Beep(x,y) method, You can write Your own method and then Refactor->Rename all methods to MyBeep(x,y) for example.

public void MyBeep(int freq, int dur)
        Beep(freq, dur);

How to refactor->rename on YT.