]> git.mxchange.org Git - flightgear.git/blob - src/Sound/beacon.hxx
- Added "SG" prefix to sound classes that recently moved to SimGear.
[flightgear.git] / src / Sound / beacon.hxx
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 - curt@flightgear.org
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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 //
23 // $Id$
24
25
26 #ifndef _BEACON_HXX
27 #define _BEACON_HXX
28
29 #ifdef HAVE_CONFIG_H
30 #  include <config.h>
31 #endif
32
33 #include <simgear/compiler.h>
34 #include <simgear/sound/soundmgr.hxx>
35
36 #include <plib/sl.h>
37 #include <plib/sm.h>
38
39 #include "morse.hxx"
40
41
42 // Quoting from http://www.smartregs.com/data/sa326.htm
43 // Smart REGS Glossary - marker beacon
44 // 
45 // An electronic navigation facility transmitting a 75 MHz vertical fan
46 // or boneshaped radiation pattern.  Marker beacons are identified by
47 // their modulation frequency and keying code, and when received by
48 // compatible airborne equipment, indicate to the pilot, both aurally
49 // and visually, that he is passing over the facility.
50 // (See outer marker middle marker inner marker.)
51 // 
52 // Smart REGS Glossary - outer marker
53 // 
54 // A marker beacon at or near the glideslope intercept altitude of an
55 // ILS approach.  It is keyed to transmit two dashes per second on a
56 // 400 Hz tone, which is received aurally and visually by compatible
57 // airborne equipment.  The OM is normally located four to seven miles from
58 // the runway threshold on the extended centerline of the runway.
59 // 
60 // Smart REGS Glossary - middle marker
61 // 
62 // A marker beacon that defines a point along the glideslope of an
63 // ILS normally located at or near the point of decision height
64 // (ILS Category I).  It is keyed to transmit alternate dots and dashes,
65 // with the alternate dots and dashes keyed at the rate of 95 dot/dash
66 // combinations per minute on a 1300 Hz tone, which is received
67 // aurally and visually by compatible airborne equipment.
68 // 
69 // Smart REGS Glossary - inner marker
70 // 
71 // A marker beacon used with an ILS (CAT II) precision approach located
72 // between the middle marker and the end of the ILS runway,
73 // transmitting a radiation pattern keyed at six dots per second and
74 // indicating to the pilot, both aurally and visually, that he is at
75 // the designated decision height (DH), normally 100 feet above the
76 // touchdown zone elevation, on the ILS CAT II approach.  It also marks
77 // progress during a CAT III approach.
78 // (See instrument landing system) (Refer to AIM.)
79
80
81 static const int INNER_FREQ = 3000;
82 static const int MIDDLE_FREQ = 1300;
83 static const int OUTER_FREQ = 400;
84
85 static const int INNER_SIZE = BYTES_PER_SECOND;
86 static const int MIDDLE_SIZE = (int)(BYTES_PER_SECOND * 60 / 95 );
87 static const int OUTER_SIZE = BYTES_PER_SECOND;
88
89 static const int INNER_DIT_LEN = (int)(BYTES_PER_SECOND / 6.0);
90 static const int MIDDLE_DIT_LEN = (int)(MIDDLE_SIZE / 3.0);
91 static const int MIDDLE_DAH_LEN = (int)(MIDDLE_SIZE * 2 / 3.0);
92 static const int OUTER_DAH_LEN = (int)(BYTES_PER_SECOND / 2.0);
93
94 // manages everything we need to know for an individual sound sample
95 class FGBeacon {
96
97 private:
98
99     unsigned char inner_buf[ INNER_SIZE ] ;
100     unsigned char middle_buf[ MIDDLE_SIZE ] ;
101     unsigned char outer_buf[ OUTER_SIZE ] ;
102
103     SGSimpleSound *inner;
104     SGSimpleSound *middle;
105     SGSimpleSound *outer;
106
107 public:
108
109     FGBeacon();
110     ~FGBeacon();
111
112     // allocate and initialize sound samples
113     bool init();
114
115     SGSimpleSound *get_inner() { return inner; }
116     SGSimpleSound *get_middle() { return middle; }
117     SGSimpleSound *get_outer() { return outer; }
118    
119 };
120
121
122
123 #endif // _BEACON_HXX
124
125