Skip to content

Commit

Permalink
Add "soft" flat (X), sharp (#*), and natural (Y), which appear only i…
Browse files Browse the repository at this point in the history
…f they are the first on the line or different from the previous alteration. Remove the header option alteration-scope.
  • Loading branch information
davidweichiang committed Jan 26, 2025
1 parent 1a0b474 commit a0054fd
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 26 deletions.
3 changes: 3 additions & 0 deletions src/gabc/gabc-glyphs-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ static char add_note_to_a_glyph(gregorio_glyph_type current_glyph_type,
break;
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
next_glyph_type = G_ALTERATION;
*end_of_glyph = DET_END_OF_BOTH;
break;
Expand Down
12 changes: 12 additions & 0 deletions src/gabc/gabc-notes-determination.l
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,10 @@ x\? {
gregorio_change_shape(current_note, S_FLAT_PAREN,
legacy_oriscus_orientation);
}
X {
gregorio_change_shape(current_note, S_FLAT_SOFT,
legacy_oriscus_orientation);
}
# {
gregorio_change_shape(current_note, S_SHARP,
legacy_oriscus_orientation);
Expand All @@ -1310,6 +1314,10 @@ x\? {
gregorio_change_shape(current_note, S_SHARP_PAREN,
legacy_oriscus_orientation);
}
#\* {
gregorio_change_shape(current_note, S_SHARP_SOFT,
legacy_oriscus_orientation);
}
y {
gregorio_change_shape(current_note, S_NATURAL,
legacy_oriscus_orientation);
Expand All @@ -1318,6 +1326,10 @@ y\? {
gregorio_change_shape(current_note, S_NATURAL_PAREN,
legacy_oriscus_orientation);
}
Y {
gregorio_change_shape(current_note, S_NATURAL_SOFT,
legacy_oriscus_orientation);
}
!?\/0 {
gregorio_add_space_as_note(&current_note, SP_HALF_SPACE, NULL,
&notes_lloc);
Expand Down
9 changes: 9 additions & 0 deletions src/gabc/gabc-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,27 @@ static void gabc_write_gregorio_note(FILE *f, gregorio_note *note,
case S_FLAT_PAREN:
fprintf(f, "%cx?", pitch_letter(note->u.note.pitch));
break;
case S_FLAT_SOFT:
fprintf(f, "%cX", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL:
fprintf(f, "%cy", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL_PAREN:
fprintf(f, "%cy?", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL_SOFT:
fprintf(f, "%cY", pitch_letter(note->u.note.pitch));
break;
case S_SHARP:
fprintf(f, "%c#", pitch_letter(note->u.note.pitch));
break;
case S_SHARP_PAREN:
fprintf(f, "%c#?", pitch_letter(note->u.note.pitch));
break;
case S_SHARP_SOFT:
fprintf(f, "%c#*", pitch_letter(note->u.note.pitch));
break;
case S_VIRGA:
fprintf(f, "%cv", pitch_letter(note->u.note.pitch));
break;
Expand Down
12 changes: 12 additions & 0 deletions src/gregoriotex/gregoriotex-position.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ OFFSET_CASE(LeadingQuilisma);
OFFSET_CASE(LeadingOriscus);
OFFSET_CASE(Flat);
OFFSET_CASE(FlatParen);
OFFSET_CASE(FlatSoft);
OFFSET_CASE(Sharp);
OFFSET_CASE(SharpParen);
OFFSET_CASE(SharpSoft);
OFFSET_CASE(Natural);
OFFSET_CASE(NaturalParen);
OFFSET_CASE(NaturalSoft);

static __inline const char *note_before_last_note_case_ignoring_deminutus(
const gregorio_note *const current_note)
Expand Down Expand Up @@ -951,18 +954,27 @@ static gregorio_vposition advise_positioning(const gregorio_glyph *const glyph,
case S_FLAT_PAREN:
note->gtex_offset_case = FlatParen;
break;
case S_FLAT_SOFT:
note->gtex_offset_case = FlatSoft;
break;
case S_SHARP:
note->gtex_offset_case = Sharp;
break;
case S_SHARP_PAREN:
note->gtex_offset_case = SharpParen;
break;
case S_SHARP_SOFT:
note->gtex_offset_case = SharpSoft;
break;
case S_NATURAL:
note->gtex_offset_case = Natural;
break;
case S_NATURAL_PAREN:
note->gtex_offset_case = NaturalParen;
break;
case S_NATURAL_SOFT:
note->gtex_offset_case = NaturalSoft;
break;
default:
note->gtex_offset_case = last_note_case(glyph,
fused_single_note_case(glyph, FinalPunctum, LeadingPunctum),
Expand Down
33 changes: 33 additions & 0 deletions src/gregoriotex/gregoriotex-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ SHAPE(DescendensOriscusScapusOpenqueue);
SHAPE(DescendensPunctumInclinatum);
SHAPE(Flat);
SHAPE(FlatParen);
SHAPE(FlatSoft);
SHAPE(Flexus);
SHAPE(FlexusLongqueue);
SHAPE(FlexusNobar);
Expand All @@ -106,6 +107,7 @@ SHAPE(Linea);
SHAPE(LineaPunctum);
SHAPE(Natural);
SHAPE(NaturalParen);
SHAPE(NaturalSoft);
SHAPE(OriscusDeminutus);
SHAPE(Pes);
SHAPE(PesAscendensOriscus);
Expand Down Expand Up @@ -145,6 +147,7 @@ SHAPE(SalicusLongqueue);
SHAPE(Scandicus);
SHAPE(Sharp);
SHAPE(SharpParen);
SHAPE(SharpSoft);
SHAPE(Stropha);
SHAPE(StrophaAucta);
SHAPE(StrophaAuctaLongtail);
Expand Down Expand Up @@ -789,14 +792,20 @@ static const char *determine_note_glyph_name(const gregorio_note *const note,
return SHAPE_Flat;
case S_FLAT_PAREN:
return SHAPE_FlatParen;
case S_FLAT_SOFT:
return SHAPE_FlatSoft;
case S_SHARP:
return SHAPE_Sharp;
case S_SHARP_PAREN:
return SHAPE_SharpParen;
case S_SHARP_SOFT:
return SHAPE_SharpSoft;
case S_NATURAL:
return SHAPE_Natural;
case S_NATURAL_PAREN:
return SHAPE_NaturalParen;
case S_NATURAL_SOFT:
return SHAPE_NaturalSoft;
default:
/* not reachable unless there's a programming error */
/* LCOV_EXCL_START */
Expand Down Expand Up @@ -2609,14 +2618,20 @@ static __inline const char *alteration_name(
return "Flat";
case S_FLAT_PAREN:
return "FlatParen";
case S_FLAT_SOFT:
return "FlatSoft";
case S_SHARP:
return "Sharp";
case S_SHARP_PAREN:
return "SharpParen";
case S_SHARP_SOFT:
return "SharpSoft";
case S_NATURAL:
return "Natural";
case S_NATURAL_PAREN:
return "NaturalParen";
case S_NATURAL_SOFT:
return "NaturalSoft";
default:
return "";
}
Expand Down Expand Up @@ -2689,10 +2704,13 @@ static void write_note(FILE *f, gregorio_note *note,
switch (note->u.note.shape) {
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
fprintf(f, "\\Gre%s{%d}{0}", alteration_name(note->u.note.shape),
pitch_value(note->u.note.pitch));
break;
Expand Down Expand Up @@ -2783,18 +2801,27 @@ static void syllable_first_type(gregorio_syllable *syllable,
case S_FLAT_PAREN:
*alteration = ALT_FLAT_PAREN;
break;
case S_FLAT_SOFT:
*alteration = ALT_FLAT_SOFT;
break;
case S_NATURAL:
*alteration = ALT_NATURAL;
break;
case S_NATURAL_PAREN:
*alteration = ALT_NATURAL_PAREN;
break;
case S_NATURAL_SOFT:
*alteration = ALT_NATURAL_SOFT;
break;
case S_SHARP:
*alteration = ALT_SHARP;
break;
case S_SHARP_PAREN:
*alteration = ALT_SHARP_PAREN;
break;
case S_SHARP_SOFT:
*alteration = ALT_SHARP_SOFT;
break;
default:
/* not reachable unless there's a programming error */
/* LCOV_EXCL_START */
Expand Down Expand Up @@ -3938,10 +3965,13 @@ static void write_default_end_of_element(FILE *f,
switch(last_note->u.note.shape) {
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
break;
default:
last_pitch = last_note->u.note.pitch;
Expand All @@ -3955,10 +3985,13 @@ static void write_default_end_of_element(FILE *f,
switch(next_note->u.note.shape) {
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
break;
default:
if (next_note->u.note.pitch != NO_PITCH &&
Expand Down
5 changes: 4 additions & 1 deletion src/gregoriotex/gregoriotex.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ typedef enum gtex_alteration {
ALT_SHARP = 3,
ALT_FLAT_PAREN = 4,
ALT_NATURAL_PAREN = 5,
ALT_SHARP_PAREN = 6
ALT_SHARP_PAREN = 6,
ALT_FLAT_SOFT = 7,
ALT_NATURAL_SOFT = 8,
ALT_SHARP_SOFT = 9
} gtex_alteration;

/* Here we define a function that will determine the number of the
Expand Down
3 changes: 3 additions & 0 deletions src/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,13 @@ static __inline signed char next_pitch_from_glyph(const gregorio_glyph *glyph,
switch (note->u.note.shape) {
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
if (note->u.note.pitch >= LOWEST_PITCH &&
note->u.note.pitch <= MAX_PITCH) {
alterations[note->u.note.pitch] =
Expand Down
3 changes: 3 additions & 0 deletions src/struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ ENUM(gregorio_clef, GREGORIO_CLEF);
E(S_LINEA_PUNCTUM) \
E(S_FLAT) \
E(S_FLAT_PAREN) \
E(S_FLAT_SOFT) \
E(S_SHARP) \
E(S_SHARP_PAREN) \
E(S_SHARP_SOFT) \
E(S_NATURAL) \
E(S_NATURAL_PAREN) \
E(S_NATURAL_SOFT) \
/* special shapes that must not appear in the final form of the score :
* quadratum is the shape of the first note of a punctum quadratum
* and quilisma quadratum is the shape of the first note of a pes
Expand Down
14 changes: 0 additions & 14 deletions tex/gregoriotex-main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2142,18 +2142,4 @@
% We load the default space configuration.
\greloadspaceconf{default}%

\newif\ifgre@alteration@line
\gre@alteration@linefalse
\def\gresetalterationscope#1{%
\IfStrEqCase{#1}{%
{none}%
{\gre@alteration@linefalse}%
{line}%
{\gre@alteration@linetrue}%
}[% all other cases
\gre@error{Unrecognized option "#1" for \protect\gresetalterationscope\MessageBreak Possible options are: 'none' and 'line'}%
]%
}
\gresetheadercapture{alteration-scope}{gresetalterationscope}{}

\input gregoriotex-nabc.tex
Loading

0 comments on commit a0054fd

Please sign in to comment.