bool Control::playpos(song_t songpos) { EXIT_IDLE; return mpd_run_play_pos(conn->h(), songpos); }
int cmd_play ( int argc, char ** argv, struct mpd_connection *conn ) { int song; int i; if(0==argc) song = -1; else { struct mpd_status *status; for(i=0;i<argc-1;i++) printf("skipping: %s\n",argv[i]); if(!parse_songnum(argv[i], &song)) DIE("error parsing song numbers from: %s\n",argv[i]); song--; /* This is necessary, otherwise mpc will output the wrong playlist number */ status = getStatus(conn); i = mpd_status_get_queue_length(status); mpd_status_free(status); if(song >= i) DIE("song number greater than playlist length.\n"); } if (song >= 0) mpd_run_play_pos(conn, song); else mpd_run_play(conn); return 1; }
void songlist_play_cursor(void) { int id = get_songlist_cursor_item_index(); if(id > -1) mpd_run_play_pos(conn, songlist->meta[id].id - 1); }
int cmd_play(int argc, char **argv, struct mpd_connection *conn) { assert(argc < 2); bool success; if (argc > 0) { const char *string = argv[0]; int song; if (!parse_songnum(string, &song)) DIE("error parsing song numbers from: %s\n", string); song--; success = mpd_run_play_pos(conn, song); } else success = mpd_run_play(conn); if (!success) printErrorAndExit(conn); return 1; }
/*The thread of I2C*/ void * I2CThread(void *arg) { int res = 0; while (1) { res = 0; if (i2c_file > 0) { if (!bread_register) { res = i2c_smbus_read_word_data(i2c_file, REGISTER3); switch (res) { case SWITCH_BTN_SHUT_DWON: { printf("nd I2CThread SWITCH_BTN_SHUT_DWON: 0x%0*x\n", 2, res); break; } case SHUT_DWON: { printf("nd I2CThread BTN3 SHUT_DWON: 0x%0*x\n", 2, res); break; } case AUTO_SLEEP: { printf("nd I2CThread AUTO_SLEEP: 0x%0*x\n", 2, res); break; } } bread_register = true; } res = i2c_smbus_read_word_data(i2c_file, REGISTER2); //printf("md I2CThread i2c_file res: 0x%0*x\n", 2, res); switch (res) { case BTN1_SHORT_PRESS: { printf("nd I2CThread BTN1_SHORT_PRESS: 0x%0*x\n", 2, res); btn1_short_press(); break; } case BTN1_LONG_PRESS: { printf("nd I2CThread BTN1_LONG_PRESS: 0x%0*x\n", 2, res); btn1_long_press(); break; } case BTN1_AUDIO_SPPEK_ARECORD: { printf("nd BTN1_AUDIO_SPPEK_ARECORD :: 0x%0*x\n", 2, res); btn1_audio_sppek_arecord(res); break; } case BTN2_SHORT_PRESS: { printf("nd I2CThread BTN2_SHORT_PRESS: 0x%0*x\n", 2, res); btn2_short_press(); break; } case BTN2_LONG_PRESS: { printf("nd I2CThread BTN2_LONG_PRESS: 0x%0*x\n", 2, res); btn2_long_press(); break; } case BTN3_SHORT_PRESS: { printf("nd I2CThread BTN3_SHORT_PRESS: 0x%0*x\n", 2, res); btn3_short_press(); break; } case BTN3_LONG_PRESS: { printf("nd I2CThread BTN3_LONG_PRESS: 0x%0*x\n", 2, res); btn3_long_press(); break; } case BTN4_SHORT_PRESS: { printf("nd I2CThread BTN4_SHORT_PRESS: 0x%0*x\n", 2, res); btn4_short_press(); break; } case BTN4_LONG_PRESS: { printf("nd I2CThread BTN4_LONG_PRESS: 0x%0*x\n", 2, res); btn4_long_press(); break; } case BTN5_SHORT_PRESS: { printf("nd I2CThread BTN5_SHORT_PRESS: 0x%0*x\n", 2, res); btn5_short_press(); break; } case BTN5_LONG_PRESS: { printf("nd I2CThread BTN5_LONG_PRESS: 0x%0*x\n", 2, res); btn5_long_press(); break; } case BTN5_QUESTION_ANSWER_ARECORD: { btn5_question_answer_arecord(res); break; } case PEN_START: { #ifdef PEN_SUPPORT printf("nd I2CThread PEN_START: 0x%0*x\n", 2, res); int nValue = 0, nValue8 = 0, nValue9 = 0, nValue10 = 0, nValue89 = 0; nValue10 = i2c_smbus_read_word_data(i2c_file, REGISTER10); printf("nd I2CThread REGISTER10: 0x%0*x, %d\n", 2, nValue10, nValue10); nValue9 = i2c_smbus_read_word_data(i2c_file, REGISTER9); printf("nd I2CThread REGISTER9: 0x%0*x, %d\n", 2, nValue9, nValue9); nValue8 = i2c_smbus_read_word_data(i2c_file, REGISTER8); printf("nd I2CThread REGISTER8: 0x%0*x, %d\n", 2, nValue8, nValue8); nValue89 = nValue8 | ((nValue9 << 8) & 0xff00); printf("nd I2CThread nValue89: %x, nValue89: %d, \n", nValue89, nValue89); nValue = nValue8 | ((nValue9 << 8) & 0xff00) | ((nValue10 << 16) & 0xff0000); printf("nd I2CThread nValue: %x, \n", nValue, nValue); if (nValue == 0x60fff8) { pthread_mutex_lock(&mutex); mpd_run_pause(conn, true); mpd_run_clear(conn); mpd_run_load(conn, "ljyy.lst"); pthread_mutex_unlock(&mutex); } else if (nValue == 0x60fff7) { } else if (nValue89 > 52900) { int nPos = nValue89 - 52901; printf("nd I2CThread nPos: %d, \n", nPos); pthread_mutex_lock(&mutex); mpd_run_pause(conn, true); mpd_run_single(conn, true); mpd_run_play_pos(conn, nPos); pthread_mutex_unlock(&mutex); } res = i2c_smbus_read_word_data(i2c_file, REGISTER2); printf("nd I2CThread REGISTER2: 0x%0*x\n", 2, res); #endif break; } case NOT_BTN_EVENT: { break; } } } else { printf("nd I2CThread i2c_file: %d\n", i2c_file); InitI2CDev(); } usleep(50*1000); } }
void Connection::Play(int pos) { prechecksNoCommandsList(); mpd_run_play_pos(m_connection.get(), pos); checkErrors(); }