Repository navigation
Expand file tree
/
Copy pathtdconf.cpp
More file actions
111 lines (93 loc) · 2.41 KB
/
Copy pathtdconf.cpp
File metadata and controls
111 lines (93 loc) · 2.41 KB
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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <QtGlobal>
#include <QDebug>
#include "tdconf.h"
static int defchmap[9] = { 7, 6, 5, 4, 3, 2, 1, 0, 8 };
// --------------------------------------------------------------------------
TDConf::TDConf()
{
format = F_NRZ1;
bpi = 800;
sampling_speed = 1.0f;
tape_speed = 50;
updateFctob();
qCopy(defchmap, defchmap+9, chmap);
deskew = bpl * 0.6;
deskew_auto = true;
edge_sens = EDGE_RISING;
glitch_single = true;
glitch_max = 2;
glitch_distance = 2;
realign_margin = 0;
realign_push = 0;
unscatter_auto = true;
qFill(unscatter, unscatter+9, 0);
unscatter_fixed = 0;
pe_mark_pulses_min = 40;
pe_sync_pulses_min = 25;
pe_bpl_margin = 0.4;
}
// format => fctob => fcpi => BPL => deskew
// bpi ============/ /
// tape_speed ============/
// sampling_speed =======/
// --------------------------------------------------------------------------
void TDConf::updateFctob()
{
fctob_ratio = format == F_PE ? 2 : 1;
updateFcpi();
}
// --------------------------------------------------------------------------
void TDConf::updateFcpi()
{
fcpi = fctob_ratio * bpi;
updateBPL();
}
// --------------------------------------------------------------------------
void TDConf::updateBPL()
{
bpl = qRound((1000000.0f * (double) sampling_speed) / ((double) fcpi * (double) tape_speed));
updateDeskew();
}
// --------------------------------------------------------------------------
void TDConf::updateDeskew()
{
deskew = 0.2 * bpl;
}
// --------------------------------------------------------------------------
void TDConf::updateBPI()
{
fcpi = qRound((1000000.0f * (double) sampling_speed) / ((double) bpl * (double) tape_speed));
bpi = fcpi / fctob_ratio;
}
// --------------------------------------------------------------------------
void TDConf::setFormat(Encoding f)
{
format = f;
updateFctob();
}
// --------------------------------------------------------------------------
void TDConf::setBPI(int b)
{
bpi = b;
updateFcpi();
}
// --------------------------------------------------------------------------
void TDConf::setSamplingSpeed(int s)
{
sampling_speed = s;
updateBPL();
}
// --------------------------------------------------------------------------
void TDConf::setTapeSpeed(int s)
{
tape_speed = s;
updateBPL();
}
// --------------------------------------------------------------------------
void TDConf::setBPL(int b)
{
bpl = b;
updateBPI();
updateDeskew();
}
// vim: tabstop=4 shiftwidth=4 autoindent