codec: Fix tone generation

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2013-12-17 00:37:58 +01:00
parent e0a41716db
commit df95ae699f
2 changed files with 4 additions and 6 deletions

View File

@ -132,9 +132,7 @@ ambe_decode_frame(struct ambe_decoder *dec,
return 0;
case AMBE_TONE:
/* FIXME: Tone gen */
memset(audio, 0, 160*sizeof(int16_t));
return 0;
return ambe_decode_tone(dec, audio, N, frame);
}
return -EINVAL;

View File

@ -147,10 +147,10 @@ ambe_decode_tone(struct ambe_decoder *dec,
memset(audio, 0x00, sizeof(int16_t) * N);
/* Audio start / stop */
start = (p_sf_sel & 2) ? 0 : N << 1;
stop = (p_sf_sel & 1) ? ((N << 1) - 1) : (N - 1);
start = (p_sf_sel & 2) ? 0 : N >> 1;
stop = (p_sf_sel & 1) ? (N-1) : ((N >> 1) - 1);
if (start < stop)
if (start >= stop)
return 0;
/* Compute amplitude */