SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kttsd / libkttsd / stretcher.h
blob5594c662b10ed62e448874203c050fca7c6b11e0
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2 Description:
3 Speeds up or slows down an audio file by stretching the audio stream.
4 Uses the sox program to do the stretching.
6 Copyright:
7 (C) 2004 by Gary Cramblitt <garycramblitt@comcast.net>
8 -------------------
9 Original author: Gary Cramblitt <garycramblitt@comcast.net>
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ******************************************************************************/
26 #ifndef STRETCHER_H
27 #define STRETCHER_H
29 #include <QObject>
31 #include <kdemacros.h>
33 class K3Process;
35 class KDE_EXPORT Stretcher : public QObject{
36 Q_OBJECT
38 public:
39 /**
40 * Constructor.
42 explicit Stretcher(QObject *parent = 0, const char *name = 0);
44 /**
45 * Destructor.
47 ~Stretcher();
49 enum StretcherState {
50 ssIdle = 0, // Not doing anything. Ready to stretch.
51 ssStretching = 1, // Stretching.
52 ssFinished = 2 // Stretching finished.
55 /**
56 * Stretch the given input file to an output file.
57 * @param inFilename Name of input audio file.
58 * @param outFilename Name of output audio file.
59 * @param stretchFactor Amount to stretch. 2.0 is twice as slow. 0.5 is twice as fast.
61 bool stretch(const QString &inFilename, const QString &outFilename, float stretchFactor);
63 /**
64 * Returns the state of the Stretcher.
66 int getState();
68 /**
69 * Returns the output filename (as given in call to stretch).
71 QString getOutFilename();
73 /**
74 * Acknowledges the finished stretching.
76 void ackFinished();
78 signals:
79 /**
80 * Emitted whenever stretching is completed.
82 void stretchFinished();
84 private slots:
85 void slotProcessExited(K3Process* proc);
87 private:
88 // Stretcher state.
89 int m_state;
91 // Sox process.
92 K3Process* m_stretchProc;
94 // Output file name.
95 QString m_outFilename;
98 #endif // STRETCHER_H