SDRPlay plugin: interface replaced by libmirisdr: refactor interim state (1)

This commit is contained in:
f4exb 2016-11-15 18:58:17 +01:00
parent a9f7c67f7b
commit e4f3915282
7 changed files with 389 additions and 684 deletions

View File

@ -28,331 +28,6 @@
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
// ====================================================================
unsigned int SDRPlayGui::m_bbGr[m_nbBands][m_nbGRValues] = {
{ // 10k - 12M
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, // 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, // 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, // 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, // 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, // 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, // 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, // 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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, // 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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
}
};
// ====================================================================
SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
QWidget(parent),
@ -375,12 +50,6 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->ifFrequency->addItem(QString::number(SDRPlayIF::getIF(i)));
}
ui->mirDCCorr->clear();
for (int i = 0; i < SDRPlayDCCorr::getNbDCCorrs(); i++)
{
ui->mirDCCorr->addItem(SDRPlayDCCorr::getDCCorrName(i));
}
ui->samplerate->clear();
for (int i = 0; i < SDRPlaySampleRates::getNbRates(); i++)
{
@ -476,6 +145,8 @@ bool SDRPlayGui::handleMessage(const Message& message)
{
if (SDRPlayInput::MsgReportSDRPlay::match(message))
{
qDebug() << "SDRPlayGui::handleMessage: MsgReportSDRPlay";
m_gains = ((SDRPlayInput::MsgReportSDRPlay&) message).getGains();
displaySettings();
return true;
}
@ -534,8 +205,8 @@ void SDRPlayGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->ppm->setValue(m_settings.m_LOppmTenths);
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
ui->ppm->setValue(m_settings.m_LOppmCorrection);
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmCorrection/10.0, 'f', 1)));
ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex);
@ -544,25 +215,36 @@ void SDRPlayGui::displaySettings()
ui->fBand->setCurrentIndex(m_settings.m_frequencyBandIndex);
ui->ifFrequency->setCurrentIndex(m_settings.m_ifFrequencyIndex);
ui->mirDCCorr->setCurrentIndex(m_settings.m_mirDcCorrIndex);
ui->mirDCCorrTrackTime->setValue(m_settings.m_mirDcCorrTrackTimeIndex);
ui->mirDCCorrTrackTimeText->setText(tr("%1us").arg(m_settings.m_mirDcCorrIndex * 3));
ui->samplerate->setCurrentIndex(m_settings.m_devSampleRateIndex);
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
ui->gr->setValue(m_settings.m_gainRedctionIndex);
if (m_gains.size() > 0)
{
int dist = abs(m_settings.m_gain - m_gains[0]);
int pos = 0;
char grStrChr[20];
for (uint i = 1; i < m_gains.size(); i++)
{
if (abs(m_settings.m_gain - m_gains[i]) < dist)
{
dist = abs(m_settings.m_gain - m_gains[i]);
pos = i;
}
}
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]);
ui->grText->setText(QString(grStrChr));
ui->gainText->setText(tr("%1.%2").arg(m_gains[pos] / 10).arg(abs(m_gains[pos] % 10)));
ui->gain->setMaximum(m_gains.size() - 1);
ui->gain->setEnabled(true);
ui->gain->setValue(pos);
}
else
{
ui->gain->setMaximum(0);
ui->gain->setEnabled(false);
ui->gain->setValue(0);
}
}
void SDRPlayGui::sendSettings()
@ -616,8 +298,8 @@ void SDRPlayGui::on_centerFrequency_changed(quint64 value)
void SDRPlayGui::on_ppm_valueChanged(int value)
{
m_settings.m_LOppmTenths = value;
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
m_settings.m_LOppmCorrection = value;
ui->ppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmCorrection/10.0, 'f', 1)));
sendSettings();
}
@ -735,24 +417,22 @@ void SDRPlayGui::on_record_toggled(bool checked)
// ====================================================================
unsigned int SDRPlaySampleRates::m_rates[m_nb_rates] = {
2000, // 0
2048, // 1
2304, // 2
2400, // 3
3072, // 4
3200, // 5
4000, // 6
4096, // 7
4608, // 8
4800, // 9
5000, // 10
6000, // 11
6144, // 12
8000, // 13
8192, // 14
9216, // 15
9600, // 16
10000, // 17
1536000, // 0
2000000, // 1
2048000, // 2
2304000, // 3
2400000, // 4
3072000, // 5
3200000, // 6
4000000, // 7
4096000, // 8
4608000, // 9
4800000, // 10
5000000, // 11
6000000, // 12
6144000, // 13
8000000, // 14
8192000, // 15
};
unsigned int SDRPlaySampleRates::getRate(unsigned int rate_index)
@ -788,14 +468,14 @@ unsigned int SDRPlaySampleRates::getNbRates()
// ====================================================================
unsigned int SDRPlayBandwidths::m_bw[m_nb_bw] = {
200, // 0
300, // 1
600, // 2
1536, // 3
5000, // 4
6000, // 5
7000, // 6
8000, // 7
200000, // 0
300000, // 1
600000, // 2
1536000, // 3
5000000, // 4
6000000, // 5
7000000, // 6
8000000, // 7
};
unsigned int SDRPlayBandwidths::getBandwidth(unsigned int bandwidth_index)
@ -831,10 +511,10 @@ unsigned int SDRPlayBandwidths::getNbBandwidths()
// ====================================================================
unsigned int SDRPlayIF::m_if[m_nb_if] = {
0, // 0
450, // 1
1620, // 2
2048, // 3
0, // 0
450000, // 1
1620000, // 2
2048000, // 3
};
unsigned int SDRPlayIF::getIF(unsigned int if_index)
@ -945,31 +625,3 @@ unsigned int SDRPlayBands::getNbBands()
{
return SDRPlayBands::m_nb_bands;
}
// ====================================================================
const char* SDRPlayDCCorr::m_dcCorrName[m_nb_dcCorrs] = {
"None", // 0
"Per1", // 1
"Per2", // 2
"Per3", // 3
"1Shot", // 4
"Cont", // 5
};
QString SDRPlayDCCorr::getDCCorrName(unsigned int dcCorr_index)
{
if (dcCorr_index < m_nb_dcCorrs)
{
return QString(m_dcCorrName[dcCorr_index]);
}
else
{
return QString(m_dcCorrName[0]);
}
}
unsigned int SDRPlayDCCorr::getNbDCCorrs()
{
return SDRPlayDCCorr::m_nb_dcCorrs;
}

View File

@ -18,6 +18,7 @@
#define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_
#include <QTimer>
#include <vector>
#include "plugin/plugingui.h"
#include "sdrplayinput.h"
@ -56,18 +57,13 @@ private:
SDRPlaySettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains;
DeviceSampleSource* m_sampleSource;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
int m_sampleRate;
quint64 m_deviceCenterFrequency; //!< Center frequency in device
int m_lastEngineState;
static const unsigned int m_nbGRValues = 103;
static const unsigned int m_nbBands = 8;
static unsigned int m_bbGr[m_nbBands][m_nbGRValues];
static unsigned int m_lnaGr[m_nbBands][m_nbGRValues];
static unsigned int m_mixerGr[m_nbBands][m_nbGRValues];
void displaySettings();
void sendSettings();
void updateSampleRateAndFrequency();
@ -82,13 +78,11 @@ private slots:
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_fBand_currentIndexChanged(int index);
void on_mirDCCorr_currentIndexChanged(int index);
void on_mirDCCorrTrackTime_valueChanged(int value);
void on_bandwidth_currentIndexChanged(int index);
void on_samplerate_currentIndexChanged(int index);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
void on_gr_valueChanged(int value);
void on_gain_valueChanged(int value);
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
};
@ -102,7 +96,7 @@ public:
static unsigned int getRateIndex(unsigned int rate);
static unsigned int getNbRates();
private:
static const unsigned int m_nb_rates = 18;
static const unsigned int m_nb_rates = 16;
static unsigned int m_rates[m_nb_rates];
};
@ -139,13 +133,4 @@ private:
static const char* m_bandName[m_nb_bands];
};
class SDRPlayDCCorr {
public:
static QString getDCCorrName(unsigned int dcCorr_index);
static unsigned int getNbDCCorrs();
private:
static const unsigned int m_nb_dcCorrs = 6;
static const char* m_dcCorrName[m_nb_dcCorrs];
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYGUI_H_ */

View File

@ -35,7 +35,16 @@
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -201,7 +210,7 @@
</size>
</property>
<property name="text">
<string>0.0</string>
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -219,13 +228,17 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout_corr">
<item row="1" column="2">
<widget class="ButtonSwitch" name="iqImbalance">
<item row="1" column="7">
<widget class="QComboBox" name="fBand">
<property name="toolTip">
<string>Automatic IQ imbalance correction</string>
<string>Frequency band</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="corrLabel">
<property name="text">
<string>IQ</string>
<string>Auto</string>
</property>
</widget>
</item>
@ -252,24 +265,20 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="corrLabel">
<item row="1" column="2">
<widget class="ButtonSwitch" name="iqImbalance">
<property name="toolTip">
<string>Automatic IQ imbalance correction</string>
</property>
<property name="text">
<string>Auto</string>
<string>IQ</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QComboBox" name="fBand">
<property name="toolTip">
<string>Frequency band</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QComboBox" name="ifFrequency">
<property name="toolTip">
<string>IF frequency in kHz</string>
<widget class="QLabel" name="fBandLabel">
<property name="text">
<string>Band</string>
</property>
</widget>
</item>
@ -287,53 +296,7 @@
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="6">
<widget class="QComboBox" name="bandwidth">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>IF bandwidth in kHz</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<widget class="QLabel" name="bandwidthLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>BW </string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="bandwidthUnit">
<property name="text">
<string>kHz</string>
</property>
</widget>
</item>
<item row="0" column="8">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -346,75 +309,130 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="mirDCCorr">
<item row="0" column="2">
<widget class="QComboBox" name="bandwidth">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>MirSDR DC auto tracking</string>
</property>
<property name="currentText" stdset="0">
<string/>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
<property name="maxVisibleItems">
<number>5</number>
<string>IF bandwidth in kHz</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDial" name="mirDCCorrTrackTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
<widget class="QLabel" name="bandwidthLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>MirSDR DC auto tracking time in uS</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>63</number>
</property>
<property name="value">
<number>35</number>
<property name="text">
<string>BW </string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="mirDCCorrTrackTimeText">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<item row="0" column="3">
<widget class="QLabel" name="bandwidthUnit">
<property name="text">
<string>105uS</string>
<string>kHz</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</widget>
</item>
<item row="0" column="6">
<widget class="QComboBox" name="ifFrequency">
<property name="toolTip">
<string>IF frequency in kHz</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="ifFrequencyLabel">
<property name="text">
<string>IF</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QLabel" name="label">
<property name="text">
<string>kHz</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0,0,0">
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0,0,0,0">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="3">
<item row="0" column="1">
<widget class="QComboBox" name="samplerate">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sample rate in kS/s</string>
</property>
</widget>
</item>
<item row="0" column="8">
<spacer name="fcPosRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="fcPos">
<property name="toolTip">
<string>Relative position of device center frequency</string>
</property>
<item>
<property name="text">
<string>Inf</string>
</property>
</item>
<item>
<property name="text">
<string>Sup</string>
</property>
</item>
<item>
<property name="text">
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="label_fcPos">
<property name="text">
<string>Fp</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="4">
<item row="0" column="5">
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
@ -465,61 +483,6 @@
</item>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="label_fcPos">
<property name="text">
<string>Fp</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QComboBox" name="fcPos">
<property name="toolTip">
<string>Relative position of device center frequency</string>
</property>
<item>
<property name="text">
<string>Inf</string>
</property>
</item>
<item>
<property name="text">
<string>Sup</string>
</property>
</item>
<item>
<property name="text">
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item row="0" column="7">
<spacer name="fcPosRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="samplerate">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sample rate in kS/s</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
@ -540,6 +503,19 @@
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -555,21 +531,21 @@
<number>3</number>
</property>
<item row="0" column="1">
<widget class="QSlider" name="gr">
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Gain reduction</string>
<string>Tuner gain</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>102</number>
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>35</number>
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -577,7 +553,7 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="grText">
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>40</width>
@ -585,10 +561,10 @@
</size>
</property>
<property name="toolTip">
<string>Gain reduction:LNA-Mixer-BaseBand gains in dB</string>
<string>Tuner gain in dB</string>
</property>
<property name="text">
<string>035:24-19-59</string>
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -596,9 +572,9 @@
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="grLabel">
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>GR</string>
<string>Gain</string>
</property>
</widget>
</item>
@ -652,6 +628,26 @@
</customwidgets>
<resources>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
<include location="../../../sdrbase/resources/res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -34,10 +34,9 @@ MESSAGE_CLASS_DEFINITION(SDRPlayInput::MsgReportSDRPlay, Message)
SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_dev(0),
m_sdrPlayThread(0),
m_deviceDescription("SDRPlay"),
m_samplesPerPacket(4096),
m_mirStreamRunning(false)
m_deviceDescription("SDRPlay")
{
}
@ -51,68 +50,142 @@ bool SDRPlayInput::init(const Message& cmd)
return false;
}
bool SDRPlayInput::start(int device)
bool SDRPlayInput::start(uint32_t device)
{
mir_sdr_ErrT r;
QMutexLocker mutexLocker(&m_mutex);
if (m_dev != 0)
{
stop();
}
char vendor[256];
char product[256];
char serial[256];
int res;
int numberOfGains;
if (!m_sampleFifo.setSize(96000 * 4))
{
qCritical("SDRPlayInput::start: could not allocate SampleFifo");
return false;
}
if ((res = mirisdr_open(&m_dev, device)) < 0)
{
qCritical("SDRPlayInput::start: could not open SDRPlay #%d: %s", device, strerror(errno));
return false;
}
vendor[0] = '\0';
product[0] = '\0';
serial[0] = '\0';
if ((res = mirisdr_get_device_usb_strings(m_dev, vendor, product, serial)) < 0)
{
qCritical("SDRPlayInput::start: error accessing USB device");
stop();
return false;
}
qWarning("SDRPlayInput::start: open: %s %s, SN: %s", vendor, product, serial);
m_deviceDescription = QString("%1 (SN %2)").arg(product).arg(serial);
if ((res = mirisdr_set_sample_rate(m_dev, 2048000)) < 0)
{
qCritical("SDRPlayInput::start: could not set sample rate: 2048kS/s");
stop();
return false;
}
if ((res = mirisdr_set_center_freq(m_dev, m_settings.m_centerFrequency)) < 0)
{
qCritical("SDRPlayInput::start: could not set frequency to: %lu Hz", m_settings.m_centerFrequency);
stop();
return false;
}
if ((res = mirisdr_set_sample_format(m_dev, "336_S16"))) // sample format S12
{
qCritical("SDRPlayInput::start: could not set sample format: rc: %d", res);
stop();
return false;
}
if ((res = mirisdr_set_transfer(m_dev, "BULK")) < 0)
{
qCritical("SDRPlayInput::start: could not set USB Bulk mode: rc: %d", res);
stop();
return false;
}
if ((res = mirisdr_set_if_freq(m_dev, SDRPlayIF::m_if[m_settings.m_ifFrequencyIndex])) < 0)
{
qCritical("SDRPlayInput::start: could not set IF frequency at index %d: rc: %d", m_settings.m_ifFrequencyIndex, res);
stop();
return false;
}
if ((res = mirisdr_set_bandwidth(m_dev, SDRPlayBandwidths::m_bw[m_settings.m_bandwidthIndex])) < 0)
{
qCritical("SDRPlayInput::start: could not set bandwidth at index %d: rc: %d", m_settings.m_bandwidthIndex, res);
stop();
return false;
}
if ((res = mirisdr_set_tuner_gain_mode(m_dev, 1)) < 0)
{
qCritical("SDRPlayInput::start: error setting tuner gain mode");
stop();
return false;
}
numberOfGains = mirisdr_get_tuner_gains(m_dev, 0);
if (numberOfGains < 0)
{
qCritical("SDRPlayInput::start: error getting number of gain values supported");
stop();
return false;
}
else
{
qDebug("SDRPlayInput::start: supported gain values: %d", numberOfGains);
}
m_gains.resize(numberOfGains);
if (mirisdr_get_tuner_gains(m_dev, &m_gains[0]) < 0)
{
qCritical("SDRPlayInput::start: error getting gain values");
stop();
return false;
}
else
{
qDebug() << "SDRPlayInput::start: " << m_gains.size() << "gains";
MsgReportSDRPlay *message = MsgReportSDRPlay::create(m_gains);
getOutputMessageQueueToGUI()->push(message);
}
if ((res = mirisdr_reset_buffer(m_dev)) < 0)
{
qCritical("SDRPlayInput::start: could not reset USB EP buffers: %s", strerror(errno));
stop();
return false;
}
if((m_sdrPlayThread = new SDRPlayThread(&m_sampleFifo)) == 0)
{
qFatal("SDRPlayInput::start: failed to create thread");
return false;
}
int agcSetPoint = -m_settings.m_gainRedctionIndex;
double sampleRateMHz = SDRPlaySampleRates::getRate(m_settings.m_devSampleRateIndex) / 1e3;
double frequencyMHz = m_settings.m_centerFrequency / 1e6;
int infoOverallGr;
m_sdrPlayThread->startWork();
r = mir_sdr_DCoffsetIQimbalanceControl(1, 0);
if (r != mir_sdr_Success)
{
qCritical("SDRPlayInput::start: mir_sdr_DCoffsetIQimbalanceControl failed with code %d", (int) r);
}
mutexLocker.unlock();
r = mir_sdr_AgcControl(mir_sdr_AGC_DISABLE, agcSetPoint, 0, 0, 0, 0, 1);
if (r != mir_sdr_Success)
{
qCritical("SDRPlayInput::start: mir_sdr_AgcControl failed with code %d", (int) r);
}
qDebug("SDRPlayInput::start: sampleRateMHz: %lf frequencyMHz: %lf", sampleRateMHz, frequencyMHz);
mir_sdr_DebugEnable(1);
r = mir_sdr_StreamInit(
&agcSetPoint,
sampleRateMHz,
frequencyMHz,
mir_sdr_BW_1_536,
mir_sdr_IF_Zero,
1, /* LNA */
&infoOverallGr,
0, /* use internal gr tables according to band */
&m_samplesPerPacket,
SDRPlayThread::streamCallback,
SDRPlayInput::callbackGC,
0);
if (r != mir_sdr_Success)
{
qCritical("SDRPlayInput::start: mir_sdr_StreamInit failed with code %d", (int) r);
}
else
{
qDebug("SDRPlayInput::start: Mir stream started: samplesPerPacket: %d", m_samplesPerPacket);
m_mirStreamRunning = true;
m_sdrPlayThread->startWork();
}
applySettings(m_settings, true);
}
void SDRPlayInput::stop()
@ -293,11 +366,11 @@ bool SDRPlayInput::applySettings(const SDRPlaySettings& settings, bool force)
}
}
if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force)
if ((m_settings.m_LOppmCorrection != settings.m_LOppmCorrection) || force)
{
m_settings.m_LOppmTenths = settings.m_LOppmTenths;
m_settings.m_LOppmCorrection = settings.m_LOppmCorrection;
mir_sdr_ErrT r = mir_sdr_SetPpm(m_settings.m_LOppmTenths / 10.0);
mir_sdr_ErrT r = mir_sdr_SetPpm(m_settings.m_LOppmCorrection / 10.0);
if (r != mir_sdr_Success)
{

View File

@ -20,8 +20,9 @@
#include <dsp/devicesamplesource.h>
#include "sdrplaysettings.h"
#include <mirsdrapi-rsp.h>
#include <mirisdr.h>
#include <QString>
#include <stdint.h>
class DeviceSourceAPI;
class SDRPlayThread;
@ -52,14 +53,19 @@ public:
MESSAGE_CLASS_DECLARATION
public:
static MsgReportSDRPlay* create()
const std::vector<int>& getGains() const { return m_gains; }
static MsgReportSDRPlay* create(const std::vector<int>& gains)
{
return new MsgReportSDRPlay();
return new MsgReportSDRPlay(gains);
}
protected:
MsgReportSDRPlay() :
Message()
std::vector<int> m_gains;
MsgReportSDRPlay(const std::vector<int>& gains) :
Message(),
m_gains(gains)
{ }
};
@ -67,7 +73,7 @@ public:
virtual ~SDRPlayInput();
virtual bool init(const Message& message);
virtual bool start(int device);
virtual bool start(uint32_t device);
virtual void stop();
virtual const QString& getDeviceDescription() const;
@ -78,17 +84,14 @@ 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;
QMutex m_mutex;
SDRPlaySettings m_settings;
mirisdr_dev_t* m_dev;
SDRPlayThread* m_sdrPlayThread;
QString m_deviceDescription;
int m_samplesPerPacket;
bool m_mirStreamRunning;
std::vector<int> m_gains;
};
#endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYINPUT_H_ */

View File

@ -27,11 +27,10 @@ SDRPlaySettings::SDRPlaySettings()
void SDRPlaySettings::resetToDefaults()
{
m_centerFrequency = 7040*1000;
m_LOppmTenths = 0;
m_gain = 0;
m_LOppmCorrection = 0;
m_frequencyBandIndex = 0;
m_ifFrequencyIndex = 0;
m_mirDcCorrIndex = 0;
m_mirDcCorrTrackTimeIndex = 1;
m_bandwidthIndex = 0;
m_devSampleRateIndex = 0;
m_gainRedctionIndex = 35;
@ -45,18 +44,17 @@ QByteArray SDRPlaySettings::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_LOppmTenths);
s.writeS32(1, m_LOppmCorrection);
s.writeU32(2, m_frequencyBandIndex);
s.writeU32(3, m_ifFrequencyIndex);
s.writeU32(4, m_mirDcCorrIndex);
s.writeU32(5, m_mirDcCorrTrackTimeIndex);
s.writeU32(6, m_bandwidthIndex);
s.writeU32(7, m_devSampleRateIndex);
s.writeU32(8, m_gainRedctionIndex);
s.writeU32(9, m_log2Decim);
s.writeS32(10, (int) m_fcPos);
s.writeBool(11, m_dcBlock);
s.writeBool(12, m_iqCorrection);
s.writeS32(4, m_gain);
s.writeU32(5, m_bandwidthIndex);
s.writeU32(6, m_devSampleRateIndex);
s.writeU32(7, m_gainRedctionIndex);
s.writeU32(8, m_log2Decim);
s.writeS32(9, (int) m_fcPos);
s.writeBool(10, m_dcBlock);
s.writeBool(11, m_iqCorrection);
return s.final();
}
@ -75,19 +73,18 @@ bool SDRPlaySettings::deserialize(const QByteArray& data)
{
int intval;
d.readS32(1, &m_LOppmTenths, 0);
d.readS32(1, &m_LOppmCorrection, 0);
d.readU32(2, &m_frequencyBandIndex, 0);
d.readU32(3, &m_ifFrequencyIndex, 0);
d.readU32(4, &m_mirDcCorrIndex, 0);
d.readU32(5, &m_mirDcCorrTrackTimeIndex, 1);
d.readU32(6, &m_bandwidthIndex, 0);
d.readU32(7, &m_devSampleRateIndex, 0);
d.readU32(8, &m_gainRedctionIndex, 35);
d.readU32(9, &m_log2Decim, 0);
d.readS32(10, &intval, 0);
d.readS32(4, &m_gain, 0);
d.readU32(5, &m_bandwidthIndex, 0);
d.readU32(6, &m_devSampleRateIndex, 0);
d.readU32(7, &m_gainRedctionIndex, 35);
d.readU32(8, &m_log2Decim, 0);
d.readS32(9, &intval, 0);
m_fcPos = (fcPos_t) intval;
d.readBool(11, &m_dcBlock, false);
d.readBool(12, &m_iqCorrection, false);
d.readBool(10, &m_dcBlock, false);
d.readBool(11, &m_iqCorrection, false);
return true;
}

View File

@ -28,11 +28,10 @@ struct SDRPlaySettings {
} fcPos_t;
uint64_t m_centerFrequency;
int32_t m_LOppmTenths;
qint32 m_gain;
int32_t m_LOppmCorrection;
uint32_t m_frequencyBandIndex;
uint32_t m_ifFrequencyIndex;
uint32_t m_mirDcCorrIndex;
uint32_t m_mirDcCorrTrackTimeIndex;
uint32_t m_bandwidthIndex;
uint32_t m_devSampleRateIndex;
uint32_t m_gainRedctionIndex;