Skip to content

Commit e23869e

Browse files
authored
Merge pull request #1237 from JungleHippo/1236-OpenBCI-GUI-hangs-if-AuditoryFeedback-sounds-cannot-be-loaded
Fix GUI hanging if AuditoryFeedback sounds cannot be loaded
2 parents 41610b9 + 1d3fcdd commit e23869e

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)