namespace Agora.Rtc
{
///
///
/// The audio frame observer.
///
///
public abstract class IAudioFrameObserver
{
///
///
/// Gets the captured audio frame.
/// If you want to set the format of the captured audio frame, Agora recommends that you call the RegisterAudioFrameObserver method to set the format of the audio frame after calling the GetRecordAudioParams method to register an audio frame observer. The SDK calculates the sampling interval according to the AudioParams set in the GetRecordAudioParams Callback return value, and triggers the OnRecordAudioFrame Callback according to the sampling interval.
///
///
/// The raw audio data. See AudioFrame .
///
/// The channel ID.
///
///
/// Reserved for future use.
///
///
public virtual bool OnRecordAudioFrame(string channelId ,AudioFrame audioFrame)
{
return true;
}
///
///
/// Gets the audio frame for playback.
/// If you want to set the format of the audio frame for playback, Agora recommends that you call the RegisterAudioFrameObserver method to set the format of the audio frame after calling the SetPlaybackAudioFrameParameters method to register an audio frame observer.
///
///
/// The raw audio data. See AudioFrame .
///
/// The channel ID.
///
///
/// Reserved for future use.
///
///
public virtual bool OnPlaybackAudioFrame(string channelId, AudioFrame audio_frame)
{
return true;
}
///
///
/// Retrieves the mixed captured and playback audio frame.
/// This Callback only returns the single-channel data.If you want to set the format of the mixed captured and playback audio frame, Agora recommends you call the RegisterAudioFrameObserver method to set the format of the audio frames after calling the SetMixedAudioFrameParameters method to register an audio frame observer.
///
///
/// The raw audio data. See AudioFrame .
///
/// The channel ID.
///
///
/// Reserved for future use.
///
///
public virtual bool OnMixedAudioFrame(string channelId, AudioFrame audio_frame)
{
return true;
}
///
/// @ignore
///
public virtual int GetObservedAudioFramePosition()
{
return (int)AUDIO_FRAME_POSITION.AUDIO_FRAME_POSITION_NONE;
}
///
///
/// Sets the audio format for the OnPlaybackAudioFrame Callback.
/// You need to register the Callback when calling the RegisterAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this Callback, and you can set the audio format in the return value of this Callback.The SDK calculates the sample interval according to the AudioParams you set in the return value of this Callback.Sample interval = samplePerCall/(sampleRate × channel).Ensure that the sample interval ≥ 0.01 (s).The SDK triggers the OnPlaybackAudioFrame Callback according to the sampling interval.
///
///
///
/// Sets the audio format. See AudioParams .
///
///
public virtual AudioParams GetPlaybackAudioParams()
{
return new AudioParams();
}
///
///
/// Sets the audio format for the OnRecordAudioFrame Callback.
/// You need to register the Callback when calling the RegisterAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this Callback, and you can set the audio format in the return value of this Callback.The SDK calculates the sample interval according to the AudioParams you set in the return value of this Callback.Sample interval = samplePerCall/(sampleRate × channel).Ensure that the sample interval ≥ 0.01 (s).The SDK triggers the OnRecordAudioFrame Callback according to the sampling interval.
///
///
///
/// Sets the audio format. See AudioParams .
///
///
public virtual AudioParams GetRecordAudioParams()
{
return new AudioParams();
}
///
///
/// Sets the audio format for the OnMixedAudioFrame Callback.
/// You need to register the Callback when calling the RegisterAudioFrameObserver method. After you successfully register the audio observer, the SDK triggers this Callback, and you can set the audio format in the return value of this Callback.The SDK calculates the sample interval according to the AudioParams you set in the return value of this Callback.Sample interval = samplePerCall/(sampleRate × channel).Ensure that the sample interval ≥ 0.01 (s).The SDK triggers the OnMixedAudioFrame Callback according to the sampling interval.
///
///
///
/// Sets the audio format. See AudioParams .
///
///
public virtual AudioParams GetMixedAudioParams()
{
return new AudioParams();
}
///
///
/// Retrieves the audio frame of a specified user before mixing.
///
///
/// The channel ID.
///
/// The user ID of the specified user.
///
/// The raw audio data. See AudioFrame .
///
///
/// Reserved for future use.
///
///
public virtual bool OnPlaybackAudioFrameBeforeMixing(string channel_id,
uint uid,
AudioFrame audio_frame)
{
return false;
}
///
///
/// Retrieves the audio frame of a specified user before mixing.
///
///
/// The channel name that the audio frame came from.
///
/// The ID of the user sending the audio frame.
///
/// The raw audio data. See AudioFrame .
///
///
/// Reserved for future use.
///
///
public virtual bool OnPlaybackAudioFrameBeforeMixing(string channel_id,
string uid,
AudioFrame audio_frame)
{
return false;
}
}
}