Jump to content

Phatline

Members
  • Posts

    1,279
  • Joined

  • Last visited

  • Days Won

    71

Everything posted by Phatline

  1. ...schä laungsam wiads...

  2. Here a Block-Diagram> How does the Melody Retrigger works? Here 1 Trigger-Voice: (all that *8 and you have the trigger matrix) EDIT- the Melody Retrigger now works in a ther way.... i use RTOS task for decay-time-not-off-things....
  3. i dont have a midifile "midifile_fi" - I have no clue BUT trial&Error Style - it WORKED FOR ME LOAD is done: MUTEX_SDCARD_TAKE; statusDir = FILE_DirExists("t"); MUTEX_SDCARD_GIVE; if(statusDir != 1) {MUTEX_LCD_TAKE; MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s %d", "CANT-LOAD-Status:", statusDir); MUTEX_LCD_GIVE;} if(statusDir == 1) { sprintf(filepathL, "t/%d.tm", SongNrLoad); FILE_ReadOpen (&midifile_fi, filepathL); FILE_ReadBuffer ((u8 *)file_typeBank, 4); FILE_ReadBuffer ((u8 *)SongNameLoad, 8); FILE_ReadBuffer ((u8 *)PCSet, 16); FILE_ReadBuffer ((u8 *)UIVariable, 127); FILE_ReadBuffer ((u8 *)ChordSet, 36); FILE_ReadBuffer ((u8 *)MtxPart, 512); FILE_ReadClose (&midifile_fi); MUTEX_SDCARD_GIVE MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "loaded!"); just to see the way i come to this: haveing troubles with the LOAD-Code s32 FILE_ReadOpen ( file_t * file, char * filepath ) file_t (whatever that is) is linked to this site: http://www.midibox.org/mios32/manual/structfile__t.html aha csect, curr-clust, dir-ptr, dir sect,dsect, flag,fptr, fsize, & orgclust ? :getlost: ... and no further explainations... ok ask dr google: cscect: control section curr-clust: current state of cluster dir-ptr:? dir-sect:? dsect: Drug Safety & Effectiveness Cross-Disciplinary Training :no: flag: "fags variable is a integral type that I wish to treat as an array of bits, where each bit represents a flag or boolean value.." fptr: function pointer fsize: file size of buffered file orgclust? ok and that bring me what? ok ok i assume what i have: a sdcard, a dir "t/" a file "1" a filetype "tm" togehter as path: t/1.tm, tried that out "FILE_ReadOpen (0, filepathL);" >>> LCD says HARD FAULT (0 for zero idea, but compiler passt it) ok lets try: "FILE_ReadOpen(dir_ptr, filepathL);" compiler says dir_ptr undeclared "FILE_ReadOpen(1, filepathL);" compiler says app.c:295:12: warning: passing argument 1 of 'FILE_ReadOpen' makes pointer from integer without a cast [enabled by default] then file_t maybe means filetype? so: "FILE_ReadOpen(tm, filepathL);" compiler says tm undeclared (by the way: sprintf(filepathS, "t/1.tm");) then --- hmm fsize= when i sum all writing buffersizes i get 703bythes...maybe this "FILE_ReadOpen(703, filepathL);" compiler says mios32/trunk/modules/file/file.h:92:12: note: expected 'struct file_t *' but argument is of type 'int', hm file.h: extern s32 FILE_ReadOpen(file_t* file, char *filepath); so then: FILE_ReadOpen (file_t* file, char *filepathL); app.c:295:27: error: expected expression before 'file_t' FILE_ReadOpen (curr_clust, char *filepathL); app.c:295:27: error: 'curr_clust' undeclared (first use in this function) Check the SDCard, make folders & files --trigger that code every 2seconds: MUTEX_SDCARD_TAKE; //SD-Card is now only for the following LINES reserved: statusSD = FILE_CheckSDCard(); if (statusSD == 2) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Card");} if (statusSD == 3) { if (!FILE_SDCardAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Cord");} if (!FILE_VolumeAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO FAT");}} if (statusSD == 1) {// YES CARD! >>> next: check Card-content statusDir = FILE_DirExists("t"); //ask file.c: exist a folder "t/" on the CARD? if(statusDir == 1){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "good file structure");} if(statusDir == 0){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "create filestructure...2 minutes!"); FILE_MakeDir("t"); //make a folder "t" on the SD-Card (root/t/) sprintf(filepathS, "t/0.tm"); //First Pattern --- will be later copied 511 times! FILE_WriteOpen (filepathS, 1); FILE_WriteBuffer((u8 *)file_typeBank, 4); //"TM01" = 4 Positons SongNameStore[0] = 65; //65 is ASCI means "A", the rest is "space" because i intitalised it with the value"32" FILE_WriteBuffer((u8 *)SongNameStore, 8); //"A " = 8 Positons FILE_WriteBuffer((u8 *)PCSet, 16); //the Variable PCSet is declared as PCSet[16] (see @ top of the file) it has 16 Variables in it FILE_WriteBuffer((u8 *)UIVariable, 127); //declared as UIVariable[127] >>> array that bundles 127 Variables: UIVariable[0] - > UIVariable[127] FILE_WriteBuffer((u8 *)ChordSet, 36); //declared as ChordSet[6][6] 6x6 = 36 FILE_WriteBuffer((u8 *)MtxPart, 512); //declared as MtxPart[8][8][8]; 8x8x8=512 FILE_WriteClose (); //The First File named "0" is locatet @ SDCARD/t/0.tm, now its time to copy this 511 times, I want 511 Banks/files s16 BankCreateCounter = 0; //declere and set the Bank Counter inital value to 0 for(BankCreateCounter=0; BankCreateCounter<512; BankCreateCounter++){ //countes 2 511 and do following commandos 511 times in a loop: char copyfilepath[8]; sprintf(copyfilepath, "t/%d.tm", BankCreateCounter); //make a new filename depending on the counter value 1.tm, 2.tm, 3.tm...511.tm FILE_Copy ((char *)"t/0.tm", (char *)copyfilepath);} //copy the File 0.tm to all other 511 files... MUTEX_SDCARD_GIVE; //SD-Card is now free 4 access MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "init SDCard > done");}}}} Trial And Error > Feedback, resume: this file ting was a real hang, a deep, a blues a down a stock a break a slow down.... as newbee I must say that the documentation dont helped that much i hoped, somewho wrote that programming midibox is high percentage of "reading" - but int his case and of my point off view it is high percentage of "trial and error" What helped was the Midifileplayer Tutorial, the Sequencer App only for formatting things > it is way to big and complex and all that stuff extFunctiosn, C-tricks and high Syntax is confuzing a man hows new with that language and whos working in texteditors and not in an IDE (overview) (what is necessery what not - strip down). it took me 4 days and 6 evenings-, i have made whole grooveboxes in such a time (synthesis, sequencing, sampling, mixing, osc, hardware UI mapping) yes the syntax is new, but how a bout more detail in the MIOS32 Documentation (functions, modules, structures)? ... yes its clear what every module or function does, but not how it does - or what the hell it wants from me... i always had to go in the *.c-file and seek for it to see what it really needs and givebacks and how... and not even in all cases that helped- specially in the file.c - In this case i found the solution in this way 1 Know what i want program, 2 Look in a Tutorial that make that - finding the correct function/module - not understanding that function 3 going in the MIOS32 Documentation find all possible commands -write them in a order - 4 finding that commands in tutorials and apps and look how the used the commands >>>> command(complex, synthax) >>> 5 going back to my code and Trial error --- but normally it goes this way: 1 knowing what to program, 2 program, 3 cant go ahead, 4 look in the MIOS32 Documentation, 5 program... anyhow I am happy that it work now, and i can write code that make sound - not bytes on a sdcare :ahappy: - also happy that i documented it here, in the future when i dont know that again i will look in here.
  4. STORE is DONE if(tick == 1 && order == 2){//Store Data & update the Load NR & Name MUTEX_SDCARD_TAKE; statusSD = FILE_CheckSDCard(); MUTEX_SDCARD_GIVE; //SDC-Connected? if(statusSD != 0) {MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s %d", "CANT-SAVE-Status:", statusSD);} if(statusSD == 0) { // YES CARD! >>> next: check Card-content MUTEX_SDCARD_TAKE; statusDir = FILE_DirExists("t"); MUTEX_SDCARD_GIVE; //ask/call file.c: exist a folder "t/" on the CARD? if(statusDir == 0) {MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "Invalid File Structure>Reconnect Card");} if(statusDir == 1) { MUTEX_SDCARD_TAKE; sprintf(filepathS, "t/%d.tm", SongNrStor); //First Pattern --- will be later copied 511 times! FILE_WriteOpen (filepathS, 1); //WRITE!!!! FILE_WriteBuffer((u8 *)file_typeBank, 4);//"TM01" = 4 Positons FILE_WriteBuffer((u8 *)SongNameStore, 8);//"A " = 8 Positons FILE_WriteBuffer(PCSet, 16); //the Variable PCSet is declared as PCSet[16] (see @ top of the file) it has 16 Variables in it FILE_WriteBuffer(UIVariable, 127); //declared as UIVariable[127] >>> array that bundles 127 Variables: UIVariable[0] - > UIVariable[127] FILE_WriteBuffer((u8 *)ChordSet, 36); //declared as ChordSet[6][6] 6x6 = 36 FILE_WriteBuffer((u8 *)MtxPart, 512); //declared as MtxPart[8][8][8]; 8x8x8=512 FILE_WriteClose (); //The First File named "0" is locatet @ SDCARD/t/0.tm, now its time to copy this 511 times, I want 511 Banks/files MUTEX_SDCARD_GIVE; //SD-Card is now free 4 access MUTEX_LCD_TAKE; MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "stored!"); MUTEX_LCD_GIVE;}}}
  5. DONE - this is the working code with Menue - Load and Store and Rename. //app.c SD-Card-Format //if your SD-Card is empty: make 512 identical Files on your SD-Card in a Folder named "t" >>> this take 2 minutes! - it dont hang up! > 703bytes*512=~20kb Diskspace is needet //The SD-Card-Files can be opened with an TextEditor or an HEX-Editor: The Content starts with "TM01A" and ends with hundrets of "0'" //with 1 Menue Page Encoder, you could switch between different Menue Pages... but there is only one up to now - and for this tutoral and me - for ever. //4 Meneu Encoder under a 2x40Char Display do this (from left to right): //1.select File 2 Load, 2.select File 2 Store&read the name, 3.select 1 of 8 caracter-positions 4.change the character on this position. //the store button stores to the selectet File, the load loads the selected file, and dump the loaded name and Nr to Store Name and Number (to avoid to overwrite importent Banks!!!) //Feel free to make a tutorial out of it, or use it in your code, no need to name me! //as TK whish: Private & NonComercial Use only! #include <mios32.h> #include "tasks.h" #include "file.h" #include "app.h" #include <FreeRTOS.h> #include <portmacro.h> #include <task.h> #include <queue.h> #include <semphr.h> #include <string.h> static file_t midifile_fi; #define NUM_ENCODERS 5 //5 Menue Encoders are connectet const mios32_enc_config_t encoders[NUM_ENCODERS] = {//(SR begin with 1, ENC with 0) // setup the Pinout of that Encoders { .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed_par=2, .cfg.sr=1, .cfg.pos=0 }, //Menue Encoder 0 - only virtual, since they are mapped to differnt Variables... { .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed_par=2, .cfg.sr=1, .cfg.pos=2 }, //Menue Encoder 1 - ...if "Menue Page Encoder" has changed { .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed_par=2, .cfg.sr=5, .cfg.pos=0 }, //Menue Encoder 2 { .cfg.type=DETENTED2, .cfg.speed=FAST, .cfg.speed_par=2, .cfg.sr=5, .cfg.pos=2 }, //Menue Encoder 3 { .cfg.type=DETENTED2, .cfg.speed=SLOW, .cfg.speed_par=4, .cfg.sr=4, .cfg.pos=0 },}; //Menue Page Encoder #define PRIORITY_StoreLoad ( tskIDLE_PRIORITY + 4 ) // higher priority than MIDI receive task! xSemaphoreHandle xSDCardSemaphore; // take and give access to SD-Card xSemaphoreHandle xLCDSemaphore; // take and give access to LCD #define MUTEX_LCD_TAKE { while( xSemaphoreTakeRecursive(xLCDSemaphore, (portTickType)1) != pdTRUE ); } //a Mutex reserve a Resoure (LCD or SD-Card) for a task, until it is given away... #define MUTEX_LCD_GIVE { xSemaphoreGiveRecursive(xLCDSemaphore); } //These are for Save-Store-UI - a 2x40Character Display - 5 Encoders 2 Buttons and much more virtual Encoders and buttons... (not Saved on CARD) s32 MenuPage = 0; //All Other Encoders are Virtual and set the allocated Variables (locate via MenuPage) u16 SongNrLoad = 0; //The Song Number to be loaded,,, u16 SongNrStor = 0; //TO DO!!! After Loading a Song Number (hit load) the S{onNrStor = SongNrLoad} --- to avoid endless Encoder scrolling.... s8 SongNamePointerCount = 0; //to navigate thru the 8 Character position of one Name s8 SongNameChar = 0; //Change the Songname via Encoder you select the Characters s8 SongNamePointer[8] = {94,95,95,95,95,95,95,95}; //95= "_" 94=Indicator: indicate Edit Songname Character (looped via SongNamePointerCount) u8 MenueLoad = 0; //in this tutorial LOAD FILES u8 MenueStore = 0; //in this tutorial STORE FILES u8 SongNamecount; //to transfair data from Load to Store Songnames... //These are the Bank-files I want to save on SD-Card. Alltogehter in one File!!!! and i want to have 512 of this files. s8 SongNameLoad[8] = {32}; //This is the load name only, once loadet we work with the STORE Variables --- by the way 32 is asci Code 4 "space" & "[]" meant that this variable is an array of variables! s8 SongNameStore[8] = {32}; //This is the Song Name that will be stored if you hit store u8 UIVariable[127]={0}; //all ControllChange Parameters you perform on your UI or Menue, of course not all are used, but we hold blocks free on the SD-Card, 4 future UI-Updates u8 ChordSet[6][6]={{0}}; //6 different 6String-Chord-sets that are add to your played Melody (your choise which is the root note...) u8 PCSet[16]={0}; //program Changes for 16 midichannels u8 MtxPart[8][8][8]={{{1}}}; //to drive 8x (8x8) LED-Matrixes --- initalised with 1 all cells are filled with 1! //These are the UI-variables that are Saved to SD-Card.// You dont have to worry about what these are doing... i put them here to have somethingt to save ;) // Midi IO u8 Mel0PortSwitch = 1; //1: Melody Input1 and Melody Input2 came booth from "ProtMeloI1" 0: they come from seperate Ports (MelPort0+MelPort1) u8 Mel1PortSwitch = 1; //--//-- the same but for Melody 1 u8 Mel0ChSw = 0; //Select 1 of 2 Preconfigured Input Midichannels (MelChI0 o MelChI1) u8 Mel1ChSw = 0; //--//-- the same but for Melody 1 u8 MelNotOffType0 = 0; //MelodySynthesizer0--- Noteoffhandling --- react the connectet Synthesizer to 0:NoteOff Messages or 1:NoteON with Velo 0 Messages u8 MelNotOffType1 = 0; //--//-- the same but for connectet Synthesizer 1 //Melody Variables u8 Mel0hold = 0; //Hold NoteInputBuffer for Melody... u8 Mel1hold = 0; //--//-- ... so how matter what you play on sequencer or Keyboard or Guitar, the buffer will not change = HOLD = HALTE = HALT u8 Mel0Mono = 0; //switch between Mono and Poly Retrigger, how Mono act is switched by Mel0MonoLoHi u8 Mel1Mono = 0; //switch between Mono and Poly Retrigger, how Mono act is switched by Mel1MonoLoHi u8 Mel0MonoLoHi = 0; //if Mel0Mono - Mode is switched to Mono (1) this definies if you hear the lowest or highest note of the Poly-Note-Stack. (0:Lo, 1:Hi) u8 Mel1MonoLoHi = 0; //if Mel1Mono - Mode is switched to Mono (1) this definies if you hear the lowest or highest note of the Poly-Note-Stack. (0:Lo, 1:Hi) u8 Mel0OctShift = 1; //0-3 -Shift the Melody Output Notes 0:-12 1:+0 2:+12 u8 Mel1OctShift = 1; //0-3 -Shift the Melody Output Notes 0:-12 1:+0 2:+12 //Thesa are for calculating only: u16 LCDcount = 0; //display update rate calculation char file_typeBank[4] = "TM01"; //should always be 4, and not longer then 4 chars!!! //definie the Filetype which is later saved via "FILE_WriteBuffer" into the file header (use Text/Hex-Editor to proove) char filepathS[8]; //STORE-path - Number of Pathsymbols t/512.tm >>> 8! >> again: dont change the length, or you will have to change the code char filepathL[8]; //LOAD -path - Number of Pathsymbols t/512.tm >>> 8! >> again: dont change the length, or you will have to change the code u8 i = 0; //only to count some things... s32 statusSD; //Status of the SDCard--connected? fat? s32 statusDir; //Status "is" your direction "sdcard/t" there? u16 SDCardCount = 0; //Counter used to dedect periodicly the SD-Card u16 MenueUpdateCount = 0; //Counter used to update the menue 1time - in case to delete a message like "stored" or "loadet" after some time - to show the whole menue again. u8 MenueUpdateFlag = 1; //Flag to force the MenueUpdateCounter to count a periode of time, after the time "update the menue" void StoreLoad(u8 tick, u16 order); void APP_Init(void){ xLCDSemaphore = xSemaphoreCreateRecursiveMutex(); // create Mutex for LCD access xSDCardSemaphore = xSemaphoreCreateRecursiveMutex(); // create semaphores FILE_Init(0); // initialize file functions s32 i; //initialize encoders i = counter for(i=0; i<NUM_ENCODERS; ++i) MIOS32_ENC_ConfigSet(i, encoders[i]);} //initialize encoders void APP_Background(void){} void APP_Tick(void){ //1ms Event Triggering SDCardCount = SDCardCount + 1; if(SDCardCount > 2000){SDCardCount = 0; StoreLoad(1, 3);} //2s Counter > send Check-SDCard-Commant to StoreLoad-Function if(MenueUpdateFlag==0){MenueUpdateCount = MenueUpdateCount + 1; if(MenueUpdateCount > 650){MenueUpdateCount = 0; StoreLoad(0, 0); MenueUpdateFlag=1;}} //update the Menue 0,5seconds after a message like "stored" (1.time!) } void APP_MIDI_Tick(void){} void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){} void APP_SRIO_ServicePrepare(void){} void APP_SRIO_ServiceFinish(void){} void APP_DIN_NotifyToggle(u32 pin, u32 pin_value){//Store & Load Buttons if(pin == 26 && pin_value == 0){StoreLoad(1, 1);} //1: 1st Menue, 1: STORE Bank command if(pin == 38 && pin_value == 0){StoreLoad(1, 2);}} //1: 1st Menue, 2: LOAD Bank command void APP_ENC_NotifyChange(u32 encoder, s32 incrementer){ //ENCODER AND MENUE //set Menue Encoder (=Virtual Encoder-Bank Selector) if(encoder == 4){ s32 value = MenuPage + incrementer; // increment to virtual position and ensure that the value is in range 0..127 if(value < 0){value = 16;} if(value > 16){value = 0;} MenuPage = value;} //All those Virtual Encoders. if(encoder <= 3){ if(MenuPage == 0){ if(encoder == 0){ s32 value = SongNrLoad + incrementer; // increment to virtual position and ensure that the value is in range 0..127 if(value < 0){value = 511;} if(value > 511){value = 0;} SongNrLoad = value; //ReadName From File MUTEX_SDCARD_GIVE; sprintf(filepathL, "t/%d.tm", SongNrLoad); FILE_ReadOpen (&midifile_fi, filepathL); FILE_ReadBuffer ((u8 *)file_typeBank, 4); FILE_ReadBuffer ((u8 *)SongNameLoad, 8); FILE_ReadClose (&midifile_fi); MUTEX_SDCARD_GIVE;} if(encoder == 1){ s32 value = SongNrStor + incrementer; // increment to virtual position and ensure that the value is in range 0..127 if(value < 0){value = 511;} if(value > 511){value = 0;} SongNrStor= value;} if(encoder == 2){ s32 value = SongNamePointerCount+ incrementer; // increment to virtual position and ensure that the value is in range 0..127 if(value < 0){value = 7;} if(value > 7){value = 0;} SongNamePointerCount = value; if(SongNamePointerCount == 0){ SongNamePointer[0]=94; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 1){ SongNamePointer[0]=95; SongNamePointer[1]=94; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 2){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=94; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 3){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=94; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 4){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=94; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 5){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=94; SongNamePointer[6]=95; SongNamePointer[7]=95;} if(SongNamePointerCount == 6){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=94; SongNamePointer[7]=95;} if(SongNamePointerCount == 7){ SongNamePointer[0]=95; SongNamePointer[1]=95; SongNamePointer[2]=95; SongNamePointer[3]=95; SongNamePointer[4]=95; SongNamePointer[5]=95; SongNamePointer[6]=95; SongNamePointer[7]=94;} } if(encoder == 3){ s32 value = SongNameChar + incrementer; // increment to virtual position and ensure that the value is in range 0..127 if(value < 32){value = 90;} if(value > 90){value = 32;} SongNameChar= value; SongNameStore[SongNamePointerCount] = SongNameChar;//write on the current Name-Position -the choosen ASCI-Caracter... } if(SongNamePointerCount == 0) {SongNameChar = SongNameStore[SongNamePointerCount];}//when i surf thru the 8 letters of the name, i want to start from the already set Character...avoid jumps... if(SongNamePointerCount == 1) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 2) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 3) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 4) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 5) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 6) {SongNameChar = SongNameStore[SongNamePointerCount];} if(SongNamePointerCount == 7) {SongNameChar = SongNameStore[SongNamePointerCount];} } } StoreLoad(0, 10);} //update Menue Page void APP_AIN_NotifyChange(u32 pin, u32 pin_value){} void StoreLoad(u8 tick, u16 order){//MENUE, Store+Load Bank & Sys-Config if(tick == 0){//Menue if (MenuPage == 0) { //1stMenu MUTEX_LCD_TAKE; //request LCD access MIOS32_LCD_Clear(); //clear screen //1st Line = Encoder Variables....change something! MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString("%d", SongNrLoad); MIOS32_LCD_CursorSet(4, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[0]); MIOS32_LCD_CursorSet(5, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[1]); MIOS32_LCD_CursorSet(6, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[2]); MIOS32_LCD_CursorSet(7, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[3]); MIOS32_LCD_CursorSet(8, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[4]); MIOS32_LCD_CursorSet(9, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[5]); MIOS32_LCD_CursorSet(10, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[6]); MIOS32_LCD_CursorSet(10, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameLoad[7]); MIOS32_LCD_CursorSet(13, 0); MIOS32_LCD_PrintFormattedString("%d", SongNrStor); MIOS32_LCD_CursorSet(17, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[0]); MIOS32_LCD_CursorSet(18, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[1]); MIOS32_LCD_CursorSet(19, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[2]); MIOS32_LCD_CursorSet(20, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[3]); MIOS32_LCD_CursorSet(21, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[4]); MIOS32_LCD_CursorSet(22, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[5]); MIOS32_LCD_CursorSet(23, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[6]); MIOS32_LCD_CursorSet(24, 0); MIOS32_LCD_PrintFormattedString("%c", SongNameStore[7]); MIOS32_LCD_CursorSet(26, 0); MIOS32_LCD_PrintFormattedString("%s", "<> abc"); //2nd Line = Menue Describtion MIOS32_LCD_CursorSet(0, 1); MIOS32_LCD_PrintFormattedString("%s%c%c%c%c%c%c%c%c", "Nr NameLoad Stor", SongNamePointer[0], SongNamePointer[1], SongNamePointer[2], SongNamePointer[3], SongNamePointer[4], SongNamePointer[5], SongNamePointer[6], SongNamePointer[7]); MIOS32_LCD_CursorSet(26, 1); MIOS32_LCD_PrintFormattedString("%s", "<> PAGE>"); MIOS32_LCD_CursorSet(38, 1); MIOS32_LCD_PrintFormattedString("%d ", MenuPage); MUTEX_LCD_GIVE;} // release LCD access for other tasks } //more pages //STORE if(tick == 1 && order == 2){//Store Data & update the Load NR & Name MUTEX_SDCARD_TAKE; statusSD = FILE_CheckSDCard(); MUTEX_SDCARD_GIVE; //SDC-Connected? if(statusSD != 0) {MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s %d", "CANT-SAVE-Status:", statusSD);} if(statusSD == 0) { // YES CARD! >>> next: check Card-content MUTEX_SDCARD_TAKE; statusDir = FILE_DirExists("t"); MUTEX_SDCARD_GIVE; //ask/call file.c: exist a folder "t/" on the CARD? if(statusDir == 0) {MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "Invalid File Structure>Reconnect Card");} if(statusDir == 1) { UIVariable[0] = Mel0PortSwitch; //copy Variables into a Bundle/Array! UIVariable[1] = Mel1PortSwitch; UIVariable[2] = Mel0ChSw; UIVariable[3] = Mel1ChSw; UIVariable[4] = MelNotOffType0; UIVariable[5] = MelNotOffType1; UIVariable[6] = Mel0hold; UIVariable[7] = Mel1hold; UIVariable[8] = Mel0Mono; UIVariable[9] = Mel1Mono; UIVariable[10] = Mel0MonoLoHi; UIVariable[11] = Mel1MonoLoHi; UIVariable[12] = Mel0OctShift; UIVariable[13] = Mel1OctShift; MUTEX_SDCARD_TAKE; sprintf(filepathS, "t/%d.tm", SongNrStor); //First Pattern --- will be later copied 511 times! FILE_WriteOpen (filepathS, 1); //WRITE!!!! FILE_WriteBuffer((u8 *)file_typeBank, 4);//"TM01" = 4 Positons FILE_WriteBuffer((u8 *)SongNameStore, 8);//"A " = 8 Positons FILE_WriteBuffer(PCSet, 16); //the Variable PCSet is declared as PCSet[16] (see @ top of the file) it has 16 Variables in it FILE_WriteBuffer(UIVariable, 127); //declared as UIVariable[127] >>> array that bundles 127 Variables: UIVariable[0] - > UIVariable[127] FILE_WriteBuffer((u8 *)ChordSet, 36); //declared as ChordSet[6][6] 6x6 = 36 FILE_WriteBuffer((u8 *)MtxPart, 512); //declared as MtxPart[8][8][8]; 8x8x8=512 FILE_WriteClose (); //The First File named "0" is locatet @ SDCARD/t/0.tm, now its time to copy this 511 times, I want 511 Banks/files MUTEX_SDCARD_GIVE; //SD-Card is now free 4 access MUTEX_LCD_TAKE; MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "stored!"); MUTEX_LCD_GIVE; MenueUpdateFlag = 0;}}}//menue Updateflag 2 restore after some time the menue //LOAD if(tick == 1 && order == 1){ //Load Data & update the Load NR & Name and also Store Nr & Store Name MUTEX_SDCARD_TAKE; statusDir = FILE_DirExists("t"); MUTEX_SDCARD_GIVE; if(statusDir != 1) {MUTEX_LCD_TAKE; MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s %d", "CANT-LOAD-Status:", statusDir); MUTEX_LCD_GIVE;} if(statusDir == 1) { sprintf(filepathL, "t/%d.tm", SongNrLoad); FILE_ReadOpen (&midifile_fi, filepathL); FILE_ReadBuffer ((u8 *)file_typeBank, 4); FILE_ReadBuffer ((u8 *)SongNameLoad, 8); FILE_ReadBuffer ((u8 *)PCSet, 16); FILE_ReadBuffer ((u8 *)UIVariable, 127); FILE_ReadBuffer ((u8 *)ChordSet, 36); FILE_ReadBuffer ((u8 *)MtxPart, 512); FILE_ReadClose (&midifile_fi); MUTEX_SDCARD_GIVE MIOS32_LCD_Clear(); MIOS32_LCD_PrintFormattedString ("%s", "loaded!"); SongNrStor = SongNrLoad; //transfiar load nr 2 store nr. for(SongNamecount=0; SongNamecount<8; SongNamecount++){SongNameStore[SongNamecount]=SongNameLoad[SongNamecount];} //transfair loadet Filename 2 Storefilename if(MenuPage == 0){StoreLoad(0,0);}//Update Menue for SongNameLoad }} if(tick == 1 && order == 3){//CHECK SD-Card/Initalize Card MUTEX_SDCARD_TAKE; //SD-Card is now only for the following LINES reserved: statusSD = FILE_CheckSDCard(); if (statusSD == 2) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Card");} if (statusSD == 3) { if (!FILE_SDCardAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Cord");} if (!FILE_VolumeAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO FAT");}} if (statusSD == 1) {// YES CARD! >>> next: check Card-content statusDir = FILE_DirExists("t"); //ask file.c: exist a folder "t/" on the CARD? if(statusDir == 1){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "good file structure");} if(statusDir == 0){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "create filestructure...2 minutes!"); FILE_MakeDir("t"); //make a folder "t" on the SD-Card (root/t/) sprintf(filepathS, "t/0.tm"); //First Pattern --- will be later copied 511 times! FILE_WriteOpen (filepathS, 1); FILE_WriteBuffer((u8 *)file_typeBank, 4); //"TM01" = 4 Positons SongNameStore[0] = 65; //65 is ASCI means "A", the rest is "space" because i intitalised it with the value"32" FILE_WriteBuffer((u8 *)SongNameStore, 8); //"A " = 8 Positons FILE_WriteBuffer((u8 *)PCSet, 16); //the Variable PCSet is declared as PCSet[16] (see @ top of the file) it has 16 Variables in it FILE_WriteBuffer((u8 *)UIVariable, 127); //declared as UIVariable[127] >>> array that bundles 127 Variables: UIVariable[0] - > UIVariable[127] FILE_WriteBuffer((u8 *)ChordSet, 36); //declared as ChordSet[6][6] 6x6 = 36 FILE_WriteBuffer((u8 *)MtxPart, 512); //declared as MtxPart[8][8][8]; 8x8x8=512 FILE_WriteClose (); //The First File named "0" is locatet @ SDCARD/t/0.tm, now its time to copy this 511 times, I want 511 Banks/files s16 BankCreateCounter = 0; //declere and set the Bank Counter inital value to 0 for(BankCreateCounter=0; BankCreateCounter<512; BankCreateCounter++){ //countes 2 511 and do following commandos 511 times in a loop: char copyfilepath[8]; sprintf(copyfilepath, "t/%d.tm", BankCreateCounter); //make a new filename depending on the counter value 1.tm, 2.tm, 3.tm...511.tm FILE_Copy ((char *)"t/0.tm", (char *)copyfilepath);} //copy the File 0.tm to all other 511 files... MUTEX_SDCARD_GIVE; //SD-Card is now free 4 access MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "init SDCard > done");}}}}
  6. stripped down: app.c: //app.c for private non comercial use only! //make 512 identical Files on your SD-Card in a Folder named "t" //this take 2 minutes! - it dont hang up! //Filesize is 703bytes*512=~20kb. The File can be opened with an TextEditor: The Content starts with "TM01A" and ends with hundrets of "0" //I Coment my code... but there is uncommented code from the Tutorial 19 Midi-file-Player > there it was already uncommented #include <mios32.h> #include "tasks.h" #include "file.h" #include "app.h" #include <FreeRTOS.h> #include <portmacro.h> #include <task.h> #include <queue.h> #include <semphr.h> #include <string.h> #define PRIORITY_TASK_SEQ (tskIDLE_PRIORITY + 4) //higher priority than MIDI receive task! xSemaphoreHandle xSDCardSemaphore; //take and give access to SD-Card static void TASK_SEQ(void *pvParameters); //These are the Bank-files I want to save on SD-Card. Alltogehter in one File!!!! and i want to have 512 of this files. s8 BankName[8] = {32}; //32 is asci Code 4 "space" & "[]" meant that this variable is an array of variables! u8 UIVariable[127]={0}; //all ControllChange of your UI, not all are used >hold blocks free on SD-Card 4 future u8 ChordSet[6][6]={{0}}; //6x 6String-Chord-sets that are add to your played Melody ( u8 PCSet[16]={0}; //program Changes for 16 midichannels u8 MtxPart[8][8][8]={{{1}}}; //drive 8x (8x8) LED-Matrixes --- initalised with 1 all cells are filled with 1! void APP_Init(void){xSDCardSemaphore = xSemaphoreCreateRecursiveMutex(); // create semaphores FILE_Init(0); // initialize file functions xTaskCreate(TASK_SEQ, (signed portCHAR *)"SEQ", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_SEQ, NULL);}// install sequencer task void APP_Background(void){} void APP_Tick(void){} void APP_MIDI_Tick(void){} void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){} void APP_SRIO_ServicePrepare(void){} void APP_SRIO_ServiceFinish(void){} void APP_DIN_NotifyToggle(u32 pin, u32 pin_value){} void APP_ENC_NotifyChange(u32 encoder, s32 incrementer){} void APP_AIN_NotifyChange(u32 pin, u32 pin_value){} static void TASK_SEQ(void *pvParameters){ //SD-Card-Initalize portTickType xLastExecutionTime; u16 sdcard_check_ctr = 0; xLastExecutionTime = xTaskGetTickCount(); // Initialise the xLastExecutionTime variable on task entry while( 1 ) { // CHECK THE SD-CARD --- GIVE STATUS vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS); if( ++sdcard_check_ctr >= 1000 ) { // each second: check if SD Card (still) available sdcard_check_ctr = 0; // reset the 1000ms counter to 0 MUTEX_SDCARD_TAKE; // SD-Card is now only for the following LINES reserved: s32 status = FILE_CheckSDCard();//SDC-Connected? if ( status == 2 ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Card");} if ( status == 3 ) { if ( !FILE_SDCardAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO Cord");} if ( !FILE_VolumeAvailable() ) {MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "NO FAT");}} if ( status == 1 ) {// YES CARD! >>> next: check Card-content s32 statusDir = FILE_DirExists("t"); //ask/call file.c: exist a folder "t/" on the CARD? if(statusDir == 1){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "good, file structure exists");} if(statusDir == 0){MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "create filestructure...2 minutes!"); FILE_MakeDir("t"); //make a folder "t" on the SD-Card (root/t/) const char file_type[4] = "TM01";//definie the Filetype which is later saved via "FILE_WriteBuffer" into the file header >>>means if you look on one of the 512 files with a Hex Editor, you will find somewhere @ top char filepath[8]; //Number of Pathsymbols t/512.tm >>> 8! sprintf(filepath, "t/0.tm"); //First Pattern --- will be later copied 511 times! FILE_WriteOpen (filepath, 1); FILE_WriteBuffer((u8 *)file_type, 4); //"TM01" = 4 Positons BankName[0] = 65; //65 is ASCI means "A", the rest is "space" FILE_WriteBuffer((u8 *)BankName, 8); //"A " = 8 Positons FILE_WriteBuffer((u8 *)PCSet, 16); //PCSet declared as PCSet[16] FILE_WriteBuffer((u8 *)UIVariable, 127);//declared as UIVariable[127] >>> array that bundles 127 Variables: UIVariable[0] - > UIVariable[127] FILE_WriteBuffer((u8 *)ChordSet, 36); //declared as ChordSet[6][6] 6x6 = 36 FILE_WriteBuffer((u8 *)MtxPart, 512); //declared as MtxPart[8][8][8]; 8x8x8=512 FILE_WriteClose (); //The First File named "0" is locatet @ SDCARD/t/0.tm, now its time to copy this 511 times, I want 511 Banks/files s16 BankCreateCounter = 0; //declere and set the Bank Counter inital value to 0 for(BankCreateCounter=0; BankCreateCounter<512; BankCreateCounter++){ //countes 2 511 and do following commandos 511 times in a loop: char copyfilepath[8]; //Number of Pathsymbols t/512.tm >>> 8! sprintf(copyfilepath, "t/%d.tm", BankCreateCounter); //make a new filename depending on the counter value 1.tm...511.tm FILE_Copy ((char *)"t/0.tm", (char *)copyfilepath); //copy the File 0.tm to all other 511 files... }//up to here it will be looped MUTEX_SDCARD_GIVE; //SD-Card is now free 4 access MIOS32_LCD_Clear(); MIOS32_LCD_CursorSet(0, 0); MIOS32_LCD_PrintFormattedString ("%s", "done"); }}}}} app.h: //Header file of application - for private non comercial use only! #ifndef _APP_H #define _APP_H extern void APP_Init(void); extern void APP_Background(void); extern void APP_Tick(void); extern void APP_MIDI_Tick(void); extern void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package); extern void APP_SRIO_ServicePrepare(void); extern void APP_SRIO_ServiceFinish(void); extern void APP_DIN_NotifyToggle(u32 pin, u32 pin_value); extern void APP_ENC_NotifyChange(u32 encoder, s32 incrementer); extern void APP_AIN_NotifyChange(u32 pin, u32 pin_value); #endif /* _APP_H */ makefile.h: # MakeFile - for private non comercial use only! # following setup taken from environment variables PROCESSOR = $(MIOS32_PROCESSOR) FAMILY = $(MIOS32_FAMILY) BOARD = $(MIOS32_BOARD) LCD = $(MIOS32_LCD) THUMB_SOURCE = app.c # Source Files, include paths and libraries # (following source stubs not relevant for Cortex M3 derivatives) THUMB_AS_SOURCE = ARM_SOURCE = ARM_AS_SOURCE = C_INCLUDE = -I . A_INCLUDE = -I . LIBS = # Remaining variables LD_FILE = $(MIOS32_PATH)/etc/ld/$(FAMILY)/$(PROCESSOR).ld PROJECT = project DEBUG = -g OPTIMIZE = -Os CFLAGS = $(DEBUG) $(OPTIMIZE) include $(MIOS32_PATH)/programming_models/traditional/programming_model.mk include $(MIOS32_PATH)/modules/app_lcd/$(LCD)/app_lcd.mk # application specific LCD driver (selected via makefile variable) include $(MIOS32_PATH)/modules/fatfs/fatfs.mk # FATFS Driver include $(MIOS32_PATH)/modules/file/file.mk # FILE Access Layer include $(MIOS32_PATH)/include/makefile/common.mk # Please keep this include statement at the end of this Makefile. Add new modules above. mios32_config.h: //Local MIOS32 configuration file - for private non comercial use only! #ifndef _MIOS32_CONFIG_H #define _MIOS32_CONFIG_H #define MIOS32_LCD_BOOT_MSG_LINE1 "SD-CARD-HOW-TO" #define MIOS32_LCD_BOOT_MSG_LINE2 "stripped by phatty" #endif /* _MIOS32_CONFIG_H */ tasks.h: //tasks.h - for private non comercial use only! #ifndef _TASKS_H #define _TASKS_H #ifndef MIOS32_FAMILY_EMULATION # include <FreeRTOS.h> # include <portmacro.h> # include <task.h> # include <queue.h> # include <semphr.h> #endif // Global definitions #ifdef __cplusplus extern "C" { #endif // this mutex should be used by all tasks which are accessing the SD Card #ifdef MIOS32_FAMILY_EMULATION extern void TASKS_SDCardSemaphoreTake(void); extern void TASKS_SDCardSemaphoreGive(void); # define MUTEX_SDCARD_TAKE { TASKS_SDCardSemaphoreTake(); } # define MUTEX_SDCARD_GIVE { TASKS_SDCardSemaphoreGive(); } #else extern xSemaphoreHandle xSDCardSemaphore; # define MUTEX_SDCARD_TAKE { while( xSemaphoreTakeRecursive(xSDCardSemaphore, (portTickType)1) != pdTRUE ); } # define MUTEX_SDCARD_GIVE { xSemaphoreGiveRecursive(xSDCardSemaphore); } #endif // Export global variables #ifdef __cplusplus } #endif #endif /* _TASKS_H */ next comes then the same but with store load, chane Pattername (internally not filename)
  7. horrible to isolate a code there... :huh: .. when i take the whole seq stuff (that i dont need, my program need those resoureces)...yes of course it work... but then to integrate in my code: , with taking the seq_file.c and file_g.c it is not done... in order to use it i have to delete or replace or // all that stuff that i dont have (all that referenced ui.s tasks functions and whatever)...by ending again and again that the compiler find this and this not because i have to delete or replece something else anywhare to, or a reference what is then again needed by other things... change makefile, mios lokal config, overwrite _file.c and _file_g.c and then all the headers... overwrite complete without testing it step by step, the whole networkt ... hardcore! but i dont give up! of course i will lose a lot of hair on this! or i take the whole sequ. dont change anything, add my code, and live with all that unwantet stuff. and hope that the onchip memory is enough. this makes me feel stupid WHAT I AM NOT!
  8. hey pete thx 4 the clarification :happy: lets step forward with that little overview (studying this files) i came to the point that i have to think about "how my application" should work and not SEQV4... like i did bevore, step by step function to function... (anyway that stripdown-trial and understand-trial was good to get a bit overview) so first i have to find out what i need in the UserInterace (ui is in app.c) app.c 1st Menu Page: LoadBankNumber --- LoadBankName --- StoreBankNumber --- StoreBankName --- Store --- Load Then How many Banks i will need: 511 What about the Systemconfig? - ok let say it is the first Bank (0). turn on the device, proove SD-CARD... if there is no Data, it has to be made, (make files, fill with Defaults, 4 matrix e.g. a 1:1 routing) For this case the SEQ app.c "void SEQ_TASK_Period1S(void){.... " is a good starting point, it formats the Card, and call seq_file_.... to make files... a really good point to start :excl: so whats then on the SD-Card? |CARD-FILES:_ | CONTENT_____________________________ | 0.b | u8 SysVariable[127] | | | 1.b | u8 MtxPart[8][8][8] | | u8 SongName[8] | | u8 UI-Variables[127] | | u8 ChordSet[6][6] | | u8 PCSet[16][16] | | | 2.b | u8 MtxPart[8][8][8] | . | u8 SongName[8] | . | u8 UI-Variables[127] | . | u8 ChordSet[6][6] | . | u8 PCSet[16][16] | . | | 511.b | u8 MtxPart[8][8][8] | | u8 SongName[8] | | u8 UI-Variables[127] | | u8ChordSet[6][6] | | u8 PCSet[16][16]_________________________ So the Filename is a interger: that is good 4: to sort the songs better on Computer... to select them better in the LOAD/STORE MenuePage. So i have to write/adapt following addition files tm_file_bank.c tm_file_bank.h tm_file_system.c tm_file_system.h tm_file.c/h ... keep the hirachy flat... i try to make that in app.c... next is to define the file path stored on the the sd card, i decidet to put all files in a folder called "tm" locatet in root: root/tm/
  9. lets start... since i dont get anywhere the last days, trial and error, youtube, try to understand file.c, hard stuff, Now I start to document the newbe way to awarness... ok I will expect this all --- so no proof if this is true or false... Problem: the Blueprint for SD-Card - Filemanagement is: SEQV4(SVN) in all Variants, too bad that that app is complex10 && because off its complexity the code is diffused as functions on different locations - and are referenced (#include) in the main-loop (app.c) so take a look at the top of the app.c: #include "file.h" #include "seq_file.h" #include "seq_file_b.h" #include "seq_file_g.h" #include "seq_file_c.h" #include "seq_file_gc.h" #include "seq_file_hw.h" #include "seq_file_m.h" #include "seq_file_s.h" #include "seq_file_bm.h" file.h is a hEADER-File, all what is in there will be copied from the compiler in the app.c i found there: definitions, types, prototypes which are importend for the FUNCTION "file.c" --without these head you can CALL but nobody will hear...nobody will do, nothing will happen exept a error message from the compiler "not declared difintion..." file.c :is a Function that is specified under "Modules" if i write in app.c "FILE_CheckSDCard" the Function File.c get called "CheckSDCard" File.c do then with that something and returns it something to app.c... all this Commands begin with "FILE_" file.mk: aka MakeFile, normally when you build an hex-file you ask your compiler to "make" it, in this file -as far as i understand - is describet how-2-make-it... I assume that i dont have to change anything in file.c/h/mk ok now whats that, take a look @ seq_file.h, seq_file_b.h, seq_file_bm.h... seq_file.c, seq_file_b.c, seq_file_bm.c... I found in different application similar files (mbcv_file.h), I assume these are User/app files. by looking in the Header files, they differ a bit some store Banks, some System Variables, but they are almost identical (..._file_a/a/c/d/e.h) except for the first one those ..._file.hÅ› it define possible Error Codes that could come back if i call these _file_a/a/c/d/e.hÅ› // used by seq_file_b.c #define SEQ_FILE_B_ERR_INVALID_BANK -128 // invalid bank number #define SEQ_FILE_B_ERR_INVALID_GROUP -129 // invalid group number // used by seq_file_m.c #define SEQ_FILE_M_ERR_INVALID_BANK -144 // invalid bank number #define SEQ_FILE_M_ERR_INVALID_MAP -146 // invalid map number // used by seq_file_bm.c #define SEQ_FILE_BM_ERR_FORMAT -156 // invalid config file format #define SEQ_FILE_BM_ERR_READ -157 // error while reading file (exact error status cannot be determined anymore) ---hm lets take a look @ app.c again, search for e.g. SEQ_FILE_B_ERR_INVALID_BANK, SEQ_FILE_B_ERR_INVALID_GROUP, SEQ_FILE_BM_ERR_FORMAT ...nope nothing - am confuzed... but results for: SEQ_FILE_B_.... like this: (SEQ_FILE_B_ none error) ...u8 bank; for(bank=0; bank<4; ++bank) str1[7+bank] = SEQ_FILE_B_NumPatterns(bank) ? ('1'+bank) : '-'; by searching the file.c module documentation i dont found any "NumPatterns" I assume seq_file and file are more seperatet then i thougt (up to now i dont any clue anyway, trial and error) .... ok then take a look @ the seq_file_b.c; search for that "NumPatterns" ///////////////////////////////////////////////////////////////////////////// // Returns number of patterns in bank // Returns 0 if bank not valid s32 SEQ_FILE_B_NumPatterns(u8 bank){ if( (bank < SEQ_FILE_B_NUM_BANKS) && seq_file_b_info[bank].valid ) return seq_file_b_info[bank].header.num_patterns; return 0;} ok i can see clear now, the seq_file_b.h define that error messages, that are User/App coded in the seq_file_b.c - these messages are callback messeges, which must be specified... let me proove this by searching the seq_file.c yep here are those error messages: ///////////////////////////////////////////////////////////////////////////// // create a complete bank file // returns < 0 on errors (error codes are documented in seq_file.h) s32 SEQ_FILE_B_Create(char *session, u8 bank){ if( bank >= SEQ_FILE_B_NUM_BANKS ) return SEQ_FILE_B_ERR_INVALID_BANK; ..._file_a/b/c/d.c are specific Memory Tasks, like SystemBank, PatternBank,SongBank, NameBank....... whatever... ..._file.c manage all Memory Tasks, after booting or loading a "Master Preset" it comunicate with all Banks, i expect this "manager" is needet to avoid multiple acces on the sdcard... app.c then dont have to do much... so now its time to code something stripped down, write a variable array on SD-Card & Recall it... & lets proove what is right and what not... lets say if we need this triangle "dreifaltigkeit" or it can be done with app.c and _file_a/b/c/d.cÅ›
  10. I built with your help something like an router...so i merge DIN and Midi to my Function where now almost everthing is... stripped down this it is: #include <mios32.h> #include "app.h" #include <FreeRTOS.h> #include <task.h> #include <queue.h> u8 CCinPort = 33; u8 CCInChn = Chn9; //Function "Router" Variables u32 Cc = 0; u32 Cc_value = 0; u32 port = 0; void APP_Init(void){} void Router(u32 port, u32 Cc, u32 Cc_value) { MIOS32_LCD_Clear(); // clear screen MIOS32_LCD_CursorSet(0, 0); // X,Y FIRST LINE MIOS32_LCD_PrintFormattedString("%d %d %d", port, Cc, Cc_value); //Ports are Midi=0 and Din=1 } void APP_Tick(void) {} void APP_Background(void){} void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){ if((port == CCinPort) && (midi_package.chn == CCInChn) && (midi_package.type == NoteOn)) {Router(0, midi_package.note, midi_package.velocity);}} void APP_SRIO_ServicePrepare(void){} void APP_SRIO_ServiceFinish(void){} //called after the shift register chain has been scanned void APP_DIN_NotifyToggle(u32 pin, u32 pin_value){ if(pin < 256) {Router(1, pin, pin_value);}} // void APP_ENC_NotifyChange(u32 encoder, s32 incrementer){} void APP_AIN_NotifyChange(u32 pin, u32 pin_value){} void BUTTON_NotifyToggle(u8 row, u8 column, u8 pin_value, u32 timestamp){}
  11. yes you understand enough... because the answer is 1A a self written function which is called from both DIN and Midi!!! @ flag and state.... the word state is enough i youtube this...thx @ take a look on this... i make it more readable the next days - and then 2000lines here
  12. hello can give me someone a littel C instruction... i dont write my code here, because its 2000 lines long.... it is more a generell newbe question then something specific --- i think its a standart knowhow that i just have to know, to do more complex progamms... anyway: my APP has following Midibox -standart-functions: void APP_Init(void){} void APP_Tick(void){}//counts DECAY Timings, and do with that NOTE-OFF Handling void APP_Background(Void){} void APP_MIDI_NotifyPackage(mios32void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){}//do Note-ON-Handling, MidiInCC void APP_SRIO_ServicePrepare(void){}//filling the 8x8 LED-Matrix void APP_SRIO_ServiceFinish(void)}//nothing void APP_DIN_NotifyToggle(u32 pin, u32 pin_value)}//All Buttons, and Virtual Matrix Buttons void APP_ENC_NotifyChange(u32 encoder, s32 incrementer)}//Menue Encoders void APP_AIN_NotifyChange(u32 pin, u32 pin_value)}//4 Potis void BUTTON_NotifyToggle(u8 row, u8 column, u8 pin_value, u32 timestamp){}//nothing.... with the MidiBox Buttons that are connectet to the DIN-Modules --- I am in the "DIN_Notifiy" Lo and HIs: I do there most things that happens only one time: when i hit a button - something happens - up to an end, where nothing happens... everthing runs perfect in this closed box, I am happy like a childe with a blinking led speaking robot, and aslong i dont need a time counter like and DECAY-Time it is serial and very logical (for me)... I run into problems when I want to Remote this APP extra via "Midi_Notify" -like an footboard (MB Buttons and Midi Note On/OFFs controll the some Code): - problems? > many code strings are locatet in the DIN_Notify, from Midi-Notify I dont have access to the DIN --- in Din there must be Triggerd something... else nothing is happening there.... So my idea was: Is there a way to force, fake, call from MidiNotify to DinNotify? >>> MidiNoteOn comes in >>> fake Din Pin HI, >>> MidiNoteOff Comes in >>> fake Din Pin LO Event??? like "force pin = 32, pin_value =1" away of that serial processing of triggers (without program loop) i found also loops here "App_Tick" and "App_Background" --- so i run into a world that is not mine... not mine in the past... so tried a workaround, by puting my CODE-Strings (Calculations) under the "APP_Tick" Function, and manage-ing the DIN and Midi HI and LOs --- by working with "Done 0" "Done 1" Flags...to avoid endless triggers on code blocks (each ms) but with that i get so much flags, unbelieveable... @the end off the program there is something and in top this and 2000 lines between others.... mindfuck... and @ the end of day the machine does anything but not that what i want off... (maybe because there is so much code...) Bevore this workaround, i used this TICK only for LCD-Menue & for the Decay-Time for the NoteOFF Events (Note On I do in the Midi-Notify Tread) I come from max msp, and all there is TRIGGER, that triggers this and that, and after a serial way of happenings the code ends... --- so I like that "Midi or DIN trigger a event" very much... for me its logical... that Din and Midi Events in differnt Treads/Functions cracks my head --- help please. michi
  13. ... hmm my sequencer and in near future blm4x and tdp also needs case and frontpanel... but i want 19" rackmount because of being more live musican then studio human.
  14. i had in mind that it was dualcolor...just switched on - uuups you are right > single color (me to many years... it was a nightmare to get that mexico encoders replacements...)
  15. i cant test it, i dont have controllsurfaces with ledrings on it. looks like the "morph assign" feature that the nordlead/rack III has - the NordRack III has a LEDRING Interface: When you press & hold one of the Morph Assign Knobs (Velocity, Keyboard, A.Touch, Wheel) all Ledrings are turned off, and then by turning one or more Encoders you assign it to the pressed Morph Source (e.g. a CC). The Ledrings inital Position is "middle" if you turn it left, the Morph Source is substractetd, turn right and you add a Amount of Morph.... in the Nord Rack Case you have then -64 +64 of Maximal Morph Impact (not 127) Since the Nordrack has "Dual-Colour" Ledrings, this ammount of Morph is indicatet by a differnt colour (Grenn is the morph Factor, red is the CC amount before the morph additon) this could be simulated on the MB-Side with a blinking LED, or with a "show morph" button. that meens techically: the morph CC is addet by the ammount off the morph factor the morph Factor is set Holding the Morph-Assign-Knob + by turning the Destination CC, the result is a int from +-64, for example we turn "+32" now release the Morph-Assign-Knob - now we are in the normal "Perform-Mode" I now turn the Destination-CC to 64. (=Ledring-Value) when i now turn the Morph-CC, to 127, the Resulting Destination-CC-Value will be 96. a cool feature, but only when you see what it does by indicating it wih differnt colours, or some blinking...otherwise it is confuzing...
  16. hopefully the whole hardware thing and synth remote....get something rolling called -preset morph-.... i love soundmorph, i could jam the whole day arround, and then i make a snapshot/save Preset, on gigs the croud dont give me the time to jam the whole day... >>>some crossfade between sounds is "doing less sounding much killer feature" with the possibity to exclude some CCs from that morph - like: LPF-Cutoff, Fiter-Env.Ammount, >>> - for all the filterheadz out there who still got to have controll over the sound while morphing. >exclude the morph Controller from morph fade, morph the morph may end in endless cc traffic sessions... Select the "to be morphed CCs" by hold a "shift"(morph)-Button, now all LEDRINGs are blank by turning a Encoder the dedicatet Ledring lit up > that indicate that this CCs will be morphed.... Next to the MORPH-Button is the Morph encoder, and next to the Morph Encoder is one of this Dispays, that shows on the left the actual Preset, and on the Right the GOAL/Destionation Preset. 2Encoder and one Button should do the job...
  17. I use Trigger Channel 7 + 8 as "Midi-Poly-Melody - Retrigger" - Trigger -Channels Connections: Midi-In-Port1: DrumSequencer Midi-In-Port2: Melody Source on 2 differnt Midichannel (selectable for each Channel per Button) Midi-Out-Port1: Melody Goal on 2 differnt Midichannels here a video, with some functions off the "Tekkstar" and its Brain the "Trigger Matrix" https://vimeo.com/117018283
  18. Situation: 100BPM Midiclock on CH10 over UART-IN-Port to LPC17 Core - from there i route the Clock to the UART-OUT-Ports in additon to that Midiclock i send a lot of notes (polyphone, drumroll > 2x8Notes 32th trigger) on two differnt channels (8Notes 32th retrigger per channel) The Clock routing i do this way: void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){ MIOS32_MIDI_SendPackage(UART0, midi_package); MIOS32_MIDI_SendPackage(UART1, midi_package);} below this code is then my application... inclusive the poly drumroll when my Application send out a lot of Midinotes (Poly-Note-Roll) the BPM dedection on My Synthesizer now slow down about -6BPM so a few ticks are not going out, or to late? is there a way to give a task more priority (Task=midiclock)? or is it better to take a incoming "Start" (0xFA), and start with that 24ppqn Tick (0xF8) with a User (UI) definied BPM rate that is static, and send that out UARTs, until "Stop" (0xFC) come thru the UART-Ins that stop the tick. what is a intresting alternative, by that way i could double or half the BPM, to have more flexibility on Synths like slower LFOs or Arpegs. Here is my Testsetup (yes it is a part of the "Tama Techstar" or "tekkstar" midibox...) https://vimeo.com/117018283
  19. From the album: TekkStar (Tama Techstar Midification)

    The Keyboard give the Midibox(Tama Techstar) some chords, but if you press a Key, you hear NO sound You will hear the Keys when the drummachine (KorgER1)play a note! You will hear the Keys on the Red Synth - NordRack II
×
×
  • Create New...