1 // FGATCVoice.hxx - a class to encapsulate an ATC voice
3 // Written by David Luff, started November 2002.
5 // Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <simgear/compiler.h>
26 #if defined( SG_HAVE_STD_INCLUDES ) || defined( __BORLANDC__ ) || (__APPLE__)
31 # include <iostream.h>
38 #include <simgear/sound/sample_openal.hxx>
46 SG_USING_STD(ofstream);
47 SG_USING_STD(ifstream);
51 unsigned int offset; // Offset of beginning of word sample into raw sound sample
52 unsigned int length; // Byte length of word sample
55 typedef map < string, WordData > atc_word_map_type;
56 typedef atc_word_map_type::iterator atc_word_map_iterator;
57 typedef atc_word_map_type::const_iterator atc_word_map_const_iterator;
66 // Load the two voice files - one containing the raw sound data (.wav) and one containing the word positions (.vce).
67 // Return true if successful.
68 bool LoadVoice(string voice);
70 // Given a desired message, return a pointer to the data buffer and write the buffer length into len.
71 // Sets dataOK = true if the returned buffer is valid.
72 unsigned char* WriteMessage(char* message, int& len, bool& dataOK);
77 // the sound and word position data
79 unsigned int rawDataSize;
80 SGSoundSample *SoundData;
82 // A map of words vs. byte position and length in rawSoundData
83 atc_word_map_type wordMap;
87 #endif // _FG_ATC_VOICE