@@ -88,20 +88,22 @@ void Rank::write(wxTextFile *outFile) {
8888 outFile->AddLine (wxT (" HarmonicNumber=" ) + wxString::Format (wxT (" %i" ), harmonicNumber));
8989 if (pitchCorrection != 0 )
9090 outFile->AddLine (wxT (" PitchCorrection=" ) + wxString::Format (wxT (" %f" ), pitchCorrection));
91- wxString wcRef = GOODF_functions::number_format (::wxGetApp ().m_frame ->m_organ ->getIndexOfOrganWindchest (windchest));
92- outFile->AddLine (wxT (" WindchestGroup=" ) + wcRef);
93- if (percussive != windchest->getIsPercussive ()) {
94- if (percussive) {
95- outFile->AddLine (wxT (" Percussive=Y" ));
96- if (hasIndependentRelease != windchest->getHasIndependentRelease ()) {
97- if (hasIndependentRelease) {
98- outFile->AddLine (wxT (" HasIndependentRelease=Y" ));
99- } else {
100- outFile->AddLine (wxT (" HasIndependentRelease=N" ));
91+ if (windchest) {
92+ wxString wcRef = GOODF_functions::number_format (::wxGetApp ().m_frame ->m_organ ->getIndexOfOrganWindchest (windchest));
93+ outFile->AddLine (wxT (" WindchestGroup=" ) + wcRef);
94+ if (percussive != windchest->getIsPercussive ()) {
95+ if (percussive) {
96+ outFile->AddLine (wxT (" Percussive=Y" ));
97+ if (hasIndependentRelease != windchest->getHasIndependentRelease ()) {
98+ if (hasIndependentRelease) {
99+ outFile->AddLine (wxT (" HasIndependentRelease=Y" ));
100+ } else {
101+ outFile->AddLine (wxT (" HasIndependentRelease=N" ));
102+ }
101103 }
104+ } else {
105+ outFile->AddLine (wxT (" Percussive=N" ));
102106 }
103- } else {
104- outFile->AddLine (wxT (" Percussive=N" ));
105107 }
106108 }
107109 if (minVelocityVolume != 100 )
@@ -135,16 +137,18 @@ void Rank::writeFromStop(wxTextFile *outFile) {
135137 outFile->AddLine (wxT (" HarmonicNumber=" ) + wxString::Format (wxT (" %i" ), harmonicNumber));
136138 if (pitchCorrection != 0 )
137139 outFile->AddLine (wxT (" PitchCorrection=" ) + wxString::Format (wxT (" %f" ), pitchCorrection));
138- wxString wcRef = GOODF_functions::number_format (::wxGetApp ().m_frame ->m_organ ->getIndexOfOrganWindchest (windchest));
139- outFile->AddLine (wxT (" WindchestGroup=" ) + wcRef);
140- if (percussive != windchest->getIsPercussive ()) {
141- if (percussive) {
142- outFile->AddLine (wxT (" Percussive=Y" ));
143- if (hasIndependentRelease) {
144- outFile->AddLine (wxT (" HasIndependentRelease=Y" ));
140+ if (windchest) {
141+ wxString wcRef = GOODF_functions::number_format (::wxGetApp ().m_frame ->m_organ ->getIndexOfOrganWindchest (windchest));
142+ outFile->AddLine (wxT (" WindchestGroup=" ) + wcRef);
143+ if (percussive != windchest->getIsPercussive ()) {
144+ if (percussive) {
145+ outFile->AddLine (wxT (" Percussive=Y" ));
146+ if (hasIndependentRelease) {
147+ outFile->AddLine (wxT (" HasIndependentRelease=Y" ));
148+ }
149+ } else {
150+ outFile->AddLine (wxT (" Percussive=N" ));
145151 }
146- } else {
147- outFile->AddLine (wxT (" Percussive=N" ));
148152 }
149153 }
150154 if (minVelocityVolume != 100 )
@@ -198,7 +202,7 @@ void Rank::read(wxFileConfig *cfg, Organ *readOrgan) {
198202 if (pitchCorr >= -1800 && pitchCorr <= 1800 ) {
199203 setPitchCorrection (pitchCorr);
200204 }
201- int windchestRef = static_cast <int >(cfg->ReadLong (" WindchestGroup" , 1 ));
205+ int windchestRef = static_cast <int >(cfg->ReadLong (" WindchestGroup" , 0 ));
202206 if (windchestRef > 0 && windchestRef <= (int ) readOrgan->getNumberOfWindchestgroups ()) {
203207 setWindchest (readOrgan->getOrganWindchestgroupAt (windchestRef - 1 ));
204208 }
0 commit comments