void main()
{
rawpcm_vpconfig.identifier = RAW_PCM_VOICE_POOL_ID;
rawpcm_vpconfig.num_voices = 1;
rawpcm_vpconfig.player_config.max_channels = 1;
raw]pcm_vpconfig.player_config.max_sampling_rate = PCM_SAMPLING_RATE;
rawpcm_vpconfig.player_config.pcm_format = CRIATOM_PCM_FORMAT_SINT16;
&rawpcm_vpconfig, NULL, 0);
memset(app_obj->pcm_buffer[0], 0, PCM_BUFFER_LENGTH * sizeof(CriSint16));
app_obj->sin_offset = 0.0f;
app_obj->pcm_buffer_current = 0;
app_obj->pcm_buffer[0], PCM_BUFFER_LENGTH * sizeof(CriSint16));
}
static void app_data_request_func(
{
AppObj *app_obj = (AppObj*)obj;
CriFloat32 sin_offset = app_obj->sin_offset;
CriFloat32 sin_step = 2.0f * 3.141592f * app_obj->sin_frequency / PCM_SAMPLING_RATE;
app_obj->pcm_buffer_current++;
app_obj->pcm_buffer_current %= 2;
CriSint16 *buffer = app_obj->pcm_buffer[app_obj->pcm_buffer_current];
for (i = 0; i < PCM_BUFFER_LENGTH; i++) {
buffer[i] = (CriSint16)(sinf(sin_offset) * 32767.0f);
sin_offset += sin_step;
}
app_obj->sin_offset = fmodf(sin_offset, 2.0f * 3.141592f);
}
#define CRIATOMEX_FORMAT_RAW_PCM
Definition: cri_le_atom_ex.h:1932
void criAtomExPlayer_SetVoicePoolIdentifier(CriAtomExPlayerHn player, CriAtomExVoicePoolIdentifier identifier)
Specify the Voice Pool identifier
void criAtomExPlayer_SetData(CriAtomExPlayerHn player, void *buffer, CriSint32 size)
Set the sound data to play (specifying in-memory data)
void criAtomExPlayer_SetFormat(CriAtomExPlayerHn player, CriAtomExFormat format)
Specify the format of a sound
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback
void criAtomExPlayer_SetDataRequestCallback(CriAtomExPlayerHn player, CriAtomExPlayerDataRequestCbFunc func, void *obj)
Register the data request callback function
CriUint32 CriAtomExPlaybackId
Playback ID
Definition: cri_le_atom_ex.h:3722
void criAtomExPlayer_SetNumChannels(CriAtomExPlayerHn player, CriSint32 num_channels)
Specify the number of channels of a sound
void criAtomExPlayer_SetSamplingRate(CriAtomExPlayerHn player, CriSint32 sampling_rate)
Specify the sampling rate of a sound
#define criAtomExVoicePool_SetDefaultConfigForRawPcmVoicePool(p_config)
Assign the default values to the configuration structure used to create a raw PCM Voice Pool
Definition: cri_le_atom_ex.h:672
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateRawPcmVoicePool(const CriAtomExRawPcmVoicePoolConfig *config, void *work, CriSint32 work_size)
Create a raw PCM Voice Pool
struct CriAtomPlayerTag * CriAtomPlayerHn
Atom player handle
Definition: cri_le_atom.h:2339
void criAtomPlayer_SetData(CriAtomPlayerHn player, void *buffer, CriSint32 buffer_size)
Set sound data (specify On-memory data)