1 /*
2  * sampler.h
3  *
4  * Written by
5  *  Marco van den Heuvel <blackystardust68@yahoo.com>
6  *
7  * This file is part of VICE, the Versatile Commodore Emulator.
8  * See README for copyright notice.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23  *  02111-1307  USA.
24  *
25  */
26 
27 #ifndef VICE_SAMPLER_H
28 #define VICE_SAMPLER_H
29 
30 #include "types.h"
31 
32 #define SAMPLER_CHANNEL_DEFAULT 0
33 #define SAMPLER_CHANNEL_1       1
34 #define SAMPLER_CHANNEL_2       2
35 
36 #define SAMPLER_OPEN_MONO   1
37 #define SAMPLER_OPEN_STEREO 2
38 
39 #define SAMPLER_CLOSED   0
40 #define SAMPLER_STARTED  1
41 
42 #define SAMPLER_DEVICE_FILE        0
43 #define SAMPLER_DEVICE_PORTAUDIO   1
44 
45 #define SAMPLER_MAX_DEVICES        2
46 
47 typedef struct sampler_device_s {
48     const char *name;
49     void (*open)(int channels);
50     void (*close)(void);
51     uint8_t (*get_sample)(int channel);
52     void (*shutdown)(void);
53     int (*resources_init)(void);
54     int (*cmdline_options_init)(void);
55     void (*reset)(void);
56 } sampler_device_t;
57 
58 extern void sampler_start(int channels, char *devname);
59 extern void sampler_stop(void);
60 extern uint8_t sampler_get_sample(int channel);
61 extern void sampler_reset(void);
62 
63 extern void sampler_device_register(sampler_device_t *device, int id);
64 
65 extern int sampler_resources_init(void);
66 extern void sampler_resources_shutdown(void);
67 extern int sampler_cmdline_options_init(void);
68 
69 extern sampler_device_t *sampler_get_devices(void);
70 
71 #endif
72