audio.h 2.22 KB
Newer Older
Led's avatar
Led committed
1
/* the Music Player Daemon (MPD)
Led's avatar
Led committed
2
 * (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
Led's avatar
Led committed
3
 * This project's homepage is: http://www.musicpd.org
Led's avatar
Led committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef AUDIO_H
#define AUDIO_H

Led's avatar
Led committed
22 23
#include "../config.h"

Led's avatar
Led committed
24
#include "mpd_types.h"
Led's avatar
Led committed
25
#include "tag.h"
Led's avatar
Led committed
26

Led's avatar
Led committed
27 28
#include <stdio.h>

Led's avatar
Led committed
29 30 31
#define AUDIO_AO_DRIVER_DEFAULT	"default"

typedef struct _AudioFormat {
Led's avatar
Led committed
32 33 34
	volatile mpd_sint8 channels;
	volatile mpd_uint32 sampleRate;
	volatile mpd_sint8 bits;
Led's avatar
Led committed
35 36
} AudioFormat;

Led's avatar
Led committed
37 38
size_t audio_device_count(void);

Led's avatar
Led committed
39 40
void copyAudioFormat(AudioFormat * dest, AudioFormat * src);

Led's avatar
Led committed
41 42
int cmpAudioFormat(AudioFormat * dest, AudioFormat * src);

Led's avatar
Led committed
43 44
void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);

Led's avatar
Led committed
45
int parseAudioConfig(AudioFormat * audioFormat, char *conf);
Led's avatar
Led committed
46

Led's avatar
Led committed
47
/* make sure initPlayerData is called before this function!! */
Led's avatar
Led committed
48
void initAudioConfig(void);
Led's avatar
Led committed
49

Led's avatar
Led committed
50
void finishAudioConfig(void);
Led's avatar
Led committed
51

Led's avatar
Led committed
52
void initAudioDriver(void);
Led's avatar
Led committed
53

Led's avatar
Led committed
54
void finishAudioDriver(void);
Led's avatar
Led committed
55

Led's avatar
Led committed
56
int openAudioDevice(AudioFormat * audioFormat);
Led's avatar
Led committed
57

Led's avatar
Led committed
58 59
int playAudio(char *playChunk, int size);

Led's avatar
Led committed
60
void dropBufferedAudio(void);
Led's avatar
Led committed
61

Led's avatar
Led committed
62
void closeAudioDevice(void);
Led's avatar
Led committed
63

Led's avatar
Led committed
64
int isAudioDeviceOpen(void);
Led's avatar
Led committed
65

Led's avatar
Led committed
66 67
int isCurrentAudioFormat(AudioFormat * audioFormat);

Led's avatar
Led committed
68 69
void sendMetadataToAudioDevice(MpdTag * tag);

Led's avatar
Led committed
70 71
/* these functions are called in the main parent process while the child
	process is busy playing to the audio */
Led's avatar
Led committed
72 73 74 75 76
int enableAudioDevice(int fd, int device);

int disableAudioDevice(int fd, int device);

void printAudioDevices(int fd);
Led's avatar
Led committed
77

Led's avatar
Led committed
78
void readAudioDevicesState(FILE *fp);
Led's avatar
Led committed
79

Led's avatar
Led committed
80
void saveAudioDevicesState(FILE *fp);
Led's avatar
Led committed
81

Led's avatar
Led committed
82
void loadAudioDrivers(void);
Led's avatar
Led committed
83
#endif