Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequencer's implementation of LOOP_CONTINUOUSLY doesn't work #18

Open
chriscoomber opened this issue Jun 24, 2020 · 0 comments
Open

Sequencer's implementation of LOOP_CONTINUOUSLY doesn't work #18

chriscoomber opened this issue Jun 24, 2020 · 0 comments

Comments

@chriscoomber
Copy link

chriscoomber commented Jun 24, 2020

The code it uses to iterate over the loops is here:

for (int loop = 0; loop < getLoopCount() + 1; loop = (getLoopCount() == LOOP_CONTINUOUSLY ? loop : loop + 1)) {

(https://github.com/kshoji/javax.sound.midi-for-Android/blob/develop/javax.sound.midi/src/jp/kshoji/javax/sound/midi/impl/SequencerImpl.java#L308)

where LOOP_CONTINUOUSLY is equal to -1. In the case where getLoopCount() == LOOP_CONTINUOUSLY, this is saying:

for (int loop = 0; loop < -1 + 1; loop = loop) {

clearly, this means that the code in the for loop never executes, since loop is always 0 and 0 < 0 is false.

I think this line should be:

for (
    int loop = 0;  // initialize at 0
    loop < getLoopCount + 1 || getLoopCount() == LOOP_CONTINUOUSLY;  // keep going if set to loop continuously
    loop++  // iterate up in increments of 1, as standard
)
@chriscoomber chriscoomber changed the title Synthesizer's implementation of LOOP_CONTINUOUSLY doesn't work Sequencer's implementation of LOOP_CONTINUOUSLY doesn't work Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant