Skip to content

Commit 701ce37

Browse files
kroedercodingjoe
authored andcommitted
Giving additional feedback when no audio input was found
This catches the issue when no audio input was found This might catch the java exception that is thrown on some systems You can test this when you deactivate every audio input on your operating system
1 parent c13e77b commit 701ce37

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

MusicBeam/Info.plist.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
<!-- Customize this set as you wish -->
2323
<key>CFBundleShortVersionString</key>
24-
<string>2.1.0</string>
24+
<string>2.1.1</string>
2525
<key>CFBundleVersion</key>
26-
<string>2.1.0</string>
26+
<string>2.1.1</string>
2727
<key>CFBundleSignature</key>
2828
<string>com.codingjoe.MusicBeam</string>
2929
<key>NSHumanReadableCopyright</key>

MusicBeam/MusicBeam.pde

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import controlP5.*;
1010
import ddf.minim.*;
1111
import ddf.minim.analysis.*;
1212

13-
String version = "2.1.0";
13+
String version = "2.1.1";
1414

1515
public Boolean debugMode = false;
1616

@@ -48,6 +48,8 @@ int height = 570;
4848
float maxLevel = 0;
4949
float goalMaxLevel=0;
5050
void settings() {
51+
initAudioInput();
52+
5153
if(!hasEnoughScreenDevices()) {
5254
String msg = "No second screen device detected!\n"
5355
+"Please make sure to attach your video projector before you launch MusicBeam.\n"
@@ -56,6 +58,7 @@ void settings() {
5658
if (close == JOptionPane.NO_OPTION)
5759
System.exit(1);
5860
}
61+
5962
size(width, height);
6063
}
6164

@@ -64,13 +67,6 @@ void setup() {
6467
PImage titlebaricon = loadImage("icon.png");
6568
surface.setIcon(titlebaricon);
6669

67-
Minim minim = new Minim(this);
68-
in = minim.getLineIn(Minim.STEREO, 512);
69-
70-
bdFreq = new BeatDetect(in.bufferSize(), in.sampleRate());
71-
bdSound = new BeatDetect();
72-
73-
7470
colorMode(HSB, 360, 100, 100);
7571

7672
initControls();
@@ -344,3 +340,22 @@ private boolean hasEnoughScreenDevices()
344340
return false;
345341
return true;
346342
}
343+
344+
private void initAudioInput()
345+
{
346+
String msg = "No audio input found!\n\n"
347+
+ "Please check the audio settings on your current operating system.\n"
348+
+ "There must be at least one audio input activated.";
349+
350+
minim = new Minim(this);
351+
in = minim.getLineIn(Minim.STEREO, 512);
352+
353+
if(in == null)
354+
{
355+
JOptionPane.showMessageDialog(null, msg, "Device detection", JOptionPane.ERROR_MESSAGE);
356+
System.exit(1);
357+
}
358+
359+
bdFreq = new BeatDetect(in.bufferSize(), in.sampleRate());
360+
bdSound = new BeatDetect();
361+
}

0 commit comments

Comments
 (0)