///////////////////////////////////////////////////////////////////////////// // called by the UI to handle the "Fwd" button ///////////////////////////////////////////////////////////////////////////// s32 SEQ_SONG_Fwd(void) { if( ui_page == SEQ_UI_PAGE_SONG ) { song_pos = ui_song_edit_pos; song_loop_ctr = 0; SEQ_SONG_NextPos(); if( ui_song_edit_pos != song_pos ) ui_song_edit_pos = song_pos; else { // increment if possible if( song_pos < SEQ_SONG_NUM_STEPS ) { ++song_pos; SEQ_SONG_FetchPos(0, 0); ui_song_edit_pos = song_pos; // update display immediately seq_ui_display_update_req = 1; } } } else { u32 bpm_tick = SEQ_BPM_TickGet(); u32 ticks_per_pattern = ((u32)seq_core_steps_per_pattern+1) * (SEQ_BPM_PPQN_Get()/4); u32 measure = bpm_tick / ticks_per_pattern; u32 next_bpm_tick = (measure+1) * ticks_per_pattern; SEQ_CORE_Reset(next_bpm_tick); SEQ_SONG_NextPos(); SEQ_BPM_TickSet(next_bpm_tick); } return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Sets new song position (new_song_pos resolution: 16th notes) ///////////////////////////////////////////////////////////////////////////// static s32 SEQ_SongPos(u16 new_song_pos) { u16 new_tick = new_song_pos * (SEQ_BPM_PPQN_Get() / 4); // set new tick value SEQ_BPM_TickSet(new_tick); #if DEBUG_VERBOSE_LEVEL >= 2 DEBUG_MSG("[SEQ] Setting new song position %u (-> %u ticks)\n", new_song_pos, new_tick); #endif // since timebase has been changed, ensure that Off-Events are played // (otherwise they will be played much later...) SEQ_PlayOffEvents(); // restart song MID_PARSER_RestartSong(); // release pause seq_pause = 0; if( new_song_pos > 1 ) { // (silently) fast forward to requested position ffwd_silent_mode = 1; MID_PARSER_FetchEvents(0, new_tick-1); ffwd_silent_mode = 0; } // when do we expect the next prefetch: next_prefetch = new_tick; prefetch_offset = new_tick; return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Resets song position of sequencer ///////////////////////////////////////////////////////////////////////////// s32 SEQ_Reset(u8 play_off_events) { // since timebase has been changed, ensure that Off-Events are played // (otherwise they will be played much later...) if( play_off_events ) SEQ_PlayOffEvents(); // release pause and FFWD mode seq_pause = 0; ffwd_silent_mode = 0; next_prefetch = 0; prefetch_offset = 0; // restart song MID_PARSER_RestartSong(); // set initial BPM (according to MIDI file spec) SEQ_BPM_PPQN_Set(384); // not specified SEQ_BPM_Set(120.0); // reset BPM tick SEQ_BPM_TickSet(0); return 0; // no error }
///////////////////////////////////////////////////////////////////////////// //! Sets new song position (new_song_pos resolution: 16th notes) ///////////////////////////////////////////////////////////////////////////// static s32 MBNG_SEQ_SongPos(u16 new_song_pos) { u32 new_tick = new_song_pos * (SEQ_BPM_PPQN_Get() / 4); // set new tick value SEQ_BPM_TickSet(new_tick); return 0; // no error }
///////////////////////////////////////////////////////////////////////////// //! Resets song position of sequencer ///////////////////////////////////////////////////////////////////////////// s32 MBNG_SEQ_Reset(void) { // release pause and FFWD mode MBNG_SEQ_SetPauseMode(0); // reset BPM tick SEQ_BPM_TickSet(0); return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Resets song position of sequencer ///////////////////////////////////////////////////////////////////////////// s32 SEQ_Reset(void) { // since timebase has been changed, ensure that Off-Events are played // (otherwise they will be played much later...) SEQ_PlayOffEvents(); // release pause mode seq_pause = 0; // reset BPM tick SEQ_BPM_TickSet(0); return 0; // no error }
void MClock_Reset(void) { SEQ_MIDI_OUT_FlushQueue(); // flush the SEQ_MIDI queues which should be empty anyways midiclockcounter = 0; // reset the counter reset_Req = 0; // we just did that mClock.ticked = 0; // and we need to reset this too SEQ_BPM_TickSet(0); // reset BPM tick SEQ_BPM_Timestamp = mod_Tick_Timestamp = 0; // we'll force this to zero in case it's already advanced mClock.status.reset_req = 1; // Set global reset flag Mod_PreProcess(DEAD_NODEID); // preprocess all modules, so they can catch the reset mClock.status.reset_req = 0; // Clear the flag }
void Clocks_Init(void) { SEQ_BPM_TickSet(0); // reset sequencer SEQ_BPM_Init(0); // initialize SEQ module sequencer SEQ_BPM_PPQN_Set(VXPPQN); // set internal clock resolution as per the define (usually 384) MClock_SetBPM(100.0); // Master BPM mClock.status.all = 0; // bit 7 is run/stop mClock.ticked = 0; // we haven't gotten that far yet mClock.timesigu = 4; // Upper value of the Master Time Signature, min 2 mClock.timesigl = 4; // Lower value of the Master Time Signature, min 2 mClock.res = SEQ_BPM_PPQN_Get(); // fill this from the SEQ_BPM module to be safe mClock.rt_latency = VXLATENCY; // initialise from define MClock_Init(); // init the vX master clock MClock_Reset(); }
///////////////////////////////////////////////////////////////////////////// // called by the UI to handle the "Rew" button ///////////////////////////////////////////////////////////////////////////// s32 SEQ_SONG_Rew(void) { if( ui_page == SEQ_UI_PAGE_SONG ) { song_pos = ui_song_edit_pos; song_loop_ctr = 0; SEQ_SONG_PrevPos(); ui_song_edit_pos = song_pos; } else { u32 bpm_tick = SEQ_BPM_TickGet(); u32 ticks_per_pattern = ((u32)seq_core_steps_per_pattern+1) * (SEQ_BPM_PPQN_Get()/4); u32 measure = bpm_tick / ticks_per_pattern; u32 next_bpm_tick = measure ? ((measure-1) * ticks_per_pattern) : 0; SEQ_CORE_Reset(next_bpm_tick); SEQ_SONG_PrevPos(); SEQ_BPM_TickSet(next_bpm_tick); } return 0; // no error }