summaryrefslogtreecommitdiff
path: root/config.h
blob: 0a48ed7e32dcab8296de258bf69fb05023263340 (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
#pragma once

#include <stdint.h>

#define MAX_LINECOUNT 32

extern int g_min_y, g_max_y;

extern int g_midi_two_octave_split;
extern int g_midi_three_octave_split_1;
extern int g_midi_three_octave_split_2;
extern int g_midi_three_octave_split_inverse;
extern int g_midi_main_control;
extern int g_midi_main_channel;
extern int g_settled_dist;
extern int g_timetosilence;

typedef enum {
  midi_one_octave    = 0,
  midi_two_octaves   = 1,
  midi_three_octaves = 2,
  midi_control       = 3,
  midi_control_inv   = 4
} StringMode;

typedef enum {
  none                = 0,
  pitch_bend_up       = 1,
  pitch_bend_down     = 2,
  midi_controller     = 3,
  midi_controller_inv = 4
} StringModifier;

typedef enum {
  silent              = 0,
  in_attack           = 1,
  playing             = 2
} StringPlaying;

typedef struct {
  int x0; int y0;
  int x1; int y1;
} LLine;

typedef struct {
  int x; int y;
} LPoint;

typedef struct {
  StringMode        mode;
  LLine             line;
  uint8_t           channel;
  uint8_t           note;
  uint8_t           controller;
  int               timetosilence;
  StringModifier    modifier;
  int               pitch_factor;

/* runtime values */
  uint32_t          first_time_seen;
  uint32_t          last_time_seen;
  StringPlaying     playing;
  int               octave;
  int               start_off;
  int               last_off;
  int               current_pitch;
} StringConfig;

extern StringConfig g_string_conf[MAX_LINECOUNT];
extern int g_string_count;
void config_reset();
int  config_handle_line( char *line);
char *config_midi_note_to_string(int string);