summaryrefslogtreecommitdiff
path: root/config.h
blob: 56e1e88df9480a7a66d72540880a628b4bff25b9 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#pragma once

#include <stdint.h>
#include <stdlib.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_settled_timedelta;
extern int g_timetosilence;
extern int g_pitch_factor;
extern int g_pitchbend_delay;
extern int g_normalize_factor;

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 {
  string_is_silent    = 0,
  string_is_in_attack = 1,
  string_is_playing   = 2,
  string_is_bending   = 3
} 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;
  int               seen_but_unchecked;
  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;
extern ConfigSource g_config_source;
extern int          g_importing_config;
extern int          g_calibration_running;

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);
void  config_reverse_strings();
void  config_flip_y();
void  config_flip_pitch();