#include <api.h>
Data Fields | |
void(* | logged_in )(sp_session *session, sp_error error) |
void(* | logged_out )(sp_session *session) |
void(* | metadata_updated )(sp_session *session) |
void(* | connection_error )(sp_session *session, sp_error error) |
void(* | message_to_user )(sp_session *session, const char *message) |
void(* | notify_main_thread )(sp_session *session) |
int(* | music_delivery )(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames) |
void(* | play_token_lost )(sp_session *session) |
void(* | log_message )(sp_session *session, const char *data) |
Registered when you create a session. If some callbacks should not be of interest, set them to NULL.
void( * sp_session_callbacks::logged_in)(sp_session *session, sp_error error) |
Called when login has been processed and was successful
[in] | session | Session |
[in] | error | Error code sp_error |
void( * sp_session_callbacks::logged_out)(sp_session *session) |
Called when logout has been processed. Either called explicitly if you initialize a logout operation, or implicitly if there is a permanent connection error
[in] | session | Session |
void( * sp_session_callbacks::metadata_updated)(sp_session *session) |
Called whenever metadata has been updated
If you have metadata cached outside of libspotify, you should purge your caches and fetch new versions.
[in] | session | Session |
void( * sp_session_callbacks::connection_error)(sp_session *session, sp_error error) |
Called when there is a connection error, and the library has problems reconnecting to the Spotify service. Could be called multiple times (as long as the problem is present)
[in] | session | Session |
[in] | error | Status code sp_error |
void( * sp_session_callbacks::message_to_user)(sp_session *session, const char *message) |
Called when the access point wants to display a message to the user
In the desktop client, these are shown in a blueish toolbar just below the search box.
[in] | session | Session |
[in] | message | String in UTF-8 format. |
void( * sp_session_callbacks::notify_main_thread)(sp_session *session) |
Called when processing needs to take place on the main thread.
You need to call sp_session_process_events() in the main thread to get libspotify to do more work. Failure to do so may cause request timeouts, or a lost connection.
[in] | session | Session |
int( * sp_session_callbacks::music_delivery)(sp_session *session, const sp_audioformat *format, const void *frames, int num_frames) |
Called when there is decompressed audio data available.
[in] | session | Session |
[in] | format | Audio format descriptor sp_audioformat |
[in] | frames | Points to raw PCM data as described by format |
[in] | num_frames | Number of available samples in frames . |
This function must never block. If your output buffers are full you must return 0 to signal that the library should retry delivery in a short while.
void( * sp_session_callbacks::play_token_lost)(sp_session *session) |
Music has been paused because only one account may play music at the same time.
[in] | session | Session |
void( * sp_session_callbacks::log_message)(sp_session *session, const char *data) |
Logging callback.
[in] | session | Session |
[in] | data | Log data |