X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSound%2Fbeacon.cxx;h=4505017c93da03183788ebd3b2dbbf60b44b96b4;hb=8b57675aef4930245a964816469be922e3004287;hp=497cbf03277ee37a143b1aef485e50b5bb21a9e3;hpb=6e2974ea570da0f6d4d671b2410bea1383fc630c;p=flightgear.git diff --git a/src/Sound/beacon.cxx b/src/Sound/beacon.cxx index 497cbf032..4505017c9 100644 --- a/src/Sound/beacon.cxx +++ b/src/Sound/beacon.cxx @@ -21,7 +21,7 @@ // $Id$ -#include +#include #include "beacon.hxx" @@ -39,13 +39,12 @@ FGBeacon::~FGBeacon() { // allocate and initialize sound samples bool FGBeacon::init() { - int i; - int len; unsigned char *ptr; + size_t i, len; - std::auto_ptrinner_buf( new unsigned char[ INNER_SIZE ] ); - std::auto_ptrmiddle_buf( new unsigned char[ MIDDLE_SIZE ] ); - std::auto_ptrouter_buf( new unsigned char[ OUTER_SIZE ] ); + const unsigned char* inner_buf = (const unsigned char*)malloc( INNER_SIZE ); + const unsigned char* middle_buf = (const unsigned char*)malloc(MIDDLE_SIZE); + const unsigned char* outer_buf = (const unsigned char*)malloc( OUTER_SIZE ); // Make inner marker beacon sound len= (int)(INNER_DIT_LEN / 2.0 ); @@ -53,14 +52,14 @@ bool FGBeacon::init() { make_tone( inner_dit, INNER_FREQ, len, INNER_DIT_LEN, TRANSITION_BYTES ); - ptr = inner_buf.get(); + ptr = (unsigned char*)inner_buf; for ( i = 0; i < 6; ++i ) { memcpy( ptr, inner_dit, INNER_DIT_LEN ); ptr += INNER_DIT_LEN; } try { - inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND ); + inner = new SGSoundSample( &inner_buf, INNER_SIZE, BYTES_PER_SECOND ); inner->set_reference_dist( 10.0 ); inner->set_max_dist( 20.0 ); @@ -75,12 +74,12 @@ bool FGBeacon::init() { make_tone( middle_dah, MIDDLE_FREQ, len, MIDDLE_DAH_LEN, TRANSITION_BYTES ); - ptr = middle_buf.get(); + ptr = (unsigned char*)middle_buf; memcpy( ptr, middle_dit, MIDDLE_DIT_LEN ); ptr += MIDDLE_DIT_LEN; memcpy( ptr, middle_dah, MIDDLE_DAH_LEN ); - middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND ); + middle = new SGSoundSample( &middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND); middle->set_reference_dist( 10.0 ); middle->set_max_dist( 20.0 ); @@ -90,12 +89,12 @@ bool FGBeacon::init() { make_tone( outer_dah, OUTER_FREQ, len, OUTER_DAH_LEN, TRANSITION_BYTES ); - ptr = outer_buf.get(); + ptr = (unsigned char*)outer_buf; memcpy( ptr, outer_dah, OUTER_DAH_LEN ); 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 ); } catch ( sg_io_exception &e ) {