Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/sound/sampled/Mixers/NoSimpleInputDevice.java
41153 views
1
/*
2
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import javax.sound.sampled.AudioSystem;
25
import javax.sound.sampled.Mixer;
26
27
/**
28
* @test
29
* @bug 4936397
30
* @summary Verify that there'll be either SimpleInputDevice OR DirectAudioDevice
31
*/
32
public class NoSimpleInputDevice {
33
34
public static void main(String[] args) throws Exception {
35
out("4936397: Verify that there'll be either SimpleInputDevice OR DirectAudioDevice");
36
boolean foundSimpleInputDevice = false;
37
boolean foundDirectAudioDevice = false;
38
39
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
40
for (int i = 0; i < aInfos.length; i++) {
41
try {
42
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
43
String mixerClass = mixer.getClass().toString();
44
if (mixerClass.indexOf("SimpleInputDevice") >= 0) {
45
out("Found SimpleInputDevice: "+aInfos[i]);
46
foundSimpleInputDevice = true;
47
}
48
if (mixerClass.indexOf("DirectAudioDevice") >= 0) {
49
out("Found DirectAudioDevice: "+aInfos[i]);
50
foundDirectAudioDevice = true;
51
}
52
} catch (Exception e) {
53
out("Unexpected exception: "+e);
54
}
55
}
56
if (aInfos.length == 0) {
57
out("[No mixers available] - cannot exercise this test.");
58
} else {
59
if (foundSimpleInputDevice && foundDirectAudioDevice) {
60
out("Found both types of capture devices!");
61
throw new Exception("Test FAILED!");
62
}
63
out("Did not find both types of capture devices. Test passed");
64
}
65
}
66
67
static void out(String s) {
68
System.out.println(s); System.out.flush();
69
}
70
}
71
72