提交 c5b8d3ee authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5568 --resolve the real problem is that L=-1 is not valid because the L param…

FS-5568 --resolve the real problem is that L=-1 is not valid because the L param is about how many times to generate the output while generating the tone so -1 is impossible because it can never end to let you hear it.  The real fix is to not allow -1 loops=-1 is the correct way to do this because that is parsed after the tone is generated and repeats the entire thing.  Doing something like L=100 actually generates the whole slinear audio 100 times into memore where loops=100 only generates the little snippet and repeats it after it was generated.
上级 620a5804
...@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ...@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
break; break;
case 'L': case 'L':
if (!LOOPING) { if (!LOOPING) {
ts->LOOPS = atoi(cur + 2); int L;
if ((L = atoi(cur + 2)) > 0) {
ts->LOOPS = L;
LOOPING++;
}
} }
LOOPING++;
break; break;
} }
} else { } else {
...@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ...@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
bottom: bottom:
free(data); free(data);
data = NULL; data = NULL;
if (ts->LOOPS > 0) { if (ts->LOOPS > 0) {
ts->LOOPS--; ts->LOOPS--;
} }
......
...@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ...@@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
break; break;
case 'L': case 'L':
if (!LOOPING) { if (!LOOPING) {
ts->LOOPS = atoi(cur + 2); int L;
if ((L = atoi(cur + 2)) > 0) {
ts->LOOPS = L;
LOOPING++;
}
} }
LOOPING++;
break; break;
} }
} else { } else {
...@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ...@@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
bottom: bottom:
free(data); free(data);
data = NULL; data = NULL;
if (ts->LOOPS > 0) { if (ts->LOOPS > 0) {
ts->LOOPS--; ts->LOOPS--;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论