Subversion Repositories svn.mios32

Rev

Rev 1350 | Rev 1454 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
134 tk 1
// $Id: seq_ui.h 1421 2012-02-11 23:44:23Z tk $
2
/*
3
 * Header file for user interface routines
4
 *
5
 * ==========================================================================
6
 *
7
 *  Copyright (C) 2008 Thorsten Klose (tk@midibox.org)
8
 *  Licensed for personal non-commercial use only.
9
 *  All other rights reserved.
10
 *
11
 * ==========================================================================
12
 */
13
 
14
#ifndef _SEQ_UI_H
15
#define _SEQ_UI_H
16
 
167 tk 17
/////////////////////////////////////////////////////////////////////////////
18
// Menu Page definitions
19
/////////////////////////////////////////////////////////////////////////////
134 tk 20
 
272 tk 21
#include "seq_ui_pages.inc"
167 tk 22
 
23
 
134 tk 24
/////////////////////////////////////////////////////////////////////////////
25
// Global definitions
26
/////////////////////////////////////////////////////////////////////////////
27
 
168 tk 28
// cursor flash with following waveform:
1319 tk 29
// 0..449 mS: cursor on
30
// 450..499 mS: cursor off
168 tk 31
#define SEQ_UI_CURSOR_FLASH_CTR_MAX     500  // mS
1319 tk 32
#define SEQ_UI_CURSOR_FLASH_CTR_LED_OFF 450  // mS
134 tk 33
 
1203 tk 34
#define SEQ_UI_BOOKMARKS_NUM 16
168 tk 35
 
1146 tk 36
#define UI_QUICKSEL_NUM_PRESETS 8
37
 
1203 tk 38
 
134 tk 39
/////////////////////////////////////////////////////////////////////////////
40
// Global Types
41
/////////////////////////////////////////////////////////////////////////////
42
 
167 tk 43
typedef union {
44
  struct {
848 tk 45
    u32 ALL;
167 tk 46
  };
47
  struct {
1203 tk 48
    u8 PAGE_CHANGE_BUTTON_FLAGS:7;
678 tk 49
  };
50
  struct {
51
    // these button functions will change a page (special "radio button" handling required)
1203 tk 52
    u32 MENU_PRESSED:1;
53
    u32 STEP_VIEW:1;
54
    u32 PAR_LAYER_SEL:1;
55
    u32 TRG_LAYER_SEL:1;
56
    u32 TRACK_SEL:1;
57
    u32 TEMPO_PRESET:1;
58
    u32 BOOKMARK:1;
678 tk 59
 
60
    // remaining functions
1203 tk 61
    u32 MENU_FIRST_PAGE_SELECTED:1;
62
    u32 CHANGE_ALL_STEPS:1;
63
    u32 CHANGE_ALL_STEPS_SAME_VALUE:1;
64
    u32 SELECT_PRESSED:1;
65
    u32 EDIT_PRESSED:1;
66
    u32 MUTE_PRESSED:1;
67
    u32 PATTERN_PRESSED:1;
68
    u32 SONG_PRESSED:1;
69
    u32 FAST_ENCODERS:1;
70
    u32 FAST2_ENCODERS:1;
71
    u32 SOLO:1;
72
    u32 SCRUB:1;
73
    u32 REW:1;
74
    u32 FWD:1;
75
    u32 COPY:1;
76
    u32 PASTE:1;
77
    u32 CLEAR:1;
78
    u32 UNDO:1;
79
    u32 TAP_TEMPO:1;
80
    u32 UP:1;
81
    u32 DOWN:1;
167 tk 82
  };
83
} seq_ui_button_state_t;
134 tk 84
 
167 tk 85
 
168 tk 86
typedef enum {
87
  SEQ_UI_BUTTON_GP1,
88
  SEQ_UI_BUTTON_GP2,
89
  SEQ_UI_BUTTON_GP3,
90
  SEQ_UI_BUTTON_GP4,
91
  SEQ_UI_BUTTON_GP5,
92
  SEQ_UI_BUTTON_GP6,
93
  SEQ_UI_BUTTON_GP7,
94
  SEQ_UI_BUTTON_GP8,
95
  SEQ_UI_BUTTON_GP9,
96
  SEQ_UI_BUTTON_GP10,
97
  SEQ_UI_BUTTON_GP11,
98
  SEQ_UI_BUTTON_GP12,
99
  SEQ_UI_BUTTON_GP13,
100
  SEQ_UI_BUTTON_GP14,
101
  SEQ_UI_BUTTON_GP15,
102
  SEQ_UI_BUTTON_GP16,
103
  SEQ_UI_BUTTON_Exit,
104
  SEQ_UI_BUTTON_Select,
105
  SEQ_UI_BUTTON_Left,
106
  SEQ_UI_BUTTON_Right,
107
  SEQ_UI_BUTTON_Up,
1350 tk 108
  SEQ_UI_BUTTON_Down,
109
  SEQ_UI_BUTTON_Edit  // only used in seq_ui_edit.c
168 tk 110
} seq_ui_button_t;
167 tk 111
 
168 tk 112
 
113
typedef enum {
114
  SEQ_UI_ENCODER_GP1,
115
  SEQ_UI_ENCODER_GP2,
116
  SEQ_UI_ENCODER_GP3,
117
  SEQ_UI_ENCODER_GP4,
118
  SEQ_UI_ENCODER_GP5,
119
  SEQ_UI_ENCODER_GP6,
120
  SEQ_UI_ENCODER_GP7,
121
  SEQ_UI_ENCODER_GP8,
122
  SEQ_UI_ENCODER_GP9,
123
  SEQ_UI_ENCODER_GP10,
124
  SEQ_UI_ENCODER_GP11,
125
  SEQ_UI_ENCODER_GP12,
126
  SEQ_UI_ENCODER_GP13,
127
  SEQ_UI_ENCODER_GP14,
128
  SEQ_UI_ENCODER_GP15,
129
  SEQ_UI_ENCODER_GP16,
130
  SEQ_UI_ENCODER_Datawheel
131
} seq_ui_encoder_t;
132
 
133
 
240 tk 134
typedef enum {
135
  SEQ_UI_EDIT_MODE_NORMAL,
136
  SEQ_UI_EDIT_MODE_COPY,
137
  SEQ_UI_EDIT_MODE_PASTE,
138
  SEQ_UI_EDIT_MODE_CLEAR,
139
  SEQ_UI_EDIT_MODE_MOVE,
140
  SEQ_UI_EDIT_MODE_SCROLL,
141
  SEQ_UI_EDIT_MODE_RANDOM,
600 tk 142
  SEQ_UI_EDIT_MODE_RECORD,
143
  SEQ_UI_EDIT_MODE_MANUAL
240 tk 144
} seq_ui_edit_mode_t;
168 tk 145
 
240 tk 146
 
596 tk 147
typedef enum {
148
  SEQ_UI_MSG_USER,
741 tk 149
  SEQ_UI_MSG_USER_R,
740 tk 150
  SEQ_UI_MSG_SDCARD,
756 tk 151
  SEQ_UI_MSG_DELAYED_ACTION,
152
  SEQ_UI_MSG_DELAYED_ACTION_R
596 tk 153
} seq_ui_msg_type_t;
154
 
155
 
625 tk 156
typedef enum {
626 tk 157
  SEQ_UI_REMOTE_MODE_AUTO=0,
625 tk 158
  SEQ_UI_REMOTE_MODE_SERVER,
159
  SEQ_UI_REMOTE_MODE_CLIENT
160
} seq_ui_remote_mode_t;
161
 
1203 tk 162
// numbers should not be changed, as it's also used by the bookmark function
163
typedef enum {
164
  SEQ_UI_EDIT_VIEW_STEPS = 0,
165
  SEQ_UI_EDIT_VIEW_TRG = 1,
166
  SEQ_UI_EDIT_VIEW_LAYERS = 2,
167
  SEQ_UI_EDIT_VIEW_303 = 3,
168
  SEQ_UI_EDIT_VIEW_STEPSEL = 8,
169
} seq_ui_edit_view_t;
625 tk 170
 
1203 tk 171
typedef union {
172
  u8 ALL;
173
 
174
  struct {
175
    u8 LOCKED:1;
176
    u8 SOLO:1;
177
    u8 CHANGE_ALL_STEPS:1;
178
    u8 FAST:1;
179
    u8 METRONOME:1;
180
    u8 LOOP:1;
181
    u8 FOLLOW:1;
182
  };
183
} seq_ui_bookmark_flags_t;
184
 
185
typedef union {
186
  u32 ALL;
187
 
188
  struct {
189
    u32 SOLO:1;
190
    u32 CHANGE_ALL_STEPS:1;
191
    u32 FAST:1;
192
    u32 METRONOME:1;
193
    u32 LOOP:1;
194
    u32 FOLLOW:1;
195
 
196
    u32 PAGE:1;
197
    u32 GROUP:1;
198
    u32 PAR_LAYER:1;
199
    u32 TRG_LAYER:1;
200
    u32 INSTRUMENT:1;
201
    u32 STEP_VIEW:1;
202
    u32 STEP:1;
203
    u32 EDIT_VIEW:1;
204
    u32 MUTES:1;
205
    u32 TRACKS:1;
206
  };
207
} seq_ui_bookmark_enable_t;
208
 
209
typedef struct seq_ui_bookmark_t {
210
  seq_ui_bookmark_enable_t enable;
211
  seq_ui_bookmark_flags_t flags;
212
  char name[6]; // 5 chars used
213
  u8  page;
214
  u8  group;
215
  u8  par_layer;
216
  u8  trg_layer;
217
  u8  instrument;
218
  u8  step_view;
219
  u8  step;
220
  u8  edit_view;
221
  u16 tracks;
222
  u16 mutes;
223
 
224
  // note: pattern and song number shouldn't be stored via bookmark
225
  // since the "song phrases" feature is intended for such a purpose.
226
  // storing mutes is already an exception, because they can be controlled via phrases as well.
227
} seq_ui_bookmark_t;
228
 
229
 
134 tk 230
/////////////////////////////////////////////////////////////////////////////
231
// Prototypes
232
/////////////////////////////////////////////////////////////////////////////
233
 
234
extern s32 SEQ_UI_Init(u32 mode);
235
 
178 tk 236
extern s32 SEQ_UI_InitEncSpeed(u32 auto_config);
237
 
134 tk 238
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
524 tk 239
extern s32 SEQ_UI_BLM_Button_Handler(u32 row, u32 pin, u32 pin_value);
134 tk 240
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
626 tk 241
extern s32 SEQ_UI_REMOTE_MIDI_Receive(mios32_midi_port_t port, mios32_midi_package_t midi_package);
742 tk 242
extern s32 SEQ_UI_REMOTE_MIDI_Keyboard(u8 key, u8 depressed);
741 tk 243
 
1068 tk 244
extern s32 SEQ_UI_Button_Play(s32 depressed);
245
extern s32 SEQ_UI_Button_Stop(s32 depressed);
246
 
134 tk 247
extern s32 SEQ_UI_LED_Handler(void);
248
extern s32 SEQ_UI_LED_Handler_Periodic();
184 tk 249
extern s32 SEQ_UI_LCD_Handler(void);
168 tk 250
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 251
 
167 tk 252
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
272 tk 253
extern char *SEQ_UI_PageNameGet(seq_ui_page_t page);
167 tk 254
 
255
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 256
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
257
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
258
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
259
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
690 tk 260
extern s32 SEQ_UI_InstallExitCallback(void *callback);
752 tk 261
extern s32 SEQ_UI_InstallDelayedActionCallback(void *callback, u16 delay_mS, u32 parameter);
740 tk 262
extern s32 SEQ_UI_UnInstallDelayedActionCallback(void *callback);
167 tk 263
 
353 tk 264
extern s32 SEQ_UI_LCD_Update(void);
265
 
328 tk 266
extern s32 SEQ_UI_CheckSelections(void);
267
 
168 tk 268
extern u8  SEQ_UI_VisibleTrackGet(void);
178 tk 269
extern s32 SEQ_UI_IsSelectedTrack(u8 track);
270
 
240 tk 271
extern s32 SEQ_UI_SelectedStepSet(u8 step);
272
 
168 tk 273
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
240 tk 274
extern s32 SEQ_UI_Var16_Inc(u16 *value, u16 min, u16 max, s32 incrementer);
275
extern s32 SEQ_UI_Var8_Inc(u8 *value, u16 min, u16 max, s32 incrementer);
248 tk 276
extern s32 SEQ_UI_CC_Inc(u8 cc, u8 min, u8 max, s32 incrementer);
277
extern s32 SEQ_UI_CC_Set(u8 cc, u8 value);
278
extern s32 SEQ_UI_CC_SetFlags(u8 cc, u8 flag_mask, u8 value);
134 tk 279
 
744 tk 280
extern s32 SEQ_UI_SelectListItem(s32 incrementer, u8 num_items, u8 max_items_on_screen, u8 *selected_item_on_screen, u8 *view_offset);
134 tk 281
 
752 tk 282
extern s32 SEQ_UI_KeyPad_Init(void);
283
extern s32 SEQ_UI_KeyPad_Handler(seq_ui_encoder_t encoder, s32 incrementer, char *edit_str, u8 len);
284
extern s32 SEQ_UI_KeyPad_LCD_Msg(void);
744 tk 285
 
752 tk 286
 
134 tk 287
/////////////////////////////////////////////////////////////////////////////
240 tk 288
// Prototypes for functions implemented in seq_ui_*.c
289
/////////////////////////////////////////////////////////////////////////////
290
 
758 tk 291
extern s32 SEQ_UI_EDIT_LED_Handler(u16 *gp_leds);
292
extern s32 SEQ_UI_EDIT_Button_Handler(seq_ui_button_t button, s32 depressed);
240 tk 293
extern s32 SEQ_UI_EDIT_LCD_Handler(u8 high_prio, seq_ui_edit_mode_t edit_mode);
294
 
295
extern s32 SEQ_UI_UTIL_CopyButton(s32 depressed);
296
extern s32 SEQ_UI_UTIL_PasteButton(s32 depressed);
297
extern s32 SEQ_UI_UTIL_ClearButton(s32 depressed);
298
extern s32 SEQ_UI_UTIL_UndoButton(s32 depressed);
299
 
280 tk 300
extern s32 SEQ_UI_MIXER_Copy(void);
301
extern s32 SEQ_UI_MIXER_Paste(void);
302
extern s32 SEQ_UI_MIXER_Clear(void);
1014 tk 303
extern s32 SEQ_UI_MIXER_Undo(void);
280 tk 304
extern s32 SEQ_UI_MIXER_UndoUpdate(void);
305
 
729 tk 306
extern s32 SEQ_UI_SONG_Copy(void);
307
extern s32 SEQ_UI_SONG_Paste(void);
308
extern s32 SEQ_UI_SONG_Clear(void);
309
extern s32 SEQ_UI_SONG_Insert(void);
310
extern s32 SEQ_UI_SONG_Delete(void);
752 tk 311
extern s32 SEQ_UI_SONG_EditPosSet(u8 new_edit_pos);
729 tk 312
 
1090 tk 313
extern s32 SEQ_UI_BPM_TapTempo(void);
314
 
240 tk 315
extern s32 SEQ_UI_UTIL_UndoUpdate(u8 track);
316
 
317
extern u8 SEQ_UI_UTIL_CopyPasteBeginGet(void);
318
extern u8 SEQ_UI_UTIL_CopyPasteEndGet(void);
319
 
596 tk 320
extern s32 SEQ_UI_Msg(seq_ui_msg_type_t msg_type, u16 delay, char *line1, char *line2);
321
extern s32 SEQ_UI_MsgStop(void);
299 tk 322
extern s32 SEQ_UI_SDCardErrMsg(u16 delay, s32 status);
240 tk 323
 
1203 tk 324
extern s32 SEQ_UI_Bookmark_Store(u8 bookmark);
325
extern s32 SEQ_UI_Bookmark_Restore(u8 bookmark);
299 tk 326
 
1205 tk 327
extern s32 SEQ_UI_BOOKMARKS_Button_Handler(seq_ui_button_t button, s32 depressed);
1203 tk 328
 
1205 tk 329
 
240 tk 330
/////////////////////////////////////////////////////////////////////////////
134 tk 331
// Export global variables
332
/////////////////////////////////////////////////////////////////////////////
333
 
159 tk 334
extern u8 seq_ui_display_update_req;
335
extern u8 seq_ui_display_init_req;
134 tk 336
 
167 tk 337
extern seq_ui_button_state_t seq_ui_button_state;
338
 
134 tk 339
extern u8 ui_selected_group;
484 tk 340
extern u16 ui_selected_tracks;
134 tk 341
extern u8 ui_selected_par_layer;
342
extern u8 ui_selected_trg_layer;
328 tk 343
extern u8 ui_selected_instrument;
134 tk 344
extern u8 ui_selected_step_view;
345
extern u8 ui_selected_step;
168 tk 346
extern u8 ui_selected_item;
1319 tk 347
extern u16 ui_selected_gp_buttons;
134 tk 348
 
240 tk 349
extern u16 ui_hold_msg_ctr;
350
 
206 tk 351
extern seq_ui_page_t ui_page;
272 tk 352
extern seq_ui_page_t ui_selected_page;
303 tk 353
extern seq_ui_page_t ui_stepview_prev_page;
326 tk 354
extern seq_ui_page_t ui_trglayer_prev_page;
355
extern seq_ui_page_t ui_parlayer_prev_page;
206 tk 356
 
173 tk 357
extern volatile u8 ui_cursor_flash;
740 tk 358
extern volatile u8 ui_cursor_flash_overrun_ctr;
1020 tk 359
extern u16 ui_cursor_flash_ctr;
168 tk 360
 
316 tk 361
extern u8 ui_edit_name_cursor;
362
extern u8 ui_edit_preset_num_category;
363
extern u8 ui_edit_preset_num_label;
729 tk 364
extern u8 ui_edit_preset_num_drum;
316 tk 365
 
193 tk 366
extern u8 ui_seq_pause;
367
 
1421 tk 368
extern u8 ui_song_edit_pos;
369
 
1146 tk 370
extern u8 ui_quicksel_length[UI_QUICKSEL_NUM_PRESETS];
371
extern u8 ui_quicksel_loop_length[UI_QUICKSEL_NUM_PRESETS];
372
extern u8 ui_quicksel_loop_loop[UI_QUICKSEL_NUM_PRESETS];
373
 
634 tk 374
extern u8 seq_ui_backup_req;
740 tk 375
extern u8 seq_ui_format_req;
974 tk 376
extern u8 seq_ui_saveall_req;
634 tk 377
 
746 tk 378
extern char ui_global_dir_list[80];
744 tk 379
 
1203 tk 380
extern seq_ui_edit_view_t seq_ui_edit_view;
381
 
382
extern seq_ui_bookmark_t seq_ui_bookmarks[SEQ_UI_BOOKMARKS_NUM];
383
 
134 tk 384
#endif /* _SEQ_UI_H */