[r80]: trunk / synth / synth.h  Maximize  Restore  History

Download this file

93 lines (77 with data), 3.3 kB

 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
84
85
86
87
88
89
90
91
// synth.h -- synthesis code
typedef float sample;
extern bool synth_initialized;
extern bool synth_samples_loaded;
extern int synth_ticket;
void note_on(int vi, int pitch, int velocity);
void note_off(int vi);
void synth_init();
void synth(float *input_buffer, float *output_buffer);
const char *synth_read(const char *filename, int n); // in synthread.cpp
/*SER string synth_read(string, int) PENT*/
const char *synth_read_to(const char *filename, int n, int offset); // in synthread.cpp
/*SER string synth_read_to(string, int, int) PENT*/
void synth_set_my_state(int pitch, int velocity, bool ignore);
/*SER void synth_set_my_state(int, int, bool) PENT*/
void synth_set_state(char *state, int len);
/*SER void synth_set_state(string, long) PENT*/
void synth_set_some_state(int voice, int pitch, int velocity);
/*SER void synth_set_some_state(int, int, int) PENT*/
char *audio_get_device_info(int id);
/*SER string audio_get_device_info(long) PENT*/
void audio_set_output_device(int id);
/*SER void audio_set_output_device(long) PENT*/
void audio_set_input_device(int id);
/*SER void audio_set_input_device(long) PENT*/
int synth_start(bool start, bool input);
/*SER long synth_start(bool, bool) PENT*/
double synth_set_volume(double v, double mv, int mi, double vv);
/*SER double synth_set_volume(double, double, long, double) PENT*/
void synth_set_reverb(double theirs, double mine);
/*SER void synth_set_reverb(double, double) PENT*/
// set ticket sets the 32-bit token that GNO uses for client
// authentication. It's a random number issued by the website
// and without it, would-be clients are ignored.
// Recorded audio is returned with the ticket to make it
// easier to pass the data along to the server.
void synth_set_ticket(int ticket);
/*SER void synth_set_ticket(int) PENT*/
void synth_record(bool enable);
/*SER void synth_record(bool) PENT*/
SVal synth_get_audio(Machine_ptr m); // returns an SString or nil
/*SER any synth_get_audio(Machine) PENT*/
void synth_put_audio(SVal samples, Machine_ptr m);
/*SER void synth_put_audio(any, Machine) PENT*/
bool synth_playing();
/*SER bool synth_playing() PENT*/
void synth_play();
/*SER void synth_play() PENT*/
extern char *voice_buff; // buffer to record voice (up to 15s)
extern int voice_max; // max number of samples (length of buffer)
extern int voice_len; // length of recorded samples
extern int voice_next; // pointer for reading and writing
#define MAX_VOICE 200
#define MAX_NOTES 18
#define NOTE_LEN 5
#define SAMPLE_LEN (NOTE_LEN * AR + VL)
typedef struct {
int state; // 0 = rest, 1 = playing, 2 = decaying
int pitch;
int first_pitch;
int num_pitches;
float *samples;;
int next_offset;
int end_offset;
float gain;
float gain_delta;
int pending_pitch;
int pending_velocity;
} voice_node, *voice_type;
extern int num_voices;
// in addition to the voices we read in from a big file, we can ask for
// "extra" voices which are numbered consecutively after the first num_voices,
// and which reuse samples starting at voice 10. So if num_voices = 84, and
// EXTRA_VOICES is 36, then voice 84 uses sample set 10, 85 uses sample set 11,
// etc. up to voice 119, which uses 45.
#define EXTRA_VOICES 36
extern voice_node voices[MAX_VOICE];

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks