void GOrgueEnclosure::Load(GOrgueConfigReader& cfg, wxString group, int enclosure_nb) { m_organfile->RegisterSaveableObject(this); m_group = group; m_Name = cfg.ReadStringNotEmpty(ODFSetting, m_group, wxT("Name")); m_Displayed1 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, true); m_Displayed2 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, false); m_AmpMinimumLevel = cfg.ReadInteger(ODFSetting, m_group, wxT("AmpMinimumLevel"), 0, 100); m_MIDIInputNumber = cfg.ReadInteger(ODFSetting, m_group, wxT("MIDIInputNumber"), 0, 200, false, 0); Set(cfg.ReadInteger(CMBSetting, m_group, wxT("Value"), 0, 127, false, 127)); m_midi.SetIndex(enclosure_nb); m_midi.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_sender.Load(cfg, m_group, m_organfile->GetSettings().GetMidiMap()); m_shortcut.Load(cfg, m_group); }
void GOrgueSoundingPipe::LoadAttack(GOrgueConfigReader& cfg, wxString group, wxString prefix) { attack_load_info ainfo; ainfo.filename.Assign(cfg.ReadStringTrim(ODFSetting, group, prefix), m_organfile); ainfo.sample_group = cfg.ReadInteger(ODFSetting, group, prefix + wxT("IsTremulant"), -1, 1, false, -1); ainfo.load_release = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("LoadRelease"), false, !m_Percussive);; ainfo.percussive = m_Percussive; ainfo.max_playback_time = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MaxKeyPressTime"), -1, 100000, false, -1); ainfo.cue_point = cfg.ReadInteger(ODFSetting, group, prefix + wxT("CuePoint"), -1, MAX_SAMPLE_LENGTH, false, -1); ainfo.min_attack_velocity = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackVelocity"), 0, 127, false, 0); ainfo.max_released_time = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MaxTimeSinceLastRelease"), -1, 100000, false, -1); ainfo.attack_start = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackStart"), 0, MAX_SAMPLE_LENGTH, false, 0); ainfo.release_end = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseEnd"), -1, MAX_SAMPLE_LENGTH, false, -1); unsigned loop_cnt = cfg.ReadInteger(ODFSetting, group, prefix + wxT("LoopCount"), 0, 100, false, 0); for(unsigned j = 0; j < loop_cnt; j++) { loop_load_info linfo; linfo.loop_start = cfg.ReadInteger(ODFSetting, group, prefix + wxString::Format(wxT("Loop%03dStart"), j + 1), 0, MAX_SAMPLE_LENGTH, false, 0); linfo.loop_end = cfg.ReadInteger(ODFSetting, group, prefix + wxString::Format(wxT("Loop%03dEnd"), j + 1), linfo.loop_start + 1, MAX_SAMPLE_LENGTH, true); ainfo.loops.push_back(linfo); } m_AttackInfo.push_back(ainfo); }
void GOrgueSoundingPipe::Load(GOrgueConfigReader& cfg, wxString group, wxString prefix) { m_organfile->RegisterCacheObject(this); m_Filename = cfg.ReadStringTrim(ODFSetting, group, prefix); m_PipeConfig.Load(cfg, group, prefix); m_HarmonicNumber = cfg.ReadInteger(ODFSetting, group, prefix + wxT("HarmonicNumber"), 1, 1024, false, m_HarmonicNumber); m_PitchCorrection = cfg.ReadFloat(ODFSetting, group, prefix + wxT("PitchCorrection"), -1200, 1200, false, m_PitchCorrection); m_SamplerGroupID = cfg.ReadInteger(ODFSetting, group, prefix + wxT("WindchestGroup"), 1, m_organfile->GetWindchestGroupCount(), false, m_SamplerGroupID); m_Percussive = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("Percussive"), false, m_Percussive); m_SampleMidiKeyNumber = cfg.ReadInteger(ODFSetting, group, prefix + wxT("MIDIKeyNumber"), -1, 127, false, -1); m_LoopCrossfadeLength = cfg.ReadInteger(ODFSetting, group, prefix + wxT("LoopCrossfadeLength"), 0, 120, false, 0); m_ReleaseCrossfadeLength = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseCrossfadeLength"), 0, 200, false, 0); m_RetunePipe = cfg.ReadBoolean(ODFSetting, group, prefix + wxT("AcceptsRetuning"), false, m_RetunePipe); UpdateAmplitude(); m_organfile->GetWindchest(m_SamplerGroupID - 1)->AddPipe(this); LoadAttack(cfg, group, prefix); unsigned attack_count = cfg.ReadInteger(ODFSetting, group, prefix + wxT("AttackCount"), 0, 100, false, 0); for(unsigned i = 0; i < attack_count; i++) LoadAttack(cfg, group, prefix + wxString::Format(wxT("Attack%03d"), i + 1)); unsigned release_count = cfg.ReadInteger(ODFSetting, group, prefix + wxT("ReleaseCount"), 0, 100, false, 0); for(unsigned i = 0; i < release_count; i++) { release_load_info rinfo; wxString p = prefix + wxString::Format(wxT("Release%03d"), i + 1); rinfo.filename.Assign(cfg.ReadStringTrim(ODFSetting, group, p), m_organfile); rinfo.sample_group = cfg.ReadInteger(ODFSetting, group, p + wxT("IsTremulant"), -1, 1, false, -1); rinfo.max_playback_time = cfg.ReadInteger(ODFSetting, group, p + wxT("MaxKeyPressTime"), -1, 100000, false, -1); rinfo.cue_point = cfg.ReadInteger(ODFSetting, group, p + wxT("CuePoint"), -1, MAX_SAMPLE_LENGTH, false, -1); rinfo.release_end = cfg.ReadInteger(ODFSetting, group, p + wxT("ReleaseEnd"), -1, MAX_SAMPLE_LENGTH, false, -1); m_ReleaseInfo.push_back(rinfo); } m_MinVolume = cfg.ReadFloat(ODFSetting, group, wxT("MinVelocityVolume"), 0, 1000, false, m_MinVolume); m_MaxVolume = cfg.ReadFloat(ODFSetting, group, wxT("MaxVelocityVolume"), 0, 1000, false, m_MaxVolume); m_SoundProvider.SetVelocityParameter(m_MinVolume, m_MaxVolume); m_PipeConfig.SetName(wxString::Format(_("%d: %s"), m_MidiKeyNumber, m_Filename.c_str())); }
void GOrgueDivisionalCoupler::Load(GOrgueConfigReader& cfg, wxString group) { wxString buffer; m_BiDirectionalCoupling=cfg.ReadBoolean(ODFSetting, group,wxT("BiDirectionalCoupling")); unsigned NumberOfManuals=cfg.ReadInteger(ODFSetting, group,wxT("NumberOfManuals"), 1, m_organfile->GetManualAndPedalCount() - m_organfile->GetFirstManualIndex() + 1); m_manuals.resize(0); for (unsigned i = 0; i < NumberOfManuals; i++) { buffer.Printf(wxT("Manual%03d"), i + 1); m_manuals.push_back(cfg.ReadInteger(ODFSetting, group, buffer, m_organfile->GetFirstManualIndex(), m_organfile->GetManualAndPedalCount())); } GOrgueDrawstop::Load(cfg, group); }
void GOrgueDivisional::Load(GOrgueConfigReader& cfg, wxString group, int manualNumber, int divisionalNumber) { m_DivisionalNumber = divisionalNumber; m_ManualNumber = manualNumber; m_midi.SetIndex(manualNumber); m_Protected = cfg.ReadBoolean(ODFSetting, group, wxT("Protected"), false, false); GOrguePushbutton::Load(cfg, group); if (!m_IsSetter) { /* skip ODF settings */ UpdateState(); wxString buffer; int pos; std::vector<bool> used(m_State.size()); GOrgueManual* associatedManual = m_organfile->GetManual(m_ManualNumber); unsigned NumberOfStops = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfStops"), 0, associatedManual->GetStopCount(), true, 0); unsigned NumberOfCouplers = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfCouplers"), 0, associatedManual->GetCouplerCount(), m_organfile->DivisionalsStoreIntermanualCouplers() || m_organfile->DivisionalsStoreIntramanualCouplers(), 0); unsigned NumberOfTremulants = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfTremulants"), 0, m_organfile->GetTremulantCount(), m_organfile->DivisionalsStoreTremulants(), 0); unsigned NumberOfSwitches = cfg.ReadInteger(ODFSetting, m_group, wxT("NumberOfSwitches"), 0, m_organfile->GetSwitchCount(), false, 0); for (unsigned i = 0; i < NumberOfStops; i++) { buffer.Printf(wxT("Stop%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -associatedManual->GetStopCount(), associatedManual->GetStopCount()); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_STOP, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfCouplers; i++) { buffer.Printf(wxT("Coupler%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_COUPLER, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfTremulants; i++) { buffer.Printf(wxT("Tremulant%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_TREMULANT, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } for (unsigned i = 0; i < NumberOfSwitches; i++) { buffer.Printf(wxT("Switch%03d"), i + 1); int s = cfg.ReadInteger(ODFSetting, m_group, buffer, -999, 999, false, 0); pos = m_Template.findEntry(GOrgueCombinationDefinition::COMBINATION_SWITCH, m_ManualNumber, abs(s)); if (pos >= 0) { if (used[pos]) { wxLogError(_("Duplicate combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } used[pos] = true; } else { wxLogError(_("Invalid combination entry %s in %s"), buffer.c_str(), m_group.c_str()); } } } }
void GOGUIButton::Load(GOrgueConfigReader& cfg, wxString group) { GOGUIControl::Load(cfg, group); m_IsPiston = cfg.ReadBoolean(ODFSetting, group, wxT("DisplayAsPiston"), false, m_IsPiston); m_TextColor = cfg.ReadColor(ODFSetting, group, wxT("DispLabelColour"), false, wxT("Dark Red")); m_FontSize = cfg.ReadFontSize(ODFSetting, group, wxT("DispLabelFontSize"), false, wxT("normal")); m_FontName = cfg.ReadStringTrim(ODFSetting, group, wxT("DispLabelFontName"), false, wxT("")); m_Text = cfg.ReadString(ODFSetting, group, wxT("DispLabelText"), false, m_Button->GetName()); int x, y, w, h; m_DispKeyLabelOnLeft = cfg.ReadBoolean(ODFSetting, group, wxT("DispKeyLabelOnLeft"), false, true); wxString off_mask_file, on_mask_file; wxString on_file, off_file; if (m_IsPiston) { int DispImageNum = cfg.ReadInteger(ODFSetting, group, wxT("DispImageNum"), 1, 5, false, m_Button->IsReadOnly() ? 3 : 1); off_file = wxString::Format(wxT("GO:piston%02d_off"), DispImageNum); on_file = wxString::Format(wxT("GO:piston%02d_on"), DispImageNum); m_DispRow = cfg.ReadInteger(ODFSetting, group, wxT("DispButtonRow"), 0, 99 + m_metrics->NumberOfExtraButtonRows(), false, 1); m_DispCol = cfg.ReadInteger(ODFSetting, group, wxT("DispButtonCol"), 1, m_metrics->NumberOfButtonCols(), false, 1); } else { int DispImageNum = cfg.ReadInteger(ODFSetting, group, wxT("DispImageNum"), 1, 6, false, m_Button->IsReadOnly() ? 4 : 1); off_file = wxString::Format(wxT("GO:drawstop%02d_off"), DispImageNum); on_file = wxString::Format(wxT("GO:drawstop%02d_on"), DispImageNum); m_DispRow = cfg.ReadInteger(ODFSetting, group, wxT("DispDrawstopRow"), 1, 99 + m_metrics->NumberOfExtraDrawstopRowsToDisplay(), false, 1); m_DispCol = cfg.ReadInteger(ODFSetting, group, wxT("DispDrawstopCol"), 1, m_DispRow > 99 ? m_metrics->NumberOfExtraDrawstopColsToDisplay() : m_metrics->NumberOfDrawstopColsToDisplay(), false, 1); } on_file = cfg.ReadStringTrim(ODFSetting, group, wxT("ImageOn"), false, on_file); off_file = cfg.ReadStringTrim(ODFSetting, group, wxT("ImageOff"), false, off_file); on_mask_file = cfg.ReadStringTrim(ODFSetting, group, wxT("MaskOn"), false, wxEmptyString); off_mask_file = cfg.ReadStringTrim(ODFSetting, group, wxT("MaskOff"), false, on_mask_file); m_OnBitmap = m_panel->LoadBitmap(on_file, on_mask_file); m_OffBitmap = m_panel->LoadBitmap(off_file, off_mask_file); x = cfg.ReadInteger(ODFSetting, group, wxT("PositionX"), 0, m_metrics->GetScreenWidth(), false, -1); y = cfg.ReadInteger(ODFSetting, group, wxT("PositionY"), 0, m_metrics->GetScreenHeight(), false, -1); w = cfg.ReadInteger(ODFSetting, group, wxT("Width"), 1, m_metrics->GetScreenWidth(), false, m_OnBitmap.GetWidth()); h = cfg.ReadInteger(ODFSetting, group, wxT("Height"), 1, m_metrics->GetScreenHeight(), false, m_OnBitmap.GetHeight()); m_BoundingRect = wxRect(x, y, w, h); if (m_OnBitmap.GetWidth() != m_OffBitmap.GetWidth() || m_OnBitmap.GetHeight() != m_OffBitmap.GetHeight()) throw wxString::Format(_("bitmap size does not match for '%s'"), group.c_str()); m_TileOffsetX = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetX"), 0, m_OnBitmap.GetWidth() - 1, false, 0); m_TileOffsetY = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetY"), 0, m_OnBitmap.GetHeight() - 1, false, 0); x = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 0); y = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 0); w = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("MouseRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y); m_MouseRect = wxRect(x, y, w, h); m_Radius = cfg.ReadInteger(ODFSetting, group, wxT("MouseRadius"), 0, std::max(m_MouseRect.GetWidth(), m_MouseRect.GetHeight()), false, std::min(w/2, h/2)); x = cfg.ReadInteger(ODFSetting, group, wxT("TextRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 1); y = cfg.ReadInteger(ODFSetting, group, wxT("TextRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 1); w = cfg.ReadInteger(ODFSetting, group, wxT("TextRectWidth"), 1, m_BoundingRect.GetWidth() - x, false, m_BoundingRect.GetWidth() - x); h = cfg.ReadInteger(ODFSetting, group, wxT("TextRectHeight"), 1, m_BoundingRect.GetHeight() - y, false, m_BoundingRect.GetHeight() - y); m_TextRect = wxRect(x, y, w, h); m_TextWidth = cfg.ReadInteger(ODFSetting, group, wxT("TextBreakWidth"), 0, m_TextRect.GetWidth(), false, m_TextRect.GetWidth() - (m_TextRect.GetWidth() < 50 ? 4 : 14)); m_Font = m_metrics->GetControlLabelFont(); m_Font.SetName(m_FontName); m_Font.SetPoints(m_FontSize); }