208 | | no_problem=false; |
---|
209 | | } |
---|
210 | | break; |
---|
211 | | case AmdtpPortInfo::E_SPDIF: // still unimplemented |
---|
212 | | break; |
---|
213 | | /* for this processor, midi is a packet based port |
---|
214 | | case AmdtpPortInfo::E_Midi: |
---|
215 | | break;*/ |
---|
216 | | default: // ignore |
---|
217 | | break; |
---|
218 | | } |
---|
219 | | } |
---|
220 | | return no_problem; |
---|
221 | | } |
---|
222 | | |
---|
223 | | /** |
---|
224 | | * @brief write silence events to the stream ringbuffers. |
---|
225 | | */ |
---|
226 | | bool AmdtpReceiveStreamProcessor::provideSilenceBlock(unsigned int nevents, unsigned int offset) |
---|
227 | | { |
---|
228 | | debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "(%p)->proviceSilenceBlock(%u, %u)\n", this, nevents, offset); |
---|
229 | | |
---|
230 | | bool no_problem=true; |
---|
231 | | |
---|
232 | | for ( PortVectorIterator it = m_PeriodPorts.begin(); |
---|
233 | | it != m_PeriodPorts.end(); |
---|
234 | | ++it ) |
---|
235 | | { |
---|
236 | | if((*it)->isDisabled()) {continue;}; |
---|
237 | | //FIXME: make this into a static_cast when not DEBUG? |
---|
238 | | AmdtpPortInfo *pinfo=dynamic_cast<AmdtpPortInfo *>(*it); |
---|
239 | | assert(pinfo); // this should not fail!! |
---|
240 | | |
---|
241 | | switch(pinfo->getFormat()) { |
---|
242 | | case AmdtpPortInfo::E_MBLA: |
---|
243 | | if(provideSilenceToPort(static_cast<AmdtpAudioPort *>(*it), offset, nevents)) { |
---|
244 | | debugWarning("Could not put silence into to port %s",(*it)->getName().c_str()); |
---|
370 | | |
---|
371 | | int |
---|
372 | | AmdtpReceiveStreamProcessor::provideSilenceToPort( |
---|
373 | | AmdtpAudioPort *p, unsigned int offset, unsigned int nevents) |
---|
374 | | { |
---|
375 | | unsigned int j=0; |
---|
376 | | switch(p->getDataType()) { |
---|
377 | | default: |
---|
378 | | case Port::E_Int24: |
---|
379 | | { |
---|
380 | | quadlet_t *buffer=(quadlet_t *)(p->getBufferAddress()); |
---|
381 | | assert(nevents + offset <= p->getBufferSize()); |
---|
382 | | buffer+=offset; |
---|
383 | | |
---|
384 | | for(j = 0; j < nevents; j += 1) { // decode max nsamples |
---|
385 | | *(buffer)=0; |
---|
386 | | buffer++; |
---|
387 | | } |
---|
388 | | } |
---|
389 | | break; |
---|
390 | | case Port::E_Float: |
---|
391 | | { |
---|
392 | | float *buffer=(float *)(p->getBufferAddress()); |
---|
393 | | assert(nevents + offset <= p->getBufferSize()); |
---|
394 | | buffer+=offset; |
---|
395 | | |
---|
396 | | for(j = 0; j < nevents; j += 1) { // decode max nsamples |
---|
397 | | *buffer = 0.0; |
---|
398 | | buffer++; |
---|
399 | | } |
---|
400 | | } |
---|
401 | | break; |
---|
402 | | } |
---|
403 | | return 0; |
---|
404 | | } |
---|
405 | | |
---|