| lscp_client.h | | lscp_client.h | |
| | | | |
| skipping to change at line 13 | | skipping to change at line 13 | |
| #ifndef __LSCP_CLIENT_H | | #ifndef __LSCP_CLIENT_H | |
| #define __LSCP_CLIENT_H | | #define __LSCP_CLIENT_H | |
| | | | |
| #include "lscp_socket.h" | | #include "lscp_socket.h" | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| //------------------------------------------------------------------------- | | //------------------------------------------------------------------------- | |
|
| // Client sockets. | | // Client data structures. | |
| | | | |
| | | // Invalid channel | |
| | | #define LSCP_CHANNEL_INVALID (-1) | |
| | | | |
| | | // Maximum number of engines returned by lscp_get_available_engines. | |
| | | #define LSCP_MAX_ENGINES 256 | |
| | | | |
| | | // Audio output types. | |
| | | typedef enum _lscp_audio_t | |
| | | { | |
| | | LSCP_AUDIO_NONE = 0, | |
| | | LSCP_AUDIO_ALSA, | |
| | | LSCP_AUDIO_JACK | |
| | | | |
| | | } lscp_audio_t; | |
| | | | |
| | | // MIDI input types. | |
| | | typedef enum _lscp_midi_t | |
| | | { | |
| | | LSCP_MIDI_NONE = 0, | |
| | | LSCP_MIDI_ALSA | |
| | | | |
| | | } lscp_midi_t; | |
| | | | |
| | | // Buffer fill usage types. | |
| | | typedef enum _lscp_usage_t | |
| | | { | |
| | | LSCP_USAGE_BYTES = 0, | |
| | | LSCP_USAGE_PERCENTAGE | |
| | | | |
| | | } lscp_usage_t; | |
| | | | |
| | | // Engine info cache struct. | |
| | | typedef struct _lscp_engine_info_t | |
| | | { | |
| | | char * description; | |
| | | char * version; | |
| | | | |
| | | } lscp_engine_info_t; | |
| | | | |
| | | // Channel info cache struct. | |
| | | typedef struct _lscp_channel_info_t | |
| | | { | |
| | | char * engine_name; | |
| | | lscp_audio_t audio_type; | |
| | | int audio_channel; | |
| | | char * instrument; | |
| | | lscp_midi_t midi_type; | |
| | | char * midi_port; | |
| | | int midi_channel; | |
| | | float volume; | |
| | | | |
| | | } lscp_channel_info_t; | |
| | | | |
| | | // Buffer fill cache struct. | |
| | | typedef struct _lscp_buffer_fill_t | |
| | | { | |
| | | unsigned int stream_id; | |
| | | unsigned long stream_usage; | |
| | | | |
| | | } lscp_buffer_fill_t; | |
| | | | |
| | | //------------------------------------------------------------------------- | |
| | | // Client socket main structure. | |
| | | | |
| struct _lscp_client_t; | | struct _lscp_client_t; | |
| | | | |
| typedef lscp_status_t (*lscp_client_proc_t) | | typedef lscp_status_t (*lscp_client_proc_t) | |
| ( | | ( | |
| struct _lscp_client_t *pClient, | | struct _lscp_client_t *pClient, | |
| const char *pchBuffer, | | const char *pchBuffer, | |
| int cchBuffer, | | int cchBuffer, | |
| void *pvData | | void *pvData | |
| ); | | ); | |
| | | | |
| typedef struct _lscp_client_t { | | typedef struct _lscp_client_t { | |
| | | | |
|
| | | // Client socket stuff. | |
| lscp_client_proc_t pfnCallback; | | lscp_client_proc_t pfnCallback; | |
|
| void *pvData; | | void * pvData; | |
| lscp_socket_agent_t tcp; | | lscp_socket_agent_t tcp; | |
| lscp_socket_agent_t udp; | | lscp_socket_agent_t udp; | |
|
| | | // Info struct caches. | |
| | | const char ** engines; | |
| | | lscp_engine_info_t engine_info; | |
| | | lscp_channel_info_t channel_info; | |
| | | // Result and error status. | |
| | | char * pszResult; | |
| | | int iErrno; | |
| | | // Stream buffers status. | |
| | | lscp_buffer_fill_t *buffer_fill; | |
| | | int iStreamCount; | |
| | | | |
| } lscp_client_t; | | } lscp_client_t; | |
| | | | |
|
| | | //------------------------------------------------------------------------- | |
| | | // Client socket functions. | |
| | | | |
| lscp_client_t* lscp_client_create (char *pszHost, int iPort, lscp_cli
ent_proc_t pfnCallback, void *pvData); | | lscp_client_t* lscp_client_create (char *pszHost, int iPort, lscp_cli
ent_proc_t pfnCallback, void *pvData); | |
| lscp_status_t lscp_client_join (lscp_client_t *pClient); | | lscp_status_t lscp_client_join (lscp_client_t *pClient); | |
| lscp_status_t lscp_client_destroy (lscp_client_t *pClient); | | lscp_status_t lscp_client_destroy (lscp_client_t *pClient); | |
| | | | |
| lscp_status_t lscp_client_call (lscp_client_t *pClient, const char
*pchBuffer, int cchBuffer, char *pchResult, int *pcchResult); | | lscp_status_t lscp_client_call (lscp_client_t *pClient, const char
*pchBuffer, int cchBuffer, char *pchResult, int *pcchResult); | |
| | | | |
| lscp_status_t lscp_client_subscribe (lscp_client_t *pClient); | | lscp_status_t lscp_client_subscribe (lscp_client_t *pClient); | |
| lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient); | | lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient); | |
| | | | |
|
| | | //------------------------------------------------------------------------- | |
| | | // Client common protocol functions. | |
| | | | |
| | | lscp_status_t lscp_client_query (lscp_client_t *pClient, const char | |
| | | *pszQuery); | |
| | | const char * lscp_client_get_result (lscp_client_t *pClient ); | |
| | | int lscp_client_get_errno (lscp_client_t *pClient ); | |
| | | | |
| | | //------------------------------------------------------------------------- | |
| | | // Client command protocol functions. | |
| | | | |
| | | lscp_status_t lscp_load_instrument (lscp_client_t *pCl | |
| | | ient, const char *pszFileName, int iIndex, int iChannel); | |
| | | lscp_status_t lscp_load_engine (lscp_client_t *pCl | |
| | | ient, const char *pszEngineName, int iChannel); | |
| | | int lscp_get_channels (lscp_client_t *pCl | |
| | | ient); | |
| | | lscp_status_t lscp_add_channel (lscp_client_t *pCl | |
| | | ient); | |
| | | lscp_status_t lscp_remove_channel (lscp_client_t *pCl | |
| | | ient, int iChannel); | |
| | | const char ** lscp_get_available_engines (lscp_client_t *pCl | |
| | | ient); | |
| | | | |
| | | lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pCl | |
| | | ient, const char *pszEngineName); | |
| | | lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pCl | |
| | | ient, int iChannel); | |
| | | | |
| | | int lscp_get_channel_voice_count (lscp_client_t *pCl | |
| | | ient, int iChannel); | |
| | | int lscp_get_channel_stream_count (lscp_client_t *pCl | |
| | | ient, int iChannel); | |
| | | | |
| | | lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pCl | |
| | | ient, lscp_usage_t usage_type, int iChannel); | |
| | | | |
| | | lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pCl | |
| | | ient, int iChannel, lscp_audio_t audio_type); | |
| | | lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pCl | |
| | | ient, int iChannel, int audio_channel); | |
| | | | |
| | | lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pCl | |
| | | ient, int iChannel, lscp_midi_t midi_type); | |
| | | lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pCl | |
| | | ient, int iChannel, const char *midi_port); | |
| | | lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pCl | |
| | | ient, int iChannel, int midi_channel); | |
| | | lscp_status_t lscp_set_channel_volume (lscp_client_t *pCl | |
| | | ient, int iChannel, float volume); | |
| | | | |
| | | lscp_status_t lscp_reset_channel (lscp_client_t *pCl | |
| | | ient, int iChannel); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif // __LSCP_CLIENT_H | | #endif // __LSCP_CLIENT_H | |
| | | | |
| // end of lscp_client.h | | // end of lscp_client.h | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 134 lines changed or added | |
|