void GOGUIEnclosure::Load(GOrgueConfigReader& cfg, wxString group) { GOGUIControl::Load(cfg, group); unsigned bitmap_count = cfg.ReadInteger(ODFSetting, group, wxT("BitmapCount"), 1, 127, false, 16); wxChar style = wxT('A') + cfg.ReadInteger(ODFSetting, group, wxT("EnclosureStyle"), 1, 4, false, 1) - 1; for(unsigned i = 1; i <= bitmap_count; i++) { wxString bitmap = cfg.ReadStringTrim(ODFSetting, group, wxString::Format(wxT("Bitmap%03d"), i), false, wxString::Format(wxT("GO:enclosure%c%02d"), style, i - 1)); wxString mask = cfg.ReadStringTrim(ODFSetting, group, wxString::Format(wxT("Mask%03d"), i), false, wxEmptyString); m_Bitmaps.push_back(m_panel->LoadBitmap(bitmap, mask)); } for(unsigned i = 1; i < m_Bitmaps.size(); i++) if (m_Bitmaps[0].GetWidth() != m_Bitmaps[i].GetWidth() || m_Bitmaps[0].GetHeight() != m_Bitmaps[i].GetHeight()) throw wxString::Format(_("bitmap size does not match for '%s'"), group.c_str()); int x, y, w, h; 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_Bitmaps[0].GetWidth()); h = cfg.ReadInteger(ODFSetting, group, wxT("Height"), 1, m_metrics->GetScreenHeight(), false, m_Bitmaps[0].GetHeight()); m_BoundingRect = wxRect(x, y, w, h); m_TileOffsetX = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetX"), 0, m_Bitmaps[0].GetWidth() - 1, false, 0); m_TileOffsetY = cfg.ReadInteger(ODFSetting, group, wxT("TileOffsetY"), 0, m_Bitmaps[0].GetHeight() - 1, false, 0); m_TextColor = cfg.ReadColor(ODFSetting, group, wxT("DispLabelColour"), false, wxT("White")); m_FontSize = cfg.ReadFontSize(ODFSetting, group, wxT("DispLabelFontSize"), false, wxT("7")); m_FontName = cfg.ReadStringTrim(ODFSetting, group, wxT("DispLabelFontName"), false, wxT("")); m_Text = cfg.ReadString(ODFSetting, group, wxT("DispLabelText"), false, m_enclosure->GetName()); x = cfg.ReadInteger(ODFSetting, group, wxT("TextRectLeft"), 0, m_BoundingRect.GetWidth() - 1, false, 0); y = cfg.ReadInteger(ODFSetting, group, wxT("TextRectTop"), 0, m_BoundingRect.GetHeight() - 1, false, 0); 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()); 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, 13); 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 - 3); m_MouseRect = wxRect(x, y, w, h); m_MouseAxisStart = cfg.ReadInteger(ODFSetting, group, wxT("MouseAxisStart"), 0, m_MouseRect.GetHeight(), false, m_MouseRect.GetHeight() / 3); m_MouseAxisEnd = cfg.ReadInteger(ODFSetting, group, wxT("MouseAxisEnd"), m_MouseAxisStart, m_MouseRect.GetHeight(), false, m_MouseRect.GetHeight() / 3 * 2); m_Font.SetName(m_FontName); m_Font.SetPoints(m_FontSize); }
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 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); }