Add AudioSource interface

This commit is contained in:
Daniel Wolf 2019-11-04 20:23:03 +01:00
parent 37d6f667ff
commit a84c3a0146
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.rhubarb_lip_sync.audio
typealias SampleArray = FloatArray
/** A sampled monaural audio signal with a fixed duration */
interface AudioSource {
/** The sample rate in Hz */
val sampleRate: Int
/** The number of samples */
val size: Int
/**
* Returns a new sample array containing the specified audio segment.
*
* @param start The index of the first sample to be included
* @param end The index of the first sample *not* to be included
*
* @throws IllegalArgumentException if [start] < 0 or [start] > [end] or [end] > [size]
*/
suspend fun getSamples(start: Int, end: Int): SampleArray
}
/** An audio source that requires closing to free resources */
interface AutoCloseableAudioSource : AudioSource, AutoCloseable