FlightGear next
soundgenerator.hxx
Go to the documentation of this file.
1// soundgenerator.hxx -- simple sound generation
2//
3// Written by Curtis Olson, started March 2001.
4//
5// Copyright (C) 2001 Curtis L. Olson - http://www.flightgear.org/~curt
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public License as
9// published by the Free Software Foundation; either version 2 of the
10// License, or (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15// General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20//
21
22
23#ifndef _FGSOUNDGENERATOR_HXX
24#define _FGSOUNDGENERATOR_HXX
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
31
32public:
33 static const int BYTES_PER_SECOND = 22050;
34 // static const int BEAT_LENGTH = 240; // milleseconds (5 wpm)
35 static const int BEAT_LENGTH = 92; // milleseconds (13 wpm)
36 static const int TRANSITION_BYTES = BYTES_PER_SECOND/200; // aka (int)(0.005 * BYTES_PER_SECOND);
37 static const int COUNT_SIZE = BYTES_PER_SECOND * BEAT_LENGTH / 1000;
38 static const int DIT_SIZE = 2 * COUNT_SIZE; // 2 counts
39 static const int DAH_SIZE = 4 * COUNT_SIZE; // 4 counts
40 static const int SPACE_SIZE = 3 * COUNT_SIZE; // 3 counts
41 static const int LO_FREQUENCY = 1020; // AIM 1-1-7 (f) specified in Hz
42 static const int HI_FREQUENCY = 1350; // AIM 1-1-7 (f) specified in Hz
43
44protected:
57 static void make_tone( unsigned char *buf, int freq,
58 int len, int total_len, int trans_len );
59
60public:
61
62 virtual ~FGSoundGenerator();
63};
64
65
66
67#endif // _FGSOUNDGENERATOR_HXX
static const int HI_FREQUENCY
static const int COUNT_SIZE
static const int TRANSITION_BYTES
static void make_tone(unsigned char *buf, int freq, int len, int total_len, int trans_len)
Make a tone of specified freq and total_len with trans_len ramp in and out and only the first len byt...
static const int BYTES_PER_SECOND
static const int BEAT_LENGTH
static const int DIT_SIZE
static const int LO_FREQUENCY
virtual ~FGSoundGenerator()
static const int SPACE_SIZE
static const int DAH_SIZE