]> icculus.org git repositories - theoddone33/hhexen.git/blob - include/audio_plugin.h
Round 3: Some minor cross-platform compatibility changes (FreeBSD), still may not...
[theoddone33/hhexen.git] / include / audio_plugin.h
1 /*  XMMS - Cross-platform multimedia player
2  *  Copyright (C) 1998-1999  Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
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.
17  */
18 #ifndef AUDIO_PLUGIN_H
19 #define AUDIO_PLUGIN_H
20
21
22 typedef enum
23 {
24         FMT_U8, FMT_S8, FMT_U16_LE, FMT_U16_BE, FMT_U16_NE, FMT_S16_LE, FMT_S16_BE, FMT_S16_NE
25 }
26 AFormat;
27
28 typedef struct
29 {
30         void *handle;           /* Filled in by xmms */
31         char *filename;         /* Filled in by xmms */
32         char *description;      /* The description that is shown in the preferences box */
33         void (*init) (void);
34         void (*about) (void);   /* Show the about box */
35         void (*configure) (void);       /* Show the configuration dialog */
36         void (*get_volume) (int *l, int *r);
37         void (*set_volume) (int l, int r);      /* Set the volume */
38         int (*open_audio) (AFormat fmt, int rate, int nch);     /* Open the device, if the device can't handle the given 
39                                                                    parameters the plugin is responsible for downmixing
40                                                                    the data to the right format before outputting it */
41         void (*write_audio) (void *ptr, int length);    /* The input plugin calls this to write data to the output 
42                                                            buffer */
43         void (*close_audio) (void);     /* No comment... */
44         void (*flush) (int time);       /* Flush the buffer and set the plugins internal timers to time */
45         void (*pause) (short paused);   /* Pause or unpause the output */
46         int (*buffer_free) (void);      /* Return the amount of data that can be written to the buffer,
47                                            two calls to this without a call to write_audio should make
48                                            the plugin output audio directly */
49         int (*buffer_playing) (void);   /* Returns TRUE if the plugin currently is playing some audio,
50                                            otherwise return FALSE */
51         int (*output_time) (void);      /* Return the current playing time */
52         int (*written_time) (void);     /* Return the length of all the data that has been written to
53                                            the buffer */
54 }
55 OutputPlugin;
56
57
58 #endif