static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
    const uint8_t *buf, int silent_chunks, int data_size)
{
    int silent_size = s->avctx->block_align * silent_chunks * s->out_bps;

    if (silent_chunks) {
        memset(data, s->out_bps == 2 ? 0x00 : 0x80, silent_size);
        data += silent_size;
    }
    if (s->avctx->bits_per_coded_sample == 16)
        vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2);
    else {
        /* just copy the data */
        memcpy(data, buf, data_size);
    }

    return silent_size + data_size * s->out_bps;
}