CjAudioPlayer
Functions
cj_audio_player.h File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

void cj_ap_init (int sampleRate, int frameSize, int maxAudioFrameChunksToBuffer)
 Initializes library. More...
 
void cj_ap_deinit (void)
 Deinitializes the library.
 
void cj_ap_queue_audio_frames (short *audioFrames, size_t audioFramesLen)
 Queue next audio frames. More...
 
void cj_ap_mute (void)
 Mute audio player.
 
void cj_ap_unmute (void)
 Unmute audio player.
 
bool cj_ap_is_mute (void)
 Check if audio player is mute. More...
 

Function Documentation

◆ cj_ap_init()

void cj_ap_init ( int  sampleRate,
int  frameSize,
int  maxAudioFrameChunksToBuffer 
)

Initializes library.

Parameters
sampleRateSample rate of the audio being played.
frameSizeSize of the audio frame chunk. For example if we want to play 20 ms of 48KHz audio, the corresponding frame chunk size is 960.
maxAudioFrameChunksToBufferMaximum number of audio frame chunks to buffer. Less chunks means less lag but can cause audio cutouts if audio packets are not queued in proper time intervals due to network jitter. More chunks means more consistent audio, but increases the lag. Recommended values are 8 for 20 ms audio chunks, 5 for 40 ms audio chunks.

◆ cj_ap_is_mute()

bool cj_ap_is_mute ( void  )

Check if audio player is mute.

Returns
true if mute, false otherwise.

◆ cj_ap_queue_audio_frames()

void cj_ap_queue_audio_frames ( short *  audioFrames,
size_t  audioFramesLen 
)

Queue next audio frames.

Parameters
audioFramesThe audio frames to add to the queue.
audioFramesLenNumber of audio frames.