Initial revision 6759
[qball-mpd.git] / src / audio.h
blobcc4ac0752f89628be989c332d5089ae485058932
1 /* the Music Player Daemon (MPD)
2 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3 * This project's homepage is: http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef AUDIO_H
20 #define AUDIO_H
22 #include "../config.h"
24 #include "mpd_types.h"
25 #include "tag.h"
27 #include <stdio.h>
29 #define AUDIO_AO_DRIVER_DEFAULT "default"
31 typedef struct _AudioFormat {
32 volatile mpd_sint8 channels;
33 volatile mpd_uint32 sampleRate;
34 volatile mpd_sint8 bits;
35 } AudioFormat;
37 size_t audio_device_count(void);
39 void copyAudioFormat(AudioFormat * dest, AudioFormat * src);
41 int cmpAudioFormat(AudioFormat * dest, AudioFormat * src);
43 void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);
45 int parseAudioConfig(AudioFormat * audioFormat, char *conf);
47 /* make sure initPlayerData is called before this function!! */
48 void initAudioConfig(void);
50 void finishAudioConfig(void);
52 void initAudioDriver(void);
54 void finishAudioDriver(void);
56 int openAudioDevice(AudioFormat * audioFormat);
58 int playAudio(char *playChunk, int size);
60 void dropBufferedAudio(void);
62 void closeAudioDevice(void);
64 int isAudioDeviceOpen(void);
66 int isCurrentAudioFormat(AudioFormat * audioFormat);
68 void sendMetadataToAudioDevice(MpdTag * tag);
70 /* these functions are called in the main parent process while the child
71 process is busy playing to the audio */
72 int enableAudioDevice(int fd, int device);
74 int disableAudioDevice(int fd, int device);
76 void printAudioDevices(int fd);
78 void readAudioDevicesState(FILE *fp);
80 void saveAudioDevicesState(FILE *fp);
82 void loadAudioDrivers(void);
83 #endif