NUGU SDK Linux  1.7.6
PCM manipulation

PCM manipulation functions. More...

+ Collaboration diagram for PCM manipulation:

Typedefs

typedef struct _nugu_pcm NuguPcm
 pcm object
 

Functions

NUGU_API int nugu_pcm_add (NuguPcm *pcm)
 Add pcm object to managed list. More...
 
NUGU_API void nugu_pcm_clear_buffer (NuguPcm *pcm)
 Clear pcm buffer. More...
 
NUGU_API void nugu_pcm_emit_event (NuguPcm *pcm, enum nugu_media_event event)
 Emit event to registered callback. More...
 
NUGU_API void nugu_pcm_emit_status (NuguPcm *pcm, enum nugu_media_status status)
 Emit status to registered callback. More...
 
NUGU_API NuguPcmnugu_pcm_find (const char *name)
 Find a pcm object by name in the managed list. More...
 
NUGU_API void nugu_pcm_free (NuguPcm *pcm)
 Destroy the pcm object. More...
 
NUGU_API int nugu_pcm_get_audio_attribute (NuguPcm *pcm)
 Get audio attribute. More...
 
NUGU_API const char * nugu_pcm_get_audio_attribute_str (NuguPcm *pcm)
 Get audio attribute. More...
 
NUGU_API int nugu_pcm_get_data (NuguPcm *pcm, char *data, size_t size)
 Get all data. More...
 
NUGU_API size_t nugu_pcm_get_data_size (NuguPcm *pcm)
 Get pcm data size. More...
 
NUGU_API void * nugu_pcm_get_driver_data (NuguPcm *pcm)
 Get custom data for driver. More...
 
NUGU_API int nugu_pcm_get_duration (NuguPcm *pcm)
 Get duration information of pcm. More...
 
NUGU_API int nugu_pcm_get_position (NuguPcm *pcm)
 Get current playback position of pcm. More...
 
NUGU_API enum nugu_media_status nugu_pcm_get_status (NuguPcm *pcm)
 Get status of pcm. More...
 
NUGU_API int nugu_pcm_get_volume (NuguPcm *pcm)
 Get volume of pcm. More...
 
NUGU_API NuguPcmnugu_pcm_new (const char *name, NuguPcmDriver *driver, NuguAudioProperty property)
 Create new pcm object. More...
 
NUGU_API int nugu_pcm_pause (NuguPcm *pcm)
 Pause pcm playback. More...
 
NUGU_API int nugu_pcm_push_data (NuguPcm *pcm, const char *data, size_t size, int is_last)
 Push playback pcm data. More...
 
NUGU_API int nugu_pcm_push_data_done (NuguPcm *pcm)
 Set flag that push for all data is complete. More...
 
NUGU_API int nugu_pcm_receive_is_last_data (NuguPcm *pcm)
 Get flag that all data pushes are complete. More...
 
NUGU_API int nugu_pcm_remove (NuguPcm *pcm)
 Remove pcm object from managed list. More...
 
NUGU_API int nugu_pcm_resume (NuguPcm *pcm)
 Resume pcm playback. More...
 
NUGU_API int nugu_pcm_set_audio_attribute (NuguPcm *pcm, NuguAudioAttribute attr)
 Set audio attribute. More...
 
NUGU_API int nugu_pcm_set_driver_data (NuguPcm *pcm, void *data)
 Set custom data for driver. More...
 
NUGU_API void nugu_pcm_set_event_callback (NuguPcm *pcm, NuguMediaEventCallback cb, void *userdata)
 Set pcm event callback. More...
 
NUGU_API void nugu_pcm_set_status_callback (NuguPcm *pcm, NuguMediaStatusCallback cb, void *userdata)
 Set pcm status callback. More...
 
NUGU_API int nugu_pcm_set_volume (NuguPcm *pcm, int volume)
 Set volume of pcm. More...
 
NUGU_API int nugu_pcm_start (NuguPcm *pcm)
 Start pcm playback. More...
 
NUGU_API int nugu_pcm_stop (NuguPcm *pcm)
 Stop pcm playback. More...
 

Detailed Description

PCM manipulation functions.

PCM data is managed by pushing it in the nugu buffer.

Function Documentation

◆ nugu_pcm_new()

NUGU_API NuguPcm* nugu_pcm_new ( const char *  name,
NuguPcmDriver driver,
NuguAudioProperty  property 
)

Create new pcm object.

Parameters
[in]namepcm name
[in]driverdriver object
[in]propertyaudio property
Returns
pcm object
See also
nugu_pcm_driver_find()
nugu_pcm_driver_get_default()
nugu_pcm_free()

◆ nugu_pcm_free()

NUGU_API void nugu_pcm_free ( NuguPcm pcm)

Destroy the pcm object.

Parameters
[in]pcmpcm object
See also
nugu_pcm_new()

◆ nugu_pcm_add()

NUGU_API int nugu_pcm_add ( NuguPcm pcm)

Add pcm object to managed list.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_remove()
nugu_pcm_find()

◆ nugu_pcm_remove()

NUGU_API int nugu_pcm_remove ( NuguPcm pcm)

Remove pcm object from managed list.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_add()
nugu_pcm_find()

◆ nugu_pcm_find()

NUGU_API NuguPcm* nugu_pcm_find ( const char *  name)

Find a pcm object by name in the managed list.

Parameters
[in]namename of pcm object
Returns
pcm object
See also
nugu_pcm_add()
nugu_pcm_remove()

◆ nugu_pcm_set_audio_attribute()

NUGU_API int nugu_pcm_set_audio_attribute ( NuguPcm pcm,
NuguAudioAttribute  attr 
)

Set audio attribute.

Parameters
[in]pcmpcm object
[in]attraudio attribute
Returns
result
Return values
0success
-1failure

◆ nugu_pcm_get_audio_attribute()

NUGU_API int nugu_pcm_get_audio_attribute ( NuguPcm pcm)

Get audio attribute.

Parameters
[in]pcmpcm object
Returns
audio attribute
Return values
-1failure

◆ nugu_pcm_get_audio_attribute_str()

NUGU_API const char* nugu_pcm_get_audio_attribute_str ( NuguPcm pcm)

Get audio attribute.

Parameters
[in]pcmpcm object
Returns
audio attribute string
Return values
NULLfailure

◆ nugu_pcm_start()

NUGU_API int nugu_pcm_start ( NuguPcm pcm)

Start pcm playback.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_stop()

◆ nugu_pcm_stop()

NUGU_API int nugu_pcm_stop ( NuguPcm pcm)

Stop pcm playback.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_start()

◆ nugu_pcm_pause()

NUGU_API int nugu_pcm_pause ( NuguPcm pcm)

Pause pcm playback.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_resume()

◆ nugu_pcm_resume()

NUGU_API int nugu_pcm_resume ( NuguPcm pcm)

Resume pcm playback.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_pause()

◆ nugu_pcm_set_volume()

NUGU_API int nugu_pcm_set_volume ( NuguPcm pcm,
int  volume 
)

Set volume of pcm.

Parameters
[in]pcmpcm object
[in]volumevolume
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_get_volume()

◆ nugu_pcm_get_volume()

NUGU_API int nugu_pcm_get_volume ( NuguPcm pcm)

Get volume of pcm.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_set_volume()

◆ nugu_pcm_get_duration()

NUGU_API int nugu_pcm_get_duration ( NuguPcm pcm)

Get duration information of pcm.

Parameters
[in]pcmpcm object
Returns
result
Return values
>0success (duration)
-1failure

◆ nugu_pcm_get_position()

NUGU_API int nugu_pcm_get_position ( NuguPcm pcm)

Get current playback position of pcm.

Parameters
[in]pcmpcm object
Returns
result
Return values
>0success (position)
-1failure

◆ nugu_pcm_get_status()

NUGU_API enum nugu_media_status nugu_pcm_get_status ( NuguPcm pcm)

Get status of pcm.

Parameters
[in]pcmpcm object
Returns
status

◆ nugu_pcm_set_status_callback()

NUGU_API void nugu_pcm_set_status_callback ( NuguPcm pcm,
NuguMediaStatusCallback  cb,
void *  userdata 
)

Set pcm status callback.

Parameters
[in]pcmpcm object
[in]cbcallback function
[in]userdatadata to pass to the user callback

◆ nugu_pcm_emit_status()

NUGU_API void nugu_pcm_emit_status ( NuguPcm pcm,
enum nugu_media_status  status 
)

Emit status to registered callback.

Parameters
[in]pcmpcm object
[in]statuspcm status

◆ nugu_pcm_set_event_callback()

NUGU_API void nugu_pcm_set_event_callback ( NuguPcm pcm,
NuguMediaEventCallback  cb,
void *  userdata 
)

Set pcm event callback.

Parameters
[in]pcmpcm object
[in]cbcallback function
[in]userdatadata to pass to the user callback

◆ nugu_pcm_emit_event()

NUGU_API void nugu_pcm_emit_event ( NuguPcm pcm,
enum nugu_media_event  event 
)

Emit event to registered callback.

Parameters
[in]pcmpcm object
[in]eventpcm event

◆ nugu_pcm_set_driver_data()

NUGU_API int nugu_pcm_set_driver_data ( NuguPcm pcm,
void *  data 
)

Set custom data for driver.

Parameters
[in]pcmpcm object
[in]datacustom data managed by driver
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_get_driver_data()

◆ nugu_pcm_get_driver_data()

NUGU_API void* nugu_pcm_get_driver_data ( NuguPcm pcm)

Get custom data for driver.

Parameters
[in]pcmpcm object
Returns
data
See also
nugu_pcm_set_driver_data()

◆ nugu_pcm_clear_buffer()

NUGU_API void nugu_pcm_clear_buffer ( NuguPcm pcm)

Clear pcm buffer.

Parameters
[in]pcmpcm object

◆ nugu_pcm_push_data()

NUGU_API int nugu_pcm_push_data ( NuguPcm pcm,
const char *  data,
size_t  size,
int  is_last 
)

Push playback pcm data.

Parameters
[in]pcmpcm object
[in]datapcm data
[in]sizelength of pcm data
[in]is_lastlast data(is_last=1) or not(is_last=0)
Returns
result
Return values
0success
-1failure

◆ nugu_pcm_push_data_done()

NUGU_API int nugu_pcm_push_data_done ( NuguPcm pcm)

Set flag that push for all data is complete.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_receive_is_last_data()

◆ nugu_pcm_get_data()

NUGU_API int nugu_pcm_get_data ( NuguPcm pcm,
char *  data,
size_t  size 
)

Get all data.

Parameters
[in]pcmpcm object
[out]databuffer to get pcm data
[in]sizesize of buffer
Returns
result
Return values
0success
-1failure

◆ nugu_pcm_get_data_size()

NUGU_API size_t nugu_pcm_get_data_size ( NuguPcm pcm)

Get pcm data size.

Parameters
[in]pcmpcm object
Returns
size of pcm data

◆ nugu_pcm_receive_is_last_data()

NUGU_API int nugu_pcm_receive_is_last_data ( NuguPcm pcm)

Get flag that all data pushes are complete.

Parameters
[in]pcmpcm object
Returns
result
Return values
0success
-1failure
See also
nugu_pcm_push_data_done()