]> git.mxchange.org Git - flightgear.git/commitdiff
Refactor morse and beacon as singleton
authorTorsten Dreyer <Torsten@t3r.de>
Tue, 13 Sep 2011 18:06:31 +0000 (20:06 +0200)
committerTorsten Dreyer <Torsten@t3r.de>
Tue, 13 Sep 2011 18:12:52 +0000 (20:12 +0200)
17 files changed:
projects/VC90/FlightGear/FlightGear.vcproj
src/Instrumentation/adf.cxx
src/Instrumentation/adf.hxx
src/Instrumentation/kr_87.cxx
src/Instrumentation/kr_87.hxx
src/Instrumentation/marker_beacon.cxx
src/Instrumentation/marker_beacon.hxx
src/Instrumentation/navradio.cxx
src/Instrumentation/navradio.hxx
src/Sound/CMakeLists.txt
src/Sound/Makefile.am
src/Sound/beacon.cxx
src/Sound/beacon.hxx
src/Sound/morse.cxx
src/Sound/morse.hxx
src/Sound/soundgenerator.cxx [new file with mode: 0644]
src/Sound/soundgenerator.hxx [new file with mode: 0644]

index c9f3558c81105d2cb0c94cc35e4dfa185cc2e2e9..77d845292c5ea8807dc44568009c6650c5fe86ab 100644 (file)
                                RelativePath="..\..\..\src\Sound\sample_queue.hxx"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\src\Sound\soundgenerator.cxx"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\..\src\Sound\soundgenerator.hxx"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\src\Sound\voice.cxx"\r
                                >\r
index 41ee7700ed9860ce64b730839aad080f3cbdc13a..e3fbac05332aeb61f9dc1d3a6a01f9aa9941aa8d 100644 (file)
@@ -17,6 +17,8 @@
 #include <Navaids/navlist.hxx>
 
 #include "adf.hxx"
+#include <Sound/morse.hxx>
+
 
 #include <iostream>
 #include <string>
@@ -110,8 +112,6 @@ ADF::init ()
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
-    morse.init();
-
     std::ostringstream temp;
     temp << _name << _num;
     _adf_ident = temp.str();
@@ -252,7 +252,7 @@ ADF::search (double frequency_khz, double longitude_rad,
         }
 
         SGSoundSample *sound;
-        sound = morse.make_ident( ident, LO_FREQUENCY );
+        sound = FGMorse::instance()->make_ident( ident, LO_FREQUENCY );
         sound->set_volume(_last_volume = 0);
         _sgr->add( sound, _adf_ident );
 
index 88817a8ee392cb065f31fd5ccdeae326eed87c36..5b1b1667d5a8cbd8e0a1007f5cbf6d76d47356e7 100644 (file)
@@ -16,7 +16,6 @@
 #include <simgear/props/props.hxx>
 
 #include <simgear/structure/subsystem_mgr.hxx>
-#include <Sound/morse.hxx>
 
 using std::string;
 
@@ -93,7 +92,6 @@ private:
     SGVec3d _transmitter_cart;
     double _transmitter_range_nm;
 
-    FGMorse morse;
     int _ident_count;
     time_t _last_ident_time;
     float _last_volume;
index 30c0cbe6694270b0a6fa6ffc034672b4c7d79435..9b91babead8305fb9882a28fede67b2b0a4028de 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "kr_87.hxx"
 
+#include <Sound/morse.hxx>
 #include <string>
 using std::string;
 
@@ -119,7 +120,6 @@ void FGKR_87::init () {
     SGSoundMgr *smgr = globals->get_soundmgr();
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
-    morse.init();
 }
 
 
@@ -534,7 +534,7 @@ void FGKR_87::search() {
                _sgr->remove( "adf-ident" );
            }
            SGSoundSample *sound;
-           sound = morse.make_ident( trans_ident, LO_FREQUENCY );
+        sound = FGMorse::instance()->make_ident( trans_ident, LO_FREQUENCY );
            sound->set_volume( 0.3 );
            _sgr->add( sound, "adf-ident" );
 
index e59beba7b729cc2b6a340f000a8b69ff95b84f13..14accba9f2eeb83d57644883d8ae1b6289d28b85 100644 (file)
 #include <simgear/timing/timestamp.hxx>
 
 #include <Navaids/navlist.hxx>
-#include <Sound/morse.hxx>
 
 class SGSampleGroup;
 
 class FGKR_87 : public SGSubsystem
 {
-    FGMorse morse;
-
     SGPropertyNode_ptr lon_node;
     SGPropertyNode_ptr lat_node;
     SGPropertyNode_ptr alt_node;
index f7945722d1dbd22a0ed7869003eab149ff301e21..5fa56fadef3d3379887e87baee19ba4857f78947 100644 (file)
@@ -34,6 +34,7 @@
 #include <Navaids/navlist.hxx>
 
 #include "marker_beacon.hxx"
+#include <Sound/beacon.hxx>
 
 #include <string>
 using std::string;
@@ -120,8 +121,6 @@ FGMarkerBeacon::init ()
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
-    morse.init();
-    beacon.init();
     blink.stamp();
 
     outer_marker = middle_marker = inner_marker = false;
@@ -317,7 +316,7 @@ void FGMarkerBeacon::search()
             // cout << "OUTER MARKER" << endl;
             if ( last_beacon != OUTER ) {
                 if ( ! _sgr->exists( current_sound_name ) ) {
-                    SGSoundSample *sound = beacon.get_outer();
+                    SGSoundSample *sound = FGBeacon::instance()->get_outer();
                     if ( sound ) {
                         _sgr->add( sound, current_sound_name );
                     }
@@ -336,7 +335,7 @@ void FGMarkerBeacon::search()
             // cout << "MIDDLE MARKER" << endl;
             if ( last_beacon != MIDDLE ) {
                 if ( ! _sgr->exists( current_sound_name ) ) {
-                    SGSoundSample *sound = beacon.get_middle();
+                    SGSoundSample *sound = FGBeacon::instance()->get_middle();
                     if ( sound ) {
                         _sgr->add( sound, current_sound_name );
                     }
@@ -355,7 +354,7 @@ void FGMarkerBeacon::search()
             // cout << "INNER MARKER" << endl;
             if ( last_beacon != INNER ) {
                 if ( ! _sgr->exists( current_sound_name ) ) {
-                    SGSoundSample *sound = beacon.get_inner();
+                    SGSoundSample *sound = FGBeacon::instance()->get_inner();
                     if ( sound ) {
                         _sgr->add( sound, current_sound_name );
                     }
index 25e435feae4b4d93d96e49e4bfd8a25b1f48d118..52259b6a2c49ced3ed2a6dbb75a417e3ea911eb7 100644 (file)
 #include <simgear/math/interpolater.hxx>
 #include <simgear/timing/timestamp.hxx>
 
-#include <Sound/beacon.hxx>
-#include <Sound/morse.hxx>
-
 class SGSampleGroup;
 
 class FGMarkerBeacon : public SGSubsystem
 {
-    FGBeacon beacon;
-    FGMorse morse;
-
     SGInterpTable *term_tbl;
     SGInterpTable *low_tbl;
     SGInterpTable *high_tbl;
index 780094c42a8eca78df33681a69a2f38329159dbb..886ad1f373c0096a68c447fcd7eacfa74afab08c 100644 (file)
@@ -44,6 +44,7 @@
 #include <Airports/runways.hxx>
 #include <Navaids/navlist.hxx>
 #include <Main/util.hxx>
+#include <Sound/morse.hxx>
 
 
 using std::string;
@@ -175,8 +176,6 @@ FGNavRadio::init ()
     _sgr = smgr->find("avionics", true);
     _sgr->tie_to_listener();
 
-    morse.init();
-
     SGPropertyNode* node = _radio_node.get();
     bus_power_node = 
        fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
@@ -1014,7 +1013,7 @@ void FGNavRadio::audioNavidChanged()
   
   try {
     string trans_ident(_navaid->get_trans_ident());
-    SGSoundSample* sound = morse.make_ident(trans_ident, LO_FREQUENCY);
+    SGSoundSample* sound = FGMorse::instance()->make_ident(trans_ident, LO_FREQUENCY);
     sound->set_volume( 0.3 );
     if (!_sgr->add( sound, nav_fx_name )) {
       SG_LOG(SG_COCKPIT, SG_WARN, "Failed to add v1-vor-ident sound");
@@ -1024,7 +1023,7 @@ void FGNavRadio::audioNavidChanged()
       _sgr->remove( dme_fx_name );
     }
      
-    sound = morse.make_ident( trans_ident, HI_FREQUENCY );
+    sound = FGMorse::instance()->make_ident( trans_ident, HI_FREQUENCY );
     sound->set_volume( 0.3 );
     _sgr->add( sound, dme_fx_name );
 
index 96621b6d0cd207bc6662a2500d90fec6c3c5e571..4b2e16918dde9ec5a08db85c84bc202713424646 100644 (file)
@@ -26,7 +26,6 @@
 
 
 #include <Main/fg_props.hxx>
-#include "Sound/morse.hxx"
 
 #include <simgear/compiler.h>
 #include <simgear/structure/subsystem_mgr.hxx>
@@ -41,8 +40,6 @@ typedef SGSharedPtr<FGNavRecord> FGNavRecordPtr;
 
 class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
 {
-    FGMorse morse;
-
     SGInterpTable *term_tbl;
     SGInterpTable *low_tbl;
     SGInterpTable *high_tbl;
index 29a1d485402429341dfb86b237f397ac8719f592..28cc5bf8cde9f12a086d604073d27cd239989cd1 100644 (file)
@@ -1,6 +1,7 @@
 include(FlightGearComponent)
 
 set(SOURCES
+       soundgenerator.cxx
        beacon.cxx
        fg_fx.cxx
        morse.cxx
@@ -10,6 +11,7 @@ set(SOURCES
        )
 
 set(HEADERS
+       soundgenerator.hxx
        beacon.hxx
        fg_fx.hxx
        morse.hxx
@@ -18,4 +20,4 @@ set(HEADERS
        voiceplayer.hxx
        )
                
-flightgear_component(Sound "${SOURCES}" "${HEADERS}")
\ No newline at end of file
+flightgear_component(Sound "${SOURCES}" "${HEADERS}")
index e6799c233b4ec9ed1067550c3719549fc1e871f9..893b776d21f1ea31b08f1c042dc6be0a3ccef4ab 100644 (file)
@@ -1,6 +1,7 @@
 noinst_LIBRARIES = libSound.a
 
 libSound_a_SOURCES = \
+       soundgenerator.cxx soundgenerator.hxx \
        beacon.cxx beacon.hxx \
        fg_fx.cxx fg_fx.hxx \
        morse.cxx morse.hxx \
index de9a98915131516c05952013a89cf93b32a889f1..9d7a1a18452885c93c825132c14732704564100f 100644 (file)
@@ -18,8 +18,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
-// $Id$
-
 
 #include <stdlib.h>
 #include <cstring>
@@ -104,3 +102,14 @@ bool FGBeacon::init() {
 
     return true;
 }
+
+FGBeacon * FGBeacon::_instance = NULL;\r
+\r
+FGBeacon * FGBeacon::instance()\r
+{\r
+    if( _instance == NULL ) {\r
+        _instance = new FGBeacon();\r
+        _instance->init();\r
+    }\r
+    return _instance;\r
+}\r
index d0c37d6974809bdf4b1d9944fb78055d3db7e638..c60f4822554b9aa780cc7f7673d6cac245c57246 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
-// $Id$
-
 
 #ifndef _BEACON_HXX
 #define _BEACON_HXX
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include "soundgenerator.hxx"
 
 #include <simgear/compiler.h>
 #include <simgear/sound/soundmgr_openal.hxx>
 #include <simgear/structure/SGReferenced.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
 
-#include "morse.hxx"
-
-
 // Quoting from http://www.smartregs.com/data/sa326.htm
 // Smart REGS Glossary - marker beacon
 // 
 // (See instrument landing system) (Refer to AIM.)
 
 
-static const int INNER_FREQ = 3000;
-static const int MIDDLE_FREQ = 1300;
-static const int OUTER_FREQ = 400;
-
-static const int INNER_SIZE = BYTES_PER_SECOND;
-static const int MIDDLE_SIZE = (int)(BYTES_PER_SECOND * 60 / 95 );
-static const int OUTER_SIZE = BYTES_PER_SECOND;
-
-static const int INNER_DIT_LEN = (int)(BYTES_PER_SECOND / 6.0);
-static const int MIDDLE_DIT_LEN = (int)(MIDDLE_SIZE / 3.0);
-static const int MIDDLE_DAH_LEN = (int)(MIDDLE_SIZE * 2 / 3.0);
-static const int OUTER_DAH_LEN = (int)(BYTES_PER_SECOND / 2.0);
-
 // manages everything we need to know for an individual sound sample
-class FGBeacon {
+class FGBeacon : public FGSoundGenerator {
 
 private:
+    static const int INNER_FREQ = 3000;
+    static const int MIDDLE_FREQ = 1300;
+    static const int OUTER_FREQ = 400;
+
+    static const int INNER_SIZE = BYTES_PER_SECOND;
+    static const int MIDDLE_SIZE = (int)(BYTES_PER_SECOND * 60 / 95 );
+    static const int OUTER_SIZE = BYTES_PER_SECOND;
+
+    static const int INNER_DIT_LEN = (int)(BYTES_PER_SECOND / 6.0);
+    static const int MIDDLE_DIT_LEN = (int)(MIDDLE_SIZE / 3.0);
+    static const int MIDDLE_DAH_LEN = (int)(MIDDLE_SIZE * 2 / 3.0);
+    static const int OUTER_DAH_LEN = (int)(BYTES_PER_SECOND / 2.0);
 
     SGSharedPtr<SGSoundSample> inner;
     SGSharedPtr<SGSoundSample> middle;
     SGSharedPtr<SGSoundSample> outer;
 
+    // allocate and initialize sound samples
+    bool init();
+    static FGBeacon * _instance;
 public:
 
     FGBeacon();
     ~FGBeacon();
-
-    // allocate and initialize sound samples
-    bool init();
+    static FGBeacon * instance();
 
     SGSoundSample *get_inner() { return inner; }
     SGSoundSample *get_middle() { return middle; }
index 7ae7cac98871672cd553aaca2d2b6ac83e18682e..9ff603322b8452ddb4451f3fb25e900265ffe47b 100644 (file)
@@ -18,7 +18,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
-// $Id$
 
 
 #include <simgear/constants.h>
@@ -79,44 +78,6 @@ FGMorse::~FGMorse() {
 }
 
 
-// Make a tone of specified freq and total_len with trans_len ramp in
-// and out and only the first len bytes with sound, the rest with
-// silence
-void make_tone( unsigned char *buf, int freq, 
-               int len, int total_len, int trans_len )
-{
-    int i, j;
-
-    for ( i = 0; i < trans_len; ++i ) {
-       float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
-           * ((double)i / trans_len) / 2.0 + 0.5;
-
-       /* Convert to unsigned byte */
-       buf[ i ] = (unsigned char) ( level * 255.0 ) ;
-    }
-
-    for ( i = trans_len; i < len - trans_len; ++i ) {
-       float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
-           / 2.0 + 0.5;
-
-       /* Convert to unsigned byte */
-       buf[ i ] = (unsigned char) ( level * 255.0 ) ;
-    }
-    j = trans_len;
-    for ( i = len - trans_len; i < len; ++i ) {
-       float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
-           * ((double)j / trans_len) / 2.0 + 0.5;
-       --j;
-
-       /* Convert to unsigned byte */
-       buf[ i ] = (unsigned char) ( level * 255.0 ) ;
-    }
-    for ( i = len; i < total_len; ++i ) {
-       buf[ i ] = (unsigned char) ( 0.5 * 255.0 ) ;
-    }
-}
-
-
 // allocate and initialize sound samples
 bool FGMorse::init() {
     // Make Low DIT
@@ -270,3 +231,14 @@ SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) {
 
     return sample;
 }
+
+FGMorse * FGMorse::_instance = NULL;
+
+FGMorse * FGMorse::instance()
+{
+    if( _instance == NULL ) {
+        _instance = new FGMorse();
+        _instance->init();
+    }
+    return _instance;
+}
index c6ed5a43b750411b62ad20b1a3c89198206d69ea..3d8b9dfbb113345e1bb63e25371ece45ee4c27e6 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
-// $Id$
 
 
 #ifndef _MORSE_HXX
 #define _MORSE_HXX
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
+#include "soundgenerator.hxx"
 #include <simgear/compiler.h>
 #include <simgear/sound/soundmgr_openal.hxx>
 
@@ -97,7 +93,7 @@ static const int LO_FREQUENCY = 1020;  // AIM 1-1-7 (f) specified in Hz
 static const int HI_FREQUENCY = 1350;   // AIM 1-1-7 (f) specified in Hz
 
 // manages everything we need to know for an individual sound sample
-class FGMorse {
+class FGMorse : public FGSoundGenerator {
 
 private:
 
@@ -110,15 +106,18 @@ private:
     unsigned char cust_dit[ DIT_SIZE ] ;
     unsigned char cust_dah[ DAH_SIZE ] ;
 
+    static FGMorse * _instance;
+
     bool cust_init( const int freq );
+    // allocate and initialize sound samples
+    bool init();
 
 public:
 
     FGMorse();
     ~FGMorse();
 
-    // allocate and initialize sound samples
-    bool init();
+    static FGMorse * instance();
 
     // make a SimpleSound morse code transmission for the specified string
     SGSoundSample *make_ident( const string& id,
@@ -126,20 +125,6 @@ public:
 };
 
 
-/**
- * \relates FGMorse
- * Make a tone of specified freq and total_len with trans_len ramp in
- * and out and only the first len bytes with sound, the rest with
- * silence.
- * @param buf unsigned char pointer to sound buffer
- * @param freq desired frequency of tone
- * @param len length of tone within sound
- * @param total_len total length of sound (anything more than len is padded
- *        with silence.
- * @param trans_len length of ramp up and ramp down to avoid audio "pop"
- */
-void make_tone( unsigned char *buf, int freq, 
-               int len, int total_len, int trans_len );
 
 #endif // _MORSE_HXX
 
diff --git a/src/Sound/soundgenerator.cxx b/src/Sound/soundgenerator.cxx
new file mode 100644 (file)
index 0000000..0f5743e
--- /dev/null
@@ -0,0 +1,64 @@
+// soundgenerator.cxx -- simple sound generation \r
+//\r
+// Written by Curtis Olson, started March 2001.\r
+//\r
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt\r
+//\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License as\r
+// published by the Free Software Foundation; either version 2 of the\r
+// License, or (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful, but\r
+// WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+// General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
+//\r
+\r
+#include "soundgenerator.hxx"\r
+#include <simgear/constants.h>\r
+\r
+FGSoundGenerator::~FGSoundGenerator()\r
+{\r
+}\r
+\r
+// Make a tone of specified freq and total_len with trans_len ramp in\r
+// and out and only the first len bytes with sound, the rest with\r
+// silence\r
+void FGSoundGenerator::make_tone( unsigned char *buf, int freq, \r
+               int len, int total_len, int trans_len )\r
+{\r
+    int i, j;\r
+\r
+    for ( i = 0; i < trans_len; ++i ) {\r
+        float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )\r
+            * ((double)i / trans_len) / 2.0 + 0.5;\r
+\r
+        /* Convert to unsigned byte */\r
+        buf[ i ] = (unsigned char) ( level * 255.0 ) ;\r
+    }\r
+\r
+    for ( i = trans_len; i < len - trans_len; ++i ) {\r
+        float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )\r
+            / 2.0 + 0.5;\r
+\r
+        /* Convert to unsigned byte */\r
+        buf[ i ] = (unsigned char) ( level * 255.0 ) ;\r
+    }\r
+    j = trans_len;\r
+    for ( i = len - trans_len; i < len; ++i ) {\r
+        float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )\r
+            * ((double)j / trans_len) / 2.0 + 0.5;\r
+        --j;\r
+\r
+        /* Convert to unsigned byte */\r
+        buf[ i ] = (unsigned char) ( level * 255.0 ) ;\r
+    }\r
+    for ( i = len; i < total_len; ++i ) {\r
+        buf[ i ] = (unsigned char) ( 0.5 * 255.0 ) ;\r
+    }\r
+}\r
diff --git a/src/Sound/soundgenerator.hxx b/src/Sound/soundgenerator.hxx
new file mode 100644 (file)
index 0000000..fa600f3
--- /dev/null
@@ -0,0 +1,67 @@
+// soundgenerator.hxx -- simple sound generation \r
+//\r
+// Written by Curtis Olson, started March 2001.\r
+//\r
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt\r
+//\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License as\r
+// published by the Free Software Foundation; either version 2 of the\r
+// License, or (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful, but\r
+// WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+// General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
+//\r
+\r
+\r
+#ifndef _FGSOUNDGENERATOR_HXX\r
+#define _FGSOUNDGENERATOR_HXX\r
+\r
+#ifdef HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
+class FGSoundGenerator {\r
+\r
+public:\r
+    static const int BYTES_PER_SECOND = 22050;\r
+    // static const int BEAT_LENGTH = 240; // milleseconds (5 wpm)\r
+    static const int BEAT_LENGTH = 92;  // milleseconds (13 wpm)\r
+    static const int TRANSITION_BYTES = (int)(0.005 * BYTES_PER_SECOND);\r
+    static const int COUNT_SIZE = BYTES_PER_SECOND * BEAT_LENGTH / 1000;\r
+    static const int DIT_SIZE = 2 * COUNT_SIZE;   // 2 counts\r
+    static const int DAH_SIZE = 4 * COUNT_SIZE;   // 4 counts\r
+    static const int SPACE_SIZE = 3 * COUNT_SIZE; // 3 counts\r
+    static const int LO_FREQUENCY = 1020;       // AIM 1-1-7 (f) specified in Hz\r
+    static const int HI_FREQUENCY = 1350;       // AIM 1-1-7 (f) specified in Hz\r
+\r
+protected:\r
+    /**\r
+    * \relates FGMorse\r
+    * Make a tone of specified freq and total_len with trans_len ramp in\r
+    * and out and only the first len bytes with sound, the rest with\r
+    * silence.\r
+    * @param buf unsigned char pointer to sound buffer\r
+    * @param freq desired frequency of tone\r
+    * @param len length of tone within sound\r
+    * @param total_len total length of sound (anything more than len is padded\r
+    *        with silence.\r
+    * @param trans_len length of ramp up and ramp down to avoid audio "pop"\r
+    */\r
+    static void make_tone( unsigned char *buf, int freq, \r
+        int len, int total_len, int trans_len );\r
+\r
+public:\r
+\r
+    virtual ~FGSoundGenerator();\r
+};\r
+\r
+\r
+\r
+#endif // _FGSOUNDGENERATOR_HXX\r