Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/fluidsynthsoundcontroller/fluidsynthsoundcontroller.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 66 | { | |||
---|---|---|---|---|---|
67 | deleteEngine(); | 67 | deleteEngine(); | ||
68 | if (m_synth) delete_fluid_synth(m_synth); | 68 | if (m_synth) delete_fluid_synth(m_synth); | ||
69 | if (m_settings) delete_fluid_settings(m_settings); | 69 | if (m_settings) delete_fluid_settings(m_settings); | ||
70 | if (m_unregisteringEvent) delete_fluid_event(m_unregisteringEvent); | 70 | if (m_unregisteringEvent) delete_fluid_event(m_unregisteringEvent); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | void FluidSynthSoundController::setPitch(qint8 pitch) | 73 | void FluidSynthSoundController::setPitch(qint8 pitch) | ||
74 | { | 74 | { | ||
75 | if (m_pitch != pitch) { | ||||
75 | m_pitch = pitch; | 76 | m_pitch = pitch; | ||
76 | fluid_synth_cc(m_synth, 1, 101, 0); | 77 | fluid_synth_cc(m_synth, 1, 101, 0); | ||
77 | fluid_synth_cc(m_synth, 1, 6, 12); | 78 | fluid_synth_cc(m_synth, 1, 6, 12); | ||
78 | float accurate_pitch = (m_pitch + 12) * (2.0 / 3) * 1024; | 79 | float accurate_pitch = (m_pitch + 12) * (2.0 / 3) * 1024; | ||
79 | fluid_synth_pitch_bend(m_synth, 1, qMin(qRound(accurate_pitch), 16 * 1024 - 1)); | 80 | fluid_synth_pitch_bend(m_synth, 1, qMin(qRound(accurate_pitch), 16 * 1024 - 1)); | ||
80 | } | 81 | } | ||
82 | } | ||||
81 | 83 | | |||
82 | void FluidSynthSoundController::setVolume(quint8 volume) | 84 | void FluidSynthSoundController::setVolume(quint8 volume) | ||
83 | { | 85 | { | ||
86 | if (m_volume != volume) { | ||||
84 | m_volume = volume; | 87 | m_volume = volume; | ||
85 | fluid_synth_cc(m_synth, 1, 7, m_volume * 127 / 200); | 88 | fluid_synth_cc(m_synth, 1, 7, m_volume * 127 / 200); | ||
86 | } | 89 | } | ||
90 | } | ||||
87 | 91 | | |||
88 | void FluidSynthSoundController::setTempo (quint8 tempo) | 92 | void FluidSynthSoundController::setTempo (quint8 tempo) | ||
89 | { | 93 | { | ||
90 | m_tempo = tempo; | 94 | m_tempo = tempo; | ||
91 | } | 95 | } | ||
92 | 96 | | |||
93 | void FluidSynthSoundController::prepareFromExerciseOptions(QJsonArray selectedExerciseOptions) | 97 | void FluidSynthSoundController::prepareFromExerciseOptions(QJsonArray selectedExerciseOptions) | ||
94 | { | 98 | { | ||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |