Browse Source

[1.46.26]

espeakedit: Change from wxMDI to wxNotebook for prosody and vowel pages.
espeakedit: (linux) change to wxWidgets 2.8.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@292 d46cf337-b52f-0410-862d-fd96e6ae7743
master
jonsd 13 years ago
parent
commit
e1fd37b94c

+ 4
- 4
dictsource/dict_phonemes View File

ts; v w x z Z Z; ts; v w x z Z Z;




Dictionary pt_dict 2012-09-14
Dictionary pt_dict 2012-09-17


& &/ &U~ &~ @ @- a A & &/ &U~ &~ @ @- a A
aI aU e E eI EI eU EU aI aU e E eI EI eU EU
Z Z; Z Z;




Dictionary ko_dict 2012-09-15
Dictionary ko_dict 2012-09-17


@ a e E i o u u- @ a e E i o u u-


* - ; b d dZ; g h * - ; b d dZ; g h
j k k- kh l m n N j k k- kh l m n N
p p- ph q r s t t-
tS tS; w
p p- ph q r R s t
t- tS tS; w

+ 6
- 6
phsource/compile_report View File

[l/] fr [l/] fr
l/l_@ [l/3] base l/l_@ [l/3] base
[l/] fr [l/] fr
l/l@ [hÖ{] base
l/l@ [h6r] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
l/L2_uL [l/2] base l/L2_uL [l/2] base
l/l_3 [l/] de l/l_3 [l/] de
l/l_4 [ll] sq l/l_4 [ll] sq
l/la [hÖ{] base
l/la [h6r] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
[K] tn [K] tn
l/l_a [l/3] base l/l_a [l/3] base
[l/] fr [l/] fr
l/le [hÖ{] base
l/le [h6r] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
[&:] af [&:] af
l/l_front [L] sq l/l_front [L] sq
l/l_front_ [l/4] sq l/l_front_ [l/4] sq
l/li [hÖ{] base
l/li [h6r] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr
ll/_ll [L] base ll/_ll [L] base
l/l_long [l] base l/l_long [l] base
[l] fr [l] fr
l/lo [hÖ{] base
l/lo [h6r] base
[l#] base [l#] base
[l/2] fr [l/2] fr
[K] nso [K] nso
[l;] lt [l;] lt
[l] ru [l] ru
[l^] ru [l^] ru
l/lu [hÖ{] base
l/lu [h6r] base
[l#] base [l#] base
[l] fr [l] fr
[l/2] fr [l/2] fr

+ 5
- 5
src/Makefile.espeakedit View File



OBJS=$(patsubst %.cpp,%.o,$(SRCS)) OBJS=$(patsubst %.cpp,%.o,$(SRCS))


WX_LIBS = -pthread -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 -lwx_gtk2u_html-2.6 \
-lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6
WX_LIBS = -pthread -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 \
-lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8


LIBS=-lstdc++ -lportaudio LIBS=-lstdc++ -lportaudio


CPPFLAGS = -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6
-I/usr/include/wx-2.6 \
CPPFLAGS = -Wall -g -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.8
-I/usr/include/wx-2.8 \
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT


CXXFLAGS = -O2 -Wall -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 \
CXXFLAGS = -O2 -Wall -fexceptions -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 \
-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT


all: espeakedit all: espeakedit

+ 146
- 124
src/espeakedit.cpp View File





#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/notebook.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/filename.h" #include "wx/filename.h"
#include "wx/numdlg.h" #include "wx/numdlg.h"
extern void MakeVowelLists(void); extern void MakeVowelLists(void);
extern void MakeWordFreqList(); extern void MakeWordFreqList();


extern const char *dict_name;

extern wxMenu *speak_menu; extern wxMenu *speak_menu;
extern wxMenu *data_menu; extern wxMenu *data_menu;


MyFrame *myframe = NULL; MyFrame *myframe = NULL;
SpectDisplay *currentcanvas = NULL; SpectDisplay *currentcanvas = NULL;


ChildFrProsody *prosodyframe = NULL;
ProsodyDisplay *prosodycanvas = NULL; ProsodyDisplay *prosodycanvas = NULL;
wxNotebook *notebook = NULL; wxNotebook *notebook = NULL;
wxNotebook *screenpages = NULL;

wxProgressDialog *progress; wxProgressDialog *progress;
int progress_max; int progress_max;
int gui_flag = 0; int gui_flag = 0;
int frame_x, frame_y, frame_w, frame_h; int frame_x, frame_y, frame_w, frame_h;


wxList my_children;
int adding_page = 0; // fix for wxWidgets (2,8,7) bug, adding first page to a wxNotebook gives emptystring for GetPageTex() in Notebook_Page_Changed event.


wxFont FONT_SMALL(8,wxSWISS,wxNORMAL,wxNORMAL); wxFont FONT_SMALL(8,wxSWISS,wxNORMAL,wxNORMAL);
wxFont FONT_MEDIUM(9,wxSWISS,wxNORMAL,wxNORMAL); wxFont FONT_MEDIUM(9,wxSWISS,wxNORMAL,wxNORMAL);


if((frame_w == 0) || (frame_h == 0)) if((frame_w == 0) || (frame_h == 0))
{ {
frame_w = 1024;
frame_w = 800;
frame_h = 768; frame_h = 768;
} }


return TRUE; return TRUE;
} }


BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_CHAR(MyFrame::OnKey) EVT_CHAR(MyFrame::OnKey)
EVT_MENU(MENU_ABOUT, MyFrame::OnAbout) EVT_MENU(MENU_ABOUT, MyFrame::OnAbout)
EVT_MENU(MENU_DOCS, MyFrame::OnAbout) EVT_MENU(MENU_DOCS, MyFrame::OnAbout)
EVT_MENU(MENU_SORT_DICTIONARY, MyFrame::OnTools) EVT_MENU(MENU_SORT_DICTIONARY, MyFrame::OnTools)
EVT_MENU(MENU_COMPILE_MBROLA, MyFrame::OnTools) EVT_MENU(MENU_COMPILE_MBROLA, MyFrame::OnTools)
EVT_MENU(MENU_COMPILE_INTONATION, MyFrame::OnTools) EVT_MENU(MENU_COMPILE_INTONATION, MyFrame::OnTools)
EVT_MENU(MENU_CLOSE_ALL, MyFrame::OnQuit)
EVT_MENU(MENU_QUIT, MyFrame::OnQuit) EVT_MENU(MENU_QUIT, MyFrame::OnQuit)
EVT_MENU(MENU_SPEAK_TRANSLATE, MyFrame::OnSpeak) EVT_MENU(MENU_SPEAK_TRANSLATE, MyFrame::OnSpeak)
EVT_MENU(MENU_SPEAK_RULES, MyFrame::OnSpeak) EVT_MENU(MENU_SPEAK_RULES, MyFrame::OnSpeak)
EVT_MENU(MENU_TEST, MyFrame::OnTools) EVT_MENU(MENU_TEST, MyFrame::OnTools)
EVT_MENU(MENU_TEST2, MyFrame::OnTools) EVT_MENU(MENU_TEST2, MyFrame::OnTools)


EVT_MENU(SPECTSEQ_SAVE, MyFrame::PageCmd)
EVT_MENU(SPECTSEQ_SAVEAS, MyFrame::PageCmd)
EVT_MENU(SPECTSEQ_SAVESELECT, MyFrame::PageCmd)
EVT_MENU(SPECTSEQ_CLOSE, MyFrame::PageCmd)
EVT_MENU(SPECTSEQ_SAVEPITCH, MyFrame::PageCmd)
EVT_MENU(MENU_CLOSE_ALL, MyFrame::PageCmd)


EVT_NOTEBOOK_PAGE_CHANGED(ID_SCREENPAGES, MyFrame::OnPageChanged)
EVT_TIMER(1, MyFrame::OnTimer) EVT_TIMER(1, MyFrame::OnTimer)
EVT_SIZE(MyFrame::OnSize)
EVT_SASH_DRAGGED(ID_WINDOW_LEFT, MyFrame::OnSashDrag)
END_EVENT_TABLE() END_EVENT_TABLE()




MyFrame::~MyFrame(void) MyFrame::~MyFrame(void)
{//==================== {//====================
myframe->Maximize(false);
myframe->Show(false); myframe->Show(false);
myframe->Iconize(false); // os=Windows, get the non-iconsized size myframe->Iconize(false); // os=Windows, get the non-iconsized size
myframe->GetPosition(&frame_x, &frame_y); myframe->GetPosition(&frame_x, &frame_y);


MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
const long style): const long style):
wxMDIParentFrame(parent, id, title, pos, size, style)
wxFrame(parent, id, title, pos, size, style)
{//=================================================================================================================== {//===================================================================================================================
// Main Frame constructor // Main Frame constructor


int result; int result;
int param; int param;


// Another window to the left of the client window
m_leftWindow = new wxSashLayoutWindow(this, ID_WINDOW_LEFT,
wxDefaultPosition, wxSize(298, 30),
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN);
m_leftWindow->SetDefaultSize(wxSize(310, 1000));
m_leftWindow->SetOrientation(wxLAYOUT_VERTICAL);
m_leftWindow->SetAlignment(wxLAYOUT_LEFT);
m_leftWindow->SetSashVisible(wxSASH_RIGHT, TRUE);

notebook = new wxNotebook(m_leftWindow,-1);
notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxSize(312,760));
// notebook->AddPage(voicedlg,_T("Voice"),FALSE); // notebook->AddPage(voicedlg,_T("Voice"),FALSE);
formantdlg = new FormantDlg(notebook); formantdlg = new FormantDlg(notebook);
notebook->AddPage(formantdlg,_T(" Spect"),FALSE); notebook->AddPage(formantdlg,_T(" Spect"),FALSE);
notebook->AddPage(transldlg,_T("Text"),TRUE); notebook->AddPage(transldlg,_T("Text"),TRUE);




screenpages = new wxNotebook(this, ID_SCREENPAGES, wxDefaultPosition, wxSize(554,702));

wxBoxSizer *framesizer = new wxBoxSizer( wxHORIZONTAL );


framesizer->Add(
notebook,
0, // make horizontally stretchable
wxEXPAND | // make vertically stretchable
wxALL, // and make border all around
4 ); // set border width

framesizer->Add(
screenpages,
1, // make horizontally stretchable
wxEXPAND | // make vertically stretchable
wxALL, // and make border all around
4 ); // set border width

SetSizer( framesizer ); // use the sizer for layout
framesizer->SetSizeHints( this ); // set size hints to honour minimum size
SetSize(pos.x, pos.y, size.GetWidth(), size.GetHeight());

LoadConfig(); LoadConfig();
WavegenInitSound(); WavegenInitSound();




for(param=0; param<N_SPEECH_PARAM; param++) for(param=0; param<N_SPEECH_PARAM; param++)
param_stack[0].parameter[param] = param_defaults[param]; param_stack[0].parameter[param] = param_defaults[param];
SetParameter(espeakRATE,option_speed,0); SetParameter(espeakRATE,option_speed,0);


SetSpeed(3); SetSpeed(3);






void MyFrame::PageCmd(wxCommandEvent& event)
{//=========================================
int pagenum;
int ix;
int n_pages;
SpectDisplay *page;

// if(currentcanvas != NULL)
{
pagenum = screenpages->GetSelection();

switch(event.GetId())
{
case SPECTSEQ_SAVE:
currentcanvas->Save(currentcanvas->savepath);
break;
case SPECTSEQ_SAVEAS:
currentcanvas->Save();
break;
case SPECTSEQ_SAVESELECT:
currentcanvas->Save(_T(""), 1);
break;
case SPECTSEQ_CLOSE:
if(screenpages->GetPageText(pagenum) != _T("Prosody"))
{
currentcanvas->OnActivate(0);
}
screenpages->DeletePage(pagenum);

if((n_pages = screenpages->GetPageCount()) > 0)
{
if(pagenum >= n_pages)
pagenum--;
page = (SpectDisplay *)screenpages->GetPage(pagenum);

if(screenpages->GetPageText(pagenum) == _T("Prosody"))
{
MakeMenu(3, NULL);
}
else
{
page->OnActivate(1);
MakeMenu(2, NULL);
}
}
else
{
MakeMenu(1, NULL);
}
break;

case MENU_CLOSE_ALL:
n_pages = screenpages->GetPageCount();
for(ix=n_pages-1; ix>=0; ix--)
{
screenpages->DeletePage(ix);
}
currentcanvas = NULL;
MakeMenu(1, NULL);
break;
case SPECTSEQ_SAVEPITCH:
currentcanvas->SavePitchenv(currentcanvas->spectseq->pitchenv);
break;
}
}
}



void MyFrame::OnPageChanged(wxNotebookEvent& event)
{//=================================================
int pagenum;
wxString title;
SpectDisplay *page;

pagenum = event.GetSelection();

if(event.GetId() == ID_SCREENPAGES)
{
title = screenpages->GetPageText(pagenum);

if((title != _T("Prosody")) && (adding_page != 2))
{
page = (SpectDisplay *)screenpages->GetPage(pagenum);

if(page != currentcanvas)
{
if(currentcanvas != NULL)
{
currentcanvas->OnActivate(0);
}
page->OnActivate(1);
}
MakeMenu(2, NULL);
}
else
{
MakeMenu(3, NULL);
}
}
adding_page = 0; // work around for wxNotebook bug (version 2.8.7)
}


void MyFrame::OnKey(wxKeyEvent& event) void MyFrame::OnKey(wxKeyEvent& event)
{ {
int key; int key;
case MENU_COMPILE_INTONATION: case MENU_COMPILE_INTONATION:
CompileIntonation(); CompileIntonation();
break; break;
case MENU_COMPILE_DICT_DEBUG: case MENU_COMPILE_DICT_DEBUG:
debug_flag =1; // and drop through to next case debug_flag =1; // and drop through to next case
case MENU_COMPILE_DICT: case MENU_COMPILE_DICT:
} }




void MyFrame::OnSashDrag(wxSashEvent& event)
{
int w, h;

if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
return;

GetClientSize(&w, &h);

switch (event.GetId())
{
case ID_WINDOW_LEFT:
{
m_leftWindow->SetDefaultSize(wxSize(event.GetDragRect().width, h));
break;
}
}
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);

// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
}



void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
}

// Note that SASHTEST_NEW_WINDOW and SASHTEST_ABOUT commands get passed
// to the parent window for processing, so no need to
// duplicate event handlers here.

BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
EVT_MENU(SPECTSEQ_CLOSE, MyChild::OnQuit)
EVT_MENU(SPECTSEQ_SAVE, MyChild::OnSave)
EVT_MENU(SPECTSEQ_SAVEAS, MyChild::OnSaveAs)
EVT_MENU(SPECTSEQ_SAVESELECT, MyChild::OnSaveSelect)
EVT_MENU(SPECTSEQ_SAVEPITCH, MyChild::OnSavePitchenv)

EVT_ACTIVATE(MyChild::OnActivate)
END_EVENT_TABLE()

MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
const long style):
wxMDIChildFrame(parent, -1, title, pos, size, style)
{
canvas = NULL;
my_children.Append(this);
}

MyChild::~MyChild(void)
{
canvas = NULL;
#ifndef PLATFORM_WINDOWS
wxWindow *w;
// bug in wxMDIChildFrame, we need to explicitly remove the ChildFrame from the ClientWindow
w = myframe->GetClientWindow();
w->RemoveChild(this);
#endif
my_children.DeleteObject(this);
}

//extern void CloseCanvas();

void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Destroy();

}

void MyChild::OnSave(wxCommandEvent& WXUNUSED(event))
{
canvas->Save(canvas->savepath);
}

void MyChild::OnSaveAs(wxCommandEvent& WXUNUSED(event))
{
canvas->Save();
}

void MyChild::OnSaveSelect(wxCommandEvent& WXUNUSED(event))
{
canvas->Save(_T(""),1);
}

void MyChild::OnSavePitchenv(wxCommandEvent& WXUNUSED(event))
{
canvas->SavePitchenv(canvas->spectseq->pitchenv);
}

void MyChild::OnActivate(wxActivateEvent& event)
{
if(canvas)
canvas->OnActivate(event.GetActive());

}



+ 6
- 6
src/formantdlg.cpp View File

currentcanvas->SetFocus(); currentcanvas->SetFocus();
} }


FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,1000))
FormantDlg::FormantDlg(wxWindow *parent) : wxPanel(parent,-1,wxDefaultPosition,wxSize(400,800))
{//============================================================================================= {//=============================================================================================
int ix; int ix;
int y; int y;
{ {
value.Printf(_T("%3d"),peak->klt_bp); value.Printf(_T("%3d"),peak->klt_bp);
t_klt_bp[ix]->SetValue(value); t_klt_bp[ix]->SetValue(value);
}
}
} }
} }


numframes = seq->numframes; numframes = seq->numframes;


if(numframes == 0) return; if(numframes == 0) return;
GetClientSize(&width,&height); GetClientSize(&width,&height);


if(((length = seq->frames[numframes-1]->time)==0) && (numframes>1)) if(((length = seq->frames[numframes-1]->time)==0) && (numframes>1))
length = seq->frames[numframes-2]->time; length = seq->frames[numframes-2]->time;
length = length - seq->frames[0]->time; length = length - seq->frames[0]->time;


yscale = height/3000.0; yscale = height/3000.0;
double xscale, yscale; double xscale, yscale;


if(show_spectrum) DrawSpectrum(dc); if(show_spectrum) DrawSpectrum(dc);
if(npoints==0) return; if(npoints==0) return;


GetClientSize(&width,&height); GetClientSize(&width,&height);
wxPoint pt(event.GetLogicalPosition(dc)); wxPoint pt(event.GetLogicalPosition(dc));
t0 = t2 = seq->frames[0]->time; t0 = t2 = seq->frames[0]->time;
time = (double(pt.x) / spectrum_scale) + t0; time = (double(pt.x) / spectrum_scale) + t0;
for(ix=1; ix<seq->numframes; ix++) for(ix=1; ix<seq->numframes; ix++)
{ {
t1=t2; t1=t2;

+ 17
- 12
src/main.h View File

#include "wx/toolbar.h" #include "wx/toolbar.h"
#include "wx/laywin.h" #include "wx/laywin.h"
#include "wx/progdlg.h" #include "wx/progdlg.h"
#include "wx/notebook.h"


typedef unsigned short USHORT; typedef unsigned short USHORT;
typedef unsigned char UCHAR; typedef unsigned char UCHAR;
}; };


// Define a new frame // Define a new frame
class MyFrame: public wxMDIParentFrame
class MyFrame: public wxFrame
{ {
public: public:


MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyFrame(void); ~MyFrame(void);


void OnSize(wxSizeEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event); void OnOptions(wxCommandEvent& event);
void OnSpeak(wxCommandEvent& event);
void OnSpeak(wxCommandEvent& event);
void OnTools(wxCommandEvent& event); void OnTools(wxCommandEvent& event);
void OnSashDrag(wxSashEvent& event);
void OnKey(wxKeyEvent& event); void OnKey(wxKeyEvent& event);
void OnTimer(wxTimerEvent& event); void OnTimer(wxTimerEvent& event);
void LoadWavFile(void); void LoadWavFile(void);


void OnNewWindow(wxCommandEvent& event); void OnNewWindow(wxCommandEvent& event);
void OnProsody(wxCommandEvent& event); void OnProsody(wxCommandEvent& event);
void PageCmd(wxCommandEvent& event);
void SetVoiceTitle(char *voice_name); void SetVoiceTitle(char *voice_name);
void OnPageChanged(wxNotebookEvent& event);


protected: protected:
wxSashLayoutWindow* m_leftWindow;
wxTimer m_timer; wxTimer m_timer;


DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };


class MyChild: public wxMDIChildFrame

#ifdef deleted
class MyChild: public wxPanel
{ {
public: public:
SpectDisplay *canvas; SpectDisplay *canvas;
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
MyChild(wxNotebook *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void); ~MyChild(void);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnSave(wxCommandEvent& event); void OnSave(wxCommandEvent& event);
void OnSaveAs(wxCommandEvent& event); void OnSaveAs(wxCommandEvent& event);


DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif




class TranslDlg : public wxPanel class TranslDlg : public wxPanel
}; };


extern MyFrame *myframe; extern MyFrame *myframe;
extern wxNotebook* screenpages;
extern TranslDlg *transldlg; extern TranslDlg *transldlg;
extern wchar_t ipa1[256]; extern wchar_t ipa1[256];


SPECTSEQ_SAVEAS, SPECTSEQ_SAVEAS,
SPECTSEQ_SAVESELECT, SPECTSEQ_SAVESELECT,
SPECTSEQ_SAVEPITCH, SPECTSEQ_SAVEPITCH,
SPECTSEQ_VOICEDLG
SPECTSEQ_VOICEDLG,

ID_SCREENPAGES,
ID_NOTEBOOK
}; };


#define ID_WINDOW_LEFT 101







+ 108
- 97
src/menus.cpp View File



wxMenu *speak_menu; wxMenu *speak_menu;
wxMenu *data_menu = NULL; wxMenu *data_menu = NULL;
wxMenuBar *menu_bar = NULL;



wxMenuBar *MakeMenu(int type, const char *dict_name) wxMenuBar *MakeMenu(int type, const char *dict_name)
{//=================================================
{//===================================================
char buf[100]; char buf[100];
wxMenu *old_menu;
wxMenu *file_menu; wxMenu *file_menu;
wxMenu *help_menu; wxMenu *help_menu;
wxMenu *option_menu = NULL; wxMenu *option_menu = NULL;
file_menu->Append(MENU_SPECTRUM, _("&Open...")); file_menu->Append(MENU_SPECTRUM, _("&Open..."));
file_menu->Append(MENU_SPECTRUM2, _("O&pen2...")); file_menu->Append(MENU_SPECTRUM2, _("O&pen2..."));
// file_menu->Append(MENU_PROSODY, _T("&Prosody window")); // file_menu->Append(MENU_PROSODY, _T("&Prosody window"));
if(type==0)
if(type<=1)
{ {
} }
else else
if(type==1)
if(type==2)
{ {
file_menu->Append(SPECTSEQ_SAVE, _("&Save")); file_menu->Append(SPECTSEQ_SAVE, _("&Save"));
file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As...")); file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As..."));
file_menu->Append(SPECTSEQ_SAVESELECT, _("Save Selection")); file_menu->Append(SPECTSEQ_SAVESELECT, _("Save Selection"));
file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope")); file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope"));
file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); file_menu->Append(SPECTSEQ_CLOSE, _("&Close"));
// file_menu->Append(MENU_CLOSE_ALL, _T("Close &All"));
file_menu->Append(MENU_CLOSE_ALL, _T("Close &All"));
} }
else else
if(type==2)
if(type==3)
{ {
file_menu->Append(SPECTSEQ_SAVE, _("&Save"));
file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As..."));
// file_menu->Append(SPECTSEQ_SAVEPITCH, _T("Save Pitch &Envelope"));
// file_menu->Append(SPECTSEQ_SAVE, _("&Save"));
// file_menu->Append(SPECTSEQ_SAVEAS, _("Save &As..."));
file_menu->Append(SPECTSEQ_CLOSE, _("&Close")); file_menu->Append(SPECTSEQ_CLOSE, _("&Close"));
// file_menu->Append(MENU_CLOSE_ALL, _T("Close &All"));
file_menu->Append(MENU_CLOSE_ALL, _T("Close &All"));
} }
file_menu->Append(MENU_QUIT, _("&Quit")); file_menu->Append(MENU_QUIT, _("&Quit"));


// SPEAK_MENU
speak_menu = new wxMenu;
speak_menu->Append(MENU_SPEAK_TRANSLATE, _("&Translate"));
speak_menu->Append(MENU_SPEAK_RULES, _("Show &Rules"));
speak_menu->Append(MENU_SPEAK_IPA, _("Show &IPA"));
speak_menu->Append(MENU_SPEAK_TEXT, _("&Speak"));
speak_menu->AppendSeparator();
speak_menu->Append(MENU_SPEAK_FILE, _("Speak &file..."));
speak_menu->Append(MENU_SPEAK_PAUSE, _("&Pause"));
speak_menu->Append(MENU_SPEAK_STOP, _("St&op"));

// VOICE MENU
voice_menu = new wxMenu;
voice_menu->Append(MENU_SPEAK_VOICE, _("Select &Voice.."));
voice_menu->Append(MENU_SPEAK_VOICE_VARIANT, _("Select Voice Va&riant..."));

// DATA MENU
data_menu = new wxMenu;
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data"));
data_menu->Append(MENU_COMPILE_DICT, _("Compile &dictionary"));
data_menu->Append(MENU_COMPILE_DICT_DEBUG, _("Compile dictionary (debu&g)"));
data_menu->AppendSeparator();
data_menu->Append(MENU_COMPILE_MBROLA, _("Compile &mbrola phonemes list..."));
data_menu->Append(MENU_COMPILE_INTONATION, _("Compile &intonation data"));
data_menu->AppendSeparator();
data_menu->Append(MENU_FORMAT_DICTIONARY, _("&Layout *_rules file"));
data_menu->Append(MENU_SORT_DICTIONARY, _("&Sort *_rules file"));

sprintf(buf,"Compile &dictionary '%s'",dict_name);
data_menu->SetLabel(MENU_COMPILE_DICT, wxString(buf,wxConvLocal));
sprintf(buf,"&Layout '%s_rules' file",dict_name);
data_menu->SetLabel(MENU_FORMAT_DICTIONARY, wxString(buf,wxConvLocal));
sprintf(buf,"&Sort '%s_rules' file",dict_name);
data_menu->SetLabel(MENU_SORT_DICTIONARY, wxString(buf,wxConvLocal));

// OPTIONS MENU
paths_menu = new wxMenu;
paths_menu->Append(MENU_PATH0, _("Master phonemes file..."));
paths_menu->Append(MENU_PATH1, _("Phoneme data source..."));
paths_menu->Append(MENU_PATH2, _("Dictionary data source..."));
paths_menu->Append(MENU_PATH3, _("Synthesized sound WAV file..."));
paths_menu->AppendSeparator();
paths_menu->Append(MENU_PATH4, _("Voice file to modify formant peaks..."));

option_menu = new wxMenu;
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu);
option_menu->Append(MENU_OPT_SPEED, _("Speed..."));
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctiation"));
option_menu->Append(MENU_OPT_SPELL, _("Speak character names"));

// TOOLS
vowelchart_menu = new wxMenu;
vowelchart_menu->Append(MENU_VOWELCHART1, _("From compiled phoneme data"));
// vowelchart_menu->Append(MENU_VOWELCHART2, _("From list of formants..."));
vowelchart_menu->Append(MENU_VOWELCHART3, _("From directory of vowel files..."));

lexicon_menu = new wxMenu;
lexicon_menu->Append(MENU_LEXICON_RU, _("Russian"));
lexicon_menu->Append(MENU_LEXICON_BG, _("Bulgarian"));
lexicon_menu->Append(MENU_LEXICON_DE, _("German"));
lexicon_menu->Append(MENU_LEXICON_IT, _("Italian"));
// lexicon_menu->Append(MENU_LEXICON_TEST, _("Test"));

tools_menu = new wxMenu;
tools_menu->Append(MENU_VOWELCHART, _("Make &Vowels Chart"), vowelchart_menu);
// tools_menu->Append(MENU_LOAD_WAV, _T("Analyse WAV file"));
tools_menu->Append(MENU_LEXICON, _("Process &Lexicon"), lexicon_menu);
tools_menu->Append(MENU_TO_UTF8, _("Convert file to &UTF8..."));
tools_menu->Append(MENU_COUNT_WORDS, _("Count word &frequencies..."));
tools_menu->Append(MENU_TEST , _("Test (temporary)"));
// tools_menu->Append(MENU_TEST2 , _T("Test2"));

// HELP MENU
help_menu = new wxMenu;
help_menu->Append(MENU_DOCS, _("eSpeak &Documentation"));
help_menu->Append(MENU_ABOUT, _("&About"));


wxMenuBar *menu_bar = new wxMenuBar;

menu_bar->Append(file_menu, _("&File"));
menu_bar->Append(speak_menu, _("&Speak"));
menu_bar->Append(voice_menu, _("&Voice"));
menu_bar->Append(option_menu, _("&Options"));
menu_bar->Append(tools_menu, _("&Tools"));
menu_bar->Append(data_menu, _("&Compile"));
menu_bar->Append(help_menu, _("&Help"));

if(type==0)
{
// Initialization, make all the menus
// SPEAK_MENU
speak_menu = new wxMenu;
speak_menu->Append(MENU_SPEAK_TRANSLATE, _("&Translate"));
speak_menu->Append(MENU_SPEAK_RULES, _("Show &Rules"));
speak_menu->Append(MENU_SPEAK_IPA, _("Show &IPA"));
speak_menu->Append(MENU_SPEAK_TEXT, _("&Speak"));
speak_menu->AppendSeparator();
speak_menu->Append(MENU_SPEAK_FILE, _("Speak &file..."));
speak_menu->Append(MENU_SPEAK_PAUSE, _("&Pause"));
speak_menu->Append(MENU_SPEAK_STOP, _("St&op"));

// VOICE MENU
voice_menu = new wxMenu;
voice_menu->Append(MENU_SPEAK_VOICE, _("Select &Voice.."));
voice_menu->Append(MENU_SPEAK_VOICE_VARIANT, _("Select Voice Va&riant..."));

// DATA MENU
data_menu = new wxMenu;
data_menu->Append(MENU_COMPILE_PH, _("Compile &phoneme data"));
data_menu->Append(MENU_COMPILE_DICT, _("Compile &dictionary"));
data_menu->Append(MENU_COMPILE_DICT_DEBUG, _("Compile dictionary (debu&g)"));
data_menu->AppendSeparator();
data_menu->Append(MENU_COMPILE_MBROLA, _("Compile &mbrola phonemes list..."));
data_menu->Append(MENU_COMPILE_INTONATION, _("Compile &intonation data"));
data_menu->AppendSeparator();
data_menu->Append(MENU_FORMAT_DICTIONARY, _("&Layout *_rules file"));
data_menu->Append(MENU_SORT_DICTIONARY, _("&Sort *_rules file"));

sprintf(buf,"Compile &dictionary '%s'",dict_name);
data_menu->SetLabel(MENU_COMPILE_DICT, wxString(buf,wxConvLocal));
sprintf(buf,"&Layout '%s_rules' file",dict_name);
data_menu->SetLabel(MENU_FORMAT_DICTIONARY, wxString(buf,wxConvLocal));
sprintf(buf,"&Sort '%s_rules' file",dict_name);
data_menu->SetLabel(MENU_SORT_DICTIONARY, wxString(buf,wxConvLocal));

// OPTIONS MENU
paths_menu = new wxMenu;
paths_menu->Append(MENU_PATH0, _("Master phonemes file..."));
paths_menu->Append(MENU_PATH1, _("Phoneme data source..."));
paths_menu->Append(MENU_PATH2, _("Dictionary data source..."));
paths_menu->Append(MENU_PATH3, _("Synthesized sound WAV file..."));
paths_menu->AppendSeparator();
paths_menu->Append(MENU_PATH4, _("Voice file to modify formant peaks..."));

option_menu = new wxMenu;
option_menu->Append(MENU_PATHS, _("Set &paths"), paths_menu);
option_menu->Append(MENU_OPT_SPEED, _("Speed..."));
option_menu->Append(MENU_OPT_PUNCT, _("Speak punctiation"));
option_menu->Append(MENU_OPT_SPELL, _("Speak character names"));

// TOOLS
vowelchart_menu = new wxMenu;
vowelchart_menu->Append(MENU_VOWELCHART1, _("From compiled phoneme data"));
// vowelchart_menu->Append(MENU_VOWELCHART2, _("From list of formants..."));
vowelchart_menu->Append(MENU_VOWELCHART3, _("From directory of vowel files..."));

lexicon_menu = new wxMenu;
lexicon_menu->Append(MENU_LEXICON_RU, _("Russian"));
lexicon_menu->Append(MENU_LEXICON_BG, _("Bulgarian"));
lexicon_menu->Append(MENU_LEXICON_DE, _("German"));
lexicon_menu->Append(MENU_LEXICON_IT, _("Italian"));
// lexicon_menu->Append(MENU_LEXICON_TEST, _("Test"));

tools_menu = new wxMenu;
tools_menu->Append(MENU_VOWELCHART, _("Make &Vowels Chart"), vowelchart_menu);
// tools_menu->Append(MENU_LOAD_WAV, _T("Analyse WAV file"));
tools_menu->Append(MENU_LEXICON, _("Process &Lexicon"), lexicon_menu);
tools_menu->Append(MENU_TO_UTF8, _("Convert file to &UTF8..."));
tools_menu->Append(MENU_COUNT_WORDS, _("Count word &frequencies..."));
tools_menu->Append(MENU_TEST , _("Test (temporary)"));
// tools_menu->Append(MENU_TEST2 , _T("Test2"));

// HELP MENU
help_menu = new wxMenu;
help_menu->Append(MENU_DOCS, _("eSpeak &Documentation"));
help_menu->Append(MENU_ABOUT, _("&About"));


menu_bar = new wxMenuBar;

menu_bar->Append(file_menu, _("&File"));
menu_bar->Append(speak_menu, _("&Speak"));
menu_bar->Append(voice_menu, _("&Voice"));
menu_bar->Append(option_menu, _("&Options"));
menu_bar->Append(tools_menu, _("&Tools"));
menu_bar->Append(data_menu, _("&Compile"));
menu_bar->Append(help_menu, _("&Help"));
}
else
{
// Just replace the File menu
old_menu = menu_bar->Replace(0, file_menu, _("&File"));
delete old_menu;
}
return(menu_bar); return(menu_bar);
} // end of MakeMenu } // end of MakeMenu



+ 38
- 79
src/prosodydisplay.cpp View File

#include "translate.h" #include "translate.h"


extern MyFrame *myframe; extern MyFrame *myframe;
extern ChildFrProsody *prosodyframe;
extern ProsodyDisplay *prosodycanvas; extern ProsodyDisplay *prosodycanvas;


wxMenu *menu_prosody; wxMenu *menu_prosody;
scalex = 0.5; scalex = 0.5;
scaley = double(LINESEP*6)/150.0; scaley = double(LINESEP*6)/150.0;
selected_ph = -1; selected_ph = -1;
SetBackgroundColour(wxColour(245,245,245));
} // end of ProsodyDisplay::ProsodyDisplay } // end of ProsodyDisplay::ProsodyDisplay




int ProsodyDisplay::GetWidth(PHONEME_LIST *p) int ProsodyDisplay::GetWidth(PHONEME_LIST *p)
{//======================================== {//========================================
int w; int w;
if(p->ph == NULL) if(p->ph == NULL)
return(0); return(0);


{//======================================== {//========================================
PHONEME_LIST *p; PHONEME_LIST *p;
int display=1; int display=1;
if(selected_ph < 0) if(selected_ph < 0)
selected_ph = 0; selected_ph = 0;


if(selected_ph < (numph-2)) if(selected_ph < (numph-2))
selected_ph++; selected_ph++;
break; break;
case WXK_UP: case WXK_UP:
if(event.ControlDown()) if(event.ControlDown())
ChangePh(-1,2); ChangePh(-1,2);
PHONEME_DATA phdata_tone; PHONEME_DATA phdata_tone;


if(width <= 0) return; if(width <= 0) return;
if((pitchr = ph->pitch2 - ph->pitch1) < 0) if((pitchr = ph->pitch2 - ph->pitch1) < 0)
{ {
pitchr = -pitchr; pitchr = -pitchr;


y = LINEBASE+LINESEP; y = LINEBASE+LINESEP;
dc.SetPen(*wxLIGHT_GREY_PEN); dc.SetPen(*wxLIGHT_GREY_PEN);
// dc.SetPen(*wxCYAN_PEN);
for(ix=0; ix<5; ix++) for(ix=0; ix<5; ix++)
{ {
dc.DrawLine(0,offy-y,linewidth,offy-y); dc.DrawLine(0,offy-y,linewidth,offy-y);


int line, start, end; int line, start, end;


GetClientSize(&x1, &y1);
if(x1 != linewidth)
{
LayoutData(NULL, 0);
}

wxRegionIterator upd(GetUpdateRegion()); // get the update rect list wxRegionIterator upd(GetUpdateRegion()); // get the update rect list


while (upd) while (upd)
int xpos; int xpos;
int w; int w;
int ix; int ix;
int height;
PHONEME_LIST *p; PHONEME_LIST *p;




numph = n_ph;
phlist = ph_list;
if(ph_list != NULL)
{
numph = n_ph;
phlist = ph_list;
}


num_lines = 0; num_lines = 0;
linetab[0] = 1; linetab[0] = 1;
GetClientSize(&linewidth, &height);
xpos = linewidth; xpos = linewidth;


// could improve this to do 'wordwrap' - only split on word boundary // could improve this to do 'wordwrap' - only split on word boundary
} // end of ProsodyDisplay::LayoutData } // end of ProsodyDisplay::LayoutData




extern int adding_page;


void MyFrame::OnProsody(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnProsody(wxCommandEvent& WXUNUSED(event))
{//===================================================== {//=====================================================

// Open the Prosody display window // Open the Prosody display window
// Make another frame, containing a canvas

int h, w, w2;
int width, height;
int ix, npages;


if(prosodyframe != NULL)
if(prosodycanvas != NULL)
{ {
// The Prosody window is already open // The Prosody window is already open
prosodyframe->Activate();

// ?? select the prosody page ??
npages = screenpages->GetPageCount();
for(ix=0; ix<npages; ix++)
{
if(screenpages->GetPage(ix) == (wxWindow*)prosodycanvas)
{
screenpages->ChangeSelection(ix);
break;
}
}
return; return;
} }


m_leftWindow->GetSize(&w2, &h);
GetClientSize(&w, &h);
prosodyframe = new ChildFrProsody(myframe, _T(""),
wxPoint(0, 100), wxSize(w-w2, 420),
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE);

prosodyframe->SetTitle(_T("Prosody"));


// Give it a status line
prosodyframe->CreateStatusBar();

int width, height;
wxMDIClientWindow *clientwin = (wxMDIClientWindow *)this->GetClientWindow();
clientwin->GetClientSize(&width, &height);

#ifdef deleted
wxPanel *panel = new wxPanel(prosodyframe,-1,wxPoint(0,0), wxSize(width,50));
ProsodyDisplay *canvas = new ProsodyDisplay(prosodyframe, wxPoint(0, 50), wxSize(width-2, height-50));
#else
ProsodyDisplay *canvas = new ProsodyDisplay(prosodyframe, wxPoint(0, 50), wxSize(width-10, height));
#endif

prosodycanvas = canvas;
// Associate the menu bar with the frame
prosodyframe->SetMenuBar(MakeMenu(2,translator->dictionary_name));
prosodyframe->prosodycanvas = canvas;
prosodyframe->Show(TRUE);

}

BEGIN_EVENT_TABLE(ChildFrProsody, wxMDIChildFrame)
EVT_MENU(SPECTSEQ_CLOSE, ChildFrProsody::OnQuit)

// EVT_ACTIVATE(ChildFrProsody::OnActivate)
END_EVENT_TABLE()

extern wxList my_children;

ChildFrProsody::ChildFrProsody(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size,
const long style):
wxMDIChildFrame(parent, -1, title, pos, size, style)
{
my_children.Append(this);
screenpages->GetClientSize(&width, &height);
prosodycanvas = new ProsodyDisplay(screenpages, wxPoint(0, 50), wxSize(width-10, height));
adding_page = 2; // work around for wxNotebook bug (version 2.8.7)
screenpages->AddPage(prosodycanvas, _T("Prosody"), true);
} }


ChildFrProsody::~ChildFrProsody(void)
{
wxWindow *w;
my_children.DeleteObject(this);
prosodycanvas = NULL;
prosodyframe = NULL;

#ifndef PLATFORM_WINDOWS
// bug in wxMDIChildFrame, we need to explicitly remove the ChildFrame from the ClientWindow
w = myframe->GetClientWindow();
w->RemoveChild(this);
#endif
}

void ChildFrProsody::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}



+ 2
- 16
src/prosodydisplay.h View File

public: public:
ProsodyDisplay(wxWindow *parent, const wxPoint& pos, const wxSize& size); ProsodyDisplay(wxWindow *parent, const wxPoint& pos, const wxSize& size);
~ProsodyDisplay(); ~ProsodyDisplay();
virtual void OnDraw(wxDC& dc); virtual void OnDraw(wxDC& dc);
void OnMouse(wxMouseEvent& event); void OnMouse(wxMouseEvent& event);
void OnKey(wxKeyEvent& event); void OnKey(wxKeyEvent& event);
int GetWidth(PHONEME_LIST *p); int GetWidth(PHONEME_LIST *p);
void ChangePh(int pitch1, int pitch2); void ChangePh(int pitch1, int pitch2);
void SelectPh(int index); void SelectPh(int index);
int linewidth; // height for drawing pitch int linewidth; // height for drawing pitch
double scalex; // scale length values double scalex; // scale length values
double scaley; // scale pitch values double scaley; // scale pitch values
}; // end class ProsodyDisplay }; // end class ProsodyDisplay




class ChildFrProsody: public wxMDIChildFrame
{
public:
ProsodyDisplay *prosodycanvas;
ChildFrProsody(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~ChildFrProsody(void);
void OnActivate(wxActivateEvent& event);

void OnQuit(wxCommandEvent& event);
void OnSave(wxCommandEvent& event);
void OnSaveAs(wxCommandEvent& event);

DECLARE_EVENT_TABLE()
};



+ 2
- 2
src/spect.h View File

PEAKS7 peak_data[7]; PEAKS7 peak_data[7];
unsigned char data[1]; /* firstly harmonic data, then f3,f4,f5 data */ unsigned char data[1]; /* firstly harmonic data, then f3,f4,f5 data */
} CYCLE; /* VARIABLE LENGTH Structure */ } CYCLE; /* VARIABLE LENGTH Structure */
extern int SPC2_size_cycle(CYCLE *cy); extern int SPC2_size_cycle(CYCLE *cy);
//============================================================================================== //==============================================================================================


void CopyPeaks(SpectFrame *sf); void CopyPeaks(SpectFrame *sf);
void ToggleMarker(int n); void ToggleMarker(int n);
void ApplyVoiceMods(); void ApplyVoiceMods();
void MakeWaveF(int peaks, PitchEnvelope &pitch, int amplitude, int duration); void MakeWaveF(int peaks, PitchEnvelope &pitch, int amplitude, int duration);
void MakeHtab(int numh, int *htab, int pitch); void MakeHtab(int numh, int *htab, int pitch);
double GetRms(int amp); double GetRms(int amp);

+ 17
- 56
src/spectdisplay.cpp View File

extern MyFrame *frame ; extern MyFrame *frame ;
#define SCROLLUNITS 20 #define SCROLLUNITS 20


#define N_CANVASLIST 50
static int canvaslistix=0;
static SpectDisplay *canvaslist[N_CANVASLIST];
SpectSeq *clipboard_spect=NULL; SpectSeq *clipboard_spect=NULL;
wxMenu *menu_spectdisplay=NULL; wxMenu *menu_spectdisplay=NULL;


pk_num = 1; pk_num = 1;


SetExtent(); SetExtent();
if(canvaslistix < N_CANVASLIST-1)
canvaslist[canvaslistix++] = this;
// WavegenInitPkData(0);

} // end of SpectDisplay::SpectDisplay } // end of SpectDisplay::SpectDisplay






SpectDisplay::~SpectDisplay() SpectDisplay::~SpectDisplay()
{//========================== {//==========================
// delete this from the canvaslist
int ix;

for(ix=0; ix<canvaslistix; ix++)
{
if(canvaslist[ix] == this)
{
for(ix=ix+1; ix<canvaslistix; ix++)
canvaslist[ix-1] = canvaslist[ix];
canvaslistix--;
break;
}
}

if(currentcanvas==this)
{
if(canvaslistix > 0)
currentcanvas = canvaslist[0];
else
currentcanvas = NULL;
}
// ?? change currentcanvas
} }




{ {
formantdlg->GetValues(spectseq, sframe); formantdlg->GetValues(spectseq, sframe);
ReadDialogValues(); ReadDialogValues();
currentcanvas = NULL;
} }
} }


void SpectDisplay::WriteDialogLength() void SpectDisplay::WriteDialogLength()
{//=================================== {//===================================
wxString string; wxString string;
string.Printf(_T("%d mS"),int(spectseq->GetKeyedLength()+0.5)); string.Printf(_T("%d mS"),int(spectseq->GetKeyedLength()+0.5));
formantdlg->t_orig_seq->SetLabel(string); formantdlg->t_orig_seq->SetLabel(string);
} }
//{=============================== //{===============================
{ {
wxString string; wxString string;
SetSpinCtrl(formantdlg->t_amplitude,spectseq->amplitude); SetSpinCtrl(formantdlg->t_amplitude,spectseq->amplitude);


string.Printf(_T("%d - %d Hz %d mS"), string.Printf(_T("%d - %d Hz %d mS"),


pitchgraph->SetData(128,spectseq->pitchenv.env); pitchgraph->SetData(128,spectseq->pitchenv.env);
voicedlg->SetFromSpect(spectseq); voicedlg->SetFromSpect(spectseq);
WriteDialogLength(); WriteDialogLength();
} }


} // end of SpectDisplay::SavePitchenv } // end of SpectDisplay::SavePitchenv




// WX_DECLARE_LIST(MyChild,ChildList);
// WX_DEFINE_LIST(ChildList);




void SpectDisplay::PlayChild(int number, PitchEnvelope pitchenv) void SpectDisplay::PlayChild(int number, PitchEnvelope pitchenv)
{//========================================================= {//=========================================================
#ifdef deleted
SpectSeq *seq; SpectSeq *seq;



if(number >= canvaslistix) return; if(number >= canvaslistix) return;


if((seq = canvaslist[number]->spectseq) == NULL) if((seq = canvaslist[number]->spectseq) == NULL)


ReadDialogValues(); ReadDialogValues();
seq->MakeWave(0,seq->numframes-1,pitchenv); seq->MakeWave(0,seq->numframes-1,pitchenv);
#endif
} // end of PlayChild } // end of PlayChild






sf->keyframe = yes; sf->keyframe = yes;
pitchgraph->Refresh(); pitchgraph->Refresh();
WriteDialogLength(); WriteDialogLength();
} }


spectseq->bass_reduction ^= 1; spectseq->bass_reduction ^= 1;
Refresh(); Refresh();
break; break;
case 0x1043: // CTRL-C case 0x1043: // CTRL-C
spectseq->ClipboardCopy(); spectseq->ClipboardCopy();
break; break;
int frame; int frame;
int ix; int ix;


SetFocus();
if(event.RightDown()) if(event.RightDown())
{ {
PopupMenu(menu_spectdisplay); PopupMenu(menu_spectdisplay);
wxPoint pt(event.GetLogicalPosition(dc)); wxPoint pt(event.GetLogicalPosition(dc));


if(spectseq->numframes==0) return; if(spectseq->numframes==0) return;
frame = (int)(pt.y/(FRAME_HEIGHT*zoomy)); frame = (int)(pt.y/(FRAME_HEIGHT*zoomy));


if(!event.ControlDown()) if(!event.ControlDown())
else else
path_spectload2 = path.GetPath(); path_spectload2 = path.GetPath();


// Make another frame, containing a canvas
GetClientSize(&width, &height);
MyChild *subframe = new MyChild(myframe, _T("Spectrum"),
wxPoint(10, 0), wxSize(500, height),
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE);

subframe->SetTitle(leaf);


// Give it a status line
subframe->CreateStatusBar();


subframe->GetClientSize(&width, &height);
SpectDisplay *canvas = new SpectDisplay(subframe, wxPoint(0, 0), wxSize(width, height), spectseq);
GetClientSize(&width, &height);
SpectDisplay *canvas = new SpectDisplay(screenpages, wxDefaultPosition, wxSize(width, height), spectseq);
screenpages->AddPage(canvas, leaf, true);
canvas->savepath = filename; canvas->savepath = filename;
currentcanvas = canvas;

// Associate the menu bar with the frame
subframe->SetMenuBar(MakeMenu(1,translator->dictionary_name));
subframe->canvas = canvas;
subframe->Show(TRUE);

currentcanvas = canvas;
} }



void InitSpectrumDisplay() void InitSpectrumDisplay()
{//======================= {//=======================
wxMenu *menu_markers = new wxMenu; wxMenu *menu_markers = new wxMenu;

+ 1
- 1
src/synthdata.cpp View File

#include "translate.h" #include "translate.h"
#include "wave.h" #include "wave.h"


const char *version_string = "1.46.25 14.Sep.12";
const char *version_string = "1.46.26 17.Sep.12";
const int version_phdata = 0x014624; const int version_phdata = 0x014624;


int option_device_number = -1; int option_device_number = -1;

+ 6
- 8
src/transldlg.cpp View File

wxFileName fname; wxFileName fname;
FILE *f_text; FILE *f_text;
char buf[200]; char buf[200];
fname = wxFileName(path_speaktext); fname = wxFileName(path_speaktext);


file = wxFileSelector(_T("Text file to speak"),fname.GetPath(),fname.GetName(),_T(""),_T("*"),wxOPEN); file = wxFileSelector(_T("Text file to speak"),fname.GetPath(),fname.GetName(),_T(""),_T("*"),wxOPEN);
if(file == wxEmptyString) return; if(file == wxEmptyString) return;
strcpy(buf,file.mb_str(wxConvLocal)); strcpy(buf,file.mb_str(wxConvLocal));
f_text = fopen(buf,"r"); f_text = fopen(buf,"r");
if(f_text == NULL) if(f_text == NULL)
wxLogError(_T("Failed to read: ")+file); wxLogError(_T("Failed to read: ")+file);
return; return;
} }
path_speaktext = file; path_speaktext = file;
InitText(0); InitText(0);
SpeakNextClause(f_text,NULL,0); SpeakNextClause(f_text,NULL,0);
return; return;


case T_PROCESS: case T_PROCESS:
case MENU_SPEAK_TEXT: case MENU_SPEAK_TEXT:
if(prosodycanvas == NULL)
{
myframe->OnProsody(event);
}
myframe->OnProsody(event);
prosodycanvas->LayoutData(ph_list,n_ph_list); prosodycanvas->LayoutData(ph_list,n_ph_list);
myframe->Refresh();
option_phoneme_events = espeakINITIALIZE_PHONEME_EVENTS; option_phoneme_events = espeakINITIALIZE_PHONEME_EVENTS;
option_log_frames = 1; option_log_frames = 1;
MakeWave2(ph_list,n_ph_list); MakeWave2(ph_list,n_ph_list);

Loading…
Cancel
Save