Subversion Repositories svn.mios32

Compare Revisions

Ignore whitespace Rev 1983 → Rev 1984

/trunk/apps/processing/midibox_cv_v2/src/components/MbCvEnvironment.cpp
234,7 → 234,7
s32 MbCvEnvironment::bankSave(u8 bank, u8 patch)
{
#if 1
DEBUG_MSG("[CV_BANK_PatchSave] write patch %c%03d\n", 'A'+bank, patch);
DEBUG_MSG("[CV_BANK_PatchSave] write patch %c%03d\n", 'A'+bank, patch+1);
#endif
 
// change to new bank/patch
242,7 → 242,7
mbCvPatch.patchNum = patch;
 
// file operation
MBCV_PATCH_Store(bank, patch);
s32 status = MBCV_PATCH_Store(bank, patch);
 
// send confirmation (e.g. to Lemur)
if( lastNrpnMidiPort ) {
249,7 → 249,7
midiSendGlobalNRPNDump(lastNrpnMidiPort);
}
 
return -2; // not supported yet
return status;
}
 
/////////////////////////////////////////////////////////////////////////////
264,7 → 264,7
return -3; // invalid patch
 
#if 1
DEBUG_MSG("[CV_BANK_PatchRead] read patch %c%03d\n", 'A'+bank, patch);
DEBUG_MSG("[CV_BANK_PatchRead] read patch %c%03d\n", 'A'+bank, patch+1);
#endif
 
if( mbCvPatch.synchedChange && !forceImmediateChange ) {
/trunk/apps/processing/midibox_cv_v2/src/scs_config.cpp
39,6 → 39,7
#include "mbcv_map.h"
#include "mbcv_file.h"
#include "mbcv_file_p.h"
#include "mbcv_file_b.h"
#include "mbcv_patch.h"
#include "mbcv_lre.h"
 
59,6 → 60,9
static u8 selectedScope;
static u8 monPageOffset;
 
static u8 saveBank;
static u8 savePatch;
 
// we need a reference to this environment very often
static MbCvEnvironment* env;
 
79,6 → 83,7
//static void stringHex2O80(u32 ix, u16 value, char *label) { sprintf(label, " %02X ", value | 0x80); }
static void stringOnOff(u32 ix, u16 value, char *label) { sprintf(label, " [%c] ", value ? 'x' : ' '); }
static void stringCurve(u32 ix, u16 value, char *label) { sprintf(label, value ? "Exp. " : "Lin. "); }
static void stringBank(u32 ix, u16 value, char *label) { sprintf(label, " %c ", 'A'+value); }
 
static void stringCvUpdateRate(u32 ix, u16 value, char *label) {
u32 updateRate = (value+1) * 500; // Hz
344,26 → 349,29
/////////////////////////////////////////////////////////////////////////////
static u16 selectNOP(u32 ix, u16 value) { return value; }
 
static void selectSAVE_Callback(char *newString)
static void selectSaveGlobals_Callback(char *newString)
{
s32 status;
 
if( (status=MBCV_PATCH_StoreGlobal(newString)) < 0 ) {
char buffer[100];
sprintf(buffer, "Patch %s", newString);
sprintf(buffer, "Globals %s", newString);
SCS_Msg(SCS_MSG_ERROR_L, 1000, "Failed to store", buffer);
} else {
char buffer[100];
sprintf(buffer, "Patch %s", newString);
sprintf(buffer, "Globals %s", newString);
SCS_Msg(SCS_MSG_L, 1000, buffer, "stored!");
}
}
static u16 selectSAVE(u32 ix, u16 value)
 
static u16 selectSaveGlobals(u32 ix, u16 value)
{
return SCS_InstallEditStringCallback(selectSAVE_Callback, "SAVE", mbcv_file_p_patch_name, MBCV_FILE_P_FILENAME_LEN);
char buffer[10];
sprintf(buffer, "%-8s", mbcv_file_p_patch_name);
return SCS_InstallEditStringCallback(selectSaveGlobals_Callback, "SAVE", buffer, MBCV_FILE_P_FILENAME_LEN);
}
 
static void selectLOAD_Callback(char *newString)
static void selectLoadGlobals_Callback(char *newString)
{
s32 status;
 
370,16 → 378,16
if( newString[0] != 0 ) {
if( (status=MBCV_PATCH_LoadGlobal(newString)) < 0 ) {
char buffer[100];
sprintf(buffer, "Patch %s", newString);
sprintf(buffer, "Globals %s", newString);
SCS_Msg(SCS_MSG_ERROR_L, 1000, "Failed to load", buffer);
} else {
char buffer[100];
sprintf(buffer, "Patch %s", newString);
sprintf(buffer, "Globals %s", newString);
SCS_Msg(SCS_MSG_L, 1000, buffer, "loaded!");
}
}
}
static u8 getListLOAD_Callback(u8 offset, char *line)
static u8 getListGlobals_Callback(u8 offset, char *line)
{
MUTEX_SDCARD_TAKE;
s32 status = FILE_GetFiles("/", "CV2", line, 2, offset);
390,11 → 398,40
}
return status;
}
static u16 selectLOAD(u32 ix, u16 value)
static u16 selectLoadGlobals(u32 ix, u16 value)
{
return SCS_InstallEditBrowserCallback(selectLOAD_Callback, getListLOAD_Callback, "LOAD", 9, 2);
return SCS_InstallEditBrowserCallback(selectLoadGlobals_Callback, getListGlobals_Callback, "LOAD", 9, 2);
}
 
static u16 selectSavePatch(u32 ix, u16 value)
{
s32 status = env->bankSave(saveBank, savePatch);
char buffer[100];
 
sprintf(buffer, "Patch %c%03d", 'A'+saveBank, savePatch+1);
if( status >= 0 )
SCS_Msg(SCS_MSG_L, 1000, buffer, "stored!");
else
SCS_Msg(SCS_MSG_ERROR_L, 1000, buffer, "store FAILED!");
 
return 0; // no error
}
 
static u16 selectLoadPatch(u32 ix, u16 value)
{
s32 status = env->bankLoad(saveBank, savePatch);
char buffer[100];
 
sprintf(buffer, "Patch %c%03d", 'A'+saveBank, savePatch+1);
 
if( status >= 0 )
SCS_Msg(SCS_MSG_L, 1000, buffer, "loaded!");
else
SCS_Msg(SCS_MSG_ERROR_L, 1000, buffer, "load FAILED!");
 
return 0; // no error
}
 
static void selectRemoteIp_Callback(u32 newIp)
{
OSC_SERVER_RemoteIP_Set(selectedOscPort, newIp);
801,6 → 838,9
}
 
 
/////////////////////////////////////////////////////////////////////////////
// MSD
/////////////////////////////////////////////////////////////////////////////
 
static void MSD_EnableReq(u32 enable)
{
809,6 → 849,16
}
 
/////////////////////////////////////////////////////////////////////////////
// Disk
/////////////////////////////////////////////////////////////////////////////
 
static u16 saveBankGet(u32 ix) { return saveBank; }
static void saveBankSet(u32 ix, u16 value) { saveBank = value; }
 
static u16 savePatchGet(u32 ix) { return savePatch; }
static void savePatchSet(u32 ix, u16 value) { savePatch = value; }
 
/////////////////////////////////////////////////////////////////////////////
// Menu Structure
/////////////////////////////////////////////////////////////////////////////
 
972,11 → 1022,24
SCS_ITEM("Chn.", 0, 17, routerDstChnGet, routerDstChnSet,selectNOP, stringRouterChn, NULL),
};
 
const scs_menu_item_t pageDsk[] = {
SCS_ITEM("Load ", 0, 0, dummyGet, dummySet, selectLOAD, stringEmpty, NULL),
SCS_ITEM("Save ", 0, 0, dummyGet, dummySet, selectSAVE, stringEmpty, NULL),
const scs_menu_item_t pageDiskPatch[] = { // Note: page items are displayed in displayHook!
SCS_ITEM("Bank", 0, MBCV_FILE_B_NUM_BANKS-1, saveBankGet, saveBankSet,selectNOP, stringBank, NULL),
SCS_ITEM("Ptch", 0, 127, savePatchGet, savePatchSet,selectNOP, stringDecP1, NULL),
SCS_ITEM("Load ", 0, 0, dummyGet, dummySet, selectLoadPatch, stringEmpty, NULL),
SCS_ITEM("Save ", 0, 0, dummyGet, dummySet, selectSavePatch, stringEmpty, NULL),
};
 
const scs_menu_item_t pageDiskGlobals[] = { // Note: page items are displayed in displayHook!
SCS_ITEM("Load ", 0, 0, dummyGet, dummySet, selectLoadGlobals, stringEmpty, NULL),
SCS_ITEM("Save ", 0, 0, dummyGet, dummySet, selectSaveGlobals, stringEmpty, NULL),
};
 
const scs_menu_page_t subpageDisk[] = {
SCS_PAGE("Patch", pageDiskPatch),
SCS_PAGE(" Glob", pageDiskGlobals),
SCS_PAGE("als", pageDiskGlobals),
};
 
const scs_menu_item_t pageOSC[] = {
SCS_ITEM("Port ", 0, 3, oscPortGet, oscPortSet, selectNOP, stringOscPort, NULL),
SCS_ITEM("Remot", 0, 0, dummyGet, dummySet, selectRemoteIp, stringRemoteIp, NULL),
1012,7 → 1075,7
SCS_PAGE("OSC ", pageOSC),
SCS_PAGE("Netw ", pageNetw),
SCS_PAGE("Mon. ", pageMON),
SCS_PAGE("Disk ", pageDsk),
SCS_SUBPAGE("Disk ", subpageDisk),
};
 
 
1063,7 → 1126,7
if( MBCV_FILE_StatusMsgGet() )
sprintf(line1, MBCV_FILE_StatusMsgGet());
else
sprintf(line1, "Patch: %-8s [%d]", mbcv_file_p_patch_name, selectedCv+1);
sprintf(line1, "%-8s %c%03d [CV%d]", mbcv_file_p_patch_name, 'A'+env->mbCvPatch.bankNum, env->mbCvPatch.patchNum+1, selectedCv+1);
}
sprintf(line2, "%s < > MENU", env->mbCvClock.isRunning ? "STOP" : "PLAY");
 
1079,19 → 1142,40
if( MBCV_FILE_StatusMsgGet() )
sprintf(line1, MBCV_FILE_StatusMsgGet());
else
sprintf(line1, "Patch: %s", mbcv_file_p_patch_name);
sprintf(line1, "%-8s %c%03d", mbcv_file_p_patch_name, 'A'+env->mbCvPatch.bankNum, env->mbCvPatch.patchNum+1);
}
 
// TK: currently I don't know a better location to ensure that the save bank/patch is equal to the selected patch
saveBank = env->mbCvPatch.bankNum;
savePatch = env->mbCvPatch.patchNum;
 
return 1;
}
 
if( SCS_MenuPageGet() == pageDsk ) {
if( SCS_MenuPageGet() == pageDiskPatch ) {
// Disk page: we want to show the patch at upper line, and menu items at lower line
if( line1[0] == 0 ) { // no MSD overlay?
if( MBCV_FILE_StatusMsgGet() )
sprintf(line1, MBCV_FILE_StatusMsgGet());
else
sprintf(line1, "Patch: %s", mbcv_file_p_patch_name);
sprintf(line1, "Current Patch: %c%03d", 'A'+env->mbCvPatch.bankNum, env->mbCvPatch.patchNum+1);
}
if( SCS_ShowSelectedItem(1) >= 1 ) {
sprintf(line2, " %c %03d Load Save", 'A'+saveBank, savePatch+1);
} else {
sprintf(line2, " %c Load Save", 'A'+saveBank);
}
return 1;
}
 
if( SCS_MenuPageGet() == pageDiskGlobals ) {
// Disk page: we want to show the patch at upper line, and menu items at lower line
if( line1[0] == 0 ) { // no MSD overlay?
if( MBCV_FILE_StatusMsgGet() )
sprintf(line1, MBCV_FILE_StatusMsgGet());
else
sprintf(line1, "Current: %s", mbcv_file_p_patch_name);
}
sprintf(line2, "Load Save");
return 1;
}
1177,6 → 1261,26
monPageOffset = newOffset;
}
 
// main page
else if( SCS_MenuStateGet() == SCS_MENU_STATE_MAINPAGE ) {
s32 value = 128*env->mbCvPatch.bankNum + env->mbCvPatch.patchNum + incrementer;
 
if( value <= 0 )
value = 0;
else if( value >= 128*MBCV_FILE_B_NUM_BANKS )
value = 128*MBCV_FILE_B_NUM_BANKS - 1;
 
u8 bank = value / 128;
u8 patch = value % 128;
s32 status = env->bankLoad(bank, value);
 
if( status < 0 ) {
char buffer[100];
sprintf(buffer, "Patch %c%03d", 'A'+bank, patch+1);
SCS_Msg(SCS_MSG_ERROR_L, 1000, "Failed to load", buffer);
}
}
 
return 0;
}
 
1250,17 → 1354,13
env->mbCvClock.midiReceiveRealTimeEvent(DEFAULT, 0xfa); // start
return 1;
 
case SCS_PIN_SOFT2: { // previous song
MUTEX_SDCARD_TAKE;
//SEQ_PlayFileReq(-1, 1);
MUTEX_SDCARD_GIVE;
case SCS_PIN_SOFT2: { // previous patch
encHook(-1);
return 1;
}
 
case SCS_PIN_SOFT3: { // next song
MUTEX_SDCARD_TAKE;
//SEQ_PlayFileReq(1, 1);
MUTEX_SDCARD_GIVE;
case SCS_PIN_SOFT3: { // next patch
encHook(1);
return 1;
}
}
/trunk/apps/processing/midibox_cv_v2/src/app.cpp
506,6 → 506,9
DEBUG_MSG("SD Card connected: %s\n", FILE_VolumeLabel());
// load all file infos
MBCV_FILE_LoadAllFiles(1); // including HW info
 
// load A001
mbCvEnvironment.bankLoad(0, 0);
} else if( status == 2 ) {
DEBUG_MSG("SD Card disconnected\n");
// invalidate all file infos