Subversion Repositories svn.mios32

Rev

Rev 1401 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1334 tk 1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
// $Id: MbCvVoice.h 1960 2014-02-09 20:21:24Z tk $
3
/*
4
 * MIDIbox CV Voice Handlers
5
 *
6
 * ==========================================================================
7
 *
8
 *  Copyright (C) 2010 Thorsten Klose (tk@midibox.org)
9
 *  Licensed for personal non-commercial use only.
10
 *  All other rights reserved.
11
 *
12
 * ==========================================================================
13
 */
14
 
15
#ifndef _MB_CV_VOICE_H
16
#define _MB_CV_VOICE_H
17
 
18
#include <mios32.h>
19
#include "MbCvStructs.h"
20
#include "MbCvMidiVoice.h"
21
 
22
class MbCvVoice
23
{
24
public:
25
    // Constructor
26
    MbCvVoice();
27
 
28
    // Destructor
29
    ~MbCvVoice();
30
 
31
    // reference to assigned MIDI voice
32
    // has to be set by MbCv.cpp before voices are used!
33
    MbCvMidiVoice *midiVoicePtr;
34
 
35
    // voice init functions
36
    virtual void init(u8 _voiceNum, MbCvMidiVoice* _midiVoicePtr);
37
    virtual void init();
38
 
39
    // input parameters
40
    bool voiceLegato;
41
    bool voiceSusKey;
42
    bool voiceSequencerOnly;
43
    bool voicePoly;
1397 tk 44
    bool voiceGateInverted;
1334 tk 45
    bool voiceConstantTimeGlide;
46
    bool voiceGlissandoMode;
47
    u8 voiceAccentRate; // used by Bassline sequencer only
1397 tk 48
    s8 voiceKeytrack;
1334 tk 49
    s8 voiceTransposeOctave;
50
    s8 voiceTransposeSemitone;
51
    s8 voiceFinetune;
52
    u8 voicePitchrange;
53
    u8 voicePortamentoRate;
54
 
55
    // output
56
    s32 voicePitchModulation;
57
 
58
    // for AOUT mapping
59
    mbcv_midi_event_mode_t voiceEventMode;
60
    u16 voiceFrq;
61
    u8  voiceVelocity;
62
 
63
    // voice handlers
64
    virtual bool gate(const u8 &updateSpeedFactor);
65
    virtual void pitch(const u8 &updateSpeedFactor);
66
 
67
    bool noteOn(u8 note, u8 velocity);
68
    bool noteOff(u8 note, u8 lastFirstNote);
69
    void gateOn(void);
70
    void gateOff_SingleVoice(void);
71
    void gateOff(u8 note);
72
 
73
    // some flags
74
    bool voiceActive;
75
    bool voiceDisabled;
76
    bool voiceGateActive;
77
    bool voicePhysGateActive;
78
    bool voiceGateSetReq;
79
    bool voiceGateClrReq;
80
    bool voicePortamentoActive;
81
    bool voicePortamentoInitialized;
82
    bool voiceAccentActive;
83
    bool voiceSlideActive;
84
    bool voiceForceFrqRecalc; // forces CV frequency re-calculation (if CV frequency registers have been changed externally)
85
    bool voiceNoteRestartReq;
86
 
87
    // some variables
88
    u8  voiceNum; // number of assigned channel
89
    u8  voiceNote;
90
    u8  voiceForcedNote;
91
    u8  voicePlayedNote;
92
    u8  voicePrevTransposedNote;
93
    u8  voiceGlissandoNote;
94
    u16 voicePortamentoBeginFrq;
95
    u16 voicePortamentoEndFrq;
96
    u16 voicePortamentoCtr;
97
    u16 voiceLinearFrq;
98
    u8  voiceRetriggerDelay;
99
    u8  voiceSetDelayCtr;
1960 tk 100
    bool voiceForceToScale;
101
    u8  voiceExternalGateThreshold;
1334 tk 102
 
103
    u8  voiceAssignedInstrument;
104
 
1394 tk 105
    // help functions for editor
1397 tk 106
    void setAoutCurve(u8 value);
107
    u8 getAoutCurve(void);
108
    const char* getAoutCurveName();
109
 
110
    void setAoutSlewRate(u8 value);
111
    u8 getAoutSlewRate(void);
112
 
1394 tk 113
    void setPortamentoMode(u8 value);
114
    u8 getPortamentoMode(void);
115
 
1401 tk 116
    // transpose any value (used by Event modes != Note)
117
    u16 transpose(u16 value);
118
 
1334 tk 119
protected:
1960 tk 120
 
1334 tk 121
};
122
 
123
#endif /* _MB_CV_VOICE_H */