|
CLAM-Development
1.3
|
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 #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 } //namespace 00072
1.7.6.1