Skip to content

Commit 1d3fcdd

Browse files
committed
Fix #1236 - OpenBCI GUI hangs if
AuditoryFeedback sounds cannot be loaded Add conditional control over execution of AuditoryNeurofeedback.update() and AuditoryNeurofeedback.killAudio() in case a JavaSound Minim SourceDataLine could not be secured
1 parent 9e5b644 commit 1d3fcdd

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

OpenBCI_GUI/AuditoryNeurofeedback.pde

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class AuditoryNeurofeedback {
5757

5858
//Use band powers or prediction value to control volume of each sound file
5959
public void update(double[] bandPowers, float predictionVal) {
60+
if (!audioOutputIsAvailable) {return;}
6061
if (usingBandPowers) {
6162
for (int i = 0; i < NUM_SOUND_FILES; i++) {
6263
float gain = map((float)bandPowers[i], 0.1, .7, MIN_GAIN + 20f, MAX_GAIN);
@@ -85,6 +86,7 @@ class AuditoryNeurofeedback {
8586
}
8687

8788
public void killAudio() {
89+
if (!audioOutputIsAvailable) {return;}
8890
for (int i = 0; i < NUM_SOUND_FILES; i++) {
8991
auditoryNfbFilePlayers[i].pause();
9092
auditoryNfbFilePlayers[i].rewind();

0 commit comments

Comments
 (0)