Esempio n. 1
0
    pBuffer process(pBuffer b) override
    {
        Interval I = b->getInterval ();

        Signal::IntervalType i = std::max(0ll, I.first);
        FLAC__stream_decoder_seek_absolute(decoder, i);
        while (true)
        {
            fmt->block->set_sample_offset (i);
            *b |= *fmt->block;
            i += fmt->last_blocksize;

            if (i>=I.last)
                break;

            if (!FLAC__stream_decoder_process_single (decoder))
            {
                Log("flacfile: failed reading at %d") % i;
                break;
            }
        }

        // if reading before start, zeros
        if (I.first < 0)
            *b |= Buffer(Signal::Interval(I.first, 0), b->sample_rate (), b->number_of_channels ());

        // if b extends EOF, zeros
        if (i < I.last)
            *b |= Buffer(Interval(i,I.last), b->sample_rate (), b->number_of_channels ());

        return b;
    }
Esempio n. 2
0
pBuffer OperationSetSilent::Operation::
        process (pBuffer b)
{
    Signal::Interval i = section_ & b->getInterval ();

    if (i) {
        Buffer zero(i, b->sample_rate(), b->number_of_channels ());
        *b |= zero;
    }

    return b;
}