JNIEXPORT jint JNICALL Java_com_ssb_droidsound_plugins_SC68Plugin_N_1setOption(JNIEnv *env, jclass cl, jlong song, jint option, jint val) { PlayData *pd = (PlayData*) song; if (sc68_music_info(pd->sc68, &pd->info, pd->currentTrack, 0)) { return -1; } int result = -1; __android_log_print(ANDROID_LOG_VERBOSE, "SC68Plugin", "setOption"); switch(option) { case SC68_OPT_ASID: __android_log_print(ANDROID_LOG_VERBOSE, "SC68Plugin", "aSID SETTING"); if (val == 0) { result = sc68_cntl(pd->sc68, SC68_SET_ASID, SC68_ASID_OFF); __android_log_print(ANDROID_LOG_VERBOSE, "SC68Plugin", "DISABLED aSID"); break; } if (val == 1) { result = sc68_cntl(pd->sc68, SC68_CAN_ASID, SC68_DSK_TRACK); if (result != -1) { result = sc68_cntl(pd->sc68, SC68_SET_ASID, result); __android_log_print(ANDROID_LOG_VERBOSE, "SC68Plugin", "ENABLED aSID"); } break; } } return result; }
static int conf(void * data, const char * key, int op, sc68_dialval_t *val) { dial_t * dial = (dial_t *) data; int res = -1; static const char * l_spr[] = { "< custom >", "11 khz","22 khz", "44.1 khz","48 khz","96 khz" }; static const int i_spr[] = { 0, 11025, 22050, 44100, 48000, 96000 }; const int sprmax = sizeof (l_spr) / sizeof (*l_spr); /* Sanity check */ if (!key || !ismagic(dial)) goto exit; /* Run user control function */ res = dial->dial.cntl(dial->dial.data, key, op, val); /* Kill special case. */ if (op == SC68_DIAL_CALL && !strcmp(key,SC68_DIAL_KILL)) { del_dial(dial); goto exit; } /* User dealt with that message. */ if (res <= 0) goto exit; /* Assume no error */ res = 0; if (keyis("sampling")) { /* This key is used for the predefined sampling rate */ switch (op) { case SC68_DIAL_CNT: val->i = sprmax; break; case SC68_DIAL_GETI: { const option68_t * opt = option68_get("sampling-rate", opt68_ISSET); if (!opt) val->i = 5; /* default to 48khz */ else { for (val->i=1; val->i<sprmax; ++val->i) if (i_spr[val->i] == opt->val.num) break; if (val->i >= sprmax) val->i = 0; } } break; case SC68_DIAL_ENUM: if (val->i >= 0 && val->i < sprmax) { val->s = l_spr[val->i]; break; } default: res = -1; } } else if (op == SC68_DIAL_CALL) { /* Other special calls like real-tiem access */ if (keyis(SC68_DIAL_NEW)) val->i = 0; else if (keyis("save")) val->i = sc68_cntl(0, SC68_CONFIG_SAVE); else if (keyis("amiga-filter")) /* $$$ TODO: realtime amiga-filter */ val->i = !!val->i; else if (keyis("amiga-blend")) /* $$$ TODO: realtime amiga-blend */ val->i = val->i; } else { /* Finally try it as an option key. * * "sampling-rate" is converted if the value is in the index range * instead of the frequency value range. */ if (op == SC68_DIAL_SETI && keyis("sampling-rate") && val->i > 0 && val->i < sprmax) val->i = i_spr[val->i]; res = getopt(key, op, val); } exit: TRACE68(dial_cat, P "%s() #%02d \"%s\" -> %d\n", __FUNCTION__, op, key, res); return res; }