Duplicate start and stop microphone button

I have one button for start and stop microphone button. Every time i click on the button, it says start and stop mic at the same time wherein i want to click only the start and stop respectively.

Here is my code snippet:
public override void OnGUI()
{
base.OnGUI();

    if (GUI.Button(new Rect(10, 60, 50, 50), PlyTexture))
    {  //Debug.Log("Button pressed!");
        if( m_AcquireSpeechState == AcquireSpeechState.On )
        {
            //Debug.Log( "acquireSpeech startUtterance mic" );
            vhmsg.SendVHMsg("acquireSpeech startUtterance mic");
            m_AcquireSpeechState = AcquireSpeechState.On;
        }
     

       if( m_AcquireSpeechState == AcquireSpeechState.Off )
        {
            //Debug.Log("acquireSpeech stopUtterance mic");
            vhmsg.SendVHMsg("acquireSpeech stopUtterance mic");
            m_AcquireSpeechState = AcquireSpeechState.Off;
        }
    }

I also tried to put an else if statement but nothing happens.
Thank you in advance.

You’ll probably want to use a switch.

if (GUI.Button(new Rect(10, 60, 50, 50), PlyTexture))
{
  switch (m_AcquireSpeechState) {
    case AcquireSpeechState.On:
    vhmsg.SendVHMsg("acquireSpeech startUtterance mic");
    m_AcquireSpeechState = AcquireSpeechState.On;
    break;

    case AcquireSpeechState.Off:
    vhmsg.SendVHMsg("acquireSpeech stopUtterance mic");
    m_AcquireSpeechState = AcquireSpeechState.Off;
    break;
  }
}

The reason your approach doesn’t work is because both blocks get executed if the mic was in the on state when when the button is pressed.