~ubuntu-branches/ubuntu/precise/espeak/precise

« back to all changes in this revision

Viewing changes to src/synthdata.cpp

  • Committer: Package Import Robot
  • Author(s): Luke Yelavich
  • Date: 2012-01-05 09:52:27 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20120105095227-ph3ne7d12zu7rwzk
Tags: 1.46.01-0ubuntu1
* New upstream release
* debian/control: Add libpulse-dev as a build dependency
* debian/rules:
  - Build espeak with AUDIO=runtime
  - Reinstate parsing the changelog for the soname version, and extend the
    command to only extract the major version of the soname
  - DO not build and run the phondata endianness conversion utility for now,
    as the manifest file is not up to date
* debian/patches/leak: Dropped, applied upstream
* Build for multi-arch
* Fix some lintian warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "translate.h"
36
36
#include "wave.h"
37
37
 
38
 
const char *version_string = "1.45.04  25.Apr.11";
39
 
const int version_phdata  = 0x014500;
 
38
const char *version_string = "1.46.01  22.Nov.11";
 
39
const int version_phdata  = 0x014600;
40
40
 
41
41
int option_device_number = -1;
42
42
FILE *f_logespeak = NULL;
172
172
        Free(phoneme_tab_data);
173
173
        Free(phoneme_index);
174
174
        Free(phondata_ptr);
 
175
        Free(tunes);
175
176
        phoneme_tab_data=NULL;
176
177
        phoneme_index=NULL;
177
178
        phondata_ptr=NULL;
 
179
        tunes=NULL;
178
180
}
179
181
 
180
182
 
589
591
}  // end of StressCondition
590
592
 
591
593
 
 
594
static int CountVowelPosition(PHONEME_LIST *plist)
 
595
{//===============================================
 
596
        int count = 0;
 
597
 
 
598
        for(;;)
 
599
        {
 
600
                if(plist->ph->type == phVOWEL)
 
601
                        count++;
 
602
                if(plist->sourceix != 0)
 
603
                        break;
 
604
                plist--;
 
605
        }
 
606
        return(count);
 
607
}  // end of CoundVowelPosition
 
608
 
 
609
 
592
610
static bool InterpretCondition(Translator *tr, int control, PHONEME_LIST *plist, int instn)
593
611
{//========================================================================================
594
612
        int which;
597
615
        int count;
598
616
        PHONEME_TAB *ph;
599
617
        PHONEME_LIST *plist_this;
600
 
        static int ph_position[8] = {0, 1, 2, 3, 2, 0, 1, 3};  // prevPh, thisPh, nextPh, next2Ph, nextPhW, prevPhW, nextVowel, next2PhW
 
618
        static int ph_position[8] = {0, 1, 2, 3, 2, 0, 1, 3};  // prevPh, thisPh, nextPh, next2Ph, nextPhW, prevPhW, nextVowel, (other conditions)
 
619
 
 
620
        // instruction: 2xxx, 3xxx
 
621
 
 
622
        // bits 8-10 = 0 to 6,  which phoneme
 
623
        // bit 11 = 0, bits 0-7 are a phoneme code
 
624
        // bit 11 = 1, bits 5-7 type of data, bits 0-4 data value
 
625
 
 
626
        // bits 8-10 = 7,  other conditions
 
627
 
601
628
 
602
629
        data = instn & 0xff;
603
630
        instn2 = instn >> 8;
618
645
                        if(plist[0].sourceix)
619
646
                                return(false);
620
647
                }
621
 
                if(which==7)
622
 
                {
623
 
                        // nextPh2 not word boundary
624
 
                        if((plist[1].sourceix) || (plist[2].sourceix))
625
 
                                return(false);
626
 
                }
627
 
 
628
648
                if(which==6)
629
649
                {
630
650
                        // nextVowel, not word boundary
740
760
 
741
761
                        case 12:  // isVoiced
742
762
                                return((ph->type == phVOWEL) || (ph->type == phLIQUID) || (ph->phflags & phVOICED));
743
 
                        }
744
763
 
745
764
                        case 13:  // isFirstVowel
 
765
                                return(CountVowelPosition(plist)==1);
 
766
 
 
767
                        case 14:  // isSecondVowel
 
768
                                return(CountVowelPosition(plist)==2);
 
769
 
 
770
                        case 15:  // isSeqFlag1
 
771
                                // is this preceded  by a sequence if 1 or more vowels which have 'flag1' ?  (lang=hi)
 
772
                                if(plist->sourceix != 0)
 
773
                                        return(false);   // this is the first phoneme in the word, so no.
 
774
 
746
775
                                count = 0;
747
776
                                for(;;)
748
777
                                {
 
778
                                        plist--;
749
779
                                        if(plist->ph->type == phVOWEL)
750
 
                                                count++;
 
780
                                        {
 
781
                                                if(plist->ph->phflags & phFLAG1)
 
782
                                                        count++;
 
783
                                                else
 
784
                                                        break;  // stop when we find a vowel without flag1
 
785
                                        }
751
786
                                        if(plist->sourceix != 0)
752
787
                                                break;
753
 
                                        plist--;
754
788
                                }
755
 
                                return(count==1);
 
789
                                return(count > 0);
 
790
 
 
791
                        case 0x10:  //  isTranslationGiven
 
792
                                return((plist->synthflags & SFLAG_DICTIONARY) != 0);
 
793
                        }
756
794
                        break;
757
795
 
758
796
                }
872
910
                
873
911
                switch(instn >> 12)
874
912
                {
875
 
                case 0:
 
913
                case 0:   // 0xxx
876
914
                        data = instn & 0xff;
877
915
 
878
916
                        if(instn2 == 0)