Ejemplo n.º 1
0
// Initialise the recogniser
void ARec::InitRecogniser()
{
   ResourceGroup *main = rmgr->MainGroup();
   hset = main->MakeHMMSet();
   psi=InitPSetInfo(hset);
   pri=InitPRecInfo(psi,nToks);
}
Ejemplo n.º 2
0
bool ResourceManager::loadResourceGroup(const std::string &groupName)
{
	// note: it's ok to load a group more than once as long as it's
	// released more than once too.  different parts of the code
	// can use the same resource group and each of them should load
	// it when they need it and unload it when they done with it
	if (mResourceGroups.find(groupName) != mResourceGroups.end())
	{
		// disable full screen toggle while resource load/unload:
		Environment::instance()->disableFullScreenToggle();

		ResourceGroup *g = mResourceGroups[groupName];
		bool success = true;
		if (!g->isEmpty())
		{
			for (const std::string *path = g->getFirstPath() ; path!=NULL ; path = g->getNextPath())
			{
				assert(mResourcesByPath.find(*path) != mResourcesByPath.end());
				Resource *res = mResourcesByPath[*path];
				assert(res!=NULL);
				success &= res->load();
			}
		}

		Environment::instance()->enableFullScreenToggle();

		return success;
	}
	else
	{
		assert(false);

		return false;
	}
}
Ejemplo n.º 3
0
QObject *Scripting::Project::createResource( QObject *group, QObject *res )
{
    ResourceGroup *gr = qobject_cast<ResourceGroup*>( group );
    if ( gr == 0 ) {
        kDebug()<<"No group specified";
        return 0;
    }
    KPlato::ResourceGroup *g = project()->findResourceGroup( gr->kplatoResourceGroup()->id() );
    if ( g == 0 ) {
        kDebug()<<"Could not find group";
        return 0;
    }
    const Resource *rs = qobject_cast<Resource*>( res );
    if ( rs == 0 ) {
        kDebug()<<"No resource to copy from";
        return 0; // or create empty?
    }
    KPlato::Resource *r = project()->findResource( rs->kplatoResource()->id() );
    if ( r ) {
        kDebug()<<"Resource already exists";
        return 0;
    }
    r = new KPlato::Resource( rs->kplatoResource() );
    KPlato::Calendar *c = rs->kplatoResource()->calendar( true );
    if ( c ) {
        c = project()->calendar( c->id() );
    }
    r->setCalendar(c );
    project()->addResource( g, r );
    return resource( r );
}
Ejemplo n.º 4
0
void xSceneOpenDlg::OnFloderChanged()
{
    CListBox * listFloder = (CListBox *)GetDlgItem(IDC_SceneOpen_Floder);
    CListBox * listScene = (CListBox *)GetDlgItem(IDC_SceneOpen_Scene);

    while (listScene->GetCount())
        listScene->DeleteString(0);

    int isel = listFloder->GetCurSel();

    if (isel < 0)
        return ;

    CString strFloder;

    listFloder->GetText(isel, strFloder);

    ResourceGroup * rg = ResourceManager::Instance()->GetResourceGroup();

    Archive * ar = rg->GetArchive((LPCTSTR)strFloder);

    Archive::FileInfoVisitor v = ar->GetFileInfos();

    while (!v.eof())
    {
        const TString128 & filename = v.Cursor()->second.name;

        if (File::GetExternName(filename) == "scene")
        {
            listScene->AddString(filename.c_str());
        }

        ++v;
    }
}
void InsertProjectTester::testExistingTeamResourceRequest()
{
    Part pp(0);
    MainDocument part( &pp );
    pp.setDocument( &part );

    addCalendar( part );
    addResourceGroup( part );
    Resource *r = addResource( part );
    r->setName( "R1" );
    r->setType( Resource::Type_Team );
    ResourceGroup *tg = addResourceGroup( part );
    tg->setName( "TG" );
    Resource *t1 = addResource( part, tg );
    t1->setName( "T1" );
    r->addTeamMemberId( t1->id() );
    Resource *t2 = addResource( part, tg );
    t2->setName( "T2" );
    r->addTeamMemberId( t2->id() );
    addTask( part );
    addGroupRequest( part );
    addResourceRequest( part );

    QDomDocument doc = part.saveXML();

    Part pp2(0);
    MainDocument part2( &pp2 );
    pp2.setDocument( &part2 );

    Project &p2 = part2.getProject();
    part2.insertProject( part.getProject(), 0, 0 );
    ResourceRequest *rr = p2.childNode( 0 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QCOMPARE( rr->resource()->teamMembers().count(), 2 );
    QCOMPARE( rr->resource()->teamMembers().at( 0 ), t1 );
    QCOMPARE( rr->resource()->teamMembers().at( 1 ), t2 );

    KoXmlDocument xdoc;
    xdoc.setContent( doc.toString() );
    part.loadXML( xdoc, 0 );

    part2.insertProject( part.getProject(), 0, 0 );
    QCOMPARE( p2.numChildren(), 2 );

    QVERIFY( ! p2.childNode( 0 )->requests().isEmpty() );
    rr = p2.childNode( 0 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QCOMPARE( rr->resource()->teamMembers().count(), 2 );
    QCOMPARE( rr->resource()->teamMembers().at( 0 ), t1 );
    QCOMPARE( rr->resource()->teamMembers().at( 1 ), t2 );

    QVERIFY( ! p2.childNode( 1 )->requests().isEmpty() );
    rr = p2.childNode( 1 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QCOMPARE( rr->resource()->teamMembers().count(), 2 );
    QCOMPARE( rr->resource()->teamMembers().at( 0 ), t1 );
    QCOMPARE( rr->resource()->teamMembers().at( 1 ), t2 );
}
Ejemplo n.º 6
0
std::vector<std::string> recognize() {

	ABuffer auChan("auChan");		// waveform data 
	ABuffer feChan("feChan");		// features 
	ABuffer ansChan("ansChan");		// recognition output 

	ASource ain("AIn",&auChan);			// auChan connects source to coder 
	ACode acode("ACode",&auChan,&feChan); //feChan connects coder to reco 
	
	AHmms hset("HmmSet");	// create HMM set called HmmSet 
	ADict dict("ADict");	// create a dictionary called ADict 
	AGram gram("AGram");	// create a grammar called AGram 
	ARMan rman;				// create a resource manager 
	rman.StoreHMMs(&hset);	// store the resources in rman 
	rman.StoreDict(&dict); 
	rman.StoreGram(&gram); 
	
	ResourceGroup *group = rman.NewGroup("directions"); 
	group->AddHMMs(&hset); 
	group->AddDict(&dict); 
	group->AddGram(&gram); 
	ARec arec("ARec",&feChan,&ansChan,&rman); // create recogniser 
	
	ain.Start(); acode.Start(); arec.Start();
	
	arec.SendMessage("start()");
	ain.SendMessage("start()");

	// Waiting for processing to finish
	do
	{
		usleep(10000);
	}while(!auChan.IsEmpty() || !feChan.IsEmpty());
	
	// Get the results
	std::vector<std::string> result;
	while(!ansChan.IsEmpty())
	{
		APacket p = ansChan.GetPacket();
		if(p.GetKind() == PhrasePacket)
		{
			APhraseData *pd = (APhraseData *)p.GetData();
			result.push_back(pd->word);
		}
	}
	
	ain.SendMessage("stop()");
	acode.SendMessage("terminate()");
	arec.SendMessage("terminate()");
	ain.SendMessage("terminate()");
	
	// Wait for threads to finish
	acode.Join();
	arec.Join();
	ain.Join();
	
	return result;
}
Ejemplo n.º 7
0
void ResourceGroupManager::loadResourceGroup(const std::string& group)
{
    if (m_resources.find(group)==m_resources.end())
        m_resources.insert(std::pair<std::string, ResourceGroup*>(group, new ResourceGroup(group)));

    ResourceGroup *g = m_resources.at(group);
    for(boost::property_tree::ptree::value_type &v : m_ini.get_child(group))
        g->addPath(v.second.data());
}
ResourceGroup *InsertProjectTester::addResourceGroup( MainDocument &part )
{
    Project &p = part.getProject();
    ResourceGroup *g = new ResourceGroup();
    KUndo2Command *c = new AddResourceGroupCmd( &p, g );
    part.addCommand( c );
    QString s = QString( "G%1" ).arg( part.getProject().indexOf( g ) );
    g->setName( s );
    return g;
}
Ejemplo n.º 9
0
void ResourceGroupManager::addResourceLocation(const std::string& nom, const std::string& group)
{
    if (m_resources.find(group) == m_resources.end())
    {
        ResourceGroup *g = new ResourceGroup(group);
        g->addPath(nom);
        m_resources.insert(std::pair<std::string,ResourceGroup*>(group, g));
    }
    else
        m_resources.at(group)->addPath(nom);
}
Ejemplo n.º 10
0
static ResourceGroup *createWorkResources( Project &p, int count )
{
    ResourceGroup *g = new ResourceGroup();
    g->setName( "G1" );
    p.addResourceGroup( g );

    for ( int i = 0; i < count; ++i ) {
        Resource *r = new Resource();
        r->setName( QString( "R%1" ).arg( i + 1 ) );
        p.addResource( g, r );
    }
    return g;
}
void ResourceManager::load(const ResourceGroup& group)
{
    List<ResourcePtr> resources = group.resources();
    List<ResourcePtr>::iterator it = resources.begin();
    List<ResourcePtr>::const_iterator end = resources.end();

    for (; it != end; ++it)
    {
        ResourcePtr resource;
        Url url = resource->url();
        String filename = url.filename();

        if (!m_cache.exists(filename))
        {
            // TODO load in a thread
            m_cache.add(filename, resource);
        }

        else {
            resource = m_cache.get(filename);
        }

    }

    // TODO input->injectEvent...
}
Ejemplo n.º 12
0
void InsertProjectTester::testExistingRequiredResourceRequest()
{
    Part pp(0);
    MainDocument part( &pp );
    pp.setDocument( &part );

    addCalendar( part );
    addResourceGroup( part );
    Resource *r = addResource( part );
    ResourceGroup *g = addResourceGroup( part );
    g->setType( ResourceGroup::Type_Material );
    QList<Resource*> m; m << addResource( part, g );
    m.first()->setType( Resource::Type_Material );
    r->setRequiredIds( QStringList() << m.first()->id() );
    addTask( part );
    addGroupRequest( part );
    addResourceRequest( part );

    QDomDocument doc = part.saveXML();

    Project &p = part.getProject();
    Part pp2(0);
    MainDocument part2( &pp2 );
    pp2.setDocument( &part2 );
    part2.insertProject( p, 0, 0 );
    Project &p2 = part2.getProject();
    ResourceRequest *rr = p2.childNode( 0 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QVERIFY( ! rr->requiredResources().isEmpty() );
    QCOMPARE( rr->requiredResources().at( 0 ), m.first() );

    KoXmlDocument xdoc;
    xdoc.setContent( doc.toString() );
    part.loadXML( xdoc, 0 );

    part2.insertProject( part.getProject(), 0, 0 );
    rr = p2.childNode( 0 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QVERIFY( ! rr->requiredResources().isEmpty() );
    QCOMPARE( rr->requiredResources().at( 0 ), m.first() );

    rr = p2.childNode( 1 )->requests().find( p2.resourceGroupAt( 0 )->resourceAt( 0 ) );
    QVERIFY( rr );
    QVERIFY( ! rr->requiredResources().isEmpty() );
    QCOMPARE( rr->requiredResources().at( 0 ), m.first() );
}
Ejemplo n.º 13
0
///Разбор узла описания ресурсов
  void PrepareResourceNode (const ParseNode& decl)
  {
    const char* name = get<const char*> (decl, "name");
    
    if (!name)
      return;      
      
    resources.Add (name);
  }
Ejemplo n.º 14
0
void ResourceManager::unloadResourceGroup(const std::string &groupName)
{
	if (mResourceGroups.find(groupName) != mResourceGroups.end())
	{
		// disable full screen toggle while resource load/unload:
		Environment::instance()->disableFullScreenToggle();

		ResourceGroup *g = mResourceGroups[groupName];
		for (const std::string *path=g->getFirstPath() ; path!=NULL ; path=g->getNextPath())
		{
			Resource *res = mResourcesByPath[*path];
			assert(res!=NULL);
			res->release();
		}

		Environment::instance()->enableFullScreenToggle();
	}
	else
	{
		assert(false);
	}
}
Ejemplo n.º 15
0
// Prime the recogniser ready to process an utterance
void ARec::PrimeRecogniser()
{
   ResourceGroup *g;

   g = (grpName=="")?rmgr->MainGroup():rmgr->FindGroup(grpName);
   if (g == NULL){
      if (grpName=="") HRError(0,"ARec: cant find main resource group\n");
      else HRError(0,"ARec: cant find resource group %s\n",grpName.c_str());
      throw ATK_Error(11001);
   }
   Network *net = g->MakeNetwork();
   LModel *lm = g->MakeNGram();
   opMap.clear();   // forget all previously output packets
   StartRecognition(pri,net,lmScale,wordPen,prScale,ngScale,lm);
   SetPruningLevels(pri,maxActive,genBeam,wordBeam,nBeam,10.0);
   frameCount = 0; tact = 0;
   if (showRD){
      string gn = (grpName=="")?"main":grpName;
      string s = "Primed with "+  gn + "\n";
      HPostMessage(HThreadSelf(),s.c_str());
   }
}
Ejemplo n.º 16
0
BOOL xSceneOpenDlg::OnInitDialog()
{
    if (!CDialog::OnInitDialog())
        return FALSE;

    CListBox * list = (CListBox *)GetDlgItem(IDC_SceneOpen_Floder);

    ResourceGroup * rg = ResourceManager::Instance()->GetResourceGroup();

    ResourceGroup::ArchiveVisitor v = rg->GetArchives();

    int index = 0;
    while (!v.Endof())
    {
        const TString128 & floder = (*v.Cursor())->GetName();

        list->InsertString(index, floder.c_str());

        ++v;
    }

    return TRUE;
}
Ejemplo n.º 17
0
void ResourceModelTester::initTestCase()
{
    m_project = new Project();
    m_project->setName( "P1" );
    m_project->setId( m_project->uniqueNodeId() );
    m_project->registerNodeId( m_project );
    DateTime targetstart = DateTime( QDate::currentDate(), QTime(0,0,0) );
    DateTime targetend = DateTime( targetstart.addDays( 3 ) );
    m_project->setConstraintStartTime( targetstart );
    m_project->setConstraintEndTime( targetend);

    // standard worktime defines 8 hour day as default
    QVERIFY( m_project->standardWorktime() );
    QCOMPARE( m_project->standardWorktime()->day(), 8.0 );
    m_calendar = new Calendar( "Test" );
    m_calendar->setDefault( true );
    QTime t1( 9, 0, 0 );
    QTime t2 ( 17, 0, 0 );
    int length = t1.msecsTo( t2 );
    for ( int i=1; i <= 7; ++i ) {
        CalendarDay *d = m_calendar->weekday( i );
        d->setState( CalendarDay::Working );
        d->addInterval( t1, length );
    }
    m_project->addCalendar( m_calendar );


    ResourceGroup *g = new ResourceGroup();
    g->setName( "G1" );
    m_project->addResourceGroup( g );
    m_resource = new Resource();
    m_resource->setName( "R1" );
    m_resource->setCalendar( m_calendar );
    m_project->addResource( g, m_resource );

    m_task = m_project->createTask();
    m_task->setName( "T1" );
    m_project->addTask( m_task, m_project );
    m_task->estimate()->setUnit( Duration::Unit_h );
    m_task->estimate()->setExpectedEstimate( 8.0 );
    m_task->estimate()->setType( Estimate::Type_Effort );


    ResourceGroupRequest *gr = new ResourceGroupRequest( g );
    gr->addResourceRequest( new ResourceRequest( m_resource, 100 ) );
    m_task->addRequest( gr );

    m_model.setProject( m_project );

    QModelIndex idx;
    int rows = m_model.rowCount( idx );
    QCOMPARE( rows, 1 );
    idx = m_model.index( 0, 0, idx );
    QCOMPARE( g->name(), m_model.data( idx ).toString() );
    
    rows = m_model.rowCount( idx );
    QCOMPARE( rows, 1 );
    idx = m_model.index( 0, 0, idx );
    QCOMPARE( m_resource->name(), m_model.data( idx ).toString() );

    idx = m_model.parent( idx );
    QCOMPARE( g->name(), m_model.data( idx ).toString() );
}
Ejemplo n.º 18
0
int main(int argc, char *argv[])
{
   APacket p;

   try {

      // if (NCInitHTK("TRec.cfg",version)<SUCCESS){
      if (InitHTK(argc,argv,version)<SUCCESS){
         ReportErrors("Main",0); exit(-1);
      }
      printf("TRec: Basic Recogniser Test\n");
      ConfParam *cParm[MAXGLOBS];       /* config parameters */
      int numParm,i;
      char ngramFN[100],buf[100];
      ngramFN[0] = '\0';
      // Read configuration parms for ANGRAM to see if NGram used
      numParm = GetConfig("ANGRAM", TRUE, cParm, MAXGLOBS);
      if (numParm>0){
         if (GetConfStr(cParm,numParm,"NGRAMFILE",buf)) strcpy(ngramFN,buf);
      }
      printf("TRec: HTK initialised: %s\n",ngramFN);
      // Create Buffers
      ABuffer auChan("auChan");
      ABuffer feChan("feChan");
      ABuffer ansChan("ansChan");
      printf("TRec: Buffers initialised\n");
      // create a resource manager
      ARMan rman;

      // Create Audio Source and Coder
      ASource ain("AIn",&auChan);
      ACode acode("ACode",&auChan,&feChan);
      ARec  arec("ARec",&feChan,&ansChan,&rman,0);
      printf("TRec: Components initialised\n");

      // create global resources
      AHmms hset("HmmSet"); // load info in config
      ADict dict("ADict");
      AGram gram("AGram");
      rman.StoreHMMs(&hset);
      rman.StoreDict(&dict);
      rman.StoreGram(&gram);

      ResourceGroup *main = rman.NewGroup("main");
      main->AddHMMs(&hset);
      main->AddDict(&dict);
      main->AddGram(&gram);

      if (strlen(ngramFN)>0){
         ANGram * ngram  = new ANGram("ANGram");
         rman.StoreNGram(ngram);
         main->AddNGram(ngram);
      }

#ifdef WITHMON
      // Create Monitor and Start it
      AMonitor amon;
      amon.AddComponent(&ain);
      amon.AddComponent(&acode);
      amon.AddComponent(&arec);
      amon.Start();
#endif

      // Start components executing
      ain.Start();
      acode.Start();
      arec.Start();
      arec.SendMessage("usegrp(main)");
      arec.SendMessage("start()");

      Boolean terminated = FALSE;
      while (!terminated) {
         APacket p = ansChan.GetPacket();
         if (p.GetKind() == StringPacket){
            AStringData * sd = (AStringData *)p.GetData();
            if (sd->data.find("TERMINATED") != string::npos) {
               terminated = TRUE;
            }
         }
         p.Show();
      }
      // Shutdown
      printf("Waiting for ain\n");
      ain.Join();
      printf("Waiting for acode\n");
      acode.Join();
      printf("Waiting for arec\n");
      arec.Join();
#ifdef WITHMON
      printf("Waiting for monitor\n");
      amon.Terminate();
      HJoinMonitor();
#endif
      return 0;
   }
   catch (ATK_Error e){ ReportErrors("ATK",e.i); return 0;}
   catch (HTK_Error e){ ReportErrors("HTK",e.i); return 0;}
}
Ejemplo n.º 19
0
void ProjectTester::startNotEarlier()
{
    Project project;
    project.setId( project.uniqueNodeId() );
    project.registerNodeId( &project );
    project.setConstraintStartTime( DateTime::fromString( "2011-01-01T00:00:00" ) );
    project.setConstraintEndTime( DateTime::fromString( "2011-01-12T00:00:00" ) );

    createCalendar( project );

    ResourceGroup *g = createWorkResources( project, 1 );

    Task *t = project.createTask();
    t->setName( "T1" );
    project.addTask( t, &project );
    t->estimate()->setUnit( Duration::Unit_h );
    t->estimate()->setExpectedEstimate( 1.0 );
    t->estimate()->setType( Estimate::Type_Effort );
    createRequest( t, g->resourceAt( 0 ) );

    t->setConstraint( Node::StartNotEarlier );
    t->setConstraintStartTime( DateTime::fromString( "2011-01-02T11:00:00" ) );

    ScheduleManager *sm = project.createScheduleManager( "Test Plan" );
    project.addScheduleManager( sm );

    QString s = "Calculate forward, Task: StartNotEarlier ------------------------------";
    qDebug()<<s;
    Debug::print( t, s );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );

    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );

    s = "Calculate forward, 2 Tasks ------------------------------";
    qDebug()<<s;

    Task *t2 = project.createTask();
    t2->setName( "T2" );
    project.addTask( t2, &project );
    t2->estimate()->setUnit( Duration::Unit_d );
    t2->estimate()->setExpectedEstimate( 7.0 );
    t2->estimate()->setType( Estimate::Type_Effort );

    createRequest( t2, g->resourceAt( 0 ) );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );
    Debug::print( t2, s );

    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );

    s = "Calculate backward, 2 Tasks ------------------------------";
    qDebug()<<s;

    sm->setSchedulingDirection( true );

    {
        KPlatoRCPSPlugin rcps( 0, QVariantList() );
        rcps.calculate( project, sm, true/*nothread*/ );
    }

    Debug::print( &project, s );
    Debug::print( t, s );
    Debug::print( t2, s );
    Debug::printSchedulingLog( *sm, s );
    
    QVERIFY( t->startTime() >= t->constraintStartTime() );
    QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 1, 0 ) );
}
int cTumkwsaSink::setupATK()
{
  try {

  // ------- load HTK config......
  int argc=3;
  const char* argv[3] = {"ASR","-C",NULL};
  if (configfile != NULL)
    argv[2]=configfile;
  else
    argv[2]="asr.cfg";

  if (InitHTK(argc,(char**)argv,version,TRUE)<SUCCESS){
    COMP_ERR("failed to initialise ASR subsystem!");
  }

  ConfParam *cParm[MAXGLOBS];       /* config parameters */
  int numParm,i;
  char ngramFN[100],buf[100];
  ngramFN[0] = '\0';

  // Read configuration parms for ANGRAM to see if NGram used
  numParm = GetConfig((char *)"ANGRAM", TRUE, cParm, MAXGLOBS);
  if (numParm>0){
    if (GetConfStr(cParm,numParm,(char *)"NGRAMFILE",buf)) strcpy(ngramFN,buf);
  }

  // Create Buffers
  feChan = new ABuffer("feChan");
  ansChan = new ABuffer("ansChan");

  // create a resource manager
  rman = new ARMan();

  arec = new ARec("ARec",feChan,ansChan,rman,0);

  // create global resources
  hset = new AHmms("HmmSet"); // load info in config
  dict = new ADict("ADict");
  gram = new AGram("AGram");
  rman->StoreHMMs(hset);
  rman->StoreDict(dict);
  rman->StoreGram(gram);

  ResourceGroup *main = rman->NewGroup("main");
  main->AddHMMs(hset);
  main->AddDict(dict);
  main->AddGram(gram);

  if (strlen(ngramFN)>0){
    ANGram * ngram  = new ANGram("ANGram");
    rman->StoreNGram(ngram);
    main->AddNGram(ngram);
  }

  arec->Start();
  arec->SendMessage("usegrp(main)");
  arec->SendMessage("start()");

  terminated = FALSE;

  }
  catch (ATK_Error e){ ReportErrors((char*)"ATK",e.i); return 0;}
  catch (HTK_Error e){ ReportErrors((char*)"HTK",e.i); return 0;}

  HThread t = HCreateThread("resultThread", 0, HPRIO_NORM, ATKresultThreadRunner, this);
  ATKresThread = t->thread;
  //smileThreadCreate( ATKresThread, ATKresultThreadRunner, this );

  atkIsSetup=1;
  
  return 1;
}