SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kttsd / libkttsd / testplayer.h
blob5c5fb9234277affb964ce97094eb50564a4b7fff
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2 Player Object for playing synthesized audio files. Plays them
3 synchronously.
4 -------------------
5 Copyright:
6 (C) 2004 by Gary Cramblitt <garycramblitt@comcast.net>
7 -------------------
8 Original author: Gary Cramblitt <garycramblitt@comcast.net>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************************************************************************/
25 #ifndef TESTPLAYER_H
26 #define TESTPLAYER_H
28 // Qt includes.
29 #include <QObject>
31 // KDE includes.
32 #include <kdemacros.h>
34 class Player;
35 class Stretcher;
37 // TODO: Make this work asynchronously.
39 class KDE_EXPORT TestPlayer : public QObject{
40 public:
41 /**
42 * Constructor.
43 * @param playerOption
44 * @param audioStretchFactor
46 explicit TestPlayer(QObject *parent = 0, const char *name = 0,
47 const int playerOption = 0, const float audioStretchFactor = 1.0,
48 const QString &sinkName = QString());
50 /**
51 * Destructor.
53 ~TestPlayer();
55 /**
56 * Sets which audio player to use.
57 * 0 = Phonon
58 * 2 = ALSA
60 void setPlayerOption(const int playerOption);
62 /**
63 * Sets the audio stretch factor (Speed adjustment).
64 * 1.0 = normal
65 * 0.5 = twice as fast
66 * 2.0 = twice as slow
68 void setAudioStretchFactor(const float audioStretchFactor);
70 /**
71 * Plays the specifified audio file and waits for completion.
72 * The audio file speed is adjusted according to the stretch factor.
73 * @param waveFile Name of the audio file to play.
75 void play(const QString &waveFile);
77 /**
78 * Sets the GStreamer Sink Name. Examples: "alsasink", "osssink", "nassink".
80 void setSinkName(const QString &sinkName);
82 /**
83 * Creates and returns a player object based on user option.
85 Player* createPlayerObject(int playerOption);
87 private:
89 /**
90 * Constructs a temporary filename for plugins to use as a suggested filename
91 * for synthesis to write to.
92 * @return Full pathname of suggested file.
94 QString makeSuggestedFilename();
96 /**
97 * Which audio player to use.
98 * 0 = Phonon
99 * 2 = ALSA
101 int m_playerOption;
104 * Audio stretch factor (Speed).
106 float m_audioStretchFactor;
109 * GStreamer sink name.
111 QString m_sinkName;
114 * Stretcher object.
116 Stretcher* m_stretcher;
119 * Player object.
121 Player* m_player;
124 #endif // TESTPLAYER_H