From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 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/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- arts/kde/kaudioplaystream.h | 127 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 arts/kde/kaudioplaystream.h (limited to 'arts/kde/kaudioplaystream.h') diff --git a/arts/kde/kaudioplaystream.h b/arts/kde/kaudioplaystream.h new file mode 100644 index 000000000..8f34cc8c9 --- /dev/null +++ b/arts/kde/kaudioplaystream.h @@ -0,0 +1,127 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Arnold Krille + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + +*/ + +#ifndef KAUDIOPLAYSTREAM_H +#define KAUDIOPLAYSTREAM_H + +#include + +#include +#include + +#include + +class KArtsServer; +namespace Arts { class StereoEffectStack; } + +class KAudioPlayStreamPrivate; + +/** + * @brief A wrapper around ByteSoundProducer/ByteStreamToAudio/Synth_AMAN_PLAY. + * + * @author Arnold Krille + * @since 3.2 +*/ + +class KDE_ARTS_EXPORT KAudioPlayStream : public QObject { + Q_OBJECT +public: + /** + * Creates a KAudioPlayStream on server with a title. You should pass the KArtsServer also + * as parent to be sure this object is deleted before the server is. + * + * @param server The server where it should play to. + * @param title The title that is shown in the AudioManager. + * @param parent You will propably want to pass the server as parent to so this stream gets deleted before the server disappears. + * @param name The name of the stream. + */ + KAudioPlayStream( KArtsServer* server, const QString title, QObject* parent=0, const char* name=0 ); + /** + * Destructs the KAudioPlayStream. + */ + ~KAudioPlayStream(); + + /** + * Controls wether this Stream should poll the data from you via the signal requestData() + * or you use write() to fill the inputbuffer. + * + * Default is true + */ + void setPolling( bool ); + /** + * Returns the polling state. + * @see setPolling + */ + bool polling() const; + + /** + * @return wether this stream is running ("on air") or not. + */ + bool running() const; + + /** + * @return The Arts::StereoEffectStack right before the Synth_AMAN_PLAY. + */ + Arts::StereoEffectStack effectStack() const; +public slots: + /** + * Start the stream. + * @param samplingRate how many samples per second ( typically 11000/22050/44100/48000 ) + * @param bits how many bits per sample ( 8 / 16 ) + * @param channels how many channels ( 1 or 2 ) + */ + void start( int samplingRate, int bits, int channels ); + /** + * Stops the stream. + */ + void stop(); + + /** + * Write data into the inputbuffer. + * If you ignore the signal noData() it will play 0 ( silence ). + */ + void write( QByteArray& data ); +signals: + /** + * This signal is emitted when audio should be played. + * You have to fill the array with data. + */ + void requestData( QByteArray& ); + + /** + * Is emitted when the state changes. + */ + void running( bool ); + + /** + * Is emitted if the inputbuffer runs dry and polling os off. + */ + void noData(); +public: + /** + * @internal + */ + void fillData( Arts::DataPacket *packet ); +private: + KAudioPlayStreamPrivate* d; +}; + +#endif // KAUDIOPLAYSTREAM_H + +// vim: sw=4 ts=4 tw=80 -- cgit v1.2.1