blob: b926df705f739ca774684fc49709e4f02a7d90ff (
plain)
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
|
/*
** Copyright (c) 2017 rxi
**
** This library is free software; you can redistribute it and/or modify it
** under the terms of the MIT license. See `cmixer.c` for details.
**/
#ifndef CMIXER_H
#define CMIXER_H
#define CM_VERSION "0.1.1"
typedef short cm_Int16;
typedef int cm_Int32;
typedef long long cm_Int64;
typedef unsigned char cm_UInt8;
typedef unsigned short cm_UInt16;
typedef unsigned cm_UInt32;
typedef struct cm_Source cm_Source;
typedef struct {
int type;
void *udata;
const char *msg;
cm_Int16 *buffer;
int length;
} cm_Event;
typedef void (*cm_EventHandler)(cm_Event *e);
typedef struct {
cm_EventHandler handler;
void *udata;
int samplerate;
int length;
} cm_SourceInfo;
enum {
CM_STATE_STOPPED,
CM_STATE_PLAYING,
CM_STATE_PAUSED
};
enum {
CM_EVENT_LOCK,
CM_EVENT_UNLOCK,
CM_EVENT_DESTROY,
CM_EVENT_SAMPLES,
CM_EVENT_REWIND
};
const char* cm_get_error(void);
void cm_init(int samplerate);
void cm_set_lock(cm_EventHandler lock);
void cm_set_master_gain(double gain);
void cm_process(cm_Int16 *dst, int len);
cm_Source* cm_new_source(const cm_SourceInfo *info);
cm_Source* cm_new_source_from_file(const char *filename);
cm_Source* cm_new_source_from_mem(void *data, int size);
void cm_destroy_source(cm_Source *src);
double cm_get_length(cm_Source *src);
double cm_get_position(cm_Source *src);
int cm_get_state(cm_Source *src);
void cm_set_gain(cm_Source *src, double gain);
void cm_set_pan(cm_Source *src, double pan);
void cm_set_pitch(cm_Source *src, double pitch);
void cm_set_loop(cm_Source *src, int loop);
void cm_play(cm_Source *src);
void cm_pause(cm_Source *src);
void cm_stop(cm_Source *src);
#endif
|