diff --git a/.gitignore b/.gitignore index 17c1465..9f36e81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /dist/ -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +/build/ \ No newline at end of file diff --git a/README.md b/README.md index f03aa67..8616dc3 100755 --- a/README.md +++ b/README.md @@ -25,3 +25,5 @@ Java library that provides tools for audio recording and playback. 0.9.2 - Close and setGain methods in the Speaker class. - Close and getInputStream method added to Microphone class. 0.9.3 - Set open methods + +0.9.4 - Add getControl method to Speaker and Microphone diff --git a/build/built-jar.properties b/build/built-jar.properties index c936ff4..1d2d0b0 100644 --- a/build/built-jar.properties +++ b/build/built-jar.properties @@ -1,4 +1,4 @@ -#Tue, 03 Apr 2018 21:46:29 -0300 +#Sat, 12 May 2018 12:04:54 -0300 /home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom= diff --git a/build/classes/org/aucom/sound/AudioInterface.class b/build/classes/org/aucom/sound/AudioInterface.class index 3d4dd82..118e68c 100644 Binary files a/build/classes/org/aucom/sound/AudioInterface.class and b/build/classes/org/aucom/sound/AudioInterface.class differ diff --git a/build/classes/org/aucom/sound/Microphone.class b/build/classes/org/aucom/sound/Microphone.class index 945012a..1c72896 100644 Binary files a/build/classes/org/aucom/sound/Microphone.class and b/build/classes/org/aucom/sound/Microphone.class differ diff --git a/build/classes/org/aucom/sound/Speaker.class b/build/classes/org/aucom/sound/Speaker.class index 8c7f34e..7d5d58a 100644 Binary files a/build/classes/org/aucom/sound/Speaker.class and b/build/classes/org/aucom/sound/Speaker.class differ diff --git a/build/classes/org/aucom/test/Main.class b/build/classes/org/aucom/test/Main.class index efd8fca..a38c5d7 100644 Binary files a/build/classes/org/aucom/test/Main.class and b/build/classes/org/aucom/test/Main.class differ diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index d7a737e..ce46158 100755 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -18,11 +18,12 @@ file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/sound/Microphone.java file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/sound/AudioInfo.java + + file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/test/Main.java file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/sound/Speaker.java file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/sound/AudioQuality.java file:/home/martin/Dropbox/Java/Proyectos/NetBeansProjects/AuCom/src/org/aucom/io/ByteBuffer.java - diff --git a/src/org/aucom/sound/AudioInterface.java b/src/org/aucom/sound/AudioInterface.java index b38cedc..1b22c0b 100755 --- a/src/org/aucom/sound/AudioInterface.java +++ b/src/org/aucom/sound/AudioInterface.java @@ -6,6 +6,7 @@ package org.aucom.sound; import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; /** @@ -21,6 +22,7 @@ public AudioInterface(AudioFormat quality) {} public abstract void configure(AudioFormat format) throws LineUnavailableException; public abstract boolean isOpen(); public abstract AudioFormat getFormat(); + public abstract FloatControl getControl(FloatControl.Type type); public abstract void open() throws LineUnavailableException; public abstract void stop(); public abstract void close(); diff --git a/src/org/aucom/sound/Microphone.java b/src/org/aucom/sound/Microphone.java index d0c3b1d..e1769f5 100755 --- a/src/org/aucom/sound/Microphone.java +++ b/src/org/aucom/sound/Microphone.java @@ -9,6 +9,7 @@ import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; +import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; import static org.aucom.sound.AudioInfo.BUFF_SIZE; @@ -72,6 +73,10 @@ public AudioFormat getFormat(){ return driver.getFormat(); } + public FloatControl getControl(FloatControl.Type type) { + return (FloatControl) driver.getControl(type); + } + @Override public void open() throws LineUnavailableException { //AudioFormat format = driver == null ? null : driver.getFormat(); diff --git a/src/org/aucom/sound/Speaker.java b/src/org/aucom/sound/Speaker.java index b15a7c4..b31f1a0 100755 --- a/src/org/aucom/sound/Speaker.java +++ b/src/org/aucom/sound/Speaker.java @@ -10,7 +10,6 @@ import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.FloatControl.Type; -import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import static org.aucom.sound.AudioInfo.DEFAULT_FORMAT; @@ -69,8 +68,12 @@ public AudioFormat getFormat(){ return driver.getFormat(); } + public FloatControl getControl(FloatControl.Type type) { + return (FloatControl) driver.getControl(type); + } + @Override - public void open() throws LineUnavailableException{ + public void open() throws LineUnavailableException { AudioFormat format = driver.getFormat(); driver.open(format == null ? DEFAULT_FORMAT : format); driver.start(); diff --git a/src/org/aucom/test/Main.java b/src/org/aucom/test/Main.java index 44771ef..23efb85 100644 --- a/src/org/aucom/test/Main.java +++ b/src/org/aucom/test/Main.java @@ -4,7 +4,10 @@ * and open the template in the editor. */ package org.aucom.test; +import java.io.File; import java.io.IOException; +import javafx.scene.media.Media; +import javafx.scene.media.MediaPlayer; import javax.sound.sampled.LineUnavailableException; import org.aucom.sound.AudioQuality; import org.aucom.sound.Microphone; @@ -16,7 +19,12 @@ */ public class Main { public static void main(String[] args) throws LineUnavailableException, IOException { - Microphone micro = new Microphone(AudioQuality.HIGH); + File sound = new File("/home/martin/AudioTesting/music/John Petrucci/" + + "When_The_Keyboard_Breaks_Live_In_Chicago/Universal_Mind.m4a"); + Media song = new Media(sound.toURI().toString()); + MediaPlayer player = new MediaPlayer(song); + player.play(); + /*Microphone micro = new Microphone(AudioQuality.HIGH); Speaker speaker = new Speaker(AudioQuality.HIGH); micro.open();speaker.open(); @@ -36,7 +44,7 @@ public static void main(String[] args) throws LineUnavailableException, IOExcept // list.add(micro.readAudio(32)); // // for (byte[] buffer : list) -// System.out.println(Arrays.toString(buffer)); +// System.out.println(Arrays.toString(buffer));*/ } }