aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Burk <[email protected]>2017-07-31 18:37:19 -0700
committerGitHub <[email protected]>2017-07-31 18:37:19 -0700
commite0c2c23cfea01f317e62c75177d388f312618fc3 (patch)
tree32195d9002a962d1d652c02c35087db78ba51862 /src
parent4d158c44e93849622aa56633fbe1f1facbe1eea9 (diff)
parent5581ea67ca8831b74450d7ad3d5be68be2a013b3 (diff)
Merge pull request #51 from nmulcahey/master
Ensure upper bound for argument to Thread#setPriority is less than Thread#MAX_PRIORITY
Diffstat (limited to 'src')
-rw-r--r--src/com/jsyn/engine/SynthesisEngine.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/jsyn/engine/SynthesisEngine.java b/src/com/jsyn/engine/SynthesisEngine.java
index c79083e..b49e78e 100644
--- a/src/com/jsyn/engine/SynthesisEngine.java
+++ b/src/com/jsyn/engine/SynthesisEngine.java
@@ -233,7 +233,9 @@ public class SynthesisEngine implements Synthesizer {
engineThread = new EngineThread(inputDeviceID, numInputChannels,
outputDeviceID, numOutputChannels);
logger.fine("Synth thread old priority = " + engineThread.getPriority());
- engineThread.setPriority(engineThread.getPriority() + 2);
+ int engineThreadPriority = engineThread.getPriority() + 2 > Thread.MAX_PRIORITY ?
+ Thread.MAX_PRIORITY : engineThread.getPriority() + 2;
+ engineThread.setPriority(engineThreadPriority);
logger.fine("Synth thread new priority = " + engineThread.getPriority());
engineThread.start();
}