Loops

I'm a total C++ beginner, and this may be an obvious question to most of you.

How do I get one loop to start at a certain time during another loop?

Say I want something to happen after something has happened twice in another loop, yet keep the first loop carrying on.

This is in the context of MIDI btw, and playing two instruments at once, with one starting later etc.

Can anyone help?

Thankyou.
Ah, polyphonics... I'm not sure that's the solution you'll find to be effective. You could try a library with threads, such as boost, and tie each of your music playing actions to a thread so they would run simultaneously. I think that should work pretty well.
The thing about C++, and the reason why I believe your problem will not be answered with loops, is that code will execute from the top down. If you nested one loop inside another, you could set that loop's condition to be bound against a counter in your first loop. It would only ever execute then, if your counter in your first loop was suitable. But the execution of your first loop would then wait while the second one ran. Only once the second loop was finished, would the first one resume iteration. (You see what I mean by that, right?) That's why I think threading is the solution for you.
I'm no expert on sound libraries, heck I've never even worked with one, but the way it works would have some effect on how this would be done... sorry, that's about all the advice I've got.
Topic archived. No new replies allowed.