PANetworkPlayer.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00046 PANetworkPlayer(const std::string & networkFile);
00047
00048 PANetworkPlayer();
00049 virtual ~PANetworkPlayer();
00050
00051
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
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 }
00075
00076 #endif
00077