22 #ifndef NetworkPlayer_hxx
23 #define NetworkPlayer_hxx
70 virtual void Start()=0;
73 virtual void Stop()=0;
105 CLAM_ASSERT( (_network!=
NULL),
"NetworkPlayer::GetNetwork() : NetworkPlayer does not have any Network");
109 unsigned GetNSinks()
const {
return _exportedSinks.size(); }
113 _exportedSources.clear();
115 for (Network::Processings::const_iterator it = sources.begin(); it != sources.end(); ++it)
118 std::string processingName = _network->
GetNetworkId(processing);
120 for (
unsigned i=0; i<nPorts; i++)
122 std::ostringstream portName;
123 portName << processingName;
126 _exportedSources.push_back(ExportedPort(processing,i, portName.str()));
129 _exportedSinks.clear();
131 for (Network::Processings::const_iterator it = sinks.begin(); it != sinks.end(); ++it)
134 std::string processingName = _network->
GetNetworkId(processing);
136 for (
unsigned i=0; i<nPorts; i++)
138 std::ostringstream portName;
139 portName << processingName;
142 _exportedSinks.push_back(ExportedPort(processing,i, portName.str()));
148 return _exportedSources[source].name;
152 return _exportedSinks[sink].name;
154 void SetSourceBuffer(
unsigned source,
const float * data,
unsigned nframes);
155 void SetSinkBuffer(
unsigned sink,
float * data,
unsigned nframes);
168 template <
typename ProcessingType>
169 void SetFrameAndHopSizeIf(Processing * proc,
unsigned bufferSize,
unsigned port)
171 if(
typeid(*proc)!=
typeid(ProcessingType))
return;
172 ((ProcessingType*)proc)->SetFrameAndHopSize(bufferSize, port);
175 template <
typename ProcessingType>
176 void SetExternalBuffer(Processing * proc,
const float * data,
unsigned nframes,
unsigned port)
178 if(
typeid(*proc)!=
typeid(ProcessingType))
return;
179 ((ProcessingType*)proc)->SetExternalBuffer(data, nframes, port);
181 template <
typename ProcessingType>
182 void SetExternalBuffer(Processing * proc,
float * data,
unsigned nframes,
unsigned port)
184 if(
typeid(*proc)!=
typeid(ProcessingType))
return;
185 ((ProcessingType*)proc)->SetExternalBuffer(data, nframes, port);
191 ExportedPort(Processing * aProcesing,
unsigned aPort,
const std::string & aName)
192 : processing(aProcesing)
197 Processing * processing;
201 typedef std::vector <ExportedPort> ExportedPorts;
202 ExportedPorts _exportedSources;
203 ExportedPorts _exportedSinks;
210 #endif // NetworkPlayer_hxx