java.lang.Object
org.refcodes.audio.AbstractSvgSampleWriter<MonoSample,SvgMonoSampleWriter>
org.refcodes.audio.SvgMonoSampleWriter
- All Implemented Interfaces:
AutoCloseable,MonoSampleWriter<SvgMonoSampleWriter>,SampleWriter<MonoSample,,SvgMonoSampleWriter> SamplingRateAccessor,SamplingRateAccessor.SamplingRateBuilder<SvgMonoSampleWriter>,SamplingRateAccessor.SamplingRateMutator,SamplingRateAccessor.SamplingRateProperty,org.refcodes.io.RowWriter<MonoSample>
public class SvgMonoSampleWriter
extends AbstractSvgSampleWriter<MonoSample,SvgMonoSampleWriter>
implements MonoSampleWriter<SvgMonoSampleWriter>
The
SvgMonoSampleWriter provides means to write sound samples to a
SVG file.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty -
Field Summary
Fields inherited from class org.refcodes.audio.AbstractSvgSampleWriter
_printStream -
Constructor Summary
ConstructorsConstructorDescriptionSvgMonoSampleWriter(File aFile) Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream.SvgMonoSampleWriter(OutputStream aOutputStream) Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream.SvgMonoSampleWriter(PrintStream aPrintStream) Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intRetrieves the sampling rate from the sampling rate property.voidsetSamplingRate(int aSamplingRate) Sets the sampling rate for the sampling rate property.withSamplingRate(int aSamplingRate) Sets the sampling rate for the sampling rate property.voidwriteNext(double aSampleData) Writes the next samples, one sample for each channel.voidwriteNext(MonoSample aSample) Writes the next samples, one sample for each channel.Methods inherited from class org.refcodes.audio.AbstractSvgSampleWriter
format, toDouble, toString, toYCoordinate, writeSvgHeaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateProperty
letSamplingRate
-
Constructor Details
-
SvgMonoSampleWriter
Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream.- Parameters:
aFile- TheFilewhere to write the SVG records to.- Throws:
FileNotFoundException- If the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.
-
SvgMonoSampleWriter
Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream.- Parameters:
aOutputStream- TheOutputStreamwhere to write the SVG records to.
-
SvgMonoSampleWriter
Constructs theSvgMonoSampleWriterfor writing sound samples to a SVG file or stream.- Parameters:
aPrintStream- ThePrintStreamwhere to write the SVG records to.
-
-
Method Details
-
writeNext
public void writeNext(double aSampleData) Writes the next samples, one sample for each channel. Provide one sample for mono audio, two samples for stereo audio and so on. In case you provide more or less samples than channels being supported by the writer, then it is up to the writer whether to duplicate the samples or calculate an average or the like.- Specified by:
writeNextin interfaceMonoSampleWriter<SvgMonoSampleWriter>- Parameters:
aSampleData- The samples, one for each channel.
-
writeNext
Writes the next samples, one sample for each channel. Provide one sample for mono audio, two samples for stereo audio and so on. In case you provide more or less samples than channels being supported by the writer, then it is up to the writer whether to duplicate the samples or calculate an average or the like.- Specified by:
writeNextin interfaceorg.refcodes.io.RowWriter<MonoSample>- Specified by:
writeNextin interfaceSampleWriter<MonoSample,SvgMonoSampleWriter> - Parameters:
aSample- The samples, one for each channel.
-
close
Description copied from class:AbstractSvgSampleWriter- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSampleWriter<MonoSample,SvgMonoSampleWriter> - Overrides:
closein classAbstractSvgSampleWriter<MonoSample,SvgMonoSampleWriter> - Throws:
IOException
-
getSamplingRate
public int getSamplingRate()Retrieves the sampling rate from the sampling rate property.- Specified by:
getSamplingRatein interfaceSamplingRateAccessor- Returns:
- The sampling rate stored by the sampling rate property.
-
setSamplingRate
public void setSamplingRate(int aSamplingRate) Sets the sampling rate for the sampling rate property.- Specified by:
setSamplingRatein interfaceSamplingRateAccessor.SamplingRateMutator- Parameters:
aSamplingRate- The sampling rate to be stored by the sampling rate property.
-
withSamplingRate
Sets the sampling rate for the sampling rate property.- Specified by:
withSamplingRatein interfaceSamplingRateAccessor.SamplingRateBuilder<SvgMonoSampleWriter>- Parameters:
aSamplingRate- The sampling rate to be stored by the sampling rate property.- Returns:
- The builder for applying multiple build operations.
-