]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/beacon.cxx
Update 'magic' for more consistant cross platform padding.
[flightgear.git] / src / Sound / beacon.cxx
index 6fad631e581a69a0e4d9a331f50eadaaf9f6ba0a..ddc8750b0f828e60b17a6a068f916e71e5fbe444 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
 
 
 // constructor
-FGBeacon::FGBeacon() {
+FGBeacon::FGBeacon() :
+    inner(NULL),
+    middle(NULL),
+    outer(NULL)
+{
 }
 
 // destructor
 FGBeacon::~FGBeacon() {
+    delete inner;
+    delete middle;
+    delete outer;
 }
 
 
@@ -39,6 +46,10 @@ bool FGBeacon::init() {
     int len;
     unsigned char *ptr;
 
+    unsigned char inner_buf[ INNER_SIZE ] ;
+    unsigned char middle_buf[ MIDDLE_SIZE ] ;
+    unsigned char outer_buf[ OUTER_SIZE ] ;
+
     // Make inner marker beacon sound
     len= (int)(INNER_DIT_LEN / 2.0 );
     unsigned char inner_dit[INNER_DIT_LEN];
@@ -52,6 +63,8 @@ bool FGBeacon::init() {
     }
 
     inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND );
+    inner->set_reference_dist( 10.0 );
+    inner->set_max_dist( 20.0 );
 
     // Make middle marker beacon sound
     len= (int)(MIDDLE_DIT_LEN / 2.0 );
@@ -70,6 +83,8 @@ bool FGBeacon::init() {
     memcpy( ptr, middle_dah, MIDDLE_DAH_LEN );
 
     middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND );
+    middle->set_reference_dist( 10.0 );
+    middle->set_max_dist( 20.0 );
 
     // Make outer marker beacon sound
     len= (int)(OUTER_DAH_LEN * 3.0 / 4.0 );
@@ -82,7 +97,9 @@ bool FGBeacon::init() {
     ptr += OUTER_DAH_LEN;
     memcpy( ptr, outer_dah, OUTER_DAH_LEN );
 
-    outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND );
+    outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND);
+    outer->set_reference_dist( 10.0 );
+    outer->set_max_dist( 20.0 );
 
     return true;
 }