2008-05-06 05:35:37 +02:00
|
|
|
#include "layout.h"
|
2008-02-05 03:17:35 +01:00
|
|
|
#include "../vgmstream.h"
|
2008-02-05 01:03:39 +01:00
|
|
|
|
|
|
|
void render_vgmstream_nolayout(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream) {
|
|
|
|
int samples_written=0;
|
|
|
|
|
|
|
|
const int samples_this_block = vgmstream->num_samples;
|
2008-02-05 03:17:35 +01:00
|
|
|
int samples_per_frame = get_vgmstream_samples_per_frame(vgmstream);
|
2008-02-05 01:03:39 +01:00
|
|
|
|
|
|
|
while (samples_written<sample_count) {
|
|
|
|
int samples_to_do;
|
|
|
|
|
2008-02-05 07:21:57 +01:00
|
|
|
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
|
|
|
|
continue;
|
2008-02-05 01:03:39 +01:00
|
|
|
}
|
|
|
|
|
2008-02-05 07:21:57 +01:00
|
|
|
samples_to_do = vgmstream_samples_to_do(samples_this_block, samples_per_frame, vgmstream);
|
2008-02-05 01:03:39 +01:00
|
|
|
|
|
|
|
if (samples_written+samples_to_do > sample_count)
|
|
|
|
samples_to_do=sample_count-samples_written;
|
2016-07-17 08:02:27 +02:00
|
|
|
|
|
|
|
if (!samples_to_do) {
|
|
|
|
memset(buffer + samples_written * vgmstream->channels, 0, sizeof(sample) * vgmstream->channels * (sample_count - samples_written));
|
|
|
|
return;
|
|
|
|
}
|
2008-02-05 01:03:39 +01:00
|
|
|
|
2008-02-05 03:17:35 +01:00
|
|
|
decode_vgmstream(vgmstream, samples_written, samples_to_do, buffer);
|
2008-02-05 01:03:39 +01:00
|
|
|
|
|
|
|
samples_written += samples_to_do;
|
|
|
|
vgmstream->current_sample += samples_to_do;
|
|
|
|
vgmstream->samples_into_block+=samples_to_do;
|
|
|
|
}
|
|
|
|
}
|