I get the following exception when calling
Play.audio(Score):
-------- Playing Score as Audio ...Exception in thread
"main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Native Method)
at jm.music.rt.RTLine.start(RTLine.java:202)
at jm.audio.RTMixer.begin(RTMixer.java:159)
at jm.util.Play.audio(Play.java:397)
at jm.util.Play.audio(Play.java:363)
at TestPlayAudio.main(TestPlayAudio.java:34)
Se example in attachment.
From the souce code I can identify the origin to be the
run method in jm.audio.Instrument. But at the moment I
don't now the course more precisely.
Logged In: YES
user_id=1012734
Now I identified the course: In jm.util.Play.audio(Score,
Instrument[]) a RTPhrase instance is created for each phrase
and instrument (- that means 4 instances of RTPhrase in my
example - one instrument with 4 phrases). When the RTMixer a
little later is started (method begin) it tries to start the
thread for the instrument for each phrase, ie 4 times. This
is not allowed and gives a IllegalStateException.
The cure: ? To allow polyphony (from one instrument) one
could perhaps succeed in calling the clone method of the
Instrument before adding a clone to the RTPhrase, but a lot
of code then has to be done; first of all the Cloneable
interface has to be implemented and the clone method
overridden. I expect the latter to be quite a challenge !