Exemplo n.º 1
0
        public void UpdateStatus(IDevice device)
        {
            MicStatus newStatus = (device != null) ? (device.IsMuted ? MicStatus.Off : MicStatus.On) : MicStatus.Error;
            bool      playSound = currentStatus != MicStatus.Initial && currentStatus != newStatus;

            currentStatus = newStatus;
            switch (currentStatus)
            {
            case MicStatus.On:
                UpdateIcon(iconOn, device.FullName);
                if (playSound)
                {
                    PlaySound("on.wav");
                }
                break;

            case MicStatus.Off:
                UpdateIcon(iconOff, device.FullName);
                if (playSound)
                {
                    PlaySound("off.wav");
                }
                break;

            case MicStatus.Error:
                UpdateIcon(iconError, "< No device >");
                if (playSound)
                {
                    PlaySound("error.wav");
                }
                break;
            }
        }
Exemplo n.º 2
0
 public void StopRecord()
 {
     m_GetSample = null;
     if (m_SoundWave != null)
     {
         m_SoundWave.Invoke(0);
     }
     m_SoundWave    = null;
     m_Status       = MicStatus.None;
     m_StopPosition = Microphone.GetPosition(null);
 }
Exemplo n.º 3
0
        public void UpdateStatus(IDevice device)
        {
            MicStatus newStatus = (device != null) ? (device.IsMuted ? MicStatus.Off : MicStatus.On) : MicStatus.Error;
            //if(micStatusForm == null)
            //{
            //    micStatusForm = new MicStatusForm();
            //    micStatusForm.Show(this);
            //}
            bool playSound = currentStatus != MicStatus.Initial && currentStatus != newStatus;

            currentStatus = newStatus;
            switch (currentStatus)
            {
            case MicStatus.On:
                UpdateIcon(iconOn, device.FullName);
                if (micStatusForm != null)
                {
                    //micStatusForm.Invoke()
                    micStatusForm.SetMicState(Resources.micunmuted);
                }
                if (playSound)
                {
                    PlaySound("on.wav");
                }
                break;

            case MicStatus.Off:
                UpdateIcon(iconOff, device.FullName);
                if (micStatusForm != null)
                {
                    micStatusForm.SetMicState(Resources.micmuted);
                }
                if (playSound)
                {
                    PlaySound("off.wav");
                }
                break;

            case MicStatus.Error:
                UpdateIcon(iconError, "< No device >");
                if (playSound)
                {
                    PlaySound("error.wav");
                }
                break;
            }
        }
Exemplo n.º 4
0
    public void StartRecord(Action flyStar = null, Action <float> soundWave = null, Action silentCallback = null)
    {
        //m_GetSample = getSample;
        m_GetSample             = flyStar;
        m_SoundWave             = soundWave;
        m_AlreadySilentCallback = silentCallback;

        //m_RecordClip = Microphone.Start(null, true, 6, 44100);
        //m_AudioSource.clip = m_RecordClip;
        //m_AudioSource.volume = 0.001f;
        //m_AudioSource.Play();
        m_Status              = MicStatus.Recording;
        m_AlreadySilent       = false;
        m_GetWave             = false;
        m_SilentTime          = 0;
        m_RecordTime          = 0;
        m_GetVoiceTime        = 0;
        m_RecordData          = null;
        tempFloatBuffer       = new float[3];
        tempFloatBufferListen = new float[3];
        //m_StartGetPosition = true;
    }
Exemplo n.º 5
0
 public void ResetCord()
 {
     m_Status  = MicStatus.None;
     m_GetWave = false;
 }