kaudiomanagerplay.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Matthias Kretz <kretz@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 00018 */ 00019 00020 #include "kaudiomanagerplay.h" 00021 #include "kartsserver.h" 00022 00023 #include <soundserver.h> 00024 #include <string> 00025 00026 KAudioManagerPlay::KAudioManagerPlay( KArtsServer * server, const QString & title ) 00027 { 00028 d = new PrivateData; 00029 d->amanPlay = Arts::DynamicCast( server->server().createObject( "Arts::Synth_AMAN_PLAY" ) ); 00030 d->started = false; 00031 setTitle( title ); 00032 } 00033 00034 KAudioManagerPlay::~KAudioManagerPlay() 00035 { 00036 stop(); 00037 delete d; 00038 } 00039 00040 Arts::Synth_AMAN_PLAY KAudioManagerPlay::amanPlay() 00041 { 00042 return d->amanPlay; 00043 } 00044 00045 bool KAudioManagerPlay::isNull() const 00046 { 00047 if( !this ) 00048 return true; 00049 return d->amanPlay.isNull(); 00050 } 00051 00052 void KAudioManagerPlay::setTitle( const QString & title ) 00053 { 00054 d->amanPlay.title( std::string( title.local8Bit() ) ); 00055 } 00056 00057 QString KAudioManagerPlay::title() 00058 { 00059 return QString::fromLocal8Bit( d->amanPlay.title().c_str() ); 00060 } 00061 00062 void KAudioManagerPlay::setAutoRestoreID( const QString & autoRestoreID ) 00063 { 00064 d->amanPlay.autoRestoreID( std::string( autoRestoreID.local8Bit() ) ); 00065 } 00066 00067 QString KAudioManagerPlay::autoRestoreID() 00068 { 00069 return QString::fromLocal8Bit( d->amanPlay.autoRestoreID().c_str() ); 00070 } 00071 00072 void KAudioManagerPlay::start() 00073 { 00074 if( d->started ) 00075 return; 00076 00077 d->started = true; 00078 d->amanPlay.start(); 00079 } 00080 00081 void KAudioManagerPlay::stop() 00082 { 00083 if( !d->started ) 00084 return; 00085 00086 d->started = false; 00087 d->amanPlay.stop(); 00088 } 00089 00090 // vim: sw=4 ts=4