From 00bb99ac80741fc50ef8a289719373032f2391eb Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaccessibility@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kttsd/libkttsd/stretcher.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 kttsd/libkttsd/stretcher.h (limited to 'kttsd/libkttsd/stretcher.h') diff --git a/kttsd/libkttsd/stretcher.h b/kttsd/libkttsd/stretcher.h new file mode 100644 index 0000000..e4d8686 --- /dev/null +++ b/kttsd/libkttsd/stretcher.h @@ -0,0 +1,97 @@ +/***************************************************** vim:set ts=4 sw=4 sts=4: + Description: + Speeds up or slows down an audio file by stretching the audio stream. + Uses the sox program to do the stretching. + + Copyright: + (C) 2004 by Gary Cramblitt + ------------------- + Original author: Gary Cramblitt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + ******************************************************************************/ + +#ifndef _STRETCHER_H_ +#define _STRETCHER_H_ + +#include +#include "kdeexportfix.h" + +class KProcess; + +class KDE_EXPORT Stretcher : public QObject{ + Q_OBJECT + + public: + /** + * Constructor. + */ + Stretcher(QObject *parent = 0, const char *name = 0); + + /** + * Destructor. + */ + ~Stretcher(); + + enum StretcherState { + ssIdle = 0, // Not doing anything. Ready to stretch. + ssStretching = 1, // Stretching. + ssFinished = 2 // Stretching finished. + }; + + /** + * Stretch the given input file to an output file. + * @param inFilename Name of input audio file. + * @param outFilename Name of output audio file. + * @param stretchFactor Amount to stretch. 2.0 is twice as slow. 0.5 is twice as fast. + */ + bool stretch(const QString &inFilename, const QString &outFilename, float stretchFactor); + + /** + * Returns the state of the Stretcher. + */ + int getState(); + + /** + * Returns the output filename (as given in call to stretch). + */ + QString getOutFilename(); + + /** + * Acknowledges the finished stretching. + */ + void ackFinished(); + + signals: + /** + * Emitted whenever stretching is completed. + */ + void stretchFinished(); + + private slots: + void slotProcessExited(KProcess* proc); + + private: + // Stretcher state. + int m_state; + + // Sox process. + KProcess* m_stretchProc; + + // Output file name. + QString m_outFilename; +}; + +#endif // _STRETCHER_H_ -- cgit v1.2.1