Пример #1
0
static void perform_config(void)
{
    /* TODO: equalizer, etc. */
    while (config) {
        const char *name = config;
        const char *eq = strchr(config, '=');
        if (!eq)
            break;
        const char *val = eq + 1;
        const char *end = val + strcspn(val, ": \t\n");

        if (!strncmp(name, "wait=", 5)) {
            if (atoi(val) > num_output_samples)
                return;
        } else if (!strncmp(name, "dither=", 7)) {
            dsp_dither_enable(atoi(val) ? true : false);
        } else if (!strncmp(name, "halt=", 5)) {
            if (atoi(val))
                codec_action = CODEC_ACTION_HALT;
        } else if (!strncmp(name, "loop=", 5)) {
            enable_loop = atoi(val) != 0;
        } else if (!strncmp(name, "offset=", 7)) {
            ci.id3->offset = atoi(val);
        } else if (!strncmp(name, "rate=", 5)) {
            dsp_set_pitch(atof(val) * PITCH_SPEED_100);
        } else if (!strncmp(name, "seek=", 5)) {
            codec_action = CODEC_ACTION_SEEK_TIME;
            codec_action_param = atoi(val);
        } else if (!strncmp(name, "tempo=", 6)) {
            dsp_set_timestretch(atof(val) * PITCH_SPEED_100);
        } else if (!strncmp(name, "vol=", 4)) {
            playback_set_volume(atoi(val));
        } else {
            fprintf(stderr, "error: unrecognized config \"%.*s\"\n",
                    (int)(eq - name), name);
            exit(1);
        }

        if (*end)
            config = end + 1;
        else
            config = NULL;
    }
}
Пример #2
0
void drct_set_volume (gint left, gint right)
{
    playback_set_volume (CLAMP (left, 0, 100), CLAMP (right, 0, 100));
}