Commit Diff


commit - 2f64530cd1ddb4d87202229e8f3b3537767c6382
commit + 3bf6ff83142cb9cd146e65f871c9a19254ecf1c3
blob - 59209129915dfa58d7bb90865ce35bd77708a290
blob + d135a0a98c7e83929e9496d9f1891983436ba089
--- src/SamTabs.h	
+++ src/SamTabs.h	
@@ -39,40 +39,30 @@ unsigned char signInputTable2[] =
 };
 
 //loc_9F8C 
-unsigned char flags[]={
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xA4 , 0xA4 , 0xA4 ,
-	0xA4 , 0xA4 , 0xA4 , 0x84 , 0x84 , 0xA4 , 0xA4 , 0x84 ,
-	0x84 , 0x84 , 0x84 , 0x84 , 0x84 , 0x84 , 0x44 , 0x44 ,
-	0x44 , 0x44 , 0x44 , 0x4C , 0x4C , 0x4C , 0x48 , 0x4C ,
-	0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0x44 , 0x44 ,
-	0x44 , 0x44 , 0x48 , 0x40 , 0x4C , 0x44 , 0x00 , 0x00 ,
-	0xB4 , 0xB4 , 0xB4 , 0x94 , 0x94 , 0x94 , 0x4E , 0x4E ,
-	0x4E , 0x4E , 0x4E , 0x4E , 0x4E , 0x4E , 0x4E , 0x4E ,
-	0x4E , 0x4E , 0x4B , 0x4B , 0x4B , 0x4B , 0x4B , 0x4B ,
-	0x4B , 0x4B , 0x4B , 0x4B , 0x4B , 0x4B , 0x80 , 0xC1 ,
-	0xC1
-
-
+enum {
+    FLAG_PUNCT    = 0x0100,
+    FLAG_ALVEOLAR = 0x0400,
+    FLAG_NASAL    = 0x0800,
+    FLAG_LIQUIC   = 0x1000  /* liquic consonant */
 };
 
-//??? flags overlap flags2
-//loc_9FDA
-unsigned char flags2[] = 

-{
-	0x80 , 0xC1 , 0xC1 , 0xC1 , 0xC1 , 0x00 , 0x00 , 0x00 ,
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x10 ,
-	0x10 , 0x10 , 0x10 , 0x08 , 0x0C , 0x08 , 0x04 , 0x40 ,
-	0x24 , 0x20 , 0x20 , 0x24 , 0x00 , 0x00 , 0x24 , 0x20 ,
-	0x20 , 0x24 , 0x20 , 0x20 , 0x00 , 0x20 , 0x00 , 0x00 ,
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
-	0x00 , 0x04 , 0x04 , 0x04 , 0x00 , 0x00 , 0x00 , 0x00 ,
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , 0x04 , 0x04 ,
-	0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   

-};

+unsigned short flags[]={
+	0x8000 , 0xC100 , 0xC100 , 0xC100 , 0xC100 , 0x00A4 , 0x00A4 , 0x00A4 ,
+	0x00A4 , 0x00A4 , 0x00A4 , 0x0084 , 0x0084 , 0x00A4 , 0x00A4 , 0x0084 ,
+	0x0084 , 0x0084 , 0x0084 , 0x0084 , 0x0084 , 0x0084 , 0x0044 , 0x1044 ,
+	0x1044 , 0x1044 , 0x1044 , 0x084C , 0x0C4C , 0x084C , 0x0448 , 0x404C ,
 
+	0x2440 , 0x2040 , 0x2040 , 0x2440 , 0x0040 , 0x0040 , 0x2444 , 0x2044 ,
+	0x2044 , 0x2444 , 0x2048 , 0x2040 , 0x004C , 0x2044 , 0x0000 , 0x0000 ,
+	0x00B4 , 0x00B4 , 0x00B4 , 0x0094 , 0x0094 , 0x0094 , 0x004E , 0x004E ,
 
+	0x004E , 0x044E , 0x044E , 0x044E , 0x004E , 0x004E , 0x004E , 0x004E ,
+	0x004E , 0x004E , 0x004B , 0x004B , 0x004B , 0x044B , 0x044B , 0x044B ,
+	0x004B , 0x004B , 0x004B , 0x004B , 0x004B , 0x004B , 0x0080 , 0x00C1 ,
+	0x00C1
+};
 
+
 //tab45616???
 unsigned char phonemeStressedLengthTable[] = 

 {
blob - 089d1c8908ad2e8df05790fab47cd1c1d77302b9
blob + 6b78ce873b5fa82688d8459f465455dbe04a6f76
--- src/sam.c	
+++ src/sam.c	
@@ -7,6 +7,9 @@
 #include "SamTabs.h"

 
 enum {
+    pR    = 23,
+    pD    = 57,
+    pT    = 69,
     BREAK = 254,
     END   = 255
 };
@@ -202,7 +205,7 @@ void InsertBreath(unsigned char mem59) {
 		len += phonemeLength[pos];
 		if (len < 232) {
 			if (index == BREAK) {
-            } else if (!(flags2[index]&1)) {
+            } else if (!(flags[index]& FLAG_PUNCT)) {
                 if (index == 0) mem54 = pos;
             } else {
                 len = 0;
@@ -241,13 +244,13 @@ void CopyStress() {
     // loop thought all the phonemes to be output
 	unsigned char pos=0; //mem66
     unsigned char Y;
-	while((Y = phonemeindex[pos]) != 255) {
+	while((Y = phonemeindex[pos]) != END) {
 		// if CONSONANT_FLAG set, skip - only vowels get stress
 		if (flags[Y] & 64) {
             Y = phonemeindex[pos+1];
 
             // if the following phoneme is the end, or a vowel, skip
-            if (Y != 255 && (flags[Y] & 128) != 0) {
+            if (Y != END && (flags[Y] & 128) != 0) {
                 // get the stress value at the next position
                 Y = stress[pos+1];
                 if (Y && !(Y&128)) {
@@ -390,7 +393,7 @@ int Parser1()
         }
 	} //while
 
-    phonemeindex[position] = 255;      //mark endpoint
+    phonemeindex[position] = END;
     return 1;
 }
 
@@ -491,8 +494,7 @@ void drule_post(unsigned char X) {
 
 void rule_alveolar_uw(unsigned char X) {
     // ALVEOLAR flag set?
-    unsigned char A = flags2[phonemeindex[X-1]] & 4;
-    if (A) {
+    if (flags[phonemeindex[X-1]] & FLAG_ALVEOLAR) {
         drule("<ALVEOLAR> UW -> <ALVEOLAR> UX");
         phonemeindex[X] = 16;
     }
@@ -593,24 +595,22 @@ void Parser2() {
 
         // Get current position and phoneme
 		X = pos;
-		A = p;
         
         unsigned char prior = phonemeindex[pos-1];
 
-        if (p == 23 || p == 24 || p == 32 || A == 60) {
+        if (p == pR || p == 24 || p == 32 || A == 60) {
 
-            if (p == 23) { // 'R'
+            if (p == pR) { // 'R'
                 // RULES FOR PHONEMES BEFORE R
                 // Look at prior phoneme
                 X--;
                 A = prior;
-                
-                if (prior == 69 || prior == 57) {
-                    if (prior == 69) { // 'T'
+                if (prior == pT || prior == pD) {
+                    if (prior == pT) {
                         // Example: TRACK
                         drule("T R -> CH R");
                         phonemeindex[pos-1] = 42;
-                    } else if (prior == 57) { // 'D'
+                    } else if (prior == pD) {
                         // Example: DRY
                         drule("D R -> J R");
                         phonemeindex[pos-1] = 44;
@@ -748,7 +748,7 @@ void AdjustLengths() {
 	unsigned char loopIndex=0;
 	while((index = phonemeindex[X]) != 255) {
 		// not punctuation?
-		if((flags2[index] & 1) == 0) { // skip
+		if((flags[index] & FLAG_PUNCT) == 0) { // skip
 			++X;
 			continue;
 		}
@@ -765,7 +765,7 @@ void AdjustLengths() {
 
 			//if (index != 255)//inserted to prevent access overrun
 			// test for fricative/unvoiced or not voiced

-			if(((flags2[index] & 32) == 0) || ((flags[index] & 4) != 0))     //nochmal überprüfen

+			if(((flags[index] & 0x2000) == 0) || ((flags[index] & 4) != 0))     //nochmal überprüfen

 			{
 				unsigned char A = phonemeLength[X];
 
@@ -836,7 +836,7 @@ void AdjustLengths() {
         //       Set stop consonant length to 5
            
         
-        else if((flags2[index] & 8) != 0) { // nasal?
+        else if((flags[index] & FLAG_NASAL) != 0) { // nasal?
             // M*, N*, NX, 
 
             index = phonemeindex[++X];
@@ -864,7 +864,7 @@ void AdjustLengths() {
             phonemeLength[X]         = (phonemeLength[X] >> 1) + 1;
             X = loopIndex;
             phonemeLength[loopIndex] = (phonemeLength[loopIndex] >> 1) + 1;
-        } else if ((flags2[index] & 16) != 0) { // liquic consonant?
+        } else if ((flags[index] & 0x1000) != 0) { // liquic consonant?
             // WH, R*, L*, W*, Y*, Q*, Z*, ZH, V*, DH, J*, **, 
 
             // RULE: <VOICED NON-VOWEL> <DIPTHONG>