#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) |
| void(* | end_of_track )(sp_session *session) |
| void(* | streaming_error )(sp_session *session, sp_error error) |
| void(* | userinfo_updated )(sp_session *session) |
| void(* | start_playback )(sp_session *session) |
| void(* | stop_playback )(sp_session *session) |
| void(* | get_audio_buffer_stats )(sp_session *session, sp_audio_buffer_stats *stats) |
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. If this is 0, a discontinuity has occured (such as after a seek). The application should flush its audio fifos, etc. |
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 |
| void( * sp_session_callbacks::end_of_track)(sp_session *session) |
End of track. Called when the currently played track has reached its end.
| [in] | session | Session |
| void( * sp_session_callbacks::streaming_error)(sp_session *session, sp_error error) |
Streaming error. Called when streaming cannot start or continue
| [in] | session | Session |
| [in] | errro | Error code describing the error |
| void( * sp_session_callbacks::userinfo_updated)(sp_session *session) |
Called after user info (anything related to sp_user objects) have been updated.
| [in] | session | Session |
| void( * sp_session_callbacks::start_playback)(sp_session *session) |
Called when audio playback should start
This function is called from an internal session thread - you need to have proper synchronization!
This function must never block.
| [in] | session | Session |
| void( * sp_session_callbacks::stop_playback)(sp_session *session) |
Called when audio playback should stop
This function is called from an internal session thread - you need to have proper synchronization!
This function must never block.
| [in] | session | Session |
| void( * sp_session_callbacks::get_audio_buffer_stats)(sp_session *session, sp_audio_buffer_stats *stats) |
Called to query application about its audio buffer
This function must never block.
| [in] | session | Session |
| [out] | stats | Stats struct to be filled by application |