Lines Matching defs:tone
1428 static void qdm2_fft_generate_tone(QDM2Context *q, FFTTone *tone)
1435 tone->phase += tone->phase_shift;
1437 /* calculate current level (maximum amplitude) of tone */
1438 level = fft_tone_envelope_table[tone->duration][tone->time_index] * tone->level;
1439 c.im = level * sin(tone->phase * iscale);
1440 c.re = level * cos(tone->phase * iscale);
1442 /* generate FFT coefficients for tone */
1443 if (tone->duration >= 3 || tone->cutoff >= 3) {
1444 tone->complex[0].im += c.im;
1445 tone->complex[0].re += c.re;
1446 tone->complex[1].im -= c.im;
1447 tone->complex[1].re -= c.re;
1449 f[1] = -tone->table[4];
1450 f[0] = tone->table[3] - tone->table[0];
1451 f[2] = 1.0 - tone->table[2] - tone->table[3];
1452 f[3] = tone->table[1] + tone->table[4] - 1.0;
1453 f[4] = tone->table[0] - tone->table[1];
1454 f[5] = tone->table[2];
1456 tone->complex[fft_cutoff_index_table[tone->cutoff][i]].re +=
1458 tone->complex[fft_cutoff_index_table[tone->cutoff][i]].im +=
1459 c.im * ((tone->cutoff <= i) ? -f[i] : f[i]);
1462 tone->complex[i].re += c.re * f[i + 2];
1463 tone->complex[i].im += c.im * f[i + 2];
1467 /* copy the tone if it has not yet died out */
1468 if (++tone->time_index < ((1 << (5 - tone->duration)) - 1)) {
1469 memcpy(&q->fft_tones[q->fft_tone_end], tone, sizeof(FFTTone));
1515 FFTTone tone;
1526 tone.cutoff = offset;
1528 tone.cutoff = (offset >= 60) ? 3 : 2;
1530 tone.level = (q->fft_coefs[j].exp < 0) ? 0.0 : fft_tone_level_table[q->superblocktype_2_3 ? 0 : 1][q->fft_coefs[j].exp & 63];
1531 tone.complex = &q->fft.complex[ch][offset];
1532 tone.table = fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)];
1533 tone.phase = 64 * q->fft_coefs[j].phase - (offset << 8) - 128;
1534 tone.phase_shift = (2 * q->fft_coefs[j].offset + 1) << (7 - four_i);
1535 tone.duration = i;
1536 tone.time_index = 0;
1538 qdm2_fft_generate_tone(q, &tone);