diff --git a/plugins/samplesource/sdrplay/sdrplaygui.cpp b/plugins/samplesource/sdrplay/sdrplaygui.cpp index 15eaf7082..f5b796468 100644 --- a/plugins/samplesource/sdrplay/sdrplaygui.cpp +++ b/plugins/samplesource/sdrplay/sdrplaygui.cpp @@ -32,278 +32,323 @@ unsigned int SDRPlayGui::m_bbGr[m_nbBands][m_nbGRValues] = { { // 10k - 12M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, - 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20 - 29 + 30, 31, 32, 33, 34, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 12 - 30M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, - 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20 - 29 + 30, 31, 32, 33, 34, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 30 - 60M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, - 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20 - 29 + 30, 31, 32, 33, 34, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 60 - 120M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 5, 6, 7, 8, 9, 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 5, // 20 - 29 + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 120 - 250M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 5, 6, 7, 8, 9, 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 5, // 20 - 29 + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 250 - 420M - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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, - 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10 - 19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20 - 29 + 30, 31, 32, 33, 34, 11, 12, 13, 14, 15, // 30 - 39 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 40 - 49 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, // 50 - 59 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, // 60 - 69 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, // 70 - 79 + 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, // 80 - 89 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, // 90 - 99 + 57, 58, 59, // 100 - 102 }, { // 420M - 1G - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 5, 6, 7, 8, 9, 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, - + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 5, 6, 7, 8, 9, 10, 11, 12, // 10 - 19 + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, // 20 - 29 + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, // 30 - 39 + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, // 40 - 49 + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, // 50 - 59 + 53, 54, 55, 56, 57, 58, 40, 41, 42, 43, // 60 - 69 + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, // 70 - 79 + 54, 55, 56, 57, 58, 59, 59, 59, 59, 59, // 80 - 89 + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, // 90 - 99 + 59, 59, 59, // 100 - 102 }, { // 1 - 2G - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 3, 4, 5, 6, 7, 8, 9, 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, - 40, 41, 42, 53, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0 - 9 + 10, 11, 5, 6, 7, 8, 9, 10, 11, 12, // 10 - 19 + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, // 20 - 29 + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, // 30 - 39 + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, // 40 - 49 + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, // 50 - 59 + 53, 54, 55, 56, 57, 58, 40, 41, 42, 43, // 60 - 69 + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, // 70 - 79 + 54, 55, 56, 57, 58, 59, 59, 59, 59, 59, // 80 - 89 + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, // 90 - 99 + 59, 59, 59, // 100 - 102 } }; unsigned int SDRPlayGui::m_lnaGr[m_nbBands][m_nbGRValues] = { { // 10k - 12M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 12 - 30M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 30 - 60M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 60 - 120M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, // 20 - 29 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 120 - 250M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, // 20 - 29 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 250 - 420M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, // 30 - 39 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 40 - 49 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 50 - 59 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 60 - 69 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 70 - 79 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 80 - 89 + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, // 90 - 99 + 24, 24, 24, // 100 - 102 }, { // 420M - 1G - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, // 10 - 19 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 20 - 29 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 30 - 39 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 40 - 49 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 50 - 59 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 60 - 69 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 70 - 79 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 80 - 89 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 90 - 99 + 7, 7, 7, // 100 - 102 }, { // 1 - 2G - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 10 - 19 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 20 - 29 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 30 - 39 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 40 - 49 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 50 - 59 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 60 - 69 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 70 - 79 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 80 - 89 + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 90 - 99 + 7, 7, 7, // 100 - 102 } }; unsigned int SDRPlayGui::m_mixerGr[m_nbBands][m_nbGRValues] = { { // 10k - 12M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 12 - 30M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 30 - 60M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 60 - 120M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 120 - 250M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 250 - 420M - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 - 69 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 70 - 79 + 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 420M - 1G - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, // 60 - 69 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 70 - 79 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 }, { // 1 - 2G - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 - 29 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 30 - 39 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40 - 49 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 - 59 + 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, // 60 - 69 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 70 - 79 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 80 - 89 + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 90 - 99 + 19, 19, 19, // 100 - 102 } }; @@ -354,9 +399,8 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) : displaySettings(); - // TODO: -// m_sampleSource = new SDRPlayInput(m_deviceAPI); -// m_deviceAPI->setSource(m_sampleSource); + m_sampleSource = new SDRPlayInput(m_deviceAPI); + m_deviceAPI->setSource(m_sampleSource); connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); m_deviceAPI->setSource(m_sampleSource); @@ -441,6 +485,51 @@ bool SDRPlayGui::handleMessage(const Message& message) } } +void SDRPlayGui::handleDSPMessages() +{ + Message* message; + + while ((message = m_deviceAPI->getDeviceOutputMessageQueue()->pop()) != 0) + { + qDebug("SDRPlayGui::handleDSPMessages: message: %s", message->getIdentifier()); + + if (DSPSignalNotification::match(*message)) + { + DSPSignalNotification* notif = (DSPSignalNotification*) message; + m_sampleRate = notif->getSampleRate(); + m_deviceCenterFrequency = notif->getCenterFrequency(); + qDebug("SDRPlayGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency()); + updateSampleRateAndFrequency(); + m_fileSink->handleMessage(*notif); // forward to file sink + + delete message; + } + } +} + +void SDRPlayGui::handleSourceMessages() +{ + Message* message; + + while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0) + { + qDebug("SDRPlayGui::HandleSourceMessages: message: %s", message->getIdentifier()); + + if (handleMessage(*message)) + { + delete message; + } + } +} + +void SDRPlayGui::updateSampleRateAndFrequency() +{ + m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate); + m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); + ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000)); +} + + void SDRPlayGui::displaySettings() { ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); @@ -467,7 +556,8 @@ void SDRPlayGui::displaySettings() char grStrChr[20]; - sprintf(grStrChr, "%02d-%02d-%02d", + sprintf(grStrChr, "%03d:%02d-%02d-%02d", + m_settings.m_gainRedctionIndex, 24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], 19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], 59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]); @@ -489,9 +579,38 @@ void SDRPlayGui::updateHardware() m_updateTimer.stop(); } +void SDRPlayGui::updateStatus() +{ + int state = m_deviceAPI->state(); + + if(m_lastEngineState != state) + { + switch(state) + { + case DSPDeviceSourceEngine::StNotStarted: + ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + break; + case DSPDeviceSourceEngine::StIdle: + ui->startStop->setStyleSheet("QToolButton { background-color : blue; }"); + break; + case DSPDeviceSourceEngine::StRunning: + ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); + break; + case DSPDeviceSourceEngine::StError: + ui->startStop->setStyleSheet("QToolButton { background-color : red; }"); + QMessageBox::information(this, tr("Message"), m_deviceAPI->errorMessage()); + break; + default: + break; + } + + m_lastEngineState = state; + } +} + void SDRPlayGui::on_centerFrequency_changed(quint64 value) { - m_settings.m_centerFrequency = ui->centerFrequency->getValue(); + m_settings.m_centerFrequency = value * 1000; sendSettings(); } @@ -514,7 +633,7 @@ void SDRPlayGui::on_iqImbalance_toggled(bool checked) sendSettings(); } -void SDRPlayGui::on_fBband_currentIndexChanged(int index) +void SDRPlayGui::on_fBand_currentIndexChanged(int index) { ui->centerFrequency->setValueRange( 7, @@ -522,7 +641,7 @@ void SDRPlayGui::on_fBband_currentIndexChanged(int index) SDRPlayBands::getBandHigh(index)); ui->centerFrequency->setValue((SDRPlayBands::getBandLow(index)+SDRPlayBands::getBandHigh(index)) / 2); - m_settings.m_centerFrequency = ui->centerFrequency->getValue(); + m_settings.m_centerFrequency = (SDRPlayBands::getBandLow(index)+SDRPlayBands::getBandHigh(index)) * 500; m_settings.m_frequencyBandIndex = index; sendSettings(); @@ -537,7 +656,7 @@ void SDRPlayGui::on_mirDCCorr_currentIndexChanged(int index) void SDRPlayGui::on_mirDCCorrTrackTime_valueChanged(int value) { m_settings.m_mirDcCorrTrackTimeIndex = value; - ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3)); + ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrTrackTimeIndex * 3)); sendSettings(); } @@ -571,7 +690,8 @@ void SDRPlayGui::on_gr_valueChanged(int value) char grStrChr[20]; - sprintf(grStrChr, "%02d-%02d-%02d", + sprintf(grStrChr, "%03d:%02d-%02d-%02d", + m_settings.m_gainRedctionIndex, 24 - m_lnaGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], 19 - m_mixerGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex], 59 - m_bbGr[m_settings.m_frequencyBandIndex][m_settings.m_gainRedctionIndex]); diff --git a/plugins/samplesource/sdrplay/sdrplaygui.h b/plugins/samplesource/sdrplay/sdrplaygui.h index 6499adbac..5bad63dc2 100644 --- a/plugins/samplesource/sdrplay/sdrplaygui.h +++ b/plugins/samplesource/sdrplay/sdrplaygui.h @@ -70,14 +70,18 @@ private: void displaySettings(); void sendSettings(); + void updateSampleRateAndFrequency(); private slots: void updateHardware(); + void updateStatus(); + void handleSourceMessages(); + void handleDSPMessages(); void on_centerFrequency_changed(quint64 value); void on_ppm_valueChanged(int value); void on_dcOffset_toggled(bool checked); void on_iqImbalance_toggled(bool checked); - void on_fBband_currentIndexChanged(int index); + void on_fBand_currentIndexChanged(int index); void on_mirDCCorr_currentIndexChanged(int index); void on_mirDCCorrTrackTime_valueChanged(int value); void on_bandwidth_currentIndexChanged(int index); diff --git a/plugins/samplesource/sdrplay/sdrplaygui.ui b/plugins/samplesource/sdrplay/sdrplaygui.ui index 7c6824f77..fdbb5dd9f 100644 --- a/plugins/samplesource/sdrplay/sdrplaygui.ui +++ b/plugins/samplesource/sdrplay/sdrplaygui.ui @@ -6,7 +6,7 @@ 0 0 - 291 + 292 210 @@ -79,7 +79,7 @@ - + I/Q sample rate kS/s @@ -386,6 +386,12 @@ + + + 42 + 0 + + 105uS @@ -579,10 +585,10 @@ - LNA-Mixer-BaseBand gains in dB + Gain reduction:LNA-Mixer-BaseBand gains in dB - 24-19-59 + 035:24-19-59 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/plugins/samplesource/sdrplay/sdrplayinput.cpp b/plugins/samplesource/sdrplay/sdrplayinput.cpp index ad5ccad6f..10cc8773a 100644 --- a/plugins/samplesource/sdrplay/sdrplayinput.cpp +++ b/plugins/samplesource/sdrplay/sdrplayinput.cpp @@ -36,7 +36,8 @@ SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) : m_settings(), m_sdrPlayThread(0), m_deviceDescription("SDRPlay"), - m_samplesPerPacket(4096) + m_samplesPerPacket(4096), + m_mirStreamRunning(false) { } @@ -89,7 +90,16 @@ bool SDRPlayInput::start(int device) callbackGC, 0); - m_sdrPlayThread->startWork(); + if (r != mir_sdr_Success) + { + qCritical("SDRPlayInput::start: Mir stream init failed with code %d", (int) r); + } + else + { + qDebug("SDRPlayInput::start: Mir stream started: samplesPerPacket: %d", m_samplesPerPacket); + m_mirStreamRunning = true; + m_sdrPlayThread->startWork(); + } } void SDRPlayInput::stop() @@ -104,6 +114,8 @@ void SDRPlayInput::stop() qCritical("SDRPlayInput::stop: stream uninit failed with code %d", (int) r); } + m_mirStreamRunning = false; + if(m_sdrPlayThread != 0) { m_sdrPlayThread->stopWork(); @@ -120,7 +132,7 @@ const QString& SDRPlayInput::getDeviceDescription() const int SDRPlayInput::getSampleRate() const { int rate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex); - return ((rate * 1000) / (1< 85) + { + if (m_settings.m_gainRedctionIndex < 85) + { + m_settings.m_gainRedctionIndex = 85; + + if (m_mirStreamRunning) + { + reinitMirSDR(mir_sdr_CHANGE_GR); + } + } + } + else + { + m_settings.m_gainRedctionIndex = settings.m_gainRedctionIndex; + + if (m_mirStreamRunning) + { + reinitMirSDR(mir_sdr_CHANGE_GR); + } + } + } + } + + if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) + { + m_settings.m_LOppmTenths = settings.m_LOppmTenths; + + mir_sdr_ErrT r = mir_sdr_SetPpm(m_settings.m_LOppmTenths / 10.0); + + if (r != mir_sdr_Success) + { + qDebug("SDRPlayInput::applySettings: mir_sdr_SetPpm failed with code %d", (int) r); + } + } + + if ((m_settings.m_mirDcCorrIndex != settings.m_mirDcCorrIndex) || force) + { + m_settings.m_mirDcCorrIndex = settings.m_mirDcCorrIndex; + + if (m_mirStreamRunning) + { + mir_sdr_ErrT r = mir_sdr_SetDcMode(m_settings.m_mirDcCorrIndex, 0); + + if (r != mir_sdr_Success) + { + qDebug("SDRPlayInput::applySettings: mir_sdr_SetDcMode failed with code %d", (int) r); + } + } + } + + if ((m_settings.m_mirDcCorrTrackTimeIndex != settings.m_mirDcCorrTrackTimeIndex) || force) + { + m_settings.m_mirDcCorrTrackTimeIndex = settings.m_mirDcCorrTrackTimeIndex; + + if (m_mirStreamRunning) + { + mir_sdr_ErrT r = mir_sdr_SetDcTrackTime(m_settings.m_mirDcCorrTrackTimeIndex); + + if (r != mir_sdr_Success) + { + qDebug("SDRPlayInput::applySettings: mir_sdr_SetDcTrackTime failed with code %d", (int) r); + } + } + } + if (forwardChange) { int sampleRate = getSampleRate(); DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency); m_deviceAPI->getDeviceInputMessageQueue()->push(notif); } + + return true; +} + +void SDRPlayInput::reinitMirSDR(mir_sdr_ReasonForReinitT reasonForReinit) +{ + int grdB = m_settings.m_gainRedctionIndex; + int rate = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex); + int gRdBsystem; + + mir_sdr_ErrT r = mir_sdr_Reinit( + &grdB, + rate / 1e3, + m_settings.m_centerFrequency / 1e6, + (mir_sdr_Bw_MHzT) m_settings.m_bandwidthIndex, + mir_sdr_IF_Zero, + mir_sdr_LO_Auto, + 1, // LNA + &gRdBsystem, + 0, // use mir_sdr_SetGr() to set initial gain reduction + &m_samplesPerPacket, + reasonForReinit); + + if (r != mir_sdr_Success) + { + qCritical("SDRPlayInput::reinitMirSDR (%d): MirSDR stream reinit failed with code %d", (int) reasonForReinit, (int) r); + m_mirStreamRunning = false; + } + else + { + qDebug("SDRPlayInput::reinitMirSDR (%d): MirSDR stream restarted: samplesPerPacket: %d", (int) reasonForReinit, m_samplesPerPacket); + } } void SDRPlayInput::callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext) diff --git a/plugins/samplesource/sdrplay/sdrplayinput.h b/plugins/samplesource/sdrplay/sdrplayinput.h index 7c37d8af7..4bfc9668a 100644 --- a/plugins/samplesource/sdrplay/sdrplayinput.h +++ b/plugins/samplesource/sdrplay/sdrplayinput.h @@ -78,6 +78,7 @@ public: private: bool applySettings(const SDRPlaySettings& settings, bool force); + void reinitMirSDR(mir_sdr_ReasonForReinitT reasonForReinit); static void callbackGC(unsigned int gRdB, unsigned int lnaGRdB, void *cbContext); DeviceSourceAPI *m_deviceAPI; @@ -87,6 +88,7 @@ private: QString m_deviceDescription; int m_samplesPerPacket; + bool m_mirStreamRunning; }; #endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */