//--------------------------------------------------------------------------------- int main() { //--------------------------------------------------------------------------------- readUserSettings(); irqInit(); // Start the RTC tracking IRQ initClockIRQ(); fifoInit(); //mmInstall(FIFO_MAXMOD); InstallSoundSys(); SetYtrigger(80); installWifiFIFO(); installSoundFIFO(); installSystemFIFO(); irqSet(IRQ_VCOUNT, VcountHandler); irqSet(IRQ_VBLANK, VblankHandler); irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK); setPowerButtonCB(powerButtonCB); // Keep the ARM7 mostly idle while (!exitflag) { if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) { exitflag = true; } swiWaitForVBlank(); } return 0; }
//--------------------------------------------------------------------------------- int main() { u32 i=0; //--------------------------------------------------------------------------------- readUserSettings(); irqInit(); // Start the RTC tracking IRQ initClockIRQ(); fifoInit(); //mmInstall(FIFO_MAXMOD); InstallSoundSys(); SetYtrigger(80); installWifiFIFO(); installSoundFIFO(); installSystemFIFO(); irqSet(IRQ_VCOUNT, VcountHandler); irqSet(IRQ_VBLANK, VblankHandler); irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK); setPowerButtonCB(powerButtonCB); // Keep the ARM7 mostly idle while (!exitflag) { if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) { exitflag = true; } swiWaitForVBlank(); if(seq_status==STATUS_FADING) { if(i<24) { i+=10; } else { i-=24; ADSR_mastervolume--; if(!ADSR_mastervolume) StopSeq(); } } } return 0; }
int main(int argc, char* argv[]) { consoleDemoInit(); InstallSoundSys(); iprintf("\n\n\tSSEQ player PoC v1\n"); iprintf("\tfincs.drunkencoders.com\n"); iprintf("\tgithub.com/fincs"); if (argc < 4) { if (!nitroFSInit()) { error("Can't initialize NitroFS!"); anykey(); return 0; } if (defaultLoad(&g_sseqData, &g_sbnkData, g_swarData) != 0) { anykey(); return 0; } }else { if (!fatInitDefault()) { error("Can't initialize FAT!"); anykey(); return 0; } if (argvLoad(argc-1, argv+1, &g_sseqData, &g_sbnkData, g_swarData) != 0) { anykey(); return 0; } } PlaySeq(g_sseqData, g_sbnkData, g_swarData); for(;;) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_START) break; if (keysDown() & KEY_B) StopSeq(); } return 0; }
int main(int _argc, char **_argv) { consoleDemoInit(); InstallSoundSys(); argc=_argc; argv=_argv; if(!fatInitDefault()) { iprintf("Filesystem FAIL"); for(;;) swiWaitForVBlank(); } CurrentFile = 0; ReadDIR(); ShowDIR(); CurrentSPS=malloc(768); if(readFrontend(CurrentSPS)) { ReadSPS(); } else { free(CurrentSPS); CurrentSPS=NULL; } for(;;) { if(CurrentSSEQ != LastSSEQ) { LastSSEQ = CurrentSSEQ; scrollpos = 0; scrollposcounter = 10; } if(CurrentFile != LastFile) { LastFile = CurrentFile; scrollpos = 0; scrollposcounter = 10; } if(scrollposcounter==0) { scrollposcounter=10; if(!scrollposdirection) { //RIGHT if(scrollpos<scrollposmax) { scrollpos++; } else { scrollposdirection = 1; scrollposcounter = 120; } } else { //LEFT if(scrollpos>0) { scrollpos--; } else { scrollposdirection = 0; scrollposcounter = 120; } } } else { scrollposcounter--; } if(!PlayMode) { message_pointer = 0; //Ignore any incoming debug messages. if(SSEQMode) ShowSSEQ(); else ShowDIR(); } swiWaitForVBlank(); if(PlayMode) { j = message_pointer; for(i=0; i<j; i+=6) { if(message_data[i]) { #ifdef SNDSYS_DEBUG iprintf("cmd = %.2X:%.2X",message_data[i+1],message_data[i+2]); if(message_data[i]==3) iprintf(":%.2X\n",message_data[i+3]); else iprintf("\n"); #endif switch (message_data[i+1]) { #ifdef SNDSYS_DEBUG case 0x00: iprintf("00 Unrecognized record: %d\n",message_data[i+2]); break; case 0x04: iprintf("%X:",message_data[i+5]); iprintf("04 SEQUENCE IS MULTI-TRACK\n"); break; case 0x03: iprintf("%X:",message_data[i+5]); iprintf("03 SEQUENCE IS SINGLE-TRACK\n"); break; case 0x05: iprintf("%X:",message_data[i+5]); iprintf("05 CREATED TRACK %d\n",message_data[i+2]); break; #endif case 0x06: if(PlayMode) iprintf("06 SEQUENCE STOPPED\n"); if(PlayMode && AutoPlay && !ManualStop) { if(CurrentSSEQ < SSEQCount - 1) { CurrentSSEQ++; ReadSSEQ(); } } ManualStop = false; break; case 0x07: if(PlayMode) iprintf("07 Track has looped twice\n"); if(PlayMode && AutoPlay) { FadeSeq(); } break; case 0x08: if(PlayMode) iprintf("08 Track has ended\n"); if(PlayMode && AutoPlay) { if(CurrentSSEQ < SSEQCount - 1) { CurrentSSEQ++; ReadSSEQ(); } } break; case 0xC1: // Track Volume iprintf("%X:", message_data[i+5]); iprintf("C1 Track Volume: %d\n", message_data[i+2]); break; case 0xC2: // MASTER VOLUME iprintf("%X:", message_data[i+5]); iprintf("C2 MASTER VOLUME: %d\n", message_data[i+2]); break; #ifdef SNDSYS_DEBUG case 0x94: // JUMP iprintf("%X:",message_data[i+5]); iprintf("94 POSITION JUMP:\n"); break; case 0xC3: // TRANSPOSE iprintf("C3 TRANSPOSE: %.2X\n",message_data[i+2]); break; case 0xC8: // TIE iprintf("C8 TIE: %.2X\n",message_data[i+2]); break; case 0xC9: // PORTAMENTO iprintf("C9 PORTAMENTO: %.2X\n",message_data[i+2]); break; case 0xCA: // MODULATION DEPTH iprintf("CA MODULATION DEPTH: %.2X\n",message_data[i+2]); break; case 0xCB: // MODULATION SPEED iprintf("CB MODULATION SPEED: %.2X\n",message_data[i+2]); break; case 0xCC: // MODULATION TYPE iprintf("CC MODULATION TYPE: %.2X\n",message_data[i+2]); break; case 0xCD: // MODULATION RANGE iprintf("CD MODULATION RANGE: %.2X\n",message_data[i+2]); break; case 0xCE: // PORTAMENTO ON/OFF iprintf("CE PORTAMENTO ON/OFF: %.2X\n",message_data[i+2]); break; case 0xCF: // PORTAMENTO TIME iprintf("CF PORTAMENTO TIME: %.2X\n",message_data[i+2]); break; case 0xD4: //LOOP START iprintf("%X:",message_data[i+5]); iprintf("D4 LOOP START: %d\n",message_data[i+2]); break; case 0xD6: // PRINT VAR iprintf("D6 PRINT VAR: %.2X\n",message_data[i+2]); break; case 0xE0: // MODULATION DELAY iprintf("E0 MODULATION DELAY: %.2X %.2X\n",message_data[i+2],message_data[i+3]); break; case 0xE3: // SWEEP PITCH iprintf("E3 SWEEP PITCH: %.2X %.2X\n",message_data[i+2],message_data[i+3]); break; case 0xFC: iprintf("%X:",message_data[i+5]); iprintf("FC LOOP END:\n"); break; case 0xFF: iprintf("%X:",message_data[i+5]); iprintf("FF END OF TRACK:\n"); break; default: iprintf("%.2X Unrecognized cmd: %.2X %.2X %.2X",message_data[i+1],message_data[i+2],message_data[i+3],message_data[i+4]); break; #endif } } } message_pointer -= j; } scanKeys(); if (keysDown() & KEY_A) { if(PlayMode) { fifoSendDatamsg(FIFO_SNDSYS, sizeof(curr_seq), (u8*) &curr_seq); //User may have stopped current sequence. } else { if(SSEQMode) { ReadSSEQ(); } else { if (CurrentSPS != NULL) { free(CurrentSPS); } CurrentSPS = malloc(23 + strlen(DIRList[CurrentFile])+1); strcpy(CurrentSPS, "/data/NDS Music Player/"); strcat(CurrentSPS, DIRList[CurrentFile]); CurrentSPS[23 + strlen(DIRList[CurrentFile])]=0; ReadSPS(); } } } if (keysDown() & KEY_B) { if(PlayMode) { PlayMode = false; SSEQMode = true; ShowSSEQ(); } else { if(SSEQMode) { SSEQMode = false; ShowDIR(); } else { ShowDIR(); } } } if (keysDown() & KEY_X) { ManualStop = true; StopSeq(); } if (keysDown() & KEY_Y) { ManualStop = true; FadeSeq(); } if(keysDown() & KEY_SELECT) { AutoPlay = !AutoPlay; if(PlayMode) { if(AutoPlay) iprintf("Auto Play enabled\n"); else iprintf("Auto Play disabled\n"); } } if(keysDown() & KEY_START) { PauseSeq(); } if (keysDown() & KEY_UP) { if(PlayMode) { } else { if(SSEQMode) { if(CurrentSSEQ > 0) { CurrentSSEQ--; } else { CurrentSSEQ = SSEQCount - 1; } ShowSSEQ(); } else { if(CurrentFile > 0) { CurrentFile--; } else { CurrentFile = FileCount; } ShowDIR(); } } } if (keysDown() & KEY_DOWN) { if(PlayMode) { } else { if(SSEQMode) { if(CurrentSSEQ < SSEQCount - 1) { CurrentSSEQ++; } else { CurrentSSEQ = 0; } ShowSSEQ(); } else { if(CurrentFile < FileCount) { CurrentFile++; } else { CurrentFile = 0; } ShowDIR(); } } } if (keysDown() & KEY_LEFT) { if(PlayMode) { } else { if(SSEQMode) { if(CurrentSSEQ >= 23) { CurrentSSEQ -= 23; } else { CurrentSSEQ = 0; } ShowSSEQ(); } else { if(CurrentFile >= 23) { CurrentFile -= 23; } else { CurrentFile = 0; } ShowDIR(); } } } if (keysDown() & KEY_RIGHT) { if(PlayMode) { } else { if(SSEQMode) { if(CurrentSSEQ < (SSEQCount - 24)) { CurrentSSEQ += 23; } else { CurrentSSEQ = SSEQCount - 1; } ShowSSEQ(); } else { if(CurrentFile < (FileCount - 24)) { CurrentFile += 23; } else { CurrentFile = FileCount; } ShowDIR(); } } } if (keysDown() & KEY_L) { if (PlayMode) { if(CurrentSSEQ > 0) { CurrentSSEQ--; } else { CurrentSSEQ = SSEQCount - 1; } ReadSSEQ(); } } if (keysDown() & KEY_R) { if (PlayMode) { if(CurrentSSEQ < SSEQCount - 1) { CurrentSSEQ++; } else { CurrentSSEQ = 0; } ReadSSEQ(); } } } }