-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIkuzo.java
More file actions
54 lines (44 loc) · 1.47 KB
/
Copy pathIkuzo.java
File metadata and controls
54 lines (44 loc) · 1.47 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.narutogacha;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
/**
*
* @author USER
*/
public class Ikuzo {
// to store current position
Long currentFrame;
Clip clip;
// current status of clip
String status;
AudioInputStream audioInputStream;
static String filePath;
// constructor to initialize streams and clip
public Ikuzo(String filePath)
throws UnsupportedAudioFileException,
IOException, LineUnavailableException
{
// create AudioInputStream object
audioInputStream =
AudioSystem.getAudioInputStream(new File(filePath).getAbsoluteFile());
// create clip reference
clip = AudioSystem.getClip();
// open audioInputStream to the clip
clip.open(audioInputStream);
//clip.loop(Clip.LOOP_CONTINUOUSLY);
}
public void play(){
clip.start();
}
}