mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-28 11:50:26 +00:00
Accept "nan" for mixrampdelay, sets it to -1 (disblaed) Issue #9
Changes types from double to float for mixrampdb and mixrampdelay
This commit is contained in:
parent
5cf9b5fcf2
commit
e906fd2f63
@ -976,7 +976,7 @@ function confirmSettings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$('#inputMixrampdb').is(':disabled')) {
|
if (!$('#inputMixrampdb').is(':disabled')) {
|
||||||
value=parseFloat($('#inputMixrampdb').val());
|
var value=parseFloat($('#inputMixrampdb').val());
|
||||||
if (!isNaN(value)) {
|
if (!isNaN(value)) {
|
||||||
$('#inputMixrampdb').val(value);
|
$('#inputMixrampdb').val(value);
|
||||||
} else {
|
} else {
|
||||||
@ -987,11 +987,12 @@ function confirmSettings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$('#inputMixrampdelay').is(':disabled')) {
|
if (!$('#inputMixrampdelay').is(':disabled')) {
|
||||||
value=parseFloat($('#inputMixrampdelay').val());
|
if ($('#inputMixrampdelay').val() == 'nan') $('#inputMixrampdelay').val('-1');
|
||||||
|
var value=parseFloat($('#inputMixrampdelay').val());
|
||||||
if (!isNaN(value)) {
|
if (!isNaN(value)) {
|
||||||
$('#inputMixrampdelay').val(value);
|
$('#inputMixrampdelay').val(value);
|
||||||
} else {
|
} else {
|
||||||
$('#inputMixrampdelay').popover({"content":"Must be a number","trigger":"manual"});
|
$('#inputMixrampdelay').popover({"content":"Must be a number, -1 to disable","trigger":"manual"});
|
||||||
$('#inputMixrampdelay').popover('show');
|
$('#inputMixrampdelay').popover('show');
|
||||||
$('#inputMixrampdelay').focus();
|
$('#inputMixrampdelay').focus();
|
||||||
formOK=false;
|
formOK=false;
|
||||||
|
@ -64,8 +64,8 @@ int callback_mpd(struct mg_connection *c)
|
|||||||
enum mpd_cmd_ids cmd_id = get_cmd_id(c->content);
|
enum mpd_cmd_ids cmd_id = get_cmd_id(c->content);
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
unsigned int uint_buf, uint_buf_2;
|
unsigned int uint_buf, uint_buf_2;
|
||||||
double double_buf;
|
|
||||||
int int_buf;
|
int int_buf;
|
||||||
|
float float_buf;
|
||||||
char *p_charbuf = NULL, *token;
|
char *p_charbuf = NULL, *token;
|
||||||
char *p_charbuf2 = NULL;
|
char *p_charbuf2 = NULL;
|
||||||
char *searchstr = NULL;
|
char *searchstr = NULL;
|
||||||
@ -139,12 +139,12 @@ int callback_mpd(struct mg_connection *c)
|
|||||||
mpd_run_crossfade(mpd.conn, uint_buf);
|
mpd_run_crossfade(mpd.conn, uint_buf);
|
||||||
break;
|
break;
|
||||||
case MPD_API_SET_MIXRAMPDB:
|
case MPD_API_SET_MIXRAMPDB:
|
||||||
if(sscanf(c->content, "MPD_API_SET_MIXRAMPDB,%lf", &double_buf))
|
if(sscanf(c->content, "MPD_API_SET_MIXRAMPDB,%f", &float_buf))
|
||||||
mpd_run_mixrampdb(mpd.conn, double_buf);
|
mpd_run_mixrampdb(mpd.conn, float_buf);
|
||||||
break;
|
break;
|
||||||
case MPD_API_SET_MIXRAMPDELAY:
|
case MPD_API_SET_MIXRAMPDELAY:
|
||||||
if(sscanf(c->content, "MPD_API_SET_MIXRAMPDELAY,%lf", &double_buf))
|
if(sscanf(c->content, "MPD_API_SET_MIXRAMPDELAY,%f", &float_buf))
|
||||||
mpd_run_mixrampdelay(mpd.conn, double_buf);
|
mpd_run_mixrampdelay(mpd.conn, float_buf);
|
||||||
break;
|
break;
|
||||||
case MPD_API_GET_OUTPUTS:
|
case MPD_API_GET_OUTPUTS:
|
||||||
mpd.buf_size = mpd_put_outputs(mpd.buf, 1);
|
mpd.buf_size = mpd_put_outputs(mpd.buf, 1);
|
||||||
@ -750,7 +750,7 @@ int mympd_put_settings(char *buffer)
|
|||||||
len = snprintf(buffer, MAX_SIZE,
|
len = snprintf(buffer, MAX_SIZE,
|
||||||
"{\"type\":\"settings\", \"data\":{"
|
"{\"type\":\"settings\", \"data\":{"
|
||||||
"\"repeat\":%d, \"single\":%d, \"crossfade\":%d, \"consume\":%d, \"random\":%d, "
|
"\"repeat\":%d, \"single\":%d, \"crossfade\":%d, \"consume\":%d, \"random\":%d, "
|
||||||
"\"mixrampdb\": %lf, \"mixrampdelay\": %lf, \"mpdhost\" : \"%s\", \"mpdport\": \"%d\", \"passwort_set\": %s, "
|
"\"mixrampdb\": %f, \"mixrampdelay\": %f, \"mpdhost\" : \"%s\", \"mpdport\": \"%d\", \"passwort_set\": %s, "
|
||||||
"\"streamport\": \"%d\",\"coverimage\": \"%s\", \"max_elements_per_page\": %d, \"replaygain\": \"%s\""
|
"\"streamport\": \"%d\",\"coverimage\": \"%s\", \"max_elements_per_page\": %d, \"replaygain\": \"%s\""
|
||||||
"}}",
|
"}}",
|
||||||
mpd_status_get_repeat(status),
|
mpd_status_get_repeat(status),
|
||||||
|
Loading…
Reference in New Issue
Block a user