]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/morse.hxx
Added two missing files from JSBSim.org that were missing in the last sync.
[flightgear.git] / src / Sound / morse.hxx
index 658b54db9edf310f6c2e9dbd73c10315f8647ad7..f01d45b1279459ee99c8fe0f9620761cc71a7e92 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started March 2001.
 //
-// Copyright (C) 2001  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 #endif
 
 #include <simgear/compiler.h>
-
-#include <plib/sl.h>
-#include <plib/sm.h>
-
-#include "soundmgr.hxx"
+#include <simgear/sound/soundmgr_openal.hxx>
 
 
 // Quoting from http://www.kluft.com/~ikluft/ham/morse-intro.html by
@@ -89,7 +85,7 @@ static const char DA = '2';
 static const char DAH = '2';
 static const char end = '0';
 
-static const int BYTES_PER_SECOND = 8000;
+static const int BYTES_PER_SECOND = 22050;
 // static const int BEAT_LENGTH = 240; // milleseconds (5 wpm)
 static const int BEAT_LENGTH = 92;  // milleseconds (13 wpm)
 static const int TRANSITION_BYTES = (int)(0.005 * BYTES_PER_SECOND);
@@ -124,12 +120,27 @@ public:
     // allocate and initialize sound samples
     bool init();
 
-    // make a FGSimpleSound morse code transmission for the specified string
-    FGSimpleSound *make_ident( const string& id,
-                              const int freq = LO_FREQUENCY );
+    // make a SimpleSound morse code transmission for the specified string
+    SGSoundSample *make_ident( const string& id,
+                               const int freq = LO_FREQUENCY );
 };
 
 
+/**
+ * \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