-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAudioClipTester.java
More file actions
128 lines (99 loc) · 4.5 KB
/
Copy pathAudioClipTester.java
File metadata and controls
128 lines (99 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import java.util.Scanner;
import java.util.ArrayList;
public class AudioClipTester {
public static void main(String... pumpkins) {
demo(pumpkins[0]);
// theNightHasCome(pumpkins);
}
public static void demo(String soundLocation) { // demos using sound
Scanner keyboard = new Scanner(System.in);
AudioClip testclip = new AudioClip(soundLocation);
System.out.println();
System.out.println("new AudioClip(\"" + soundLocation + "\")");
System.out.println();
System.out.println("length " + testclip.length);
System.out.println("lengthSeconds() " + testclip.lengthSeconds());
System.out.println();
System.out.print("play() "); keyboard.nextLine(); System.out.println();
testclip.play();
System.out.println("isRunning() " + testclip.isRunning());
System.out.println("getPosition() " + testclip.getPosition());
System.out.println();
System.out.print("pause() "); keyboard.nextLine(); System.out.println();
testclip.pause();
System.out.println("isRunning() " + testclip.isRunning());
System.out.println("getPosition() " + testclip.getPosition());
System.out.println();
System.out.print("play() "); keyboard.nextLine(); System.out.println();
testclip.play();
System.out.println("isRunning() " + testclip.isRunning());
System.out.println("getPosition() " + testclip.getPosition());
System.out.println();
System.out.print("stop() "); keyboard.nextLine(); System.out.println();
testclip.stop();
System.out.println("isRunning() " + testclip.isRunning());
System.out.println("getPosition() " + testclip.getPosition());
System.out.println();
System.out.print("play(double position) "); testclip.play(keyboard.nextLong()); System.out.println();
keyboard.nextLine();
System.out.println("getVolume() " + testclip.getVolume());
System.out.println("getRate() " + testclip.getRate());
System.out.println();
System.out.print("setVolume(double volume) "); testclip.setVolume(keyboard.nextDouble());
System.out.print("setRate(double rate) "); testclip.setRate(keyboard.nextDouble()); System.out.println();
keyboard.nextLine();
System.out.println("length " + testclip.length);
System.out.println("length() " + testclip.length());
System.out.println();
System.out.print("stop() "); keyboard.nextLine(); System.out.println();
testclip.stop();
System.out.println("getStart() " + testclip.getStart());
System.out.println("getStop() " + testclip.getStop());
System.out.println();
System.out.print("setStart(double time) "); testclip.setStart(keyboard.nextDouble());
System.out.print("setStop(double time) "); testclip.setStop(keyboard.nextDouble()); System.out.println();
keyboard.nextLine();
System.out.println("getStart() " + testclip.getStart());
System.out.println("getStop() " + testclip.getStop());
System.out.println("length() " + testclip.length());
System.out.println();
System.out.print("play() "); keyboard.nextLine(); System.out.println();
testclip.play();
System.out.println("getPosition() " + testclip.getPosition());
System.out.println();
System.out.print("stop() "); keyboard.nextLine(); System.out.println();
testclip.stop();
System.out.print("setLoop(true) "); keyboard.nextLine(); System.out.println("play()\n");
testclip.setLoop(true);
testclip.play();
System.out.print("setLoop(false) "); keyboard.nextLine(); System.out.println();
testclip.setLoop(false);
System.out.print("setCycleCount(int count) "); testclip.setCycleCount(keyboard.nextInt()); System.out.println("play()\n");
testclip.play();
keyboard.nextLine();
System.out.println("getCycleCount() " + testclip.getCycleCount());
System.out.println();
System.out.print("getCycleCount() "); keyboard.nextLine(); System.out.println("getCycleCount() " + testclip.getCycleCount());
System.out.println();
System.out.print("isRunning() "); keyboard.nextLine();
System.out.println(testclip.isRunning());
}
public static void theNightHasCome(String... pumpkins) {
ArrayList<AudioClip> thenightwillcome = new ArrayList<AudioClip>();
for (double i = 0.5; i <= 2; i+= 0.5) {
thenightwillcome.add(new AudioClip(pumpkins[0], 0, 5000));
thenightwillcome.get(thenightwillcome.size() - 1).setLoop(true);
thenightwillcome.get(thenightwillcome.size() - 1).setRate(i);
thenightwillcome.get(thenightwillcome.size() - 1).play();
}
new Scanner(System.in).nextLine();
for (AudioClip clip: thenightwillcome) {
// clip.stop();
clip.setVolume(0.25);
}
AudioClip clip = new AudioClip("Ricky.mp3");
clip.setLoop(true);
clip.play();
new Scanner(System.in).nextLine();
}
}