1 /* player.h - simple audio file player interface 2 * 3 * Copyright 2010 Petteri Hintsanen <petterih@iki.fi> 4 * 5 * This file is part of abx. 6 * 7 * abx is free software: you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * abx is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 15 * License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with abx. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef ABX_PLAYER_H 22 #define ABX_PLAYER_H 23 24 #include "soundfile.h" 25 #include <portaudio.h> 26 #include <semaphore.h> 27 28 typedef struct Player Player; 29 30 /* Current playback state for a player. */ 31 typedef struct { 32 enum { PLAYING, PAUSED, STOPPED } playback; 33 double location; 34 } Player_state; 35 36 extern Player *init_player(const char *filename, PaDeviceIndex outdev); 37 extern void close_player(Player *player); 38 39 extern Metadata get_player_metadata(Player *player); 40 extern Player_state get_player_state(Player *player); 41 42 extern void start_player(Player *player, sem_t *sem); 43 extern void stop_player(Player *player, sem_t *sem); 44 extern void pause_or_resume_player(Player *player, sem_t *sem); 45 extern void seek_player(Player *player, double offset, int whence, 46 sem_t *sem); 47 48 #endif 49