예제 #1
0
파일: ida.cpp 프로젝트: Audifire/mtasa-blue
void RawIDA::ProcessInputQueues()
{
	bool finished = (m_channelsFinished == size_t(m_threshold));
	unsigned int i;

	while (finished ? m_channelsReady > 0 : m_channelsReady == size_t(m_threshold))
	{
		m_channelsReady = 0;
		for (i=0; i<size_t(m_threshold); i++)
		{
			MessageQueue &queue = m_inputQueues[i];
			queue.GetWord32(m_y[i]);

			if (finished)
				m_channelsReady += queue.AnyRetrievable();
			else
				m_channelsReady += queue.NumberOfMessages() > 0 || queue.MaxRetrievable() >= 4;
		}

		for (i=0; (unsigned int)i<m_outputChannelIds.size(); i++)
		{
			if (m_outputToInput[i] != size_t(m_threshold))
				m_outputQueues[i].PutWord32(m_y[m_outputToInput[i]]);
			else if (m_v[i].size() == size_t(m_threshold))
				m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(field, m_y.begin(), m_v[i].begin(), m_threshold));
			else
			{
				m_u.resize(m_threshold);
				PrepareBulkPolynomialInterpolationAt(field, m_u.begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold);
				m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(field, m_y.begin(), m_u.begin(), m_threshold));
			}
		}
	}

	if (m_outputChannelIds.size() > 0 && m_outputQueues[0].AnyRetrievable())
		FlushOutputQueues();

	if (finished)
	{
		OutputMessageEnds();

		m_channelsReady = 0;
		m_channelsFinished = 0;
		m_v.clear();

		std::vector<MessageQueue> inputQueues;
		std::vector<word32> inputChannelIds;

		inputQueues.swap(m_inputQueues);
		inputChannelIds.swap(m_inputChannelIds);
		m_inputChannelMap.clear();
		m_lastMapPosition = m_inputChannelMap.end();

		for (i=0; i<size_t(m_threshold); i++)
		{
			inputQueues[i].GetNextMessage();
			inputQueues[i].TransferAllTo(*AttachedTransformation(), WordToString(inputChannelIds[i]));
		}
	}
}
예제 #2
0
파일: ida.cpp 프로젝트: Audifire/mtasa-blue
void RawIDA::AddOutputChannel(word32 channelId)
{
	m_outputChannelIds.push_back(channelId);
	m_outputChannelIdStrings.push_back(WordToString(channelId));
	m_outputQueues.push_back(ByteQueue());
	if (m_inputChannelIds.size() == size_t(m_threshold))
		ComputeV((unsigned int)m_outputChannelIds.size() - 1);
}
// Function name	: CDisplaySettingsDlg::SaveSettings
// Description	    : Saves the current settings to the ini files
// Return type		: void 
void CDisplaySettingsDlg::SaveSettings( )
{
	TDisplayMode *mode = NULL;
	int sel = m_cboResolutions.GetCurSel();
	if( sel >= 0 )
	{
		mode = (TDisplayMode *)m_cboResolutions.GetItemData(sel);		
	}

	if( mode == NULL )return;

	WritePrivateProfileString("Display Settings" , "Width"  , WordToString( mode->dwWidth  ) , m_strIniFile );
	WritePrivateProfileString("Display Settings" , "Height" , WordToString( mode->dwHeight ) , m_strIniFile );
	WritePrivateProfileString("Display Settings" , "BPP"    , WordToString( mode->dwBpp    ) , m_strIniFile );

	WritePrivateProfileString("Display Settings" , "Fullscreen"    , WordToString( m_bFullscreen ) , m_strIniFile );
	WritePrivateProfileString("Display Settings" , "DontAskAgain"  , WordToString( m_bDontAskAgain ) , m_strIniFile );
}
예제 #4
0
static void InvalidInstn(PHONEME_TAB *ph, int instn)
{//====================================================
	fprintf(stderr,"Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(ph->mnemonic));
}
예제 #5
0
파일: main.c 프로젝트: LuccoJ/z80sim
void PrintNumber(unsigned int n) {
	char Temp[16];
	WordToString(n, Temp);
	ConsoleWrite(Temp);
}
예제 #6
0
static void GetPhonemeName(PHONEME_TAB *ph, wxString& string)
{//==========================================================
	string = wxString(WordToString(ph->mnemonic),wxConvLocal);
}
예제 #7
0
파일: vowelchart.cpp 프로젝트: Zekom/espeak
void MakeVowelLists(void)
{//======================
// For each phoneme table, make a list of its vowels and their
// formant frequencies (f1,f2,f3) for use by VowelChart()

	int table;
	int ix;
	int phcode;
	PHONEME_TAB *ph;
	FILE *f;
	FILE *f_prog_log;
	SPECT_SEQ *seq;
	SPECT_SEQK *seqk;
	frame_t *frame;
	int n_prog_log;
	int vowelfmt_ix;
	int colour;
	int voice_found;
	PHONEME_PROG_LOG *prog_log_table;
	PHONEME_PROG_LOG *found_prog;
	PHONEME_PROG_LOG this_prog;
	char dirname[sizeof(path_source)+20];
	char fname[sizeof(dirname)+40];
	char save_voice_name[80];

	strcpy(save_voice_name,voice_name2);

	sprintf(fname,"%s%s",path_source,"compile_prog_log");
	if((f_prog_log = fopen(fname,"rb")) == NULL)
	{
		wxLogError(_T("Can't read 'compile_prog_log;"));
		return;
	}
	ix = GetFileLength(fname);
	prog_log_table = (PHONEME_PROG_LOG *)malloc(ix);
	if(prog_log_table == NULL)
	{
		fclose(f_prog_log);
		return;
	}
	ix = fread(prog_log_table, 1, ix, f_prog_log);
	fclose(f_prog_log);
	n_prog_log = ix / sizeof(PHONEME_PROG_LOG);

	progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables);

	sprintf(dirname,"%s%s",path_source,"vowelcharts");
	mkdir(dirname,S_IRWXU | S_IRGRP | S_IROTH);

	sprintf(fname,"%s/vowel_log",dirname);

	for(table=0; table<n_phoneme_tables; table++)
	{
		sprintf(fname,"%s/%s",dirname,phoneme_tab_list[table].name);
		if((f = fopen(fname,"w"))==NULL) continue;

		progress->Update(table);

		// select the phoneme table by name
//		if(SetVoiceByName(phoneme_tab_list[table].name) != 0) continue;
		if(SelectPhonemeTableName(phoneme_tab_list[table].name) < 0)
		{
			fclose(f);
			continue;
		}

		voice_found = 0;
		if((LoadVoice(phoneme_tab_list[table].name, 0) != NULL) && (translator->data_dictrules != NULL))
		{
			voice_found = 1;
			FindPhonemesUsed();
		}

		// phoneme table is terminated by a phoneme with no name (=0)
		for(phcode=1; phcode < n_phoneme_tab; phcode++)
		{
			ph = phoneme_tab[phcode];

			if((ph==NULL) || (ph->type != phVOWEL) || (ph->program == 0))
				continue;

			if(voice_found && (phoneme_tab_flags[phcode] & 3) == 0)
			{
				continue;   // inherited, and not used 
			}

			// find the size of this program
			this_prog.addr = ph->program;
			found_prog = (PHONEME_PROG_LOG *)bsearch((void *)&this_prog, (void *)prog_log_table, n_prog_log, sizeof(PHONEME_PROG_LOG), (int(*)(const void *,const void *))prog_log_sorter);

			FindVowelFmt(ph->program, found_prog->length);

			for(vowelfmt_ix=0; vowelfmt_ix < n_vowelfmt_addr; vowelfmt_ix++)
			{
				ix = vowelfmt_addr[vowelfmt_ix];

				seq = (SPECT_SEQ *)(&phondata_ptr[ix]);
				seqk = (SPECT_SEQK *)seq;
	
				if(seq->frame[0].frflags & FRFLAG_KLATT)
					frame = &seqk->frame[1];
				else
					frame = (frame_t *)&seq->frame[1];

				if((n_vowelfmt_addr - vowelfmt_ix) == 1)
					colour = 0;
				else
					colour = 1;

				fprintf(f,"%s\t %d %3d %4d %4d",WordToString(ph->mnemonic), colour,
						frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]);
	
				if(seq->frame[0].frflags & FRFLAG_KLATT)
					frame = &seqk->frame[seqk->n_frames-1];
				else
					frame = (frame_t *)&seq->frame[seq->n_frames-1];
				fprintf(f,"   %3d %4d %4d\n",frame->ffreq[1],frame->ffreq[2],frame->ffreq[3]);
			}
		}
		fclose(f);

		VowelChart(1,fname);  // draw the vowel chart
	}
	free(prog_log_table);
	LoadVoice(voice_name2,0);  // reset the original phoneme table
	delete progress;
	LoadVoiceVariant(save_voice_name,0);
}