public boolean consumerRender( RenderContext context, RenderSource source )
throws IOException
{
ConsumerContext consc = (ConsumerContext) context.getOption( KEY_CONSC );
Transmitter trns;
AudioTrail at;
int trnsIdx;
for( trnsIdx = 0; trnsIdx < source.numTrns; trnsIdx++ ) {
if( !source.trajRequest[ trnsIdx ]) continue;
trns = (Transmitter) context.getTransmitters().get( trnsIdx );
at = trns.getAudioTrail();
if( consc.as[ trnsIdx ] == null ) {
context.getHost().showMessage( JOptionPane.ERROR_MESSAGE,
AbstractApplication.getApplication().getResourceString( "renderEarlyConsume" ));
return false;
}
if( consc.bc != null ) {
final long blendLen = consc.bc.getLen(); // EEE getLen?
final long interpOff = source.blockSpan.start - context.getTimeSpan().start;
final long fadeOutOff = context.getTimeSpan().getLength() - blendLen;
if( (consc.srcBuf == null) || (consc.srcBuf[ 0 ].length < source.blockBufLen) ) {
consc.srcBuf = new float[ 2 ][ source.blockBufLen ];
}
at.readFrames( consc.srcBuf, 0, source.blockSpan );
if( interpOff < blendLen ) {
consc.bc.blend( interpOff, consc.srcBuf, 0, source.trajBlockBuf[ trnsIdx ], 0, source.trajBlockBuf[ trnsIdx ], 0, source.blockBufLen );
}
if( (interpOff + source.blockBufLen) > fadeOutOff ) {
consc.bc.blend( interpOff - fadeOutOff, source.trajBlockBuf[ trnsIdx ], 0, consc.srcBuf, 0, source.trajBlockBuf[ trnsIdx ], 0, source.blockBufLen );