~mixxxdevelopers/mixxx/features_beatcontrol

« back to all changes in this revision

Viewing changes to mixxx/src/engine/loopingcontrol.cpp

  • Committer: Phillip Whelan
  • Date: 2011-04-01 02:21:33 UTC
  • Revision ID: pwhelan@mixxx.org-20110401022133-q2o8fgkgvp5v0ikv
Use ternary operator to make the syntax for quantization simpler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
void LoopingControl::slotLoopIn(double val) {
230
230
    if (val) {
231
231
        // set loop in position
232
 
        if ( m_pQuantizeEnabled->get()) {
233
 
            m_iLoopStartSample = m_pQuantizeBeat->get();
234
 
        }
235
 
        else {
236
 
            m_iLoopStartSample = m_iCurrentSample;
237
 
        }
 
232
        m_iLoopStartSample = m_pQuantizeEnabled->get() ? m_pQuantizeBeat->get() :  m_iCurrentSample;
238
233
        m_pCOLoopStartPosition->set(m_iLoopStartSample);
239
234
 
240
235
        // Reset the loop out position if it is before the loop in so that loops
250
245
void LoopingControl::slotLoopOut(double val) {
251
246
    int pos;
252
247
 
253
 
    if ( m_pQuantizeEnabled->get()) {
254
 
        pos = m_pQuantizeBeat->get();
255
 
    }
256
 
    else {
257
 
        pos = m_iCurrentSample;
258
 
    }
259
248
 
260
249
    if (val) {
 
250
        pos = m_pQuantizeEnabled->get() ? m_pQuantizeBeat->get() : m_iCurrentSample;
261
251
        // If the user is trying to set a loop-out before the loop in or without
262
252
        // having a loop-in, then ignore it.
263
253
        if (m_iLoopStartSample == -1 || pos < m_iLoopStartSample) {