//
// 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
//
// 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$
#include <simgear/constants.h>
+#include <Main/globals.hxx>
+
#include "morse.hxx"
int i, j;
for ( i = 0; i < trans_len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
+ float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
* ((double)i / trans_len) / 2.0 + 0.5;
/* Convert to unsigned byte */
}
for ( i = trans_len; i < len - trans_len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
+ float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
/ 2.0 + 0.5;
/* Convert to unsigned byte */
}
j = trans_len;
for ( i = len - trans_len; i < len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
+ float level = ( sin( (double) i * SGD_2PI / (BYTES_PER_SECOND / freq) ) )
* ((double)j / trans_len) / 2.0 + 0.5;
--j;
// make a SGSoundSample morse code transmission for the specified string
SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) {
+
+ if (globals->get_soundmgr()->is_working() == false) {
+ return 0;
+ }
+
char *idptr = (char *)id.c_str();
int length = 0;
SGSoundSample *sample = new SGSoundSample( buffer, length,
BYTES_PER_SECOND );
+ // clean up the buffer
+ delete [] buffer;
+
+ sample->set_reference_dist( 10.0 );
+ sample->set_max_dist( 20.0 );
+
return sample;
}