Add the hasSource method to the AudioMixer interface.

PiperOrigin-RevId: 551804976
This commit is contained in:
samrobinson 2023-07-28 11:35:26 +01:00 committed by Rohit Singh
parent c221958889
commit b15e7553e5
2 changed files with 6 additions and 0 deletions

View File

@ -106,6 +106,11 @@ public interface AudioMixer {
*/
int addSource(AudioFormat sourceFormat, long startTimeUs) throws UnhandledAudioFormatException;
/**
* Returns whether there is an {@link #addSource added source} with the given {@code sourceId}.
*/
boolean hasSource(int sourceId);
/**
* Sets the volume applied to future samples queued from the given source.
*

View File

@ -151,6 +151,7 @@ import java.nio.ByteOrder;
return sourceId;
}
@Override
public boolean hasSource(int sourceId) {
checkStateIsConfigured();
return containsKey(sources, sourceId);