跳转至
400-881-9892

文档中心

官方文档,可查阅产品介绍、快速入门、用户指南、开发指南、API参考、SDK参考、帮助等信息。

文档中心 互动课堂

TKAudioMixer

TKAudioMixer class

Description Type
Inherits from NSObject
Declared in TKAudioMixer.h

Overview

The TKRoomSDK provides a mixing module interface, which developers can call to complete mixing operations.

TKAudioInfo class
  • Audio Parameters

@property (nonatomic) int bytes_per_sample;@property (nonatomic) int sample_rate;@property (nonatomic) int number_of_channels;@property (nonatomic) int number_of_frames;@property (nonatomic) int fromat;

TKAudioMixerOuputDelegate

Callback for output after mixing is completed  -(void)mixedAudioOutput:(TKAudioMixer )mixer ouput_data:(const void )data audioInfo:(TKAudioInfo *)audioInfo;

TKAudioMixer

Audio Mixing Interface Class

init
  • Brief Description

Initialize the mixer object and register the delegate callback

  • Interface Name

- (instancetype)initWithDelegate:(id<TKAudioMixerOuputDelegate>)delegate audioInfo:(TKAudioInfo *)audioInfo;

  • Parameters
Parameter Name Required Type Description
delegate Yes id The object that implements the TKAudioMixerOutputDelegate protocol
audioInfo Yes TKAudioInfo Audio parameters after mixing
  • Return Value Description
Type Description
instancetype TKAudioMixer instance object
addSource
  • Brief Description

Add a data source

  • Interface Name

- (int)addSource:(NSString *)sid;

  • Parameters
Parameter Name Required Type Description
sid Yes NSString Data Source ID
  • Return Value Description
Type Description
int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed
removeSource
  • Brief Description

Remove a data source

  • Interface Name

- (int)removeSource:(NSString *)sid;

  • Parameters
Parameter Name Required Type Description
sid Yes NSString Data Source ID
  • Return Value Description
Type Description
int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed
receiveData
  • Brief Description

Mixer data input interface

  • Interface Name

- (int)receiveData:(NSString *)sid audio_data:(void *)audio_data audioInfo:(TKAudioInfo *)audioInfo;

  • Parameters
Parameter Name Required Type Description
sid Yes NSString The data source ID that needs to be mixed
audio_data Yes void * The data that needs to be mixed
audioInfo Yes TKAudioInfo The audio parameters that need to be mixed
  • Return Value Description
Type Description
int 0: Indicates that the call was successful. Non-zero: Indicates that the call failed