[EMAIL PROTECTED] writes:
> Some time in the not too distant past, Han-Wen wrote:
> >I hope  that you are aware that I will reject contributions that looks like
> >this
> >
> > if (chord_type_i == 0/*maj*/)
> >   {
> >     pitch_arr_.push(Musical_pitch(0, 0, 0));  // Create a major
> >   chord...
> >     pitch_arr_.push(Musical_pitch(2, 0, 0));
> >     pitch_arr_.push(Musical_pitch(4, 0, 0));
> >   }
> >   if (chord_type_i == 1/*min*/)
> >   {
> >     pitch_arr_.push(Musical_pitch(0, 0, 0));  // Create minor chord...
> >     pitch_arr_.push(Musical_pitch(2, -1, 0));
> >     pitch_arr_.push(Musical_pitch(4, 0, 0));
> >   }
> >   if (chord_type_i == 2/*aug*/)
> >   {
> >
> >If you need to resort to this, use struct initializers (or better yet,
> >get the info from GUILE)
> 
> I don't understand your objection.

Your code repeats htis over and over

  if (chord_type_i == X)
  {
    pitch_arr_.push(Musical_pitch(X ))
    pitch_arr_.push(Musical_pitch(X ))
    pitch_arr_.push(Musical_pitch(X ))
  }

where the only real information is on the X-es.  If you use struct
initializers, you can use a loop to code the above more efficiently

eg.

        struct
        {
          int type;
          int chords[3][];
        } chords = {
          {0, {{0,0,0},{2,0,0},{4,0,0}}},
          ...
        }
 



-- 

Han-Wen Nienhuys, [EMAIL PROTECTED] ** GNU LilyPond - The Music Typesetter 
      http://www.cs.uu.nl/people/hanwen/lilypond/index.html 

Reply via email to