Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/fluidsynthsoundcontroller/fluidsynthsoundcontroller.cpp
Context not available. | |||||
34 | : Minuet::ISoundController(parent), | 34 | : Minuet::ISoundController(parent), | ||
---|---|---|---|---|---|
35 | m_audioDriver(0), | 35 | m_audioDriver(0), | ||
36 | m_sequencer(0), | 36 | m_sequencer(0), | ||
37 | m_song(0) | 37 | m_song(0), | ||
38 | m_unregisteringEvent(0) | ||||
38 | { | 39 | { | ||
39 | m_tempo = 60; | 40 | m_tempo = 60; | ||
40 | 41 | | |||
41 | m_settings = new_fluid_settings(); | 42 | m_settings = new_fluid_settings(); | ||
42 | fluid_settings_setstr(m_settings, "synth.reverb.active", "no"); | 43 | fluid_settings_setint(m_settings, "synth.reverb.active", 0); | ||
43 | fluid_settings_setstr(m_settings, "synth.chorus.active", "no"); | 44 | fluid_settings_setint(m_settings, "synth.chorus.active", 0); | ||
44 | 45 | | |||
45 | m_synth = new_fluid_synth(m_settings); | 46 | m_synth = new_fluid_synth(m_settings); | ||
46 | 47 | | |||
Context not available. | |||||
55 | if (fluid_res == FLUID_FAILED) | 56 | if (fluid_res == FLUID_FAILED) | ||
56 | qCritical() << "Error when loading soundfont!"; | 57 | qCritical() << "Error when loading soundfont!"; | ||
57 | 58 | | |||
59 | m_unregisteringEvent = new_fluid_event(); | ||||
60 | fluid_event_set_source(m_unregisteringEvent, -1); | ||||
61 | | ||||
58 | resetEngine(); | 62 | resetEngine(); | ||
59 | } | 63 | } | ||
60 | 64 | | |||
Context not available. | |||||
63 | deleteEngine(); | 67 | deleteEngine(); | ||
64 | if (m_synth) delete_fluid_synth(m_synth); | 68 | if (m_synth) delete_fluid_synth(m_synth); | ||
65 | 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); | ||||
66 | } | 71 | } | ||
67 | 72 | | |||
68 | void FluidSynthSoundController::setPitch(qint8 pitch) | 73 | void FluidSynthSoundController::setPitch(qint8 pitch) | ||
Context not available. | |||||
240 | 245 | | |||
241 | void FluidSynthSoundController::deleteEngine() | 246 | void FluidSynthSoundController::deleteEngine() | ||
242 | { | 247 | { | ||
248 | // explicit client unregistering required | ||||
249 | fluid_sequencer_unregister_client(m_sequencer, m_callbackSeqID); | ||||
250 | fluid_event_set_dest(m_unregisteringEvent, m_synthSeqID); | ||||
251 | fluid_event_unregistering(m_unregisteringEvent); | ||||
252 | fluid_sequencer_send_now(m_sequencer, m_unregisteringEvent); | ||||
253 | | ||||
243 | if (m_sequencer) delete_fluid_sequencer(m_sequencer); | 254 | if (m_sequencer) delete_fluid_sequencer(m_sequencer); | ||
244 | if (m_audioDriver) delete_fluid_audio_driver(m_audioDriver); | 255 | if (m_audioDriver) delete_fluid_audio_driver(m_audioDriver); | ||
245 | } | 256 | } | ||
Context not available. |