PANetworkPlayer.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2007 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 #ifndef _PORTAUDIO_NETWORK_PLAYER_HXX_
00024 #define _PORTAUDIO_NETWORK_PLAYER_HXX_
00025 
00026 #include <iostream>
00027 #include <string>
00028 #include "NetworkPlayer.hxx"
00029 #include <portaudio.h>
00030 
00031 namespace CLAM
00032 {
00033 
00034 class PANetworkPlayer : public NetworkPlayer
00035 {
00036         int mPreferredBufferSize;
00037         int mSamplingRate;
00038 
00039         PaStream * mPortAudioStream;
00040         PaError mError;
00041         std::string mErrorMessage;
00042         bool mNeedsPriority;
00043 
00044 public:
00045         //When created in the prototyper
00046         PANetworkPlayer(const std::string & networkFile);
00047         //When created in neteditor
00048         PANetworkPlayer();
00049         virtual ~PANetworkPlayer();
00050 
00051         // base class (virtual) interface:
00052         bool IsWorking();
00053         std::string NonWorkingReason();
00054         virtual bool IsRealTime() const { return true; }
00055         virtual void Start();
00056         virtual void Stop();
00057 
00058 private:
00059         static int ProcessCallback (
00060                         const void *inputBuffers,
00061                         void *outputBuffers,
00062                         unsigned long framesPerBuffer,
00063                         const PaStreamCallbackTimeInfo* timeInfo,
00064                         PaStreamCallbackFlags statusFlags,
00065                         void *userData);
00066         inline bool CheckPaError(PaError result);
00067         //Buffer copying methods
00068         void Do(const void *inputBuffers, void *outputBuffers, unsigned long framesPerBuffer);
00069         void DoInPorts(float** input, unsigned long nframes);
00070         void DoOutPorts(float** output, unsigned long nframes);
00071         void MuteOutBuffers(float** output, unsigned long nframes);
00072 };
00073 
00074 } //end namespace CLAM
00075 
00076 #endif
00077 
Generated by  doxygen 1.6.3