source: rrlib_speech_synthesis/tStreamBuffer.h

tip
Last change on this file was 7:d70de441dbce, checked in by Tobias Föhst <foehst@…>, 7 years ago

Added and updated license information

File size: 3.1 KB
Line 
1//
2// You received this file as part of RRLib
3// Robotics Research Library
4//
5// Copyright (C) Finroc GbR (finroc.org)
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this program; if not, write to the Free Software Foundation, Inc.,
19// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21//----------------------------------------------------------------------
22/*!\file    rrlib/speech_synthesis/tStreamBuffer.h
23 *
24 * \author  Tobias Föhst
25 *
26 * \date    2013-08-07
27 *
28 * \brief   Contains tStreamBuffer
29 *
30 * \b tStreamBuffer
31 *
32 */
33//----------------------------------------------------------------------
34#ifndef __rrlib__speech_synthesis__tStreamBuffer_h__
35#define __rrlib__speech_synthesis__tStreamBuffer_h__
36
37//----------------------------------------------------------------------
38// External includes (system with <>, local with "")
39//----------------------------------------------------------------------
40#include <streambuf>
41
42//----------------------------------------------------------------------
43// Internal includes with ""
44//----------------------------------------------------------------------
45#include "rrlib/speech_synthesis/voices.h"
46
47//----------------------------------------------------------------------
48// Namespace declaration
49//----------------------------------------------------------------------
50namespace rrlib
51{
52namespace speech_synthesis
53{
54
55//----------------------------------------------------------------------
56// Forward declarations / typedefs / enums
57//----------------------------------------------------------------------
58
59//----------------------------------------------------------------------
60// Class declaration
61//----------------------------------------------------------------------
62//! SHORT_DESCRIPTION
63/*!
64 */
65class tStreamBuffer : public std::streambuf
66{
67
68//----------------------------------------------------------------------
69// Public methods and typedefs
70//----------------------------------------------------------------------
71public:
72
73  explicit tStreamBuffer(speech_synthesis::tVoice &voice, std::size_t buffer_size = 256);
74
75  virtual ~tStreamBuffer();
76
77//----------------------------------------------------------------------
78// Private fields and methods
79//----------------------------------------------------------------------
80private:
81
82  speech_synthesis::tVoice &voice;
83  std::vector<char_type> buffer;
84
85  void ProcessBuffer();
86
87  virtual int_type overflow(int_type c);
88
89  int sync();
90
91};
92
93//----------------------------------------------------------------------
94// End of namespace declaration
95//----------------------------------------------------------------------
96}
97}
98
99
100#endif
Note: See TracBrowser for help on using the repository browser.