-
Notifications
You must be signed in to change notification settings - Fork 20
/
plugout.h
83 lines (71 loc) · 2.23 KB
/
plugout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* gbsplay is a Gameboy sound player
*
* 2004-2021 (C) by Tobias Diedrich <[email protected]>
*
* Licensed under GNU GPL v1 or, at your option, any later version.
*/
#ifndef _PLUGOUT_H_
#define _PLUGOUT_H_
#include <stdint.h>
#include <unistd.h>
#include "config.h"
#include "common.h"
#include "gbhw.h"
#if PLUGOUT_DSOUND == 1
# define PLUGOUT_DEFAULT "dsound"
#elif PLUGOUT_PIPEWIRE == 1
# define PLUGOUT_DEFAULT "pipewire"
#elif PLUGOUT_PULSE == 1
# define PLUGOUT_DEFAULT "pulse"
#elif PLUGOUT_ALSA == 1
# define PLUGOUT_DEFAULT "alsa"
#elif PLUGOUT_SDL == 1
# define PLUGOUT_DEFAULT "sdl"
#else
# define PLUGOUT_DEFAULT "oss"
#endif
enum plugout_endian {
PLUGOUT_ENDIAN_BIG,
PLUGOUT_ENDIAN_LITTLE,
PLUGOUT_ENDIAN_AUTOSELECT,
};
#if GBS_BYTE_ORDER == GBS_ORDER_LITTLE_ENDIAN
#define PLUGOUT_ENDIAN_NATIVE PLUGOUT_ENDIAN_LITTLE
#else
#define PLUGOUT_ENDIAN_NATIVE PLUGOUT_ENDIAN_BIG
#endif
struct plugout_metadata {
const char * player_name;
const char * filename;
};
/* Initial open of plugout. */
typedef long (*plugout_open_fn )(enum plugout_endian *endian, long rate, long *buffer_bytes, const struct plugout_metadata metadata);
/* Notification when next subsong is about to start. */
typedef int (*plugout_skip_fn )(int subsong);
/* Notification the the player is paused/resumed. */
typedef void (*plugout_pause_fn)(int pause);
/* Callback for monitoring IO in dumpers. Cycles restarts at 0 when the subsong is changed. */
typedef int (*plugout_io_fn )(cycles_t cycles, uint32_t addr, uint8_t val);
/* Callback for monitoring inferred channel status. */
typedef int (*plugout_step_fn )(const cycles_t cycles, const struct gbs_channel_status[]);
/* Callback for writing sample data. */
typedef ssize_t (*plugout_write_fn)(const void *buf, size_t count);
/* Close called on player exit. */
typedef void (*plugout_close_fn)(void);
#define PLUGOUT_USES_STDOUT 1
struct output_plugin {
char *name;
char *description;
long flags;
plugout_open_fn open;
plugout_skip_fn skip;
plugout_pause_fn pause;
plugout_io_fn io;
plugout_step_fn step;
plugout_write_fn write;
plugout_close_fn close;
};
void plugout_list_plugins(void);
const struct output_plugin* plugout_select_by_name(const char* const name);
#endif