libgroove  5.0.0
player.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Andrew Kelley
3  *
4  * This file is part of libgroove, which is MIT licensed.
5  * See http://opensource.org/licenses/MIT
6  */
7 
8 #ifndef GROOVE_PLAYER_H
9 #define GROOVE_PLAYER_H
10 
11 #include <groove/groove.h>
12 
17 
20 
23 
26 
29 };
30 
33 };
34 
35 struct GroovePlayer {
38  struct SoundIoDevice *device;
39 
47 
54  double gain;
55 
59 
63 
69 };
70 
71 GROOVE_EXPORT struct GroovePlayer *groove_player_create(void);
72 GROOVE_EXPORT void groove_player_destroy(struct GroovePlayer *player);
73 
80 GROOVE_EXPORT int groove_player_attach(struct GroovePlayer *player,
81  struct GroovePlaylist *playlist);
83 GROOVE_EXPORT int groove_player_detach(struct GroovePlayer *player);
84 
89 GROOVE_EXPORT void groove_player_position(struct GroovePlayer *player,
90  struct GroovePlaylistItem **item, double *seconds);
91 
93 GROOVE_EXPORT int groove_player_event_get(struct GroovePlayer *player,
94  union GroovePlayerEvent *event, int block);
97 GROOVE_EXPORT int groove_player_event_peek(struct GroovePlayer *player, int block);
98 
101 GROOVE_EXPORT void groove_player_event_wakeup(struct GroovePlayer *player);
102 
106 GROOVE_EXPORT int groove_player_set_gain(struct GroovePlayer *player, double gain);
107 
112 GROOVE_EXPORT struct GrooveAudioFormat groove_player_get_device_audio_format(struct GroovePlayer *player);
113 
114 #endif
void groove_player_destroy(struct GroovePlayer *player)
when the audio device is re-opened due to audio format changing
Definition: player.h:22
void groove_player_event_wakeup(struct GroovePlayer *player)
wakes up a blocking call to groove_player_event_get or groove_player_event_peek with a GROOVE_EVENT_W...
Definition: groove.h:104
int groove_player_event_peek(struct GroovePlayer *player, int block)
returns < 0 on error, 0 on no event ready, 1 on event ready if block is 1, block until event is ready...
when the currently playing track changes.
Definition: player.h:16
int groove_player_attach(struct GroovePlayer *player, struct GroovePlaylist *playlist)
Attaches the player to the playlist instance and opens the device to begin playback.
Definition: player.h:35
when something tries to read from an empty buffer
Definition: player.h:19
int groove_player_detach(struct GroovePlayer *player)
returns 0 on success, < 0 on error
void groove_player_position(struct GroovePlayer *player, struct GroovePlaylistItem **item, double *seconds)
get the position of the play head both the current playlist item and the position in seconds in the p...
double gain
Volume adjustment to make to this player.
Definition: player.h:54
struct GroovePlayer * groove_player_create(void)
int groove_player_set_gain(struct GroovePlayer *player, double gain)
See the gain property of GrooveSink.
Definition: groove.h:118
struct GrooveAudioFormat target_audio_format
The desired audio format settings with which to open the device.
Definition: player.h:46
struct GrooveAudioFormat actual_audio_format
read-only.
Definition: player.h:62
GroovePlayerEventType
use this to make a playlist utilize your speakers
Definition: player.h:14
when the audio device gets an error re-opening
Definition: player.h:25
int use_exact_audio_format
If you set this to 1, target_audio_format and actual_audio_format are ignored and no resampling...
Definition: player.h:68
struct GroovePlaylist * playlist
read-only.
Definition: player.h:58
struct SoundIoDevice * device
Set this to the device you want to open.
Definition: player.h:38
Definition: groove.h:144
user requested wakeup
Definition: player.h:28
enum GroovePlayerEventType type
Definition: player.h:32
struct GrooveAudioFormat groove_player_get_device_audio_format(struct GroovePlayer *player)
When you set the use_exact_audio_format field to 1, the audio device is closed and re-opened as neces...
Definition: player.h:31
int groove_player_event_get(struct GroovePlayer *player, union GroovePlayerEvent *event, int block)
returns < 0 on error, 0 on no event ready, 1 on got event