Fixed SPC/SFM seeking

This commit is contained in:
Chris Moeller 2013-10-26 10:30:36 -07:00
parent 2aa6ee4378
commit be33e61644

View file

@ -29,13 +29,6 @@ void SMP::enter() {
} }
void SMP::render(int16_t * buffer, unsigned count) { void SMP::render(int16_t * buffer, unsigned count) {
while (count > 4096) {
sample_buffer = buffer;
sample_buffer_end = buffer + 4096;
buffer += 4096;
count -= 4096;
enter();
}
sample_buffer = buffer; sample_buffer = buffer;
sample_buffer_end = buffer + count; sample_buffer_end = buffer + count;
enter(); enter();
@ -44,17 +37,17 @@ void SMP::render(int16_t * buffer, unsigned count) {
void SMP::skip(unsigned count) { void SMP::skip(unsigned count) {
while (count > 4096) { while (count > 4096) {
sample_buffer = 0; sample_buffer = 0;
sample_buffer_end = (const int16_t *) 4096; sample_buffer_end = ((const int16_t *)0) + 4096;
count -= 4096; count -= 4096;
enter(); enter();
} }
sample_buffer = 0; sample_buffer = 0;
sample_buffer_end = (const int16_t *) (intptr_t) count; sample_buffer_end = ((const int16_t *)0) + count;
enter(); enter();
} }
void SMP::sample(int16_t left, int16_t right) { void SMP::sample(int16_t left, int16_t right) {
if ( sample_buffer >= (const int16_t *) (intptr_t) 4096 ) { if ( sample_buffer > ((const int16_t *)0) + 4096 ) {
if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = left; if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = left;
if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = right; if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = right;
} }