示例#1
0
void sfx::generate_melee_sound( tripoint source, tripoint target, bool hit, bool targ_mon,
                                  std::string material ) {
    // If creating a new thread for each invocation is to much, we have to consider a thread
    // pool or maybe a single thread that works continuously, but that requires a queue or similar
    // to coordinate its work.
    std::thread the_thread( sound_thread( source, target, hit, targ_mon, material ) );
    the_thread.detach();
}
示例#2
0
int main() {
	int  play_buf_size = 44000;
	const unsigned int freq=44000;
	ALshort *input_audio[freq];
	ALshort *output_audio[freq];
 	std::thread sound_thread(WorkWithSound,"Hello",std::ref(input_audio),std::ref(output_audio));
 	sound_thread.detach();
	int fori=0;	
	for(;;)
	{
 	    for(int copy=0; copy<play_buf_size; copy++) output_audio[copy] = input_audio[copy];
	    std::ofstream myfile;
	    myfile.open ("debug2.txt");//std::ios::app
	    myfile << input_audio << std::endl;
	    myfile.close();
	    std::cout<<input_audio<<std::endl;
	//std::cout<<1;
	//strncpy(output_audio,input_audio,freq);
	fori++;
	}
}