unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MPlayer, StdCtrls, Menus, Grids, ExtCtrls;
type
Tfrmmainform = class(TForm)
a: TMediaPlayer;
button2: TButton;
MainMenu1: TMainMenu;
File1: TMenuItem;
Esci1: TMenuItem;
N1: TMenuItem;
About1: TMenuItem;
Visualizzamodificheeffettuate1: TMenuItem;
Button5: TButton;
memo2: TMemo;
CheckBox1: TCheckBox;
GroupBox2: TGroupBox;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
GroupBox3: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Button1: TButton;
StringGrid1: TStringGrid;
Memo1: TMemo;
Image2: TImage;
Image1: TImage;
Button3: TButton;
ListBox1: TListBox;
Button4: TButton;
Button6: TButton;
procedure button2Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure memo2Change(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure memo2KeyPress(Sender: TObject; var Key: Char);
procedure About1Click(Sender: TObject);
procedure Esci1Click(Sender: TObject);
procedure Visualizzamodificheeffettuate1Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure RadioButton5Click(Sender: TObject);
procedure RadioButton6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmmainform: Tfrmmainform;
temporaneo,voce:string;
pos:integer;
implementation
uses Unit2, Unit3, Unit4, Unit5;
{$R *.dfm}
procedure Tfrmmainform.button2Click(Sender: TObject);
begin
frmfonetica.groupbox1.Visible:=true;
frmfonetica.listbox2.Visible:=false;
frmfonetica.combobox1.Visible:=true;
frmfonetica.listbox1.visible:=true;
frmfonetica.button2.Visible:=false;
frmfonetica.button3.visible:=true;
frmfonetica.button2.enabled:=false;
frmfonetica.button3.enabled:=false;
frmfonetica.combobox1.Text:='';
frmfonetica.combobox1.itemindex:=-1;
frmfonetica.listbox1.clear;
frmfonetica.listbox1.itemindex:=-1;
frmfonetica.stringgrid1.visible:=true;
frmfonetica.stringgrid2.Visible:=false;
frmfonetica.button4.Visible:=false;
frmfonetica.radiobutton13.Checked:=false;
frmfonetica.radiobutton2.Checked:=false;
frmfonetica.radiobutton3.Checked:=false;
frmfonetica.radiobutton7.Checked:=false;
frmfonetica.radiobutton11.Checked:=false;
frmfonetica.radiobutton5.Checked:=false;
frmfonetica.groupbox6.Visible:=false;
frmfonetica.radiobutton17.Checked:=true;
frmfonetica.showmodal;
end;
procedure Tfrmmainform.RadioButton2Click(Sender: TObject);
var i:integer;
begin
button2.Visible:=true;
for i:=0 to length(memo2.Text)-1 do
begin
frmfonetica.stringgrid1.rowCount:=i+1;
frmfonetica.StringGrid1.cells[0,i]:=inttostr(i+1);
frmfonetica.StringGrid1.cells[1,i]:=memo2.text[i+1];
button2.Enabled:=true;
end
end;
procedure Tfrmmainform.memo2Change(Sender: TObject);
var i:integer;
begin
listbox1.clear;
if memo1.text='' then
button2.Enabled:=false
else
button2.Enabled:=true;
if radiobutton2.Checked then
for i:=0 to length(memo2.Text)-1 do
begin
frmfonetica.stringgrid1.rowCount:=i+1;
frmfonetica.StringGrid1.cells[0,i]:=inttostr(i+1);
frmfonetica.StringGrid1.cells[1,i]:=memo2.text[i+1];
end;
frmfonetica.Label11.Caption:='Il testo è composto da '+inttostr((length(trim(memo2.text)))) +' caratteri';
end;
procedure Tfrmmainform.RadioButton1Click(Sender: TObject);
begin
button2.Enabled:=false;
button2.Visible:=false;
end;
procedure Tfrmmainform.memo2KeyPress(Sender: TObject; var Key: Char);
begin
if ord(key) in [13] then
begin
button1.click;
key:=chr(0);
end;
if ord(key) in [8,32,97..122] then
exit
else
end;
procedure Tfrmmainform.About1Click(Sender: TObject);
begin
frmabout.show;
end;
procedure Tfrmmainform.Esci1Click(Sender: TObject);
begin
halt
end;
procedure Tfrmmainform.Visualizzamodificheeffettuate1Click(
Sender: TObject);
begin
frmmodifiche.show;
end;
procedure Tfrmmainform.Button5Click(Sender: TObject);
var messaggio:array of char;
n,n1,n2:integer;
begin
if memo1.Text='' then
showmessage('Non posso leggere ciò che non c''è!!!, prima inserisci una stringa e poi riclicca qua');
memo1.Text:=lowercase(memo1.Text);
memo1.Refresh;
setlength(messaggio,length(memo1.Text));
frmmodifiche.resetta.click;
for n:=0 to Length(memo1.Text)-1 do
begin
if memo1.text[n+1] in ['0','1','2','3','4','5','6','7','8','9'] then //se il primo è un numero allora ...
begin
if (memo1.text[n+2] in ['0','1','2','3','4','5','6','7','8','9']) then // se anche il secondo è un numero allora ...
begin
if (memo1.text[n+3] in ['0','1','2','3','4','5','6','7','8','9']) then // se anche il terzo è un numero allora
begin
if (memo1.text[n+4] in ['0','1','2','3','4','5','6','7','8','9']) then // se anche il quarto è un numero allora
begin
if (memo1.Text[n+5] in ['0','1','2','3','4','5','6','7','8','9']) then // se anche il quinto è un numero allora
begin
if (memo1.Text[n+6] in ['0','1','2','3','4','5','6','7','8','9']) then //se anche il sesto è un numero allora
begin
if (memo1.Text[n+7] in ['0','1','2','3','4','5','6','7','8','9']) then //se anche il settimo è un numero allora
begin
if (memo1.Text[n+8] in ['0','1','2','3','4','5','6','7','8','9']) then //se anche l'ottavo è un numero allora
begin
if not (memo1.text[n+1]='0')then //se il primo non è lo 0 allora
begin
if memo1.text[n+1]='1' then //se il primo è l' 1 allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1'+memo1.text[n+2]+'.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000000i'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se il primo non è l' 1
begin
if memo1.text[n+2]='0' then // se il secondo è 0 allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'0'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se il secondo non è 0
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'0.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+2]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000000i'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else
begin
end;
end
else //se il settimo non è un numero
begin
if not (memo1.text[n+1]='0') then // se il primo non è 0
begin
if memo1.text[n+1]= '1' then //se il primo è 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'un'+'.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000000'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //se il primo è maggiore di 1
begin
if memo1.Text[n]in ['1','2','3','4','5','6','7','8','9'] then
begin
end
else
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.Text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000000i'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end
else
begin
end;
end;
end
else
begin
if not(memo1.Text[n+1]='0') then
begin
if memo1.Text[n+1]<>'1' then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'100'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end
else //se il sesto non è un numero
begin
if not(memo1.Text[n+1]='0') then //se il primo non è 0
begin
if memo1.Text[n+1]='1' then //se il primo è 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1'+memo1.text[n+2]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //se il primo è maggiore di 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'0'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end;
end
else // se il quinto non è un numero
begin
if (memo1.text[n+1]='0') then //se il primo è 0
begin
if (memo1.Text[n]in['0'])and(memo1.Text[n-1]in['0']) then
begin
end
else
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000a'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
else //se il primo non è 0
if memo1.Text[n]='1' then //se il precedente era 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000a'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //se il precedente non era 1
begin
if memo1.text[n+1]='1' then // se il primo è 1
begin
if not(memo1.Text[n]=chr(0))then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000a'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
else // se il primo è superiore a 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+(memo1.text[n+1])+'.wav';
a.open;
a.Wait:=true;
a.Play;
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1000a'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end;
end;
end
else // se il quarto non è un numero
begin
If not(memo1.text[n+1]='0') then // se il primo non è 0
begin
if memo1.Text[n+1]<>'1' then //se il primo non è 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.Text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
a.DeviceType:=dtautoselect; // sia se il primo è 1 sia se non lo è
a.FileName:='suoni\'+voce+'\'+'100'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end
else // se il terzo non è un numero
begin
if not(memo1.text[n+1]='0') then //se il primo non è 0
begin
if memo1.text[n+1]='1' then //se il primo è 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'1'+memo1.text[n+2]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //se il primo è maggiore di 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.Text[n+1]+'0'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
end;
end
else //se il secondo non è un numero
begin
if not (memo1.Text[n+1]='0') then //se il primo non è 0
begin
if memo1.text[n+1]='1' then //se il primo è 1
begin
if memo1.Text[n]='1' then //se il precedente era 1
begin //non fare niente
end
else //se il precedente non era 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.Text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //se il primo non è 1
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.Text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
// else
end;
end
else
// ---------------------------------------------------------------------------------------------------------
begin
if radiobutton2.checked=true then
begin
messaggio[n]:=memo1.text[n+1];
if messaggio[n]='a' then
begin
if frmmodifiche.A.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.A.ItemIndex:=frmmodifiche.A.ItemIndex+1;
temporaneo:=frmmodifiche.A.Items[frmmodifiche.A.itemindex];
end;
end
else
begin
if messaggio[n]='b' then
begin
if frmmodifiche.b.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.b.ItemIndex:=frmmodifiche.b.ItemIndex+1;
temporaneo:=frmmodifiche.b.Items[frmmodifiche.b.itemindex];
end;
end
else
if messaggio[n]='c' then
begin
if frmmodifiche.c.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.c.ItemIndex:=frmmodifiche.c.ItemIndex+1;
temporaneo:=frmmodifiche.c.Items[frmmodifiche.c.itemindex];
end;
end
else
begin
if messaggio[n]='d' then
begin
if frmmodifiche.d.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.d.ItemIndex:=frmmodifiche.d.ItemIndex+1;
temporaneo:=frmmodifiche.d.Items[frmmodifiche.d.itemindex];
end;
end
else
begin
if messaggio[n]='e' then
begin
if frmmodifiche.e.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.e.ItemIndex:=frmmodifiche.e.ItemIndex+1;
temporaneo:=frmmodifiche.e.Items[frmmodifiche.e.itemindex];
end;
end
else
begin
if messaggio[n]='f' then
begin
if frmmodifiche.f.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.f.ItemIndex:=frmmodifiche.f.ItemIndex+1;
temporaneo:=frmmodifiche.f.Items[frmmodifiche.f.itemindex];
end;
end
else
begin
if messaggio[n]='g' then
begin
if frmmodifiche.g.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.g.ItemIndex:=frmmodifiche.g.ItemIndex+1;
temporaneo:=frmmodifiche.g.Items[frmmodifiche.g.itemindex];
end;
end
else
begin
if messaggio[n]='h' then
begin
if frmmodifiche.h.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.h.ItemIndex:=frmmodifiche.h.ItemIndex+1;
temporaneo:=frmmodifiche.h.Items[frmmodifiche.h.itemindex];
end;
end
else
begin
if messaggio[n]='i' then
begin
if frmmodifiche.i.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.i.ItemIndex:=frmmodifiche.i.ItemIndex+1;
temporaneo:=frmmodifiche.i.Items[frmmodifiche.i.itemindex];
end;
end
else
begin
if messaggio[n]='j' then
begin
if frmmodifiche.j.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.j.ItemIndex:=frmmodifiche.j.ItemIndex+1;
temporaneo:=frmmodifiche.j.Items[frmmodifiche.j.itemindex];
end;
end
else
begin
if messaggio[n]='k' then
begin
if frmmodifiche.k.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.k.ItemIndex:=frmmodifiche.k.ItemIndex+1;
temporaneo:=frmmodifiche.k.Items[frmmodifiche.k.itemindex];
end;
end
else
begin
if messaggio[n]='l' then
begin
if frmmodifiche.l.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.l.ItemIndex:=frmmodifiche.l.ItemIndex+1;
temporaneo:=frmmodifiche.l.Items[frmmodifiche.l.itemindex];
end;
end
else
begin
if messaggio[n]='m' then
begin
if frmmodifiche.m.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.m.ItemIndex:=frmmodifiche.m.ItemIndex+1;
temporaneo:=frmmodifiche.m.Items[frmmodifiche.m.itemindex];
end;
end
else
begin
if messaggio[n]='n' then
begin
if frmmodifiche.n.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.n.ItemIndex:=frmmodifiche.n.ItemIndex+1;
temporaneo:=frmmodifiche.n.Items[frmmodifiche.n.itemindex];
end;
end
else
begin
if messaggio[n]='o' then
begin
if frmmodifiche.o.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.o.ItemIndex:=frmmodifiche.o.ItemIndex+1;
temporaneo:=frmmodifiche.o.Items[frmmodifiche.o.itemindex];
end;
end
else
begin
if messaggio[n]='p' then
begin
if frmmodifiche.p.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.p.ItemIndex:=frmmodifiche.p.ItemIndex+1;
temporaneo:=frmmodifiche.p.Items[frmmodifiche.p.itemindex];
end;
end
else
begin
if messaggio[n]='q' then
begin
if frmmodifiche.q.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.q.ItemIndex:=frmmodifiche.q.ItemIndex+1;
temporaneo:=frmmodifiche.q.Items[frmmodifiche.q.itemindex];
end;
end
else
begin
if messaggio[n]='r' then
begin
if frmmodifiche.r.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.r.ItemIndex:=frmmodifiche.r.ItemIndex+1;
temporaneo:=frmmodifiche.r.Items[frmmodifiche.r.itemindex];
end;
end
else
begin
if messaggio[n]='s' then
begin
if frmmodifiche.s.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.s.ItemIndex:=frmmodifiche.s.ItemIndex+1;
temporaneo:=frmmodifiche.s.Items[frmmodifiche.s.itemindex];
end;
end
else
begin
if messaggio[n]='t' then
begin
if frmmodifiche.t.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.t.ItemIndex:=frmmodifiche.t.ItemIndex+1;
temporaneo:=frmmodifiche.t.Items[frmmodifiche.t.itemindex];
end;
end
else
begin
if messaggio[n]='u' then
begin
if frmmodifiche.u.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.u.ItemIndex:=frmmodifiche.u.ItemIndex+1;
temporaneo:=frmmodifiche.u.Items[frmmodifiche.u.itemindex];
end;
end
else
begin
if messaggio[n]='v' then
begin
if frmmodifiche.v.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.v.ItemIndex:=frmmodifiche.v.ItemIndex+1;
temporaneo:=frmmodifiche.v.Items[frmmodifiche.v.itemindex];
end;
end
else
begin
if messaggio[n]='w' then
begin
if frmmodifiche.w.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.w.ItemIndex:=frmmodifiche.w.ItemIndex+1;
temporaneo:=frmmodifiche.w.Items[frmmodifiche.w.itemindex];
end;
end
else
begin
if messaggio[n]='x' then
begin
if frmmodifiche.x.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.x.ItemIndex:=frmmodifiche.x.ItemIndex+1;
temporaneo:=frmmodifiche.x.Items[frmmodifiche.x.itemindex];
end;
end
else
begin
if messaggio[n]='y' then
begin
if frmmodifiche.y.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.y.ItemIndex:=frmmodifiche.y.ItemIndex+1;
temporaneo:=frmmodifiche.y.Items[frmmodifiche.y.itemindex];
end;
end
else
begin
if messaggio[n]='z' then
begin
if frmmodifiche.z.count=0 then
checkbox1.checked:=true
else
begin
frmmodifiche.z.ItemIndex:=frmmodifiche.z.ItemIndex+1;
temporaneo:=frmmodifiche.z.Items[frmmodifiche.z.itemindex];
end;
end
else
begin
if messaggio[n]=' ' then
begin
temporaneo:=('spazio-');
end
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
if checkbox1.checked=false then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+temporaneo+messaggio[n]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
// -----------------------------------------------------------------------------------
//else //se l'opzione è su: "automatico" allora
//------------------------------------------------------------------------------------
if (radiobutton1.checked=true) or (checkbox1.checked=true) then
begin
checkbox1.checked:=false;
if memo1.text[n+1] in ['a','h','j','o','w','x','y'] then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else
begin
if memo1.text[n+1] in ['b','d','f','k','m','p','q','r','t','v','z'] then //altrimenti, se la la lettera è una di quelle che possono essere pronunciate doppie
begin
if not (memo1.Text[n+2]=memo1.Text[n+1]) then //se la successiva non è uguale a quella corrente allora
begin
if not (memo1.Text[n]=memo1.Text[n+1] ) then //se la precedente non è uguale a quella corrente allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else // altrimenti se la precedente è uguale
begin //non fare nulla
end;
end
else //altrimenti se la successiva è uguale allora
begin //pronuncia la lettera doppia
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti, se la la lettera non è di quelle che possono essere pronunciate doppie
begin
if memo1.Text[n+1] in ['c'] then //se è una c ccccccccccccccccccccccccccccccccccccccccccccccccc
begin
if (memo1.Text[n]=memo1.Text[n+1]) then
begin
end
else
begin
if memo1.text[n+2]=memo1.Text[n+1] then //se la seconda è uguale alla prima (se è doppia)
begin
if memo1.Text[n+3] in ['e','i'] then //e se la la terza è una 'e' o una 'i'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+'dolce-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se se la terza non è ne una 'e' nè una 'i'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+'dura-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti se non è doppia
begin
if memo1.text[n+2] in ['e','i'] then //se la successiva è una 'e' o una 'i' allora
if memo1.Text[n]='s' then //se la precedente è una s allora
begin //non fare niente
end
else //altrimenti se la precedente non è una s
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'dolce-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else//altrimenti se la successiva non è nè una 'e' nè una 'i'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'dura-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end;
end
else //altrimenti se non è una 'c'
begin
if memo1.Text[n+1] in ['g'] then //se è un 'g' allora ggggggggggggggggggggggggggggggggggggggggggggggggg
begin
if memo1.text[n]=memo1.Text[n+1] then //se la precedente è una 'g' allora
begin //non fare niente
end
else //altrimenti se la precedente non è una 'g'
begin
if memo1.Text[n+2]=memo1.Text[n+1] then //se la seconda è una 'g' (se è doppia) allora
begin
if memo1.Text[n+3] in ['e','i'] then //se la terza è una 'e' o una 'i' allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+'dolce-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //se la terza non è nè una 'e', nè una 'i'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+'dura-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti se la seconda non è una g
begin
if memo1.Text[n+2] in ['l','n'] then // se la seconda è una 'l' o una 'n' allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+2]+'-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se la seconda non è ne una 'l' nè una 'n'
begin
if memo1.Text[n+2] in ['i','e'] then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'dolce-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'dura-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end;
end;
end
else// altrimenti se non è una 'g'
begin
if memo1.Text[n+1] in ['e','i'] then //se è una 'e' o una 'i' allora
begin
if memo1.Text[n] in ['c','g'] then // se la precedente è una 'c' o una 'g' allora
begin
if memo1.Text[n+1]='i' then // se la corrente è la 'i' allora
begin
if memo1.Text[n+2] in ['a','e','i','o','u'] then // se la successiva è una vocale allora
begin //non fare niente
end
else //altrimenti se la successiva non è una vocale
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti se la corrente non è la 'i' (e quindi è la 'e')
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti, se la precedente non è nè la 'c' ne la 'g'
begin
if memo1.Text[n]='l' then // se la precedente è la 'l' allora
begin
if memo1.Text[n-1]='g' then //se la precedente della precedente è la 'g' allora
begin
if memo1.Text[n+1]='i' then // se la corrente è la 'i' allora
begin
if memo1.Text[n+2] in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] then //se la successiva è una lettera dell'alfabeto allora
begin //non fare nulla
end
else // altrimenti se la successiva non è una lettera dell'alfabeto
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else // altrimenti se la corrente non è la 'i' (e quindi è la 'e')
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end
else //altrimenti se la precedente della precedente non è la 'g'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
else //altrimenti se la precedente non è la 'l'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end
else
begin //altrimenti se non è ne la 'e', ne la 'i'
if memo1.Text[n+1] in ['l','n'] then //se è la 'l' o la 'n' allora
begin
if memo1.Text[n]in ['g',memo1.Text[n+1]] then //se la precedente è la 'g' o è la stessa lettera allora
begin //non fare nulla
end
else //altrimenti
begin
if memo1.text[n+2]=memo1.Text[n+1] then //se la seconda è uguale alla lettera corrente (se è doppia)
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se non è doppia
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end;
end
else //altrimenti se non è ne la 'l' ne la 'n'
begin
if memo1.Text[n+1]='u' then //se è la 'u' allora
begin
if memo1.Text[n]='q' then // se l aprecedente è la 'q' allora
begin //non fare niente
end
else //altrimenti, se la precedente non è la 'q'
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
else //altrimenti se non è la 'u'
begin
if memo1.Text[n+1]='s' then // se è la s allora
begin
if memo1.text[n+2]='c' then //se la seconda è la c allora
begin
if memo1.text[n+3] in ['e','i'] then //se la terza è la e o la i allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'c-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrimenti se la terza non è ne la e ne la i
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
end
else // altrimenti se la seconda non è la c
begin
if memo1.text[n+2]=memo1.Text[n+1] then //se la seconda è uguale alla prima (se è doppia) allora
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'doppia-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else
begin
if memo1.text[n]=memo1.text[n+1] then
begin
end
else
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
end;
end;
end
else
begin
if memo1.Text[n+1]=' ' then //se è lo spazio
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'spazio-'+memo1.text[n+1]+'.wav';
a.open;
a.Wait:=true;
a.Play;
end
else //altrmenti se non è lo spazio
begin
if memo1.Text[n+1] in ['è','é'] then
begin
a.DeviceType:=dtautoselect;
a.FileName:='suoni\'+voce+'\'+'aperto-e'+'.wav';
a.open;
a.Wait:=true;
a.Play;
end;
// showmessage('Il carattere: "'+memo1.text[n+1]+'" non è riconosciuto come valido');
end;
end;
end;
end;
end;
end;
end;
end
end;
end;
//---------------------------------------------------------------------------------------
end;
end;
end;
procedure Tfrmmainform.RadioButton5Click(Sender: TObject);
begin
voce:='voce maschile';
image2.Visible:=false;
image1.Visible:=true;
end;
procedure Tfrmmainform.RadioButton6Click(Sender: TObject);
begin
voce:='voce femminile' ;
image2.Visible:=true;
image1.Visible:=false;
end;
procedure Tfrmmainform.FormCreate(Sender: TObject);
begin
radiobutton1.checked:=true;
radiobutton5.checked:=true;
end;
procedure Tfrmmainform.Button1Click(Sender: TObject);
var f:textfile;
riga,testo,parz1,parola:string;
n,s,conta,conta1:integer;
begin
listbox1.clear;
if memo2.text[length(memo2.text)]<>' ' then
memo2.Text:=memo2.Text+' ';
testo:=memo2.Text;
conta:=0;
conta1:=0;
////
for s:=0 to length(memo2.Text) do //mette in fila tutte le parole
begin //dentro una listbox in modo
if memo2.Text[s]<>' ' then // da poter essere molto più
begin // facilmente confrontate
conta:=conta+1; // quando si deve verificare
end //se la pronuncia della parola
else // era gia stata impostata al bot
begin
parola:=lowercase(copy(memo2.Text,conta1,conta));
listbox1.Items.Add(trim(parola)); //per precauzione si usa trim perchè non devono esserci spazi
if parola<>' ' then
listbox1.Items.add(' ');
conta1:=conta1+conta+1;
conta:=0;
memo2.Refresh;
end
end;
for s:=0 to listbox1.Count-1 do //dopo che le parole sono state
begin //messe in fila, inizia a scorrere
listbox1.itemindex:=listbox1.itemindex+1; //riga per riga, tutta la listbox
parz1:=listbox1.Items[listbox1.itemindex]; // e riconosce le parole insegnate da quelle non insegnate
////
if not(fileexists('insegnamenti\'+parz1+'.ssr')) then //se la parola non è stata insegnata allora vai in modalità automatico o manuale
begin
memo1.Text:=parz1;
button5.Click;
end
else //altrimenti, se la parola è stata insegnata
begin // la pronuncia con gli insegnamenti impostati
//showmessage(''''+parz1+'''');
assignfile(f,'insegnamenti\'+parz1+'.ssr');
reset(f);
stringgrid1.RowCount:=length(parz1);
n:=-1;
while not seekeof(f) do
begin
n:=n+1;
read(f,riga);
stringgrid1.Cells[1,n]:=(riga)
end;
for n:=0 to length(parz1) do
stringgrid1.Cells[0,n]:=parz1[n+1];
closefile(f);
for n:=0 to stringgrid1.RowCount-1 do
begin
if not(stringgrid1.Cells[1,n]='none') then
begin
a.DeviceType:=dtautoselect;
if stringgrid1.Cells[1,n]='#' then
begin
// showmessage('suoni\'+voce+'\'+stringgrid1.cells[0,n]+'.wav');
a.FileName:='suoni\'+voce+'\'+stringgrid1.cells[0,n]+'.wav'
end
else
begin
// showmessage('suoni\'+voce+'\'+stringgrid1.Cells[1,n]+stringgrid1.cells[0,n]+'.wav');
a.FileName:='suoni\'+voce+'\'+stringgrid1.Cells[1,n]+stringgrid1.cells[0,n]+'.wav';
end;
a.open;
a.Wait:=true;
a.Play;
end;
end;
end
end;
end;
procedure Tfrmmainform.Button3Click(Sender: TObject);
begin
halt;
end;
procedure Tfrmmainform.Button4Click(Sender: TObject);
begin
memo2.clear;
end;
procedure Tfrmmainform.Button6Click(Sender: TObject);
var n:integer;
begin
frmfonetica.radiobutton18.Checked:=true;
frmfonetica.groupbox1.Visible:=false;
for n:=0 to stringgrid1.rowcount-1 do
begin
frmfonetica.stringgrid1.cells[1,n]:='';
frmfonetica.stringgrid1.Cells[2,n]:='';
end;
frmfonetica.stringgrid1.RowCount:=1;
frmfonetica.listbox2.Visible:=true;
frmfonetica.combobox1.Visible:=false;
frmfonetica.listbox1.visible:=false;
frmfonetica.edit1.clear;
frmfonetica.listbox2.clear;
frmfonetica.button3.Visible:=false;
frmfonetica.button2.visible:=true;
frmfonetica.stringgrid2.visible:=true;
frmfonetica.stringgrid1.Visible:=false;
frmfonetica.button3.enabled:=false;
frmfonetica.button2.enabled:=false;
frmfonetica.button4.Visible:=true;
frmfonetica.groupbox6.Visible:=true;
frmfonetica.showmodal;
end;
end.