summaryrefslogtreecommitdiff
path: root/config.h
blob: 64f7689b6e204faf52d7b7dfd7b86de8a1f4d363 (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
79
80
81
82
83
84
#pragma once

#include <stdint.h>
#include "geometry.h"

#define MAX_LINECOUNT 32
#define CALIB_DEBUG

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 enum {
  sel_none            = 0,
  sel_min_y           = 1,
  sel_max_y           = 2,
  sel_2_oct           = 3,
  sel_3_oct_top       = 4,
  sel_3_oct_bottom    = 5
} ConfigSelect;

typedef enum {
  source_none         = 0,
  source_harfe        = 1,
  source_file         = 2,
  source_edit         = 3
} ConfigSource;

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);
size_t config_dumpglobals(char *out, size_t outsize);
size_t config_dumpstring(int string, char *out, size_t outsize);
char *config_midi_note_to_string(int string);