Debian Codegraph @

src/Sound/beacon.hxx

raw symbols SCIP
1 /**
2 * \file beacon.hxx -- Provides marker beacon audio generation.
3 */
4
5 // Written by Curtis Olson, started March 2001.
6 //
7 // Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23
24 #ifndef _BEACON_HXX
25 #define _BEACON_HXX
26
27 #include <array>
28
29 #include "soundgenerator.hxx"
30
31 #include <simgear/compiler.h>
32 #include <simgear/sound/soundmgr.hxx>
33 #include <simgear/structure/SGReferenced.hxx>
34 #include <simgear/structure/SGSharedPtr.hxx>
35
36 // Quoting from http://www.smartregs.com/data/sa326.htm
37 // Smart REGS Glossary - marker beacon
38 //
39 // An electronic navigation facility transmitting a 75 MHz vertical fan
40 // or boneshaped radiation pattern. Marker beacons are identified by
41 // their modulation frequency and keying code, and when received by
42 // compatible airborne equipment, indicate to the pilot, both aurally
43 // and visually, that he is passing over the facility.
44 // (See outer marker middle marker inner marker.)
45 //
46 // Smart REGS Glossary - outer marker
47 //
48 // A marker beacon at or near the glideslope intercept altitude of an
49 // ILS approach. It is keyed to transmit two dashes per second on a
50 // 400 Hz tone, which is received aurally and visually by compatible
51 // airborne equipment. The OM is normally located four to seven miles from
52 // the runway threshold on the extended centerline of the runway.
53 //
54 // Smart REGS Glossary - middle marker
55 //
56 // A marker beacon that defines a point along the glideslope of an
57 // ILS normally located at or near the point of decision height
58 // (ILS Category I). It is keyed to transmit alternate dots and dashes,
59 // with the alternate dots and dashes keyed at the rate of 95 dot/dash
60 // combinations per minute on a 1300 Hz tone, which is received
61 // aurally and visually by compatible airborne equipment.
62 //
63 // Smart REGS Glossary - inner marker
64 //
65 // A marker beacon used with an ILS (CAT II) precision approach located
66 // between the middle marker and the end of the ILS runway,
67 // transmitting a radiation pattern keyed at six dots per second and
68 // indicating to the pilot, both aurally and visually, that he is at
69 // the designated decision height (DH), normally 100 feet above the
70 // touchdown zone elevation, on the ILS CAT II approach. It also marks
71 // progress during a CAT III approach.
72 // (See instrument landing system) (Refer to AIM.)
73
74
75 // manages everything we need to know for an individual sound sample
76 class FGBeacon : public FGSoundGenerator {
77
78 private:
79 static const int INNER_FREQ = 3000;
80 static const int MIDDLE_FREQ = 1300;
81 static const int OUTER_FREQ = 400;
82
83 static const int INNER_SIZE = BYTES_PER_SECOND;
84 static const int MIDDLE_SIZE = (int)(BYTES_PER_SECOND * 60 / 95 );
85 static const int OUTER_SIZE = BYTES_PER_SECOND;
86
87 static const int INNER_DIT_LEN = (int)(BYTES_PER_SECOND / 6);
88 static const int MIDDLE_DIT_LEN = (int)(MIDDLE_SIZE / 3);
89 static const int MIDDLE_DAH_LEN = (int)(MIDDLE_SIZE * 2 / 3);
90 static const int OUTER_DAH_LEN = (int)(BYTES_PER_SECOND / 2);
91
92 SGSharedPtr<SGSoundSample> inner;
93 SGSharedPtr<SGSoundSample> middle;
94 SGSharedPtr<SGSoundSample> outer;
95
96 // allocate and initialize sound samples
97 bool init();
98 static FGBeacon * _instance;
99 public:
100
101 FGBeacon();
102 ~FGBeacon();
103 static FGBeacon * instance();
104
105 SGSoundSample *get_inner() { return inner; }
106 SGSoundSample *get_middle() { return middle; }
107 SGSoundSample *get_outer() { return outer; }
108
109 struct BeaconTiming {
110 uint64_t durationUSec;
111 std::array<uint64_t, 4> periodsUSec;
112 };
113
114 BeaconTiming getTimingForInner() const;
115 BeaconTiming getTimingForMiddle() const;
116 BeaconTiming getTimingForOuter() const;
117 };
118
119
120
121 #endif // _BEACON_HXX
122
123