杰理-彩屏仓-本地音乐暂停状态下无法切换上下曲问题

杰理-彩屏仓-本地音乐暂停状态下无法切换上下曲问题

在这里插入图片描述

        if(usr_get_connect_status(CONNECT_C_EDR)){
            ui_pic_show_image_by_id(MUSIC_NEXT_PIC,0);
            ui_pic_show_image_by_id(MUSIC_PREV_PIC,0);
            
            if (app_get_curr_task() != APP_MUSIC_TASK) {
                app_task_switch_to(APP_MUSIC_TASK);
            }

            if(!_music_is_play()){
                G_log(" --------------------   没有播放音乐  ");
                if(local_prev_music_next_timer){
                    sys_timeout_del(local_prev_music_next_timer);
                    local_prev_music_next_timer = 0;
                }
                if(!local_prev_music_next_timer){
                    if(elm->id == MUSIC_NEXT_BUTTON){
                        local_prev_music_next_timer = sys_timeout_add(1,local_music_prev_next_func,300);
                    }else if(elm->id == MUSIC_PREV_BUTTON){
                        local_prev_music_next_timer = sys_timeout_add(0,local_music_prev_next_func,300);
                    }
                }
            }

在这里插入图片描述

u16 local_prev_music_next_timer = 0;

void local_music_prev_next_func(bool val)
{

    if (app_get_curr_task() != APP_MUSIC_TASK) {
        app_task_switch_to(APP_MUSIC_TASK);
    }

    G_log("------------------- val = %d   ",val);
    if(val){
        app_task_put_key_msg(KEY_MUSIC_NEXT, 0);
    }
    else{
        app_task_put_key_msg(KEY_MUSIC_PREV, 0);
    }

    // if(local_prev_music_next_timer){
        // sys_timeout_del(local_prev_music_next_timer);
        // local_prev_music_next_timer = 0;
    // }
    
}

在这里插入图片描述

extern u16 local_prev_music_next_timer;
void music_stop_next_deal(void)
{
    printf(" --------------------------------- !!!  KEY_MUSIC_NEXT ");

    char *logo = NULL;
    int err = MUSIC_PLAYER_ERR_NULL;

    log_i("KEY_MUSIC_PLAYER_START !!\n");
    ///断点播放活动设备
    logo = dev_manager_get_logo(dev_manager_find_active(1));
    if (music_player_get_play_status() == FILE_DEC_STATUS_PLAY) {
        if (music_player_get_dev_cur() && logo) {
            ///播放的设备跟当前活动的设备是同一个设备,不处理
            if (0 == strcmp(logo, music_player_get_dev_cur())) {
                log_w("the same dev!!\n");
                return;
            }
        }
    }
#if (MUSIC_DEVICE_TONE_EN)
    if (music_device_tone_play(logo) == true) {
        break;
    }
#endif
    if (true == breakpoint_vm_read(breakpoint, logo)) {
        err = music_player_play_by_breakpoint(logo, breakpoint);
    } else {
        err = music_player_play_first_file(logo);
    } 

}

在这里插入图片描述

    case  KEY_MUSIC_PREV:
        log_i("KEY_MUSIC_PREV\n");
        if(local_prev_music_next_timer){
            printf(" !!!!!!!!!  KEY_MUSIC_PREV ");
            music_stop_next_deal();
            if(local_prev_music_next_timer){
                sys_timeout_del(local_prev_music_next_timer);
                local_prev_music_next_timer = 0;
            }
        }
        __this->file_play_direct = 1;
        err = music_player_play_prev();
        break;
    case  KEY_MUSIC_NEXT:
        log_i("KEY_MUSIC_NEXT\n");
        if(local_prev_music_next_timer){
            printf(" !!!!!!!!!  KEY_MUSIC_NEXT ");
            music_stop_next_deal();
            if(local_prev_music_next_timer){
                sys_timeout_del(local_prev_music_next_timer);
                local_prev_music_next_timer = 0;
            }
        }
        __this->file_play_direct = 0;
        err = music_player_play_next();
        break;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值