Subversion Repositories svn.mios32

Rev

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

Rev 1887 Rev 1960
Line 1... Line 1...
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
// $Id: MbCvVoice.cpp 1887 2013-12-15 19:59:56Z tk $
2
// $Id: MbCvVoice.cpp 1960 2014-02-09 20:21:24Z tk $
3
/*
3
/*
4
 * MIDIbox CV Voice Handlers
4
 * MIDIbox CV Voice Handlers
5
 *
5
 *
6
 * ==========================================================================
6
 * ==========================================================================
7
 *
7
 *
Line 11... Line 11...
11
 *
11
 *
12
 * ==========================================================================
12
 * ==========================================================================
13
 */
13
 */
14
14
15
#include <string.h>
15
#include <string.h>
-
 
16
#include "app.h"
16
#include "MbCvVoice.h"
17
#include "MbCvVoice.h"
17
#include "MbCvMidiVoice.h"
18
#include "MbCvMidiVoice.h"
18
#include "MbCvTables.h"
19
#include "MbCvTables.h"
19
20
20
#include <aout.h>
21
#include <aout.h>
Line 68... Line 69...
68
    voiceTransposeOctave = 0;
69
    voiceTransposeOctave = 0;
69
    voiceTransposeSemitone = 0;
70
    voiceTransposeSemitone = 0;
70
    voiceFinetune = 0;
71
    voiceFinetune = 0;
71
    voicePitchrange = 2;
72
    voicePitchrange = 2;
72
    voicePortamentoRate = 0;
73
    voicePortamentoRate = 0;
-
 
74
    voiceForceToScale = false;
-
 
75
    voiceExternalGateThreshold = 0;
73
76
74
    voicePitchModulation = 0;
77
    voicePitchModulation = 0;
75
78
76
    voiceActive = 0;
79
    voiceActive = 0;
77
    voiceDisabled = 0;
80
    voiceDisabled = 0;
Line 216... Line 219...
216
    int target_frq = transposedNote << 9;
219
    int target_frq = transposedNote << 9;
217
220
218
    // increase/decrease target frequency by pitchrange
221
    // increase/decrease target frequency by pitchrange
219
    // depending on pitchbender and finetune value
222
    // depending on pitchbender and finetune value
220
    if( voicePitchrange ) {
223
    if( voicePitchrange ) {
221
        int delta = midiVoicePtr->midivoicePitchbender; // 14bit
224
        int delta = midiVoicePtr->midivoicePitchBender; // 14bit
222
        delta += (int)voiceFinetune*64; // 8bit -> 14bit
225
        delta += (int)voiceFinetune*64; // 8bit -> 14bit
223
226
224
        if( delta ) {
227
        if( delta ) {
225
            int scaled = (delta * (int)voicePitchrange) / 16;
228
            int scaled = (delta * (int)voicePitchrange) / 16;
226
            target_frq += scaled;
229
            target_frq += scaled;
Line 521... Line 524...
521
    out += voicePitchModulation;
524
    out += voicePitchModulation;
522
    if( out < 0 ) out = 0x0000; else if( out > 0xffff ) out = 0xffff;
525
    if( out < 0 ) out = 0x0000; else if( out > 0xffff ) out = 0xffff;
523
526
524
    return out;
527
    return out;
525
}
528
}
526
-