|
|
|
|
|
|
|
|
if(t_hi < 1)return false; |
|
|
if(t_hi < 1)return false; |
|
|
if(t_hi >= (int) AUDIO_SAMPLE_RATE_EXACT / 2)return false; |
|
|
if(t_hi >= (int) AUDIO_SAMPLE_RATE_EXACT / 2)return false; |
|
|
if(t_lo >= (int) AUDIO_SAMPLE_RATE_EXACT / 2)return false; |
|
|
if(t_lo >= (int) AUDIO_SAMPLE_RATE_EXACT / 2)return false; |
|
|
if(t_time < 0)return false; |
|
|
|
|
|
|
|
|
if(t_time <= 0)return false; |
|
|
tone_lo = t_lo; |
|
|
tone_lo = t_lo; |
|
|
tone_hi = t_hi; |
|
|
tone_hi = t_hi; |
|
|
tone_phase = 0; |
|
|
tone_phase = 0; |
|
|
|
|
|
|
|
|
uint64_t tone_tmp = (0x400000000000LL * (int)(tmp&0x7fffffff)) / (int) AUDIO_SAMPLE_RATE_EXACT; |
|
|
uint64_t tone_tmp = (0x400000000000LL * (int)(tmp&0x7fffffff)) / (int) AUDIO_SAMPLE_RATE_EXACT; |
|
|
// Generate the sweep |
|
|
// Generate the sweep |
|
|
for(i = 0;i < AUDIO_BLOCK_SAMPLES;i++) { |
|
|
for(i = 0;i < AUDIO_BLOCK_SAMPLES;i++) { |
|
|
*bp++ = (short)(( (short)(arm_sin_q31((uint32_t)((tone_phase >> 15)&0x7fffffff))>>16) *tone_amp) >> 16); |
|
|
|
|
|
|
|
|
*bp++ = (short)(( (short)(arm_sin_q31((uint32_t)((tone_phase >> 15)&0x7fffffff))>>16) *tone_amp) >> 15); |
|
|
|
|
|
|
|
|
tone_phase += tone_tmp; |
|
|
tone_phase += tone_tmp; |
|
|
if(tone_phase & 0x800000000000LL)tone_phase &= 0x7fffffffffffLL; |
|
|
if(tone_phase & 0x800000000000LL)tone_phase &= 0x7fffffffffffLL; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
tone_freq += tone_incr; |
|
|
tone_freq += tone_incr; |
|
|
} else { |
|
|
} else { |
|
|
if(tmp < tone_hi) { |
|
|
|
|
|
|
|
|
if(tmp < tone_hi || tone_freq < tone_incr) { |
|
|
sweep_busy = 0; |
|
|
sweep_busy = 0; |
|
|
|
|
|
|
|
|
break; |
|
|
break; |