本文整理汇总了C++中broadcast_event函数的典型用法代码示例。如果您正苦于以下问题:C++ broadcast_event函数的具体用法?C++ broadcast_event怎么用?C++ broadcast_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了broadcast_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msm_reset_all_device
int msm_reset_all_device(void)
{
int rc = 0;
int dev_id = 0;
struct msm_snddev_info *dev_info = NULL;
for (dev_id = 0; dev_id < audio_dev_ctrl.num_dev; dev_id++) {
dev_info = audio_dev_ctrl_find_dev(dev_id);
if (IS_ERR(dev_info)) {
MM_ERR("pass invalid dev_id %d\n", dev_id);
rc = PTR_ERR(dev_info);
return rc;
}
if (!dev_info->opened)
continue;
MM_DBG("Resetting device %d active on COPP %d"
"with 0x%08x as routing\n",
dev_id, dev_info->copp_id, dev_info->sessions);
broadcast_event(AUDDEV_EVT_REL_PENDING,
dev_id,
SESSION_IGNORE);
rc = dev_info->dev_ops.close(dev_info);
if (rc < 0) {
MM_ERR("Snd device %d failed close!\n", dev_id);
return rc;
} else {
dev_info->opened = 0;
broadcast_event(AUDDEV_EVT_DEV_RLS,
dev_id,
SESSION_IGNORE);
}
dev_info->sessions = 0;
}
return 0;
}
示例2: msm_v_loopback_put
static int msm_v_loopback_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int start = ucontrol->value.integer.value[0];
printk(KERN_ERR "[MyTag]msm_v_loopback_put(%d)\n", start);
if (start)
broadcast_event(AUDDEV_EVT_AUDIO_LP_START, DEVICE_IGNORE,
SESSION_IGNORE);
else
broadcast_event(AUDDEV_EVT_AUDIO_LP_END, DEVICE_IGNORE,
SESSION_IGNORE);
return 0;
}
示例3: msm_set_voice_mute
int msm_set_voice_mute(int dir, int mute)
{
MM_AUD_INFO("dir %x mute %x\n", dir, mute);
if (dir == DIR_TX) {
routing_info.tx_mute = mute;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id, SESSION_IGNORE);
} else{
routing_info.rx_mute = mute;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_rx_dev_id, SESSION_IGNORE);
}
return 0;
}
示例4: msm_v_call_put
static int msm_v_call_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int start = ucontrol->value.integer.value[0];
if (start) {
pr_aud_info("[ALSA] msm_start_voice");
broadcast_event(AUDDEV_EVT_START_VOICE, DEVICE_IGNORE,
SESSION_IGNORE);
} else {
pr_aud_info("[ALSA] msm_end_voice");
broadcast_event(AUDDEV_EVT_END_VOICE, DEVICE_IGNORE,
SESSION_IGNORE);
}
return 0;
}
示例5: msm_volume_put
static int msm_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
int session_id = ucontrol->value.integer.value[0];
int volume = ucontrol->value.integer.value[1];
int factor = ucontrol->value.integer.value[2];
u32 session_mask = 0;
if (factor > 10000)
return -EINVAL;
if ((volume < 0) || (volume/factor > 100))
return -EINVAL;
volume = (MSM_VOLUME_STEP * volume);
volume = volume/factor;
if (volume > MSM_MAX_VOLUME)
volume = MSM_MAX_VOLUME;
session_mask = (0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
msm_vol_ctl.volume = volume;
MM_DBG("session_id %d, volume %d", session_id, volume);
broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
session_mask);
return ret;
}
示例6: msm_volume_put
static int msm_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
int session_id = ucontrol->value.integer.value[0];
int volume = ucontrol->value.integer.value[1];
u32 session_mask = 0;
pr_aud_info("[ALSA] msm_set_volume: volume %d\n", volume);
if ((volume < 0) || (volume > 100))
return -EINVAL;
volume = (MSM_VOLUME_STEP * volume);
if (volume > MSM_MAX_VOLUME)
volume = MSM_MAX_VOLUME;
/* Only Decoder volume control supported */
session_mask = (0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
msm_vol_ctl.volume = volume;
MM_DBG("session_id %d, volume %d", session_id, volume);
broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
session_mask);
return ret;
}
示例7: msm_set_voice_vol
int msm_set_voice_vol(int dir, s32 volume)
{
if (dir == DIR_TX) {
routing_info.voice_tx_vol = volume;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id,
SESSION_IGNORE);
} else if (dir == DIR_RX) {
routing_info.voice_rx_vol = volume;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_rx_dev_id,
SESSION_IGNORE);
} else
return -EINVAL;
return 0;
}
示例8: msm_set_voice_mute
int msm_set_voice_mute(int dir, int mute)
{
MM_AUD_INFO("dir %x mute %x\n", dir, mute);
if (!audio_dev_ctrl.voice_rx_dev
|| !audio_dev_ctrl.voice_tx_dev)
return -EPERM;
if (dir == DIR_TX) {
routing_info.tx_mute = mute;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id, SESSION_IGNORE);
} else{
routing_info.rx_mute = mute;
pr_aud_info("%s, rx_mute=%d\n", __func__, routing_info.rx_mute);
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_rx_dev_id, SESSION_IGNORE);
}
return 0;
}
示例9: msm_set_voice_mute
int msm_set_voice_mute(int dir, int mute, u32 session_id)
{
pr_debug("dir %x mute %x\n", dir, mute);
if (dir == DIR_TX) {
routing_info.tx_mute = mute;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id, session_id);
} else
return -EPERM;
return 0;
}
示例10: msm_set_voice_vol
int msm_set_voice_vol(int dir, s32 volume)
{
#ifdef CONFIG_2WCR
if (!audio_dev_ctrl.voice_rx_dev
|| !audio_dev_ctrl.voice_tx_dev)
return -EPERM;
#endif
if (dir == DIR_TX) {
routing_info.voice_tx_vol = volume;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id,
SESSION_IGNORE);
} else if (dir == DIR_RX) {
routing_info.voice_rx_vol = volume;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_rx_dev_id,
SESSION_IGNORE);
} else
return -EINVAL;
return 0;
}
示例11: msm_reset_all_device
int msm_reset_all_device(void)
{
int rc = 0;
int dev_id = 0;
struct msm_snddev_info *dev_info = NULL;
for (dev_id = 0; dev_id < audio_dev_ctrl.num_dev; dev_id++) {
dev_info = audio_dev_ctrl_find_dev(dev_id);
if (IS_ERR(dev_info)) {
pr_err("%s:pass invalid dev_id\n", __func__);
rc = PTR_ERR(dev_info);
return rc;
}
if (!dev_info->opened)
continue;
pr_debug("%s:Resetting device %d active on COPP %d"
"with %lld as routing\n", __func__,
dev_id, dev_info->copp_id, dev_info->sessions);
broadcast_event(AUDDEV_EVT_REL_PENDING,
dev_id,
SESSION_IGNORE);
rc = dev_info->dev_ops.close(dev_info);
if (rc < 0) {
pr_err("%s:Snd device failed close!\n", __func__);
return rc;
} else {
dev_info->opened = 0;
broadcast_event(AUDDEV_EVT_DEV_RLS,
dev_id,
SESSION_IGNORE);
if (dev_info->copp_id == VOICE_PLAYBACK_TX)
voice_start_playback(0);
}
dev_info->sessions = 0;
}
msm_clear_all_session();
return 0;
}
示例12: msm_set_voice_mute
int msm_set_voice_mute(int dir, int mute)
{
MM_DBG("dir %x mute %x\n", dir, mute);
if (!audio_dev_ctrl.voice_rx_dev
|| !audio_dev_ctrl.voice_tx_dev)
return -EPERM;
if (dir == DIR_TX) {
routing_info.tx_mute = mute;
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
routing_info.voice_tx_dev_id, SESSION_IGNORE);
} else
return -EPERM;
return 0;
}
示例13: mixer_post_event
void mixer_post_event(u32 evt_id, u32 id)
{
MM_DBG("evt_id = %d\n", evt_id);
switch (evt_id) {
case AUDDEV_EVT_DEV_CHG_VOICE: /* Called from Voice_route */
broadcast_event(AUDDEV_EVT_DEV_CHG_VOICE, id, SESSION_IGNORE);
break;
case AUDDEV_EVT_DEV_RDY:
broadcast_event(AUDDEV_EVT_DEV_RDY, id, SESSION_IGNORE);
break;
case AUDDEV_EVT_DEV_RLS:
broadcast_event(AUDDEV_EVT_DEV_RLS, id, SESSION_IGNORE);
break;
case AUDDEV_EVT_REL_PENDING:
broadcast_event(AUDDEV_EVT_REL_PENDING, id, SESSION_IGNORE);
break;
case AUDDEV_EVT_DEVICE_VOL_MUTE_CHG:
broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG, id,
SESSION_IGNORE);
break;
case AUDDEV_EVT_STREAM_VOL_CHG:
broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, id,
SESSION_IGNORE);
break;
case AUDDEV_EVT_START_VOICE:
broadcast_event(AUDDEV_EVT_START_VOICE,
id, SESSION_IGNORE);
break;
case AUDDEV_EVT_END_VOICE:
broadcast_event(AUDDEV_EVT_END_VOICE,
id, SESSION_IGNORE);
break;
case AUDDEV_EVT_FREQ_CHG:
broadcast_event(AUDDEV_EVT_FREQ_CHG, id, SESSION_IGNORE);
break;
default:
break;
}
}
示例14: msm_volume_put
static int msm_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
int session_id = ucontrol->value.integer.value[0];
int volume = ucontrol->value.integer.value[1];
int factor = ucontrol->value.integer.value[2];
u64 session_mask = 0;
pr_aud_info("[ALSA] msm_set_volume: volume %d\n", volume);
if (factor > 10000)
return -EINVAL;
if ((volume < 0) || (volume/factor > 100))
return -EINVAL;
volume = (MSM_VOLUME_STEP * volume);
/* Convert back to original decimal point by removing the 10-base factor
* and discard the fractional portion
*/
volume = volume/factor;
if (volume > MSM_MAX_VOLUME)
volume = MSM_MAX_VOLUME;
/* Only Decoder volume control supported */
session_mask = (((u64)0x1) << session_id) << (MAX_BIT_PER_CLIENT * \
((int)AUDDEV_CLNT_DEC-1));
msm_vol_ctl.volume = volume;
MM_DBG("session_id %d, volume %d", session_id, volume);
broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
session_mask);
return ret;
}
示例15: msm_route_put
static int msm_route_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int rc = 0;
int enc_freq = 0;
int requested_freq = 0;
struct msm_audio_route_config route_cfg;
struct msm_snddev_info *dev_info;
int session_id = ucontrol->value.integer.value[0];
int set = ucontrol->value.integer.value[2];
u32 session_mask = 0;
route_cfg.dev_id = ucontrol->value.integer.value[1];
pr_aud_info("[ALSA] msm_route_stream: session %d, dev %d, enable %d\n",
session_id, route_cfg.dev_id, set);
if (ucontrol->id.numid == 2)
route_cfg.stream_type = AUDIO_ROUTE_STREAM_PLAYBACK;
else
route_cfg.stream_type = AUDIO_ROUTE_STREAM_REC;
MM_DBG("route cfg %d %d type for popp %d\n",
route_cfg.dev_id, route_cfg.stream_type, session_id);
dev_info = audio_dev_ctrl_find_dev(route_cfg.dev_id);
if (IS_ERR(dev_info)) {
MM_AUD_ERR("pass invalid dev_id\n");
rc = PTR_ERR(dev_info);
return rc;
}
if (route_cfg.stream_type == AUDIO_ROUTE_STREAM_PLAYBACK) {
rc = msm_snddev_set_dec(session_id, dev_info->copp_id, set);
session_mask =
(0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
if (!set) {
if (dev_info->opened)
broadcast_event(AUDDEV_EVT_DEV_RLS,
route_cfg.dev_id,
session_mask);
dev_info->sessions &= ~(session_mask);
} else {
dev_info->sessions = dev_info->sessions | session_mask;
if (dev_info->opened)
broadcast_event(AUDDEV_EVT_DEV_RDY,
route_cfg.dev_id,
session_mask);
}
} else {
rc = msm_snddev_set_enc(session_id, dev_info->copp_id, set);
session_mask =
(0x1 << (session_id)) << (8 * ((int)AUDDEV_CLNT_ENC-1));
if (!set) {
if (dev_info->opened)
broadcast_event(AUDDEV_EVT_DEV_RLS,
route_cfg.dev_id,
session_mask);
dev_info->sessions &= ~(session_mask);
} else {
dev_info->sessions = dev_info->sessions | session_mask;
enc_freq = msm_snddev_get_enc_freq(session_id);
requested_freq = enc_freq;
if (enc_freq > 0) {
rc = msm_snddev_request_freq(&enc_freq,
session_id,
SNDDEV_CAP_TX,
AUDDEV_CLNT_ENC);
MM_DBG("sample rate configured %d"
"sample rate requested %d \n",
enc_freq, requested_freq);
if ((rc <= 0) || (enc_freq != requested_freq)) {
MM_DBG("msm_snddev_withdraw_freq\n");
rc = msm_snddev_withdraw_freq
(session_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
broadcast_event(AUDDEV_EVT_FREQ_CHG,
route_cfg.dev_id,
SESSION_IGNORE);
}
}
if (dev_info->opened)
broadcast_event(AUDDEV_EVT_DEV_RDY,
route_cfg.dev_id,
session_mask);
}
}
if (rc < 0) {
MM_AUD_ERR("device could not be assigned!\n");
return -EFAULT;
}
return rc;
}