- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
// TODO: Refactor to one call of 'refineIndexes'
std::vector<float32_t> *refined_left_1_3 = rec.refineIndexes(LEFT_CHANNEL, std::get<1>(p_l1) * ATT_3dB, INTERP_LINEAR, CROSS_RISE);
std::vector<float32_t> *refined_right_1_3 = rec.refineIndexes(RIGHT_CHANNEL, std::get<1>(p_r1) * ATT_3dB, INTERP_LINEAR, CROSS_RISE);
std::vector<float32_t> *refined_left_1_6 = rec.refineIndexes(LEFT_CHANNEL, std::get<1>(p_l1) * ATT_6dB, INTERP_LINEAR, CROSS_FALL);
std::vector<float32_t> *refined_right_1_6 = rec.refineIndexes(RIGHT_CHANNEL, std::get<1>(p_r1) * ATT_6dB, INTERP_LINEAR, CROSS_FALL);
std::vector<float32_t> *refined_left_2_3 = rec.refineIndexes(LEFT_CHANNEL, std::get<1>(p_l2) * ATT_3dB, INTERP_PARABOLIC, CROSS_RISE);
std::vector<float32_t> *refined_right_2_3 = rec.refineIndexes(RIGHT_CHANNEL, std::get<1>(p_r2) * ATT_3dB, INTERP_PARABOLIC, CROSS_RISE);
std::vector<float32_t> *refined_left_2_6 = rec.refineIndexes(LEFT_CHANNEL, std::get<1>(p_l2) * ATT_6dB, INTERP_PARABOLIC, CROSS_FALL);
std::vector<float32_t> *refined_right_2_6 = rec.refineIndexes(RIGHT_CHANNEL, std::get<1>(p_r2) * ATT_6dB, INTERP_PARABOLIC, CROSS_FALL);
bool exists_att_3dB = refined_left_1_3->size() > 0 && refined_right_1_3->size() > 0 && refined_left_2_3->size() > 0 && refined_right_2_3->size() > 0;
bool exists_att_6dB = refined_left_1_6->size() > 0 && refined_right_1_6->size() > 0 && refined_left_2_6->size() > 0 && refined_right_2_6->size() > 0;
if (exists_att_3dB || exists_att_6dB) {
float32_t rdTOA_l_3, rdTOA_r_3, rdBW_3, rdSW_3, rdTOA_l_6, rdTOA_r_6, rdBW_6, rdSW_6;
if (exists_att_3dB && !exists_att_6dB) {
rdTOA_l_6 = rdTOA_l_3 = refined_left_2_3->back() - refined_left_1_3->front();
rdTOA_r_6 = rdTOA_r_3 = refined_right_2_3->back() - refined_right_1_3->front();
rdBW_6 = rdBW_3 = refined_left_2_3->back() - refined_right_2_3->back();
rdSW_6 = rdSW_3 = refined_left_1_3->front() - refined_right_1_3->front();
}
else if (!exists_att_3dB && exists_att_6dB) {
rdTOA_l_6 = rdTOA_l_3 = refined_left_2_6->back() - refined_left_1_6->front();
rdTOA_r_6 = rdTOA_r_3 = refined_right_2_6->back() - refined_right_1_6->front();
rdBW_6 = rdBW_3 = refined_left_2_6->back() - refined_right_2_6->back();
rdSW_6 = rdSW_3 = refined_left_1_6->front() - refined_right_1_6->front();
}
else {
rdTOA_l_3 = refined_left_2_3->back() - refined_left_1_3->front();
rdTOA_r_3 = refined_right_2_3->back() - refined_right_1_3->front();
rdBW_3 = refined_left_2_3->back() - refined_right_2_3->back();
rdSW_3 = refined_left_1_3->front() - refined_right_1_3->front();
rdTOA_l_6 = refined_left_2_6->back() - refined_left_1_6->front();
rdTOA_r_6 = refined_right_2_6->back() - refined_right_1_6->front();
rdBW_6 = refined_left_2_6->back() - refined_right_2_6->back();
rdSW_6 = refined_left_1_6->front() - refined_right_1_6->front();
}
float32_t rdTOA_l = (rdTOA_l_3 + rdTOA_l_6) / 2f;
float32_t rdTOA_r =(rdTOA_r_3 + rdTOA_r_6) / 2f;
float32_t rdBW = (rdBW_3 + rdBW_6) / 2f;
float32_t rdSW = (rdSW_3 + rdSW_6) / 2f;
//TODO: Watch for group delay compensation!
float32_t rdeltaTOA = (rdTOA_l + rdTOA_r - 2 * groupDelay) / (2.0 * AUDIO_SAMPLE_RATE_EXACT);
float32_t rdeltaBlastWave = rdBW / AUDIO_SAMPLE_RATE_EXACT;
float32_t rdeltaShockWave = rdSW / AUDIO_SAMPLE_RATE_EXACT;
//..................................................
if (sd_init_status == SD_OK && current_settings.log) logFile.close();
refined_left_1_3->clear();
refined_right_1_3->clear();
refined_left_2_3->clear();
refined_right_2_3->clear();
refined_left_1_6->clear();
refined_right_1_6->clear();
refined_left_2_6->clear();
refined_right_2_6->clear();
delete refined_left_1_3;
delete refined_right_1_3;
delete refined_left_2_3;
delete refined_right_2_3;
delete refined_left_1_6;
delete refined_right_1_6;
delete refined_left_2_6;
delete refined_right_2_6;
50 часов без сна... Чувствую я пожалею завтра о том, что сегодня это написал.