summaryrefslogtreecommitdiff
path: root/javax/sound
diff options
context:
space:
mode:
authorMario Torre <neugens@limasoftware.net>2007-07-09 16:32:20 +0000
committerMario Torre <neugens@limasoftware.net>2007-07-09 16:32:20 +0000
commit9afb84648bf4fc9cfa9dd2ee4dd5937a71338e4d (patch)
tree82b0e55156d12b1b8e5d816975ac3687b9967d02 /javax/sound
parentde78d5b68527b0c5028826b5a4e98790be2b6fd9 (diff)
downloadclasspath-9afb84648bf4fc9cfa9dd2ee4dd5937a71338e4d.tar.gz
2007-07-08 Mario Torre <neugens@limasoftware.net>
* gnu/javax/sound/sampled/gstreamer: new package hierarchy. * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java: new file. * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java: likewise. * gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java: likewise. * gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java: likewise. * gnu/javax/sound/sampled/gstreamer/GStreamerMixerProvider.java: likewise. * gnu/javax/sound/AudioSecurityManager.java: likewise. * gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java: likewise. * gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java: likewise. * gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java: likewise. * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileWriter.java: likewise. * resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in: likewise. * resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in: likewise. * resource/META-INF/services/javax.sound.sampled.spi.MixerProvider: likewise. * native/jni/gstreamer-peer/gstclasspathsrc.c: likewise. * native/jni/gstreamer-peer/gstclasspathsrc.h: likewise. * native/jni/gstreamer-peer/gstinputstream.c: likewise. * native/jni/gstreamer-peer/gstinputstream.h: likewise. * native/jni/gstreamer-peer/GStreamerIOPeer.c: likewise. * native/jni/gstreamer-peer/Makefile.am: likewise. * native/jni/gstreamer-peer/.cvsignore: likewise. * include/gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer.h: likewise. * include/Makefile.am: add gstreamer generated headers. * configure.ac: add gstreamer sound backend configuration. The backend is currently disabled by default. * native/jni/Makefile.am: code to allow compilation of the gstreamer sound backend. * javax/sound/sampled/spi/MixerProvider.java (isMixerSupported): indentation fixes. * javax/sound/sampled/AudioFormat.java (toString): fix method to display informations only when available. * javax/sound/sampled/DataLine.java: (Info.isFormatSupported): indentation fixes. (Info): indentation fixes. (Info.toString): indentation fixes. (Info.matches): indentation fixes.
Diffstat (limited to 'javax/sound')
-rw-r--r--javax/sound/sampled/AudioFormat.java33
-rw-r--r--javax/sound/sampled/DataLine.java62
-rw-r--r--javax/sound/sampled/spi/MixerProvider.java4
3 files changed, 61 insertions, 38 deletions
diff --git a/javax/sound/sampled/AudioFormat.java b/javax/sound/sampled/AudioFormat.java
index 629678442..7b6ebc4b0 100644
--- a/javax/sound/sampled/AudioFormat.java
+++ b/javax/sound/sampled/AudioFormat.java
@@ -330,16 +330,35 @@ public class AudioFormat
public String toString()
{
StringBuffer result = new StringBuffer();
+
+ // usually at least encoding should be somewhat specified
result.append(encoding);
- result.append(" ");
- result.append(sampleRate);
- result.append(" Hz ");
- result.append(sampleSizeInBits);
- result.append(" bits ");
- result.append(channels);
- result.append(" channels");
+
+ if (sampleRate != AudioSystem.NOT_SPECIFIED)
+ {
+ result.append(" ");
+ result.append(sampleRate);
+ result.append(" Hz");
+ }
+
+ if (sampleSizeInBits != AudioSystem.NOT_SPECIFIED)
+ {
+ result.append(" ");
+ result.append(sampleSizeInBits);
+ result.append(" bits");
+ }
+
+ if (channels != AudioSystem.NOT_SPECIFIED)
+ {
+ result.append(" ");
+ result.append(channels);
+ result.append(" channel");
+ if (channels > 1) result.append("s");
+ }
+
if (sampleSizeInBits > 8)
result.append(bigEndian ? " big endian" : " little endian");
+
return result.toString();
}
}
diff --git a/javax/sound/sampled/DataLine.java b/javax/sound/sampled/DataLine.java
index aa99a046c..b7cb70e49 100644
--- a/javax/sound/sampled/DataLine.java
+++ b/javax/sound/sampled/DataLine.java
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.sound.sampled;
/**
@@ -138,10 +137,10 @@ public interface DataLine extends Line
public boolean isFormatSupported(AudioFormat fmt)
{
for (int i = 0; i < formats.length; ++i)
- {
- if (fmt.matches(formats[i]))
- return true;
- }
+ {
+ if (fmt.matches(formats[i]))
+ return true;
+ }
return false;
}
@@ -151,25 +150,28 @@ public interface DataLine extends Line
public boolean matches(Line.Info o)
{
if (! super.matches(o) || ! (o instanceof Info))
- return false;
+ return false;
+
Info other = (Info) o;
- if (minBufferSize < other.minBufferSize
- || maxBufferSize > other.maxBufferSize)
- return false;
+ if (minBufferSize < other.minBufferSize ||
+ maxBufferSize > other.maxBufferSize)
+ return false;
+
for (int i = 0; i < formats.length; ++i)
- {
- boolean ok = false;
- for (int j = 0; j < other.formats.length; ++j)
- {
- if (formats[i].matches(other.formats[j]))
- {
- ok = true;
- break;
- }
- }
- if (! ok)
- return false;
- }
+ {
+ boolean ok = false;
+ for (int j = 0; j < other.formats.length; ++j)
+ {
+ if (formats[i].matches(other.formats[j]))
+ {
+ ok = true;
+ break;
+ }
+ }
+ if (! ok)
+ return false;
+ }
+
return true;
}
@@ -181,18 +183,20 @@ public interface DataLine extends Line
StringBuffer result = new StringBuffer();
result.append("formats: [");
for (int i = 0; i < formats.length; ++i)
- {
- if (i > 0)
- result.append(", ");
- result.append(formats[i].toString());
- }
+ {
+ if (i > 0)
+ result.append(", ");
+ result.append(formats[i].toString());
+ }
+
result.append("]; minBufferSize: ");
result.append(minBufferSize);
result.append("; maxBufferSize: ");
result.append(maxBufferSize);
return result.toString();
}
- }
+
+ } // end class: Info
/**
* Return the number of bytes currently available on this DataLine.
diff --git a/javax/sound/sampled/spi/MixerProvider.java b/javax/sound/sampled/spi/MixerProvider.java
index 1ae7b3bb7..72b972497 100644
--- a/javax/sound/sampled/spi/MixerProvider.java
+++ b/javax/sound/sampled/spi/MixerProvider.java
@@ -78,8 +78,8 @@ public abstract class MixerProvider
Mixer.Info[] infos = getMixerInfo();
for (int i = 0; i < infos.length; ++i)
{
- if (info.equals(infos[i]))
- return true;
+ if (info.equals(infos[i]))
+ return true;
}
return false;
}