From 978614be36402128eab3520d32f5a21baf14faaf Mon Sep 17 00:00:00 2001 From: DaniTheSkunk <> Date: Fri, 25 Nov 2022 00:52:43 +0000 Subject: [PATCH] added documentation --- .../skunkworks/audio/ISample.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/com/danitheskunk/skunkworks/audio/ISample.java b/com/danitheskunk/skunkworks/audio/ISample.java index 6edf6ba..3455dd2 100644 --- a/com/danitheskunk/skunkworks/audio/ISample.java +++ b/com/danitheskunk/skunkworks/audio/ISample.java @@ -1,16 +1,56 @@ package com.danitheskunk.skunkworks.audio; +/** + * An audio sample + *

+ * Either mono or stereo. Samplerate unaware. + */ //todo: samplerate stuffs? public interface ISample { + /** + * Returns the length + * + * @return the length in samples + */ int getLength(); + /** + * Returns the sample of left channel at position + * + * @param pos position in samples + * @return the sample value from -1.0 to 1.0 (+ headroom if clipping) + */ double getSampleLeft(int pos); + /** + * Returns the sample of right channel at position + * + * @param pos position in samples + * @return the sample value from -1.0 to 1.0 (+ headroom if clipping) + */ double getSampleRight(int pos); + /** + * Returns if the sample is in stereo + * + * @return true if the sample is stereo, false if mono + */ boolean isStereo(); + /** + * Set a sample value for left and right channel + * + * @param pos position in samples + * @param left sample value of left channel -32768 to 32768 + * @param right sample value of right channel -32768 to 32768 + */ void setSamplei(int pos, short left, short right); + /** + * Set a sample value for left or mono channel + * + * @param pos position in samples + * @param left sample value of left(or mono) channel -32768 to 32768 + */ void setSamplei(int pos, short left); }