Skip to content

Commit

Permalink
Feature: Proteus 2000 Integration
Browse files Browse the repository at this point in the history
- Send Proteus 2000 Parameter Value Edit: Multimode Basic Channel Select
- Changed following functions to Proteus2000/XL-Turbo Handler:
s32 SEQ_UI_Button_Scrub
s32 SEQ_UI_Button_Metronome
- Scrub and Metronome functionality is removed by this mod
  • Loading branch information
rio-rattenrudel committed Nov 14, 2019
1 parent a3b7baf commit b444395
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 2 deletions.
9 changes: 9 additions & 0 deletions apps/sequencers/midibox_seq_v4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ LCD = $(MIOS32_LCD)
# Source Files, include paths and libraries
################################################################################

####################################
# RIO: Added PROTEUS files
####################################

THUMB_SOURCE = core/app.c \
mios32/tasks.c \
core/seq_hwcfg.c \
Expand Down Expand Up @@ -51,6 +55,7 @@ THUMB_SOURCE = core/app.c \
core/seq_ui_fx_scale.c \
core/seq_ui_manual.c \
core/seq_ui_util.c \
core/seq_ui_proteus.c \
core/seq_ui_bpm.c \
core/seq_ui_bpm_presets.c \
core/seq_ui_opt.c \
Expand Down Expand Up @@ -118,6 +123,10 @@ THUMB_SOURCE = core/app.c \
core/seq_blm8x8.c \
core/seq_tpd.c

####################################
# RIO: END MODIFICATION
####################################

# (following source stubs not relevant for Cortex M3 derivatives)
THUMB_AS_SOURCE =
ARM_SOURCE =
Expand Down
41 changes: 41 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_midi_sysex.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,45 @@ s32 SEQ_MIDI_SYSEX_REMOTE_Server_SendLED(u8 first_sr, u8 *led_sr, u8 num_sr)
return status;
}

//###########################################################################
//# RIO: Proteus 2000 Parameter Value Edit -> Multimode Basic Channel Select
//###########################################################################

/////////////////////////////////////////////////////////////////////////////
// RIO: This function is called to send a Proteus 2000 Parameter Value Edit
// EXAMPLE:> {F0h, 18h, 0Fh, dd, 55h, 01h, 02h, <xx, xx, yy, yy>, F7h}
//
// MULTIMODE_BASIC_CHANNEL (Independent of MULTIMODE_CHANNEL_SELECT)
// xx, xx = id = 139 (0Bh,01h) yy, yy = min = 0; max = 15
//
// Example for Channel 4: F0 18 0F 02 55 01 02 0B 01 03 00 F7
/////////////////////////////////////////////////////////////////////////////
s32 SEQ_MIDI_SYSEX_PROTEUS_SendChannel(mios32_midi_port_t port, u8 sysex_device_id, u8 basic_channel)
{
u8 sysex_buffer[12];
u8 *sysex_buffer_ptr = &sysex_buffer[0];

// send proteus 2000 sysex
*sysex_buffer_ptr++ = 0xf0; // sysex message
*sysex_buffer_ptr++ = 0x18; // EMU ID
*sysex_buffer_ptr++ = 0x0f; // Proteus ID
*sysex_buffer_ptr++ = sysex_device_id; // Device ID
*sysex_buffer_ptr++ = 0x55; // Special Editor designator byte
*sysex_buffer_ptr++ = 0x01; // Command::Parameter Value Edit
*sysex_buffer_ptr++ = 0x02; // Byte count(number of Byte pairs)
*sysex_buffer_ptr++ = 0x0b; // Parameter ID for MULTIMODE_BASIC_CHANNEL 139 LSB
*sysex_buffer_ptr++ = 0x01; // Parameter ID for MULTIMODE_BASIC_CHANNEL 139 MSB
*sysex_buffer_ptr++ = basic_channel; // Parameter Data for MULTIMODE_BASIC_CHANNEL LSB
*sysex_buffer_ptr++ = 0x00; // Parameter Data for MULTIMODE_BASIC_CHANNEL MSB
*sysex_buffer_ptr++ = 0xf7;

// finally send SysEx stream
MUTEX_MIDIOUT_TAKE;
s32 status = MIOS32_MIDI_SendSysEx(port, (u8 *)sysex_buffer, (u32)sysex_buffer_ptr - ((u32)&sysex_buffer[0]));
MUTEX_MIDIOUT_GIVE;
return status;
}

//###########################################################################
//# RIO: END MODIFICATION
//###########################################################################
9 changes: 9 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_midi_sysex.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ extern s32 SEQ_MIDI_SYSEX_REMOTE_Server_SendLCD(u8 x, u8 y, u8 *str, u8 len);
extern s32 SEQ_MIDI_SYSEX_REMOTE_Server_SendCharset(u8 charset);
extern s32 SEQ_MIDI_SYSEX_REMOTE_Server_SendLED(u8 first_sr, u8 *led_sr, u8 num_sr);

//###########################################################################
//# RIO: Proteus 2000 Parameter Value Edit -> Multimode Basic Channel Select
//###########################################################################

extern s32 SEQ_MIDI_SYSEX_PROTEUS_SendChannel(mios32_midi_port_t port, u8 proteus_id, u8 basic_channel);

//###########################################################################
//# RIO: END MODIFICATION
//###########################################################################

/////////////////////////////////////////////////////////////////////////////
// Export global variables
Expand Down
40 changes: 38 additions & 2 deletions apps/sequencers/midibox_seq_v4/core/seq_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,11 @@ static s32 SEQ_UI_Button_Follow(s32 depressed)
return 0; // no error
}

static s32 SEQ_UI_Button_Scrub(s32 depressed)
//####################################
//# RIO: Replace with PROTEUS Handler
//####################################

/*static s32 SEQ_UI_Button_Scrub(s32 depressed)
{
// double function: -> Loop if menu button pressed
if( seq_ui_button_state.MENU_PRESSED )
Expand All @@ -803,9 +807,23 @@ static s32 SEQ_UI_Button_Scrub(s32 depressed)
SEQ_UI_Msg(SEQ_UI_MSG_USER, 1000, "Scrub Mode", seq_ui_button_state.SCRUB ? " on" : " off");
return 0; // no error
}*/

static s32 SEQ_UI_Button_Scrub(s32 depressed)
{
if( depressed ) return -1; // ignore when button depressed

// change to utility page
SEQ_UI_PageSet(SEQ_UI_PAGE_PROTEUS);

return 0; // no error
}

//####################################
//# RIO: END MODIFICATION
//####################################

static s32 SEQ_UI_Button_TempoPreset(s32 depressed)
{
static seq_ui_page_t prev_page = SEQ_UI_PAGE_NONE;
Expand Down Expand Up @@ -854,7 +872,11 @@ static s32 SEQ_UI_Button_ExtRestart(s32 depressed)
return 0; // no error
}

static s32 SEQ_UI_Button_Metronome(s32 depressed)
//####################################
//# RIO: Replace with XLTURBO Handler
//####################################

/*static s32 SEQ_UI_Button_Metronome(s32 depressed)
{
// double function: -> ExtRestart if menu button pressed
if( seq_ui_button_state.MENU_PRESSED )
Expand Down Expand Up @@ -882,9 +904,23 @@ static s32 SEQ_UI_Button_Metronome(s32 depressed)
SEQ_PATTERN_FixAll();
#endif
return 0; // no error
}*/

static s32 SEQ_UI_Button_Metronome(s32 depressed)
{
if( depressed ) return -1; // ignore when button depressed

// change to utility page
SEQ_UI_PageSet(SEQ_UI_PAGE_XLTURBO);

return 0; // no error
}

//####################################
//# RIO: END MODIFICATION
//####################################

s32 SEQ_UI_Button_Record(s32 depressed)
{
if( depressed ) return -1; // ignore when button depressed
Expand Down
10 changes: 10 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ extern s32 SEQ_UI_TRKREPEAT_Init(u32 mode);
extern s32 SEQ_UI_PATTERN_RMX_Init(u32 mode);
extern s32 SEQ_UI_TRKEUCLID_Init(u32 mode);

//####################################
//# RIO: PROTEUS added
//####################################

extern s32 SEQ_UI_PROTEUS_Init(u32 mode); // RIO: added Proteus
extern s32 SEQ_UI_XLTURBO_Init(u32 mode); // RIO: added Proteus

//####################################
//# RIO: END MODIFICATION
//####################################

extern s32 SEQ_UI_EDIT_LED_Handler(u16 *gp_leds);
extern s32 SEQ_UI_EDIT_Button_Handler(seq_ui_button_t button, s32 depressed);
Expand Down
9 changes: 9 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_ui_pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ typedef struct {
s32 (*init_callback)(u32 mode); // will be called to initialize the page
} seq_ui_page_entry_t;

//####################################
//# RIO: PROTEUS added
//####################################

static const seq_ui_page_entry_t ui_menu_pages[SEQ_UI_PAGES] = {
{ "NONE", "TODO ", "TODO page ", 0, (void *)&SEQ_UI_TODO_Init },
{ "MENU", "Menu ", "Page Menu ", 1, (void *)&SEQ_UI_MENU_Init },
Expand Down Expand Up @@ -102,8 +106,13 @@ static const seq_ui_page_entry_t ui_menu_pages[SEQ_UI_PAGES] = {
{ "REMIX", "Remix", "Pattern Remix ", 54, (void *)&SEQ_UI_PATTERN_RMX_Init },
{ "BOOKMARKS", "BookM", "Bookmarks ", 51, (void *)&SEQ_UI_BOOKMARKS_Init },
{ "ABOUT", "About", "About this MIDIbox", 52, (void *)&SEQ_UI_INFO_Init },
{ "PROTEUS", "P2K ", "Proteus Ch Select ", 59, (void *)&SEQ_UI_PROTEUS_Init }, // RIO: added Proteus
{ "XL-TURBO", "XL-T ", "XLTurbo Ch Select ", 60, (void *)&SEQ_UI_XLTURBO_Init }, // RIO: added Proteus
};

//####################################
//# RIO: END MODIFICATION
//####################################

/////////////////////////////////////////////////////////////////////////////
// Access functions to the table
Expand Down
10 changes: 10 additions & 0 deletions apps/sequencers/midibox_seq_v4/core/seq_ui_pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
// Global Types
/////////////////////////////////////////////////////////////////////////////

//####################################
//# RIO: PROTEUS added
//####################################

// must be kept in sync with ui_menu_pages table in seq_ui_pages.c
typedef enum {
SEQ_UI_PAGE_NONE = 0,
Expand Down Expand Up @@ -85,9 +89,15 @@ typedef enum {
SEQ_UI_PAGE_PATTERN_RMX,
SEQ_UI_PAGE_BOOKMARKS,
SEQ_UI_PAGE_INFO,
SEQ_UI_PAGE_PROTEUS, // RIO: added Proteus
SEQ_UI_PAGE_XLTURBO, // RIO: added Proteus
SEQ_UI_PAGE_LAST__UNIMPLEMENTED
} seq_ui_page_t;

//####################################
//# RIO: END MODIFICATION
//####################################

#define SEQ_UI_PAGES (SEQ_UI_PAGE_LAST__UNIMPLEMENTED)
#define SEQ_UI_FIRST_MENU_SELECTION_PAGE SEQ_UI_PAGE_EDIT
#define SEQ_UI_NUM_MENU_PAGES (SEQ_UI_PAGES-SEQ_UI_FIRST_MENU_SELECTION_PAGE)
Expand Down
Loading

0 comments on commit b444395

Please sign in to comment.