⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mute.c

📁 蓝牙耳机软件源代码
💻 C
字号:
#include "demohs.h"

#include <audio.h>


static const audio_note mute_beep[] =
{
    AUDIO_TEMPO(80), AUDIO_VOLUME(32), AUDIO_TIMBRE(sine),
    AUDIO_NOTE(G5, QUAVER),
    AUDIO_END
};


static Delay delayMuteBeepPlay(TimerHandle h)
{
    h = h;
    hsState.AudioRingHandle = AudioPlay(mute_beep);
    return MUTE_BEEP_DELAY;
}


/*
    muteRequest

    Toggles the current mute state i.e. if mute was on turns it off and vice versa
*/
void muteRequest(void)
{
    uint16 want = hsState.isMuted ^ 1;
    if(AudioMuteMicrophone(want))
        hsState.isMuted = want;
        
    if (!hsState.isMuted)
    {
        /* Stop playing beeps */
        (void) AudioStop(hsState.AudioRingHandle);
        (void) TimerCancelCallback(delayMuteBeepPlay);
    }
    else if (hsState.scoConnected)
    {
        /* 
            If we have a SCO connected and the mic is muted play beeps 
            until it is unmuted. Reuse the ring handle for now.
        */
        (void) TimerAdd(D_mSEC(MUTE_BEEP_DELAY), delayMuteBeepPlay);        
    }    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -