int i, j;
for ( i = 0; i < trans_len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (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 / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (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 / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
* ((double)j / trans_len) / 2.0 + 0.5;
--j;
}
-// make a SGSimpleSound morse code transmission for the specified string
-SGSimpleSound *FGMorse::make_ident( const string& id, const int freq ) {
+// make a SGSoundSample morse code transmission for the specified string
+SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) {
char *idptr = (char *)id.c_str();
int length = 0;
buf_ptr += SPACE_SIZE;
// 4. create the simple sound and return
- SGSimpleSound *sample = new SGSimpleSound( buffer, length );
+ SGSoundSample *sample = new SGSoundSample( buffer, length,
+ BYTES_PER_SECOND );
return sample;
}