You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/processing/sound/AudioIn.java
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,12 @@ public class AudioIn extends SoundObject {
20
20
// port, so we need to control the amplitude via an extra multiplier unit
21
21
privateMultiplymultiplier;
22
22
23
+
privateStringANDROID_PERMISSION_WARNING_MESSAGE =
24
+
"\nsketch does not have permission to record audio from microphone,\n" +
25
+
"please request the permission in your AndroidManifest.xml and in\n" +
26
+
"your sketch initialization code (the Sound library's\n" +
27
+
"AudioInputAndroid example demonstrates how to do both)\n";
28
+
23
29
publicAudioIn(PAppletparent) {
24
30
this(parent, 0);
25
31
}
@@ -32,17 +38,15 @@ public AudioIn(PApplet parent) {
32
38
*/
33
39
publicAudioIn(PAppletparent, intin) {
34
40
super(parent);
41
+
35
42
if (Engine.getAudioManager() instanceofJSynAndroidAudioDeviceManager) {
36
43
// we're on Android, check if the sketch has permission to capture Audio
37
44
if (!parent.hasPermission(Manifest.permission.RECORD_AUDIO)) {
38
-
// if (ContextCompat.checkSelfPermission(parent.getContext(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_DENIED) {
39
-
Engine.printWarning("sketch does not have permission to record audio from microphone, please request the permission in your AndroidManifest.xml or in your sketch initialization code (the Sound library's AudioInputAndroid example demonstrates how to do both)");
40
-
// requesting permission in here is problematic because the
41
-
// user dialogue and granting of permission are asynchronous
42
-
// ActivityCompat.requestPermissions(parent.getContext(), new String[]{ Manifest.permission.RECORD_AUDIO }, -1);
0 commit comments