--- gigedit/trunk/src/dimregionedit.cpp 2007/03/17 09:20:19 1100 +++ gigedit/trunk/src/dimregionedit.cpp 2007/04/18 12:31:41 1164 @@ -19,179 +19,175 @@ #include "dimregionedit.h" -bool update_gui; - -namespace { - uint8_t& access_UnityNote(gig::DimensionRegion* dimreg) - { - return dimreg->UnityNote; - } - int16_t& access_FineTune(gig::DimensionRegion* dimreg) - { - return dimreg->FineTune; - } - uint32_t& access_SampleLoops(gig::DimensionRegion* dimreg) - { - return dimreg->SampleLoops; - } - uint8_t& access_Crossfade_in_start(gig::DimensionRegion* dimreg) - { - return dimreg->Crossfade.in_start; - } - uint8_t& access_Crossfade_in_end(gig::DimensionRegion* dimreg) - { - return dimreg->Crossfade.in_end; - } - uint8_t& access_Crossfade_out_start(gig::DimensionRegion* dimreg) - { - return dimreg->Crossfade.out_start; - } - uint8_t& access_Crossfade_out_end(gig::DimensionRegion* dimreg) - { - return dimreg->Crossfade.out_end; - } -} +#include +#define _(String) gettext(String) DimRegionEdit::DimRegionEdit() : - eEG1PreAttack("PreAttack", &gig::DimensionRegion::EG1PreAttack, 0, 100, 2), - eEG1Attack("Attack", &gig::DimensionRegion::EG1Attack, 0, 60, 3), - eEG1Decay1("Decay1", &gig::DimensionRegion::EG1Decay1, 0.005, 60, 3), - eEG1Decay2("Decay2", &gig::DimensionRegion::EG1Decay2, 0, 60, 3), - eEG1InfiniteSustain("InfiniteSustain", - &gig::DimensionRegion::EG1InfiniteSustain), - eEG1Sustain("Sustain", &gig::DimensionRegion::EG1Sustain, 0, 100, 2), - eEG1Release("Release", &gig::DimensionRegion::EG1Release, 0, 60, 3), - eEG1Hold("Hold", &gig::DimensionRegion::EG1Hold), - eEG1Controller("Controller", &gig::DimensionRegion::EG1Controller), - eEG1ControllerInvert("ControllerInvert", - &gig::DimensionRegion::EG1ControllerInvert), - eEG1ControllerAttackInfluence("ControllerAttackInfluence", - &gig::DimensionRegion::EG1ControllerAttackInfluence, - 0, 3), - eEG1ControllerDecayInfluence("ControllerDecayInfluence", - &gig::DimensionRegion::EG1ControllerDecayInfluence, - 0, 3), - eEG1ControllerReleaseInfluence("ControllerReleaseInfluence", - &gig::DimensionRegion::EG1ControllerReleaseInfluence, - 0, 3), - eLFO1Frequency("Frequency", &gig::DimensionRegion::LFO1Frequency, - 0.1, 10, 2), - eLFO1InternalDepth("InternalDepth", - &gig::DimensionRegion::LFO1InternalDepth, 0, 1200), - eLFO1ControlDepth("ControlDepth", &gig::DimensionRegion::LFO1ControlDepth, - 0, 1200), - eLFO1Controller("Controller", &gig::DimensionRegion::LFO1Controller), - eLFO1FlipPhase("FlipPhase", &gig::DimensionRegion::LFO1FlipPhase), - eLFO1Sync("Sync", &gig::DimensionRegion::LFO1Sync), - eEG2PreAttack("PreAttack", &gig::DimensionRegion::EG2PreAttack, 0, 100, 2), - eEG2Attack("Attack", &gig::DimensionRegion::EG2Attack, 0, 60, 3), - eEG2Decay1("Decay1", &gig::DimensionRegion::EG2Decay1, 0.005, 60, 3), - eEG2Decay2("Decay2", &gig::DimensionRegion::EG2Decay2, 0, 60, 3), - eEG2InfiniteSustain("InfiniteSustain", - &gig::DimensionRegion::EG2InfiniteSustain), - eEG2Sustain("Sustain", &gig::DimensionRegion::EG2Sustain, 0, 100, 2), - eEG2Release("Release", &gig::DimensionRegion::EG2Release, 0, 60, 3), - eEG2Controller("Controller", &gig::DimensionRegion::EG2Controller), - eEG2ControllerInvert("ControllerInvert", - &gig::DimensionRegion::EG2ControllerInvert), - eEG2ControllerAttackInfluence("ControllerAttackInfluence", - &gig::DimensionRegion::EG2ControllerAttackInfluence, - 0, 3), - eEG2ControllerDecayInfluence("ControllerDecayInfluence", - &gig::DimensionRegion::EG2ControllerDecayInfluence, - 0, 3), - eEG2ControllerReleaseInfluence("ControllerReleaseInfluence", - &gig::DimensionRegion::EG2ControllerReleaseInfluence, - 0, 3), - eLFO2Frequency("Frequency", &gig::DimensionRegion::LFO2Frequency, - 0.1, 10, 2), - eLFO2InternalDepth("InternalDepth", - &gig::DimensionRegion::LFO2InternalDepth, 0, 1200), - eLFO2ControlDepth("ControlDepth", - &gig::DimensionRegion::LFO2ControlDepth, 0, 1200), - eLFO2Controller("Controller", &gig::DimensionRegion::LFO2Controller), - eLFO2FlipPhase("FlipPhase", &gig::DimensionRegion::LFO2FlipPhase), - eLFO2Sync("Sync", &gig::DimensionRegion::LFO2Sync), - eEG3Attack("Attack", &gig::DimensionRegion::EG3Attack, 0, 10, 3), - eEG3Depth("Depth", &gig::DimensionRegion::EG3Depth, -1200, 1200), - eLFO3Frequency("Frequency", &gig::DimensionRegion::LFO3Frequency, - 0.1, 10, 2), - eLFO3InternalDepth("InternalDepth", - &gig::DimensionRegion::LFO3InternalDepth, 0, 1200), - eLFO3ControlDepth("ControlDepth", &gig::DimensionRegion::LFO3ControlDepth, - 0, 1200), - eLFO3Controller("Controller", &gig::DimensionRegion::LFO3Controller), - eLFO3Sync("Sync", &gig::DimensionRegion::LFO3Sync), - eVCFEnabled("Enabled", &gig::DimensionRegion::VCFEnabled), - eVCFType("Type", &gig::DimensionRegion::VCFType), - eVCFCutoffController("CutoffController", - &gig::DimensionRegion::VCFCutoffController), - eVCFCutoffControllerInvert("CutoffControllerInvert", - &gig::DimensionRegion::VCFCutoffControllerInvert), - eVCFCutoff("Cutoff", &gig::DimensionRegion::VCFCutoff), - eVCFVelocityCurve("VelocityCurve", &gig::DimensionRegion::VCFVelocityCurve), - eVCFVelocityScale("VelocityScale", &gig::DimensionRegion::VCFVelocityScale), - eVCFVelocityDynamicRange("VelocityDynamicRange", - &gig::DimensionRegion::VCFVelocityDynamicRange, - 0, 4), - eVCFResonance("Resonance", &gig::DimensionRegion::VCFResonance), - eVCFResonanceDynamic("ResonanceDynamic", - &gig::DimensionRegion::VCFResonanceDynamic), - eVCFResonanceController("ResonanceController", - &gig::DimensionRegion::VCFResonanceController), - eVCFKeyboardTracking("KeyboardTracking", - &gig::DimensionRegion::VCFKeyboardTracking), - eVCFKeyboardTrackingBreakpoint("KeyboardTrackingBreakpoint", - &gig::DimensionRegion::VCFKeyboardTrackingBreakpoint), - eVelocityResponseCurve("VelocityResponseCurve", - &gig::DimensionRegion::VelocityResponseCurve), - eVelocityResponseDepth("VelocityResponseDepth", - &gig::DimensionRegion::VelocityResponseDepth, 0, 4), - eVelocityResponseCurveScaling("VelocityResponseCurveScaling", - &gig::DimensionRegion::VelocityResponseCurveScaling), - eReleaseVelocityResponseCurve("ReleaseVelocityResponseCurve", - &gig::DimensionRegion::ReleaseVelocityResponseCurve), - eReleaseVelocityResponseDepth("ReleaseVelocityResponseDepth", - &gig::DimensionRegion::ReleaseVelocityResponseDepth, - 0, 4), - eReleaseTriggerDecay("ReleaseTriggerDecay", - &gig::DimensionRegion::ReleaseTriggerDecay, 0, 8), - eCrossfade_in_start("Crossfade.in_start", &access_Crossfade_in_start), - eCrossfade_in_end("Crossfade.in_end", &access_Crossfade_in_end), - eCrossfade_out_start("Crossfade.out_start", &access_Crossfade_out_start), - eCrossfade_out_end("Crossfade.out_end", &access_Crossfade_out_end), - ePitchTrack("PitchTrack", &gig::DimensionRegion::PitchTrack), - eDimensionBypass("DimensionBypass", &gig::DimensionRegion::DimensionBypass), - ePan("Pan", &gig::DimensionRegion::Pan, -64, 63), - eSelfMask("SelfMask", &gig::DimensionRegion::SelfMask), - eAttenuationController("AttenuationController", - &gig::DimensionRegion::AttenuationController), - eInvertAttenuationController("InvertAttenuationController", - &gig::DimensionRegion::InvertAttenuationController), - eAttenuationControllerThreshold("AttenuationControllerThreshold", - &gig::DimensionRegion::AttenuationControllerThreshold), - eChannelOffset("ChannelOffset", &gig::DimensionRegion::ChannelOffset, 0, 9), - eSustainDefeat("SustainDefeat", &gig::DimensionRegion::SustainDefeat), - eMSDecode("MSDecode", &gig::DimensionRegion::MSDecode), - eSampleStartOffset("SampleStartOffset", - &gig::DimensionRegion::SampleStartOffset, 0, 2000), - eUnityNote("UnityNote", &access_UnityNote), - eFineTune("FineTune", &access_FineTune, -49, 50), - eGain("Gain", -96, 0, 2), - eSampleLoops("SampleLoops", &access_SampleLoops, 0, 1) + eEG1PreAttack("Pre-attack", 0, 100, 2), + eEG1Attack("Attack", 0, 60, 3), + eEG1Decay1("Decay 1", 0.005, 60, 3), + eEG1Decay2("Decay 2", 0, 60, 3), + eEG1InfiniteSustain("Infinite sustain"), + eEG1Sustain("Sustain", 0, 100, 2), + eEG1Release("Release", 0, 60, 3), + eEG1Hold("Hold"), + eEG1Controller("Controller"), + eEG1ControllerInvert("Controller invert"), + eEG1ControllerAttackInfluence("Controller attack influence", 0, 3), + eEG1ControllerDecayInfluence("Controller decay influence", 0, 3), + eEG1ControllerReleaseInfluence("Controller release influence", 0, 3), + eLFO1Frequency("Frequency", 0.1, 10, 2), + eLFO1InternalDepth("Internal depth", 0, 1200), + eLFO1ControlDepth("Control depth", 0, 1200), + eLFO1Controller("Controller"), + eLFO1FlipPhase("Flip phase"), + eLFO1Sync("Sync"), + eEG2PreAttack("Pre-attack", 0, 100, 2), + eEG2Attack("Attack", 0, 60, 3), + eEG2Decay1("Decay 1", 0.005, 60, 3), + eEG2Decay2("Decay 2", 0, 60, 3), + eEG2InfiniteSustain("Infinite sustain"), + eEG2Sustain("Sustain", 0, 100, 2), + eEG2Release("Release", 0, 60, 3), + eEG2Controller("Controller"), + eEG2ControllerInvert("Controller invert"), + eEG2ControllerAttackInfluence("Controller attack influence", 0, 3), + eEG2ControllerDecayInfluence("Controller decay influence", 0, 3), + eEG2ControllerReleaseInfluence("Controller release influence", 0, 3), + eLFO2Frequency("Frequency", 0.1, 10, 2), + eLFO2InternalDepth("Internal depth", 0, 1200), + eLFO2ControlDepth("Control depth", 0, 1200), + eLFO2Controller("Controller"), + eLFO2FlipPhase("Flip phase"), + eLFO2Sync("Sync"), + eEG3Attack("Attack", 0, 10, 3), + eEG3Depth("Depth", -1200, 1200), + eLFO3Frequency("Frequency", 0.1, 10, 2), + eLFO3InternalDepth("Internal depth", 0, 1200), + eLFO3ControlDepth("Control depth", 0, 1200), + eLFO3Controller("Controller"), + eLFO3Sync("Sync"), + eVCFEnabled("Enabled"), + eVCFType("Type"), + eVCFCutoffController("Cutoff controller"), + eVCFCutoffControllerInvert("Cutoff controller invert"), + eVCFCutoff("Cutoff"), + eVCFVelocityCurve("Velocity curve"), + eVCFVelocityScale("Velocity scale"), + eVCFVelocityDynamicRange("Velocity dynamic range", 0, 4), + eVCFResonance("Resonance"), + eVCFResonanceDynamic("Resonance dynamic"), + eVCFResonanceController("Resonance controller"), + eVCFKeyboardTracking("Keyboard tracking"), + eVCFKeyboardTrackingBreakpoint("Keyboard tracking breakpoint"), + eVelocityResponseCurve("Velocity response curve"), + eVelocityResponseDepth("Velocity response depth", 0, 4), + eVelocityResponseCurveScaling("Velocity response curve scaling"), + eReleaseVelocityResponseCurve("Release velocity response curve"), + eReleaseVelocityResponseDepth("Release velocity response depth", 0, 4), + eReleaseTriggerDecay("Release trigger decay", 0, 8), + eCrossfade_in_start("Crossfade-in start"), + eCrossfade_in_end("Crossfade-in end"), + eCrossfade_out_start("Crossfade-out start"), + eCrossfade_out_end("Crossfade-out end"), + ePitchTrack("Pitch track"), + eDimensionBypass("Dimension bypass"), + ePan("Pan", -64, 63), + eSelfMask("Self mask"), + eAttenuationController("Attenuation controller"), + eInvertAttenuationController("Invert attenuation controller"), + eAttenuationControllerThreshold("Attenuation controller threshold"), + eChannelOffset("Channel offset", 0, 9), + eSustainDefeat("Sustain defeat"), + eMSDecode("MS decode"), + eSampleStartOffset("Sample start offset", 0, 2000), + eUnityNote("Unity note"), + eFineTune("Fine tune", -49, 50), + eGain("Gain", -96, 0, 2, -655360), + eGainPlus6("Gain +6dB", eGain, 6 * -655360), + eSampleLoopEnabled("Enabled"), + eSampleLoopStart("Loop start positon"), + eSampleLoopLength("Loop size"), + eSampleLoopType("Loop type"), + eSampleLoopInfinite("Infinite loop"), + eSampleLoopPlayCount("Playback count") { - for (int i = 0 ; i < 5 ; i++) { + for (int i = 0 ; i < 7 ; i++) { table[i] = new Gtk::Table(3, 1); - table[i]->set_col_spacings(5); + table[i]->set_col_spacings(7); } + // set tooltips + eUnityNote.set_tip( + _("Note this sample is associated with (a.k.a. 'root note')") + ); + eSampleStartOffset.set_tip(_("Sample position at which playback should be started")); + ePan.set_tip(_("Stereo balance (left/right)")); + eChannelOffset.set_tip( + _("Output channel where the audio signal should be routed to (0 - 9)") + ); + ePitchTrack.set_tip( + _("If true: sample will be pitched according to the key position " + "(this would be disabled for drums for example)") + ); + eSampleLoopEnabled.set_tip(_("If enabled: repeats to playback the sample")); + eSampleLoopStart.set_tip( + _("Start position within the sample (in sample points) of the area to " + "be looped") + ); + eSampleLoopLength.set_tip( + _("Duration (in sample points) of the area to be looped") + ); + eSampleLoopType.set_tip( + _("Direction in which the loop area in the sample should be played back") + ); + eSampleLoopInfinite.set_tip( + _("Whether the loop area should be played back forever\n" + "Caution: this setting is stored on Sample side, thus is shared " + "among all dimension regions that use this sample!") + ); + eSampleLoopPlayCount.set_tip( + _("How many times the loop area should be played back\n" + "Caution: this setting is stored on Sample side, thus is shared " + "among all dimension regions that use this sample!") + ); + pageno = 0; rowno = 0; firstRowInBlock = 0; + addHeader(_("Mandatory Settings")); addString("Sample", lSample, wSample); //TODO: the following would break drag&drop: wSample->property_editable().set_value(false); or this: wSample->set_editable(false); - addHeader("EG1"); + tooltips.set_tip(*wSample, _("Drop a sample here")); + addProp(eUnityNote); + addHeader(_("Optional Settings")); + addProp(eSampleStartOffset); + addProp(eChannelOffset); + addHeader("Loops"); + addProp(eSampleLoopEnabled); + addProp(eSampleLoopStart); + addProp(eSampleLoopLength); + { + char* choices[] = { "normal", "bidirectional", "backward", 0 }; + static const uint32_t values[] = { + gig::loop_type_normal, + gig::loop_type_bidirectional, + gig::loop_type_backward + }; + eSampleLoopType.set_choices(choices, values); + } + addProp(eSampleLoopType); + addProp(eSampleLoopInfinite); + addProp(eSampleLoopPlayCount); + + nextPage(); + + addHeader(_("General Amplitude Settings")); + addProp(eGain); + addProp(eGainPlus6); + addProp(ePan); + addHeader(_("Amplitude Envelope (EG1)")); addProp(eEG1PreAttack); addProp(eEG1Attack); addProp(eEG1Decay1); @@ -205,7 +201,10 @@ addProp(eEG1ControllerAttackInfluence); addProp(eEG1ControllerDecayInfluence); addProp(eEG1ControllerReleaseInfluence); - addHeader("LFO1"); + + nextPage(); + + addHeader(_("Amplitude Oscillator (LFO1)")); addProp(eLFO1Frequency); addProp(eLFO1InternalDepth); addProp(eLFO1ControlDepth); @@ -224,65 +223,18 @@ addProp(eLFO1Controller); addProp(eLFO1FlipPhase); addProp(eLFO1Sync); - - nextPage(); - addHeader("EG2"); - addProp(eEG2PreAttack); - addProp(eEG2Attack); - addProp(eEG2Decay1); - addProp(eEG2Decay2); - addProp(eEG2InfiniteSustain); - addProp(eEG2Sustain); - addProp(eEG2Release); - addProp(eEG2Controller); - addProp(eEG2ControllerInvert); - addProp(eEG2ControllerAttackInfluence); - addProp(eEG2ControllerDecayInfluence); - addProp(eEG2ControllerReleaseInfluence); - addHeader("LFO2"); - addProp(eLFO2Frequency); - addProp(eLFO2InternalDepth); - addProp(eLFO2ControlDepth); - { - char* choices[] = { "internal", "modwheel", "foot", - "internal+modwheel", "internal+foot", 0 }; - static const gig::lfo2_ctrl_t values[] = { - gig::lfo2_ctrl_internal, - gig::lfo2_ctrl_modwheel, - gig::lfo2_ctrl_foot, - gig::lfo2_ctrl_internal_modwheel, - gig::lfo2_ctrl_internal_foot - }; - eLFO2Controller.set_choices(choices, values); - } - addProp(eLFO2Controller); - addProp(eLFO2FlipPhase); - addProp(eLFO2Sync); + addHeader("Crossfade"); + addProp(eAttenuationController); + addProp(eInvertAttenuationController); + addProp(eAttenuationControllerThreshold); + addProp(eCrossfade_in_start); + addProp(eCrossfade_in_end); + addProp(eCrossfade_out_start); + addProp(eCrossfade_out_end); nextPage(); - addHeader("EG3"); - addProp(eEG3Attack); - addProp(eEG3Depth); - addHeader("LFO3"); - addProp(eLFO3Frequency); - addProp(eLFO3InternalDepth); - addProp(eLFO3ControlDepth); - { - char* choices[] = { "internal", "modwheel", "aftertouch", - "internal+modwheel", "internal+aftertouch", 0 }; - static const gig::lfo3_ctrl_t values[] = { - gig::lfo3_ctrl_internal, - gig::lfo3_ctrl_modwheel, - gig::lfo3_ctrl_aftertouch, - gig::lfo3_ctrl_internal_modwheel, - gig::lfo3_ctrl_internal_aftertouch - }; - eLFO3Controller.set_choices(choices, values); - } - addProp(eLFO3Controller); - addProp(eLFO3Sync); - addHeader("VCF"); + addHeader(_("General Filter Settings")); addProp(eVCFEnabled); { char* choices[] = { "lowpass", "lowpassturbo", "bandpass", @@ -350,6 +302,68 @@ nextPage(); + addHeader(_("Filter Cutoff Envelope (EG2)")); + addProp(eEG2PreAttack); + addProp(eEG2Attack); + addProp(eEG2Decay1); + addProp(eEG2Decay2); + addProp(eEG2InfiniteSustain); + addProp(eEG2Sustain); + addProp(eEG2Release); + addProp(eEG2Controller); + addProp(eEG2ControllerInvert); + addProp(eEG2ControllerAttackInfluence); + addProp(eEG2ControllerDecayInfluence); + addProp(eEG2ControllerReleaseInfluence); + addHeader(_("Filter Cutoff Oscillator (LFO2)")); + addProp(eLFO2Frequency); + addProp(eLFO2InternalDepth); + addProp(eLFO2ControlDepth); + { + char* choices[] = { "internal", "modwheel", "foot", + "internal+modwheel", "internal+foot", 0 }; + static const gig::lfo2_ctrl_t values[] = { + gig::lfo2_ctrl_internal, + gig::lfo2_ctrl_modwheel, + gig::lfo2_ctrl_foot, + gig::lfo2_ctrl_internal_modwheel, + gig::lfo2_ctrl_internal_foot + }; + eLFO2Controller.set_choices(choices, values); + } + addProp(eLFO2Controller); + addProp(eLFO2FlipPhase); + addProp(eLFO2Sync); + + nextPage(); + + addHeader(_("General Pitch Settings")); + addProp(eFineTune); + addProp(ePitchTrack); + addHeader(_("Pitch Envelope (EG3)")); + addProp(eEG3Attack); + addProp(eEG3Depth); + addHeader(_("Pitch Oscillator (LFO3)")); + addProp(eLFO3Frequency); + addProp(eLFO3InternalDepth); + addProp(eLFO3ControlDepth); + { + char* choices[] = { "internal", "modwheel", "aftertouch", + "internal+modwheel", "internal+aftertouch", 0 }; + static const gig::lfo3_ctrl_t values[] = { + gig::lfo3_ctrl_internal, + gig::lfo3_ctrl_modwheel, + gig::lfo3_ctrl_aftertouch, + gig::lfo3_ctrl_internal_modwheel, + gig::lfo3_ctrl_internal_aftertouch + }; + eLFO3Controller.set_choices(choices, values); + } + addProp(eLFO3Controller); + addProp(eLFO3Sync); + + nextPage(); + eVelocityResponseCurve.set_choices(curve_type_texts, curve_type_values); addProp(eVelocityResponseCurve); addProp(eVelocityResponseDepth); @@ -359,11 +373,6 @@ addProp(eReleaseVelocityResponseCurve); addProp(eReleaseVelocityResponseDepth); addProp(eReleaseTriggerDecay); - addProp(eCrossfade_in_start); - addProp(eCrossfade_in_end); - addProp(eCrossfade_out_start); - addProp(eCrossfade_out_end); - addProp(ePitchTrack); { char* choices[] = { "none", "effect4depth", "effect5depth", 0 }; static const gig::dim_bypass_ctrl_t values[] = { @@ -374,23 +383,13 @@ eDimensionBypass.set_choices(choices, values); } addProp(eDimensionBypass); - addProp(ePan); addProp(eSelfMask); - addProp(eAttenuationController); - addProp(eInvertAttenuationController); - addProp(eAttenuationControllerThreshold); - addProp(eChannelOffset); addProp(eSustainDefeat); - - nextPage(); addProp(eMSDecode); - addProp(eSampleStartOffset); - addProp(eUnityNote); - addProp(eFineTune); - addProp(eGain); - addProp(eSampleLoops); + nextPage(); + eEG1InfiniteSustain.signal_toggled().connect( sigc::mem_fun(*this, &DimRegionEdit::EG1InfiniteSustain_toggled) ); eEG2InfiniteSustain.signal_toggled().connect( @@ -423,11 +422,22 @@ eCrossfade_out_end.signal_value_changed().connect( sigc::mem_fun(*this, &DimRegionEdit::crossfade4_changed)); - append_page(*table[0], "EG1"); - append_page(*table[1], "EG2"); - append_page(*table[2], "EG3"); - append_page(*table[3], "Velocity"); - append_page(*table[4], "Misc"); + eSampleLoopEnabled.signal_toggled().connect( + sigc::mem_fun(*this, &DimRegionEdit::loop_enabled_toggled)); + eSampleLoopStart.signal_value_changed().connect( + sigc::mem_fun(*this, &DimRegionEdit::updateLoopElements)); + eSampleLoopLength.signal_value_changed().connect( + sigc::mem_fun(*this, &DimRegionEdit::updateLoopElements)); + eSampleLoopInfinite.signal_toggled().connect( + sigc::mem_fun(*this, &DimRegionEdit::loop_infinite_toggled)); + + append_page(*table[0], "Sample"); + append_page(*table[1], "Amplitude (1)"); + append_page(*table[2], "Amplitude (2)"); + append_page(*table[3], "Filter (1)"); + append_page(*table[4], "Filter (2)"); + append_page(*table[5], "Pitch"); + append_page(*table[6], "Misc"); } DimRegionEdit::~DimRegionEdit() @@ -484,6 +494,13 @@ firstRowInBlock = 0; } +void DimRegionEdit::addProp(BoolEntry& boolentry) +{ + table[pageno]->attach(boolentry.widget, 1, 3, rowno, rowno + 1, + Gtk::FILL, Gtk::SHRINK); + rowno++; +} + void DimRegionEdit::addProp(LabelWidget& prop) { table[pageno]->attach(prop.label, 1, 2, rowno, rowno + 1, @@ -496,90 +513,98 @@ void DimRegionEdit::set_dim_region(gig::DimensionRegion* d) { + dimregion = d; + + set_sensitive(d); + if (!d) return; + update_gui = false; wSample->set_text(d->pSample ? d->pSample->pInfo->Name.c_str() : "NULL"); - eEG1PreAttack.set_dimreg(d); - eEG1Attack.set_dimreg(d); - eEG1Decay1.set_dimreg(d); - eEG1Decay2.set_dimreg(d); - eEG1InfiniteSustain.set_dimreg(d); - eEG1Sustain.set_dimreg(d); - eEG1Release.set_dimreg(d); - eEG1Hold.set_dimreg(d); - eEG1Controller.set_dimreg(d); - eEG1ControllerInvert.set_dimreg(d); - eEG1ControllerAttackInfluence.set_dimreg(d); - eEG1ControllerDecayInfluence.set_dimreg(d); - eEG1ControllerReleaseInfluence.set_dimreg(d); - eLFO1Frequency.set_dimreg(d); - eLFO1InternalDepth.set_dimreg(d); - eLFO1ControlDepth.set_dimreg(d); - eLFO1Controller.set_dimreg(d); - eLFO1FlipPhase.set_dimreg(d); - eLFO1Sync.set_dimreg(d); - eEG2PreAttack.set_dimreg(d); - eEG2Attack.set_dimreg(d); - eEG2Decay1.set_dimreg(d); - eEG2Decay2.set_dimreg(d); - eEG2InfiniteSustain.set_dimreg(d); - eEG2Sustain.set_dimreg(d); - eEG2Release.set_dimreg(d); - eEG2Controller.set_dimreg(d); - eEG2ControllerInvert.set_dimreg(d); - eEG2ControllerAttackInfluence.set_dimreg(d); - eEG2ControllerDecayInfluence.set_dimreg(d); - eEG2ControllerReleaseInfluence.set_dimreg(d); - eLFO2Frequency.set_dimreg(d); - eLFO2InternalDepth.set_dimreg(d); - eLFO2ControlDepth.set_dimreg(d); - eLFO2Controller.set_dimreg(d); - eLFO2FlipPhase.set_dimreg(d); - eLFO2Sync.set_dimreg(d); - eEG3Attack.set_dimreg(d); - eEG3Depth.set_dimreg(d); - eLFO3Frequency.set_dimreg(d); - eLFO3InternalDepth.set_dimreg(d); - eLFO3ControlDepth.set_dimreg(d); - eLFO3Controller.set_dimreg(d); - eLFO3Sync.set_dimreg(d); - eVCFEnabled.set_dimreg(d); - eVCFType.set_dimreg(d); - eVCFCutoffController.set_dimreg(d); - eVCFCutoffControllerInvert.set_dimreg(d); - eVCFCutoff.set_dimreg(d); - eVCFVelocityCurve.set_dimreg(d); - eVCFVelocityScale.set_dimreg(d); - eVCFVelocityDynamicRange.set_dimreg(d); - eVCFResonance.set_dimreg(d); - eVCFResonanceDynamic.set_dimreg(d); - eVCFResonanceController.set_dimreg(d); - eVCFKeyboardTracking.set_dimreg(d); - eVCFKeyboardTrackingBreakpoint.set_dimreg(d); - eVelocityResponseCurve.set_dimreg(d); - eVelocityResponseDepth.set_dimreg(d); - eVelocityResponseCurveScaling.set_dimreg(d); - eReleaseVelocityResponseCurve.set_dimreg(d); - eReleaseVelocityResponseDepth.set_dimreg(d); - eReleaseTriggerDecay.set_dimreg(d); - eCrossfade_in_start.set_dimreg(d); - eCrossfade_in_end.set_dimreg(d); - eCrossfade_out_start.set_dimreg(d); - eCrossfade_out_end.set_dimreg(d); - ePitchTrack.set_dimreg(d); - eDimensionBypass.set_dimreg(d); - ePan.set_dimreg(d); - eSelfMask.set_dimreg(d); - eAttenuationController.set_dimreg(d); - eInvertAttenuationController.set_dimreg(d); - eAttenuationControllerThreshold.set_dimreg(d); - eChannelOffset.set_dimreg(d); - eSustainDefeat.set_dimreg(d); - eMSDecode.set_dimreg(d); - eSampleStartOffset.set_dimreg(d); - eUnityNote.set_dimreg(d); - eFineTune.set_dimreg(d); - eGain.set_dimreg(d); - eSampleLoops.set_dimreg(d); + eEG1PreAttack.set_ptr(&d->EG1PreAttack); + eEG1Attack.set_ptr(&d->EG1Attack); + eEG1Decay1.set_ptr(&d->EG1Decay1); + eEG1Decay2.set_ptr(&d->EG1Decay2); + eEG1InfiniteSustain.set_ptr(&d->EG1InfiniteSustain); + eEG1Sustain.set_ptr(&d->EG1Sustain); + eEG1Release.set_ptr(&d->EG1Release); + eEG1Hold.set_ptr(&d->EG1Hold); + eEG1Controller.set_ptr(&d->EG1Controller); + eEG1ControllerInvert.set_ptr(&d->EG1ControllerInvert); + eEG1ControllerAttackInfluence.set_ptr(&d->EG1ControllerAttackInfluence); + eEG1ControllerDecayInfluence.set_ptr(&d->EG1ControllerDecayInfluence); + eEG1ControllerReleaseInfluence.set_ptr(&d->EG1ControllerReleaseInfluence); + eLFO1Frequency.set_ptr(&d->LFO1Frequency); + eLFO1InternalDepth.set_ptr(&d->LFO1InternalDepth); + eLFO1ControlDepth.set_ptr(&d->LFO1ControlDepth); + eLFO1Controller.set_ptr(&d->LFO1Controller); + eLFO1FlipPhase.set_ptr(&d->LFO1FlipPhase); + eLFO1Sync.set_ptr(&d->LFO1Sync); + eEG2PreAttack.set_ptr(&d->EG2PreAttack); + eEG2Attack.set_ptr(&d->EG2Attack); + eEG2Decay1.set_ptr(&d->EG2Decay1); + eEG2Decay2.set_ptr(&d->EG2Decay2); + eEG2InfiniteSustain.set_ptr(&d->EG2InfiniteSustain); + eEG2Sustain.set_ptr(&d->EG2Sustain); + eEG2Release.set_ptr(&d->EG2Release); + eEG2Controller.set_ptr(&d->EG2Controller); + eEG2ControllerInvert.set_ptr(&d->EG2ControllerInvert); + eEG2ControllerAttackInfluence.set_ptr(&d->EG2ControllerAttackInfluence); + eEG2ControllerDecayInfluence.set_ptr(&d->EG2ControllerDecayInfluence); + eEG2ControllerReleaseInfluence.set_ptr(&d->EG2ControllerReleaseInfluence); + eLFO2Frequency.set_ptr(&d->LFO2Frequency); + eLFO2InternalDepth.set_ptr(&d->LFO2InternalDepth); + eLFO2ControlDepth.set_ptr(&d->LFO2ControlDepth); + eLFO2Controller.set_ptr(&d->LFO2Controller); + eLFO2FlipPhase.set_ptr(&d->LFO2FlipPhase); + eLFO2Sync.set_ptr(&d->LFO2Sync); + eEG3Attack.set_ptr(&d->EG3Attack); + eEG3Depth.set_ptr(&d->EG3Depth); + eLFO3Frequency.set_ptr(&d->LFO3Frequency); + eLFO3InternalDepth.set_ptr(&d->LFO3InternalDepth); + eLFO3ControlDepth.set_ptr(&d->LFO3ControlDepth); + eLFO3Controller.set_ptr(&d->LFO3Controller); + eLFO3Sync.set_ptr(&d->LFO3Sync); + eVCFEnabled.set_ptr(&d->VCFEnabled); + eVCFType.set_ptr(&d->VCFType); + eVCFCutoffController.set_ptr(&d->VCFCutoffController); + eVCFCutoffControllerInvert.set_ptr(&d->VCFCutoffControllerInvert); + eVCFCutoff.set_ptr(&d->VCFCutoff); + eVCFVelocityCurve.set_ptr(&d->VCFVelocityCurve); + eVCFVelocityScale.set_ptr(&d->VCFVelocityScale); + eVCFVelocityDynamicRange.set_ptr(&d->VCFVelocityDynamicRange); + eVCFResonance.set_ptr(&d->VCFResonance); + eVCFResonanceDynamic.set_ptr(&d->VCFResonanceDynamic); + eVCFResonanceController.set_ptr(&d->VCFResonanceController); + eVCFKeyboardTracking.set_ptr(&d->VCFKeyboardTracking); + eVCFKeyboardTrackingBreakpoint.set_ptr(&d->VCFKeyboardTrackingBreakpoint); + eVelocityResponseCurve.set_ptr(&d->VelocityResponseCurve); + eVelocityResponseDepth.set_ptr(&d->VelocityResponseDepth); + eVelocityResponseCurveScaling.set_ptr(&d->VelocityResponseCurveScaling); + eReleaseVelocityResponseCurve.set_ptr(&d->ReleaseVelocityResponseCurve); + eReleaseVelocityResponseDepth.set_ptr(&d->ReleaseVelocityResponseDepth); + eReleaseTriggerDecay.set_ptr(&d->ReleaseTriggerDecay); + eCrossfade_in_start.set_ptr(&d->Crossfade.in_start); + eCrossfade_in_end.set_ptr(&d->Crossfade.in_end); + eCrossfade_out_start.set_ptr(&d->Crossfade.out_start); + eCrossfade_out_end.set_ptr(&d->Crossfade.out_end); + ePitchTrack.set_ptr(&d->PitchTrack); + eDimensionBypass.set_ptr(&d->DimensionBypass); + ePan.set_ptr(&d->Pan); + eSelfMask.set_ptr(&d->SelfMask); + eAttenuationController.set_ptr(&d->AttenuationController); + eInvertAttenuationController.set_ptr(&d->InvertAttenuationController); + eAttenuationControllerThreshold.set_ptr(&d->AttenuationControllerThreshold); + eChannelOffset.set_ptr(&d->ChannelOffset); + eSustainDefeat.set_ptr(&d->SustainDefeat); + eMSDecode.set_ptr(&d->MSDecode); + eSampleStartOffset.set_ptr(&d->SampleStartOffset); + eUnityNote.set_ptr(&d->UnityNote); + eFineTune.set_ptr(&d->FineTune); + eGain.set_ptr(&d->Gain); + eGainPlus6.set_ptr(&d->Gain); + + eSampleLoopEnabled.set_active(d->SampleLoops); + updateLoopElements(); VCFEnabled_toggled(); @@ -640,8 +665,8 @@ eVCFCutoffControllerInvert.set_sensitive(hasController); eVCFCutoff.set_sensitive(!hasController); eVCFResonanceDynamic.set_sensitive(!hasController); - eVCFVelocityScale.label.set_text(hasController ? "MinimumCutoff:" : - "VelocityScale:"); + eVCFVelocityScale.label.set_text(hasController ? "Minimum cutoff:" : + "Velocity scale:"); } void DimRegionEdit::VCFResonanceController_changed() @@ -678,6 +703,11 @@ { bool hasController = eAttenuationController.get_active_row_number() != 0; eInvertAttenuationController.set_sensitive(hasController); + eAttenuationControllerThreshold.set_sensitive(hasController); + eCrossfade_in_start.set_sensitive(hasController); + eCrossfade_in_end.set_sensitive(hasController); + eCrossfade_out_start.set_sensitive(hasController); + eCrossfade_out_end.set_sensitive(hasController); } void DimRegionEdit::LFO1Controller_changed() @@ -735,3 +765,76 @@ if (c4 < c3) eCrossfade_out_start.set_value(c4); } + +void DimRegionEdit::loop_enabled_toggled() +{ + const bool active = eSampleLoopEnabled.get_active(); + if (active) { + // create a new sample loop in case there is none yet + if (!dimregion->SampleLoops) { + DLS::sample_loop_t loop; + loop.LoopType = gig::loop_type_normal; + // loop the whole sample by default + loop.LoopStart = 0; + loop.LoopLength = + (dimregion->pSample) ? dimregion->pSample->GetSize() : 0; + dimregion->AddSampleLoop(&loop); + } + } else { + // delete ALL existing sample loops + while (dimregion->SampleLoops) + dimregion->DeleteSampleLoop(&dimregion->pSampleLoops[0]); + } + updateLoopElements(); +} + +void DimRegionEdit::updateLoopElements() +{ + const bool active = eSampleLoopEnabled.get_active(); + eSampleLoopStart.set_sensitive(active); + eSampleLoopLength.set_sensitive(active); + eSampleLoopType.set_sensitive(active); + eSampleLoopInfinite.set_sensitive(active); + if (dimregion && dimregion->SampleLoops) { + eSampleLoopStart.set_ptr(&dimregion->pSampleLoops[0].LoopStart); + eSampleLoopLength.set_ptr(&dimregion->pSampleLoops[0].LoopLength); + eSampleLoopType.set_ptr(&dimregion->pSampleLoops[0].LoopType); + eSampleLoopPlayCount.set_ptr( + (dimregion->pSample) ? &dimregion->pSample->LoopPlayCount : NULL + ); + eSampleLoopInfinite.set_active( + dimregion->pSample && !dimregion->pSample->LoopPlayCount + ); + // sample loop shall never be longer than the actual sample size + eSampleLoopStart.set_upper( + (dimregion->pSample) + ? dimregion->pSample->GetSize() - + dimregion->pSampleLoops[0].LoopLength + : 0 + ); + eSampleLoopLength.set_upper( + (dimregion->pSample) + ? dimregion->pSample->GetSize() - + dimregion->pSampleLoops[0].LoopStart + : 0 + ); + } else { // no sample loop(s) + eSampleLoopStart.set_ptr(NULL); + eSampleLoopLength.set_ptr(NULL); + eSampleLoopType.set_ptr(NULL); + eSampleLoopPlayCount.set_ptr(NULL); + } + // updated enabled state of loop play count widget + loop_infinite_toggled(); +} + +void DimRegionEdit::loop_infinite_toggled() { + eSampleLoopPlayCount.set_sensitive( + !eSampleLoopInfinite.get_active() && + eSampleLoopEnabled.get_active() + ); + if (eSampleLoopInfinite.get_active()) + eSampleLoopPlayCount.set_value(0); + else if (!eSampleLoopPlayCount.get_value()) + eSampleLoopPlayCount.set_value(1); +}