Package com.io7m.jsamplebuffer.xmedia
Class SXMSampleBuffers
java.lang.Object
com.io7m.jsamplebuffer.xmedia.SXMSampleBuffers
Functions to create buffers from audio streams.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AudioInputStream
Produce a stream from the given sample buffer.static SampleBufferType
readSampleBufferFromFile
(Path file, SampleBufferFactoryType buffers) Read the given file into a sample buffer.static SampleBufferType
readSampleBufferFromStream
(AudioInputStream stream, SampleBufferFactoryType buffers) Read the given stream into a sample buffer.static void
writeSampleBufferToFile
(SampleBufferReadableType buffer, Path file) Write the given sample to the given file in WAVE format.static void
writeSampleBufferToFile
(SampleBufferReadableType buffer, AudioFileFormat.Type type, Path file) Write the given sample to the given file.
-
Method Details
-
writeSampleBufferToFile
public static void writeSampleBufferToFile(SampleBufferReadableType buffer, Path file) throws IOException Write the given sample to the given file in WAVE format.- Parameters:
buffer
- The sample bufferfile
- The output file- Throws:
IOException
- On errors
-
writeSampleBufferToFile
public static void writeSampleBufferToFile(SampleBufferReadableType buffer, AudioFileFormat.Type type, Path file) throws IOException Write the given sample to the given file.- Parameters:
buffer
- The sample buffertype
- The file formatfile
- The output file- Throws:
IOException
- On errors
-
readSampleBufferFromFile
public static SampleBufferType readSampleBufferFromFile(Path file, SampleBufferFactoryType buffers) throws IOException, UnsupportedAudioFileException Read the given file into a sample buffer.- Parameters:
file
- The filebuffers
- A provider of buffers- Returns:
- A sample buffer
- Throws:
IOException
- On I/O errorsUnsupportedAudioFileException
- If the file refers to an audio format that cannot be processed
-
readSampleBufferFromStream
public static SampleBufferType readSampleBufferFromStream(AudioInputStream stream, SampleBufferFactoryType buffers) throws IOException, UnsupportedAudioFileException Read the given stream into a sample buffer.- Parameters:
stream
- The streambuffers
- A provider of buffers- Returns:
- A sample buffer
- Throws:
IOException
- On I/O errorsUnsupportedAudioFileException
- If the audio stream refers to an audio format that cannot be processed
-
createStreamFromSampleBuffer
Produce a stream from the given sample buffer.- Parameters:
sample
- The sample buffer- Returns:
- A stream
-