NetworkPlayer.cxx
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 #include "NetworkPlayer.hxx"
00023 #include "AudioSource.hxx"
00024 #include "AudioBufferSource.hxx"
00025 #include "AudioSink.hxx"
00026 #include "AudioBufferSink.hxx"
00027
00028 namespace CLAM
00029 {
00030
00031 std::string NetworkPlayer::SourcesAndSinksToString()
00032 {
00033 CacheSourcesAndSinks();
00034 std::string result;
00035 for (unsigned i=0; i<_exportedSources.size(); i++)
00036 result += " * source:\t"+SourceName(i)+"\n";
00037 for (unsigned i=0; i<_exportedSinks.size(); i++)
00038 result += " * sink:\t"+SinkName(i)+"\n";
00039 return result;
00040 }
00041
00042 void NetworkPlayer::SetSourceBuffer(unsigned source, const float * data, unsigned nframes)
00043 {
00044 Processing * processing = _exportedSources[source].processing;
00045 unsigned port = _exportedSources[source].port;
00046 SetExternalBuffer<AudioSource>(processing, data, nframes, port);
00047 SetExternalBuffer<AudioBufferSource>(processing, data, nframes, port);
00048 }
00049 void NetworkPlayer::SetSinkBuffer(unsigned sink, float * data, unsigned nframes)
00050 {
00051 Processing * processing = _exportedSinks[sink].processing;
00052 unsigned port = _exportedSinks[sink].port;
00053 SetExternalBuffer<AudioSink>(processing, data, nframes, port);
00054 SetExternalBuffer<AudioBufferSink>(processing, data, nframes, port);
00055 }
00056 void NetworkPlayer::SetSinkFrameSize(unsigned sink, unsigned frameSize)
00057 {
00058 unsigned port = _exportedSinks[sink].port;
00059 Processing * processing = _exportedSinks[sink].processing;
00060 SetFrameAndHopSizeIf<AudioSink>(processing,frameSize,port);
00061 SetFrameAndHopSizeIf<AudioBufferSink>(processing,frameSize,port);
00062 }
00063 void NetworkPlayer::SetSourceFrameSize(unsigned source, unsigned frameSize)
00064 {
00065 unsigned port = _exportedSources[source].port;
00066 Processing * processing = _exportedSources[source].processing;
00067 SetFrameAndHopSizeIf<AudioSource>(processing,frameSize,port);
00068 SetFrameAndHopSizeIf<AudioBufferSource>(processing,frameSize,port);
00069 }
00070
00071 }
00072