File indexing completed on 2024-05-12 16:23:35
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2017 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 0021 #ifndef AUDIODRIVER_H 0022 #define AUDIODRIVER_H 0023 0024 #include "audioformat.h" 0025 0026 /** 0027 * Interface to be used by the implemented sound drivers. They 0028 * will be responsible for initializing of the sound device and flushing 0029 * PCM data to this device. 0030 * 0031 * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0032 */ 0033 class AudioDriver 0034 { 0035 public: 0036 virtual ~AudioDriver() {}; 0037 0038 /** 0039 * Abstract function for playing PCM data. The registered audio format 0040 * takes care of decoding to raw PCM. This function will not free the 0041 * CPU until the playing is finished. Use the playInThread function if 0042 * you want to play the sound in a separate thread. 0043 */ 0044 virtual void play() = 0; 0045 0046 /** 0047 * Abstract function for playing PCM data. It works exactly like the play 0048 * function except that it plays in a separate thread. 0049 */ 0050 virtual void playInThread() = 0; 0051 0052 /** 0053 * Abstract function for adding a audio file which later on can be played 0054 * with the play or playInThread functions. Ownership is not passed. 0055 * @param audioFile the audio file to be played 0056 */ 0057 virtual void addAudioFile(AudioFormat *audioFile) = 0; 0058 0059 /** 0060 * Abstract function for initializing the registered audio device. 0061 * @return true on success, false otherwise 0062 */ 0063 virtual bool initialize() = 0; 0064 0065 /** 0066 * Abstract function for freeing the audio device so that other programs 0067 * can use it. 0068 */ 0069 virtual void shutdown() = 0; 0070 }; 0071 0072 #endif