home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kaudioplayer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.6 KB  |  94 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20.  
  21.     */
  22.  
  23. #ifndef __KAUDIOPLAYER_H__
  24. #define __KAUDIOPLAYER_H__
  25.  
  26. #include <qobject.h>
  27. #include "kdelibs_export.h"
  28.  
  29. class KAudioPlayerPrivate;
  30. /**
  31.  * This class provides one-shot-and-forget audio playing. You will never
  32.  * know if what you wanted to play really got played.
  33.  *
  34.  * It doesn't require linking any special libraries, as it operates over
  35.  * DCOP. In the current implementation, it only indirectly communicates
  36.  * with the aRts soundserver, using knotify as DCOP -> MCOP bridge.
  37.  *
  38.  * Due to that fact, if you need "fast" response times, more control or
  39.  * feedback, use the MCOP interfaces rather than this.
  40.  *
  41.  * An example of using this class is:
  42.  *
  43.  * \code
  44.  *   KAudioPlayer::play("/var/share/foo.wav");
  45.  * \endcode
  46.  *
  47.  * If you want to use signals & slots, you can do something like:
  48.  *
  49.  * \code
  50.  *   KAudioPlayer player("/var/share/foo.wav");
  51.  *   connect(&button, SIGNAL(clicked()), &player, SLOT(play()));
  52.  * \endcode
  53.  *
  54.  */
  55. //REVISED: hausmann
  56. class KDECORE_EXPORT KAudioPlayer : public QObject {
  57. Q_OBJECT
  58. public:
  59.     /**
  60.      * Constructor.
  61.      *
  62.      * @param filename Absolute path to the filename of the sound file to play
  63.      * @param parent A parent QObject for this KAudioPlayer
  64.      * @param name An internal name for this KAudioPlayer
  65.      */
  66.     KAudioPlayer( const QString& filename,
  67.             QObject* parent = 0, const char* name = 0 );
  68.  
  69.     /**
  70.      * Destructor.
  71.      */
  72.     ~KAudioPlayer();
  73.  
  74.     /**
  75.      * Static play function.
  76.      *
  77.      * @param filename Absolute path to the filename of the sound file to play.
  78.      *                if not absolute, goes off KDEDIR/share/sounds/ (preferred)
  79.      */
  80.     static void play(const QString &filename);
  81.  
  82. public slots:
  83.     /**
  84.      * Play function as slot.
  85.      *
  86.      * Plays the soundfile given to the constructor.
  87.      */
  88.     void play();
  89. private:
  90.     KAudioPlayerPrivate *d;
  91. };
  92.  
  93. #endif // __KAUDIOPLAYER_H__
  94.