Subversion Repositories svn.mios32

Rev

Rev 2186 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2186 Rev 2187
Line 78... Line 78...
78
u8 displayMode2d_ = 0;          // if not in 2d display mode, we are rendering voxelspace
78
u8 displayMode2d_ = 0;          // if not in 2d display mode, we are rendering voxelspace
79
u8 selectedClipNumber_ = 0;     // currently active or last active clip number (1-8)
79
u8 selectedClipNumber_ = 0;     // currently active or last active clip number (1-8)
80
u16 beatLoopSteps_ = 16;        // number of steps for one beatloop (adjustable)
80
u16 beatLoopSteps_ = 16;        // number of steps for one beatloop (adjustable)
81
u8 isRecording_ = 0;            // set, if currently recording
81
u8 isRecording_ = 0;            // set, if currently recording
82
u8 stopRecordingRequest_ = 0;   // if set, the sequencer will stop recording at an even "beatLoopStep" interval, to create loopable clips
82
u8 stopRecordingRequest_ = 0;   // if set, the sequencer will stop recording at an even "beatLoopStep" interval, to create loopable clips
-
 
83
s8 reloadClipNumberRequest_ = -1; // if != -1, reload the given clip number after sequencer stop (usually, a track has been recorded, then!)
83
84
84
u16 seqPlayEnabledPorts_;
85
u16 seqPlayEnabledPorts_;
85
u16 seqRecEnabledPorts_;
86
u16 seqRecEnabledPorts_;
86
87
87
static u32 clipFilePos_[8];     // file position within midi file (for 8 clips)
88
static u32 clipFilePos_[8];     // file position within midi file (for 8 clips)
Line 938... Line 939...
938
      // Perform synchronized recording stop (tracklength a multiple of beatsteps)
939
      // Perform synchronized recording stop (tracklength a multiple of beatsteps)
939
      if (stopRecordingRequest_)
940
      if (stopRecordingRequest_)
940
      {
941
      {
941
         if (tickToStep(bpm_tick) % beatLoopSteps_ == 0)
942
         if (tickToStep(bpm_tick) % beatLoopSteps_ == 0)
942
         {
943
         {
-
 
944
            SEQ_BPM_Stop();          // stop sequencer
-
 
945
            MIOS32_DOUT_PinSet(led_armrecord, 0);
-
 
946
943
            screenFormattedFlashMessage("Stopped Recording");
947
            screenFormattedFlashMessage("Stopped Recording");
944
            MID_FILE_SetRecordMode(0);
948
            MID_FILE_SetRecordMode(0);
945
            stopRecordingRequest_ = 0;
949
            stopRecordingRequest_ = 0;
946
950
947
            SEQ_BPM_Stop();          // stop sequencer
951
            loadClip(reloadClipNumberRequest_);
948
            MIOS32_DOUT_PinSet(led_armrecord, 0);
952
            reloadClipNumberRequest_ = -1;
949
         }
953
         }
950
         else
954
         else
951
         {
955
         {
952
            u8 remainSteps = 16 - (tickToStep(bpm_tick) % beatLoopSteps_);
956
            u8 remainSteps = 16 - (tickToStep(bpm_tick) % beatLoopSteps_);
953
            screenFormattedFlashMessage("Stop Recording in %d", remainSteps);
957
            screenFormattedFlashMessage("Stop Recording in %d", remainSteps);
Line 1125... Line 1129...
1125
      }
1129
      }
1126
1130
1127
      // New step, Update clip positions
1131
      // New step, Update clip positions
1128
      u8 i;
1132
      u8 i;
1129
      for (i = 0; i < 8; i++)
1133
      for (i = 0; i < 8; i++)
-
 
1134
      {
-
 
1135
         DEBUG_MSG("[SetClipPos] clip: %u bpm_tick: %u clipTicks_[clip]: %u ticksPerStep: %u", i, bpm_tick, clipTicks_[i], ticksPerStep);
1130
         screenSetClipPosition(i, ((u32) (bpm_tick % clipTicks_[i]) / ticksPerStep));
1136
         screenSetClipPosition(i, ((u32) (bpm_tick % clipTicks_[i]) / ticksPerStep));
-
 
1137
      }
1131
1138
1132
      // Set global song step (non-wrapping), e.g. for recording clips
1139
      // Set global song step (non-wrapping), e.g. for recording clips
1133
      screenSetSongStep(bpm_tick / ticksPerStep);
1140
      screenSetSongStep(bpm_tick / ticksPerStep);
1134
   }
1141
   }
1135
}
1142
}
Line 1153... Line 1160...
1153
   u8 clipNumber;
1160
   u8 clipNumber;
1154
   for (clipNumber = 0; clipNumber < 8; clipNumber++)
1161
   for (clipNumber = 0; clipNumber < 8; clipNumber++)
1155
   {
1162
   {
1156
      if (clipFileAvailable_[clipNumber])
1163
      if (clipFileAvailable_[clipNumber])
1157
      {
1164
      {
1158
         // XXX: Use better loop calculation function for this, also in position display routine, based on clip start/end looppoints
-
 
1159
         // u32 clip_tick = bpm_tick % clipTicks_[clipNumber];
-
 
1160
-
 
1161
         // DEBUG_MSG("clip: %d bpm_tick: %d nextPrefetch: %d", clipNumber, bpm_tick, nextPrefetch_[clipNumber]);
1165
         // DEBUG_MSG("clip: %d bpm_tick: %d nextPrefetch: %d", clipNumber, bpm_tick, nextPrefetch_[clipNumber]);
1162
1166
1163
         if (bpm_tick >= nextPrefetch_[clipNumber])
1167
         if (bpm_tick >= nextPrefetch_[clipNumber])
1164
         {
1168
         {
1165
            // get number of prefetch ticks depending on current BPM
1169
            // get number of prefetch ticks depending on current BPM
Line 1360... Line 1364...
1360
     SEQ_BPM_CheckAutoMaster();
1364
     SEQ_BPM_CheckAutoMaster();
1361
1365
1362
     // enter record mode
1366
     // enter record mode
1363
     if (MID_FILE_SetRecordMode(1) >= 0)
1367
     if (MID_FILE_SetRecordMode(1) >= 0)
1364
     {
1368
     {
-
 
1369
        reloadClipNumberRequest_ = selectedClipNumber_;
1365
        isRecording_ = 1;
1370
        isRecording_ = 1;
1366
1371
1367
        // reset sequencer
1372
        // reset sequencer
1368
        seqReset(1);
1373
        seqReset(1);
1369
1374