Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/sound/sampled/Mixers/BogusMixers.java
41153 views
1
/*
2
* Copyright (c) 2002, 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.DataLine;
26
import javax.sound.sampled.Line;
27
import javax.sound.sampled.Mixer;
28
29
/**
30
* @test
31
* @bug 4667064
32
* @summary Java Sound provides bogus SourceDataLine and TargetDataLine
33
*/
34
public class BogusMixers {
35
36
public static void main(String[] args) throws Exception {
37
try {
38
out("4667064: Java Sound provides bogus SourceDataLine and TargetDataLine");
39
40
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
41
out(" available Mixers:");
42
for (int i = 0; i < aInfos.length; i++) {
43
if (aInfos[i].getName().startsWith("Java Sound Audio Engine")) {
44
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
45
Line.Info[] tlInfos = mixer.getTargetLineInfo();
46
for (int ii = 0; ii<tlInfos.length; ii++) {
47
if (tlInfos[ii].getLineClass() == DataLine.class) {
48
throw new Exception("Bogus TargetDataLine with DataLine info present!");
49
}
50
}
51
}
52
if (aInfos[i].getName().startsWith("WinOS,waveOut,multi threaded")) {
53
throw new Exception("Bogus mixer 'WinOS,waveOut,multi threaded' present!");
54
}
55
out(aInfos[i].getName());
56
}
57
if (aInfos.length == 0)
58
{
59
out("[No mixers available] - not a failure of this test case.");
60
}
61
} catch (Exception e) {
62
e.printStackTrace();
63
throw e;
64
}
65
out("Test passed");
66
}
67
68
static void out(String s) {
69
System.out.println(s); System.out.flush();
70
}
71
}
72
73