diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2017-12-09 23:28:57 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2017-12-09 23:28:57 +0300 |
commit | 2115f7d57ea51536dfeb3aa5f27b394a06a23bf8 (patch) | |
tree | 47de96e8cd4d38ead1bc8770fa096515073b4b82 | |
parent | 1e4a04ac49c44e4014997ee4785b20a8a00cbdd0 (diff) | |
download | libADLMIDI-2115f7d57ea51536dfeb3aa5f27b394a06a23bf8.tar.gz libADLMIDI-2115f7d57ea51536dfeb3aa5f27b394a06a23bf8.tar.bz2 libADLMIDI-2115f7d57ea51536dfeb3aa5f27b394a06a23bf8.zip |
Fix the incorrect offseting of backup buffer
(Issue #37)
-rw-r--r-- | src/adlmidi.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 3b124eb..2e75bbe 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -572,10 +572,10 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out) left -= (int)ate; gotten_len += ate; - if(ate < setup.backup_samples_size) + if((ate < setup.backup_samples_size) && (ate != 0)) { - for(ssize_t j = 0; j < ate; j++) - setup.backup_samples[(ate - 1) - j] = setup.backup_samples[(setup.backup_samples_size - 1) - j]; + for(ssize_t i = 0, j = ate; j < setup.backup_samples_size; i++, j++) + setup.backup_samples[i] = setup.backup_samples[j]; } setup.backup_samples_size -= ate; |