libtizsoundcloud

group libtizsoundcloud

library

A C library to access the SoundCloud streaming service.

Typedefs

typedef struct tiz_scloud tiz_scloud_t

The soundcloud opaque structure

typedef enum tiz_scloud_playback_mode tiz_scloud_playback_mode_t

Various playback modes that control the playback queue.

Enums

enum tiz_scloud_playback_mode

Various playback modes that control the playback queue.

Values:

enumerator ETIZScloudPlaybackModeNormal
enumerator ETIZScloudPlaybackModeShuffle
enumerator ETIZScloudPlaybackModeMax

Functions

int tiz_scloud_init(tiz_scloud_ptr_t *app_scloud, const char *ap_oauth_token)

Initialize the soundcloud handle.

Return

0 on success.

Parameters
  • app_scloud: A pointer to the soundcloud handle which will be initialised.

  • ap_oauth_token: A SoundCloud email account.

void tiz_scloud_clear_queue(tiz_scloud_t *ap_scloud)

Clear the playback queue.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_queue_length(tiz_scloud_t *ap_scloud)

Retrieve the current length of playback queue.

Parameters
  • ap_scloud: The tiz_scloud handle.

int tiz_scloud_get_current_queue_length_as_int(tiz_scloud_t *ap_scloud)

Retrieve the current length of the playback queue as integer.

Parameters
  • ap_scloud: The tiz_scloud handle.

const char *tiz_scloud_get_current_queue_progress(tiz_scloud_t *ap_scloud)

Retrieve the current queue progress (e.g. ‘5 of 17’, where 5 is the current stream index, and 17 is the total streams in the queue).

Parameters
  • ap_scloud: The tiz_scloud handle.

void tiz_scloud_set_playback_mode(tiz_scloud_t *ap_scloud, const tiz_scloud_playback_mode_t mode)

Set the playback mode (normal, shuffle).

Parameters
  • ap_scloud: The soundcloud handle.

  • a_mode: The playback mode (e.g. normal, shuffle)

int tiz_scloud_play_user_stream(tiz_scloud_t *ap_scloud)

Add the tracks in the user’s stream to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

int tiz_scloud_play_user_likes(tiz_scloud_t *ap_scloud)

Add the tracks in the user’s likes to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

int tiz_scloud_play_user_playlist(tiz_scloud_t *ap_scloud, const char *ap_playlist)

Search the user’s collection for a playlist add its tracks to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_playlist: The playlist name.

int tiz_scloud_play_creator(tiz_scloud_t *ap_scloud, const char *ap_creator)

Add the last 50 tracks uploaded by a user/creator to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_creator: The creator/artist name.

int tiz_scloud_play_tracks(tiz_scloud_t *ap_scloud, const char *ap_tracks)

Search SoundCloud for tracks and add them to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_tracks: A search string.

int tiz_scloud_play_playlists(tiz_scloud_t *ap_scloud, const char *ap_playlists)

Search SoundCloud for playlists and add them to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_playlists: A search string.

int tiz_scloud_play_genres(tiz_scloud_t *ap_scloud, const char *ap_genres)

Search SoundCloud for genres and tracks to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_genres: The genres (a comma separated-list).

int tiz_scloud_play_tags(tiz_scloud_t *ap_scloud, const char *ap_tags)

Search SoundCloud for tags and tracks to the playback queue.

After calling this method, the various tiz_scloud_get* methods can be used to interact with the playback queue.

Return

0 on success

Parameters
  • ap_scloud: The soundcloud handle.

  • ap_tags: The tags (a comma separated-list).

const char *tiz_scloud_get_url(tiz_scloud_t *ap_scloud, const int a_position)

Retrieve the stream url as the specified position in the play queue.

On success, the playback queue pointer moves to the position indicated.

Return

The specified url in the playback queue or NULL if the playback queue is empty or the the specified position is out of range.

Parameters
  • ap_scloud: The tiz_scloud handle.

  • a_position: A position value in the range [1, len(queue)].

const char *tiz_scloud_get_next_url(tiz_scloud_t *ap_scloud)

Retrieve the next track url

The the playback queue pointer moves one position forwards.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_prev_url(tiz_scloud_t *ap_scloud)

Retrieve the previous track url.

The the playback queue pointer moves one position backwards.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_user(tiz_scloud_t *ap_scloud)

Retrieve the current track’s uploader/creator/artist.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_title(tiz_scloud_t *ap_scloud)

Retrieve the current track’s title.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_duration(tiz_scloud_t *ap_scloud)

Retrieve the current track’s duration.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_year(tiz_scloud_t *ap_scloud)

Retrieve the current track’s publication year.

Parameters
  • ap_scloud: The soundcloud handle.

Retrieve the current track’s permalink.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_license(tiz_scloud_t *ap_scloud)

Retrieve the current track’s license.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_likes(tiz_scloud_t *ap_scloud)

Retrieve the current track’s likes count.

Parameters
  • ap_scloud: The soundcloud handle.

const char *tiz_scloud_get_current_track_user_avatar(tiz_scloud_t *ap_scloud)

Retrieve the avatar of the user associated to the current track.

Parameters
  • ap_scloud: The soundcloud handle.

void tiz_scloud_destroy(tiz_scloud_t *ap_scloud)

Destroy the soundcloud handle.

Parameters
  • ap_scloud: The soundcloud handle.