nl_tokens: Interleaves audio samples in ins into outb using sample size from the format
pl_tokens: public static void interleave ( AudioFormat format , ByteBuffer [ ] ins , ByteBuffer outb ) { int bytesPerSample = format . getSampleSizeInBits ( ) >> 3 ; int bytesPerFrame = bytesPerSample * ins . length ; int <mask> = 0 ; for ( int i = 0 ; i < ins . length ; i ++ ) if ( ins [ i ] . remaining ( ) > max ) max = ins [ i ] . remaining ( ) ; for ( int frames = 0 ; frames < max && outb . remaining ( ) >= bytesPerFrame ; frames ++ ) { for ( int j = 0 ; j < ins . length ; j ++ ) { if ( ins [ j ] . remaining ( ) < bytesPerSample ) { for ( int i = 0 ; i < bytesPerSample ; i ++ ) outb . put ( ( byte ) 0 ) ; } else { for ( int i = 0 ; i < bytesPerSample ; i ++ ) { outb . put ( ins [ j ] . get ( ) ) ; } } } } }