package open.sound;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import open.message.MessageBox;
import open.process.IOImageProcess;
import open.util.FileChoser;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import open.message.MessageBox;
import open.process.IOImageProcess;
import open.util.FileChoser;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
public class Ses {
AudioStream audio = null;
InputStream inputStream = null;
String path;
public Ses() {
}
Ses(String path) {
path = path;
}
Ses(InputStream inputSound) {
this.inputStream = inputSound;
}
public void Cal(String path) {
try {
inputStream = new FileInputStream(path);
if (inputStream.available() > 0) {
audio = new AudioStream(inputStream);
AudioPlayer.player.start(audio);
} else {
MessageBox.showMessage("Ses dosyası bulunamdı");
}
} catch (Exception e) {
}
}
public void Cal(){
String path=FileChoser.chose();
Cal(path);
}
public void kapat() {
try {
if (audio != null) {
AudioPlayer.player.stop(audio);
} else {
MessageBox.showMessage("Ses kapatılamadı");
}
} catch (Exception e) {
}
}
public static void main(String[] args) throws InterruptedException {
Ses ses = new Ses();
ses.Cal("C:\\Users\\ozaytunctan13\\Downloads\\Compressed\\2_wav_files (online-audio-converter.com)\\Java Video Tutorial - YouTube.wav");
Thread.sleep(4000);
ses.kapat();
}
}
Hiç yorum yok:
Yorum Gönder
Lütfen yorumlarınızı iletiniz...