本文整理汇总了C++中CEngine::start方法的典型用法代码示例。如果您正苦于以下问题:C++ CEngine::start方法的具体用法?C++ CEngine::start怎么用?C++ CEngine::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEngine
的用法示例。
在下文中一共展示了CEngine::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
fftw_in_data[i][0] = 0.0; fftw_in[i][1] = 0.0;
}
window = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * FRAME_SIZE*WINDOW_SIZE);
for ( int i = 0 ; i < FRAME_SIZE*WINDOW_SIZE ; i++ ) {
window[i][0] = 0.54 - 0.46 * cos((2.0*PI*((double)i))/((double)(FRAME_SIZE*WINDOW_SIZE-1)));
}
fftw_plan_data = fftw_plan_dft_1d(FRAME_SIZE*WINDOW_SIZE, fftw_in_data, fftw_out, FFTW_FORWARD, FFTW_MEASURE);
for ( int i = 0 ; i < DATA_SIZE ; i++ ) {
data_array[i] = 0.0;
}
pos = 0;
/* tell the JACK server to call `process()' whenever
there is work to be done.
*/
jack_set_process_callback (client, process, 0);
/* tell the JACK server to call `jack_shutdown()' if
it ever shuts down, either entirely, or if it
just decides to stop calling us.
*/
jack_on_shutdown (client, jack_shutdown, 0);
/* display the current sample rate.
*/
//printf ("engine sample rate: %" PRIu32 "\n", jack_get_sample_rate (client));
/* create two ports */
input_port = jack_port_register (client, "input", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
output_port = jack_port_register (client, "output", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
/* tell the JACK server that we are ready to roll */
if (jack_activate (client)) {
fprintf (stderr, "cannot activate client");
return 1;
}
/* connect the ports. Note: you can't do this before
the client is activated, because we can't allow
connections to be made to clients that aren't
running.
*/
//if ((ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput)) == NULL) {
if ((ports = jack_get_ports (client, NULL, NULL, JackPortIsOutput)) == NULL) {
fprintf(stderr, "Cannot find any physical capture ports\n");
exit(1);
}
int j = 0;
while ( ports[j] != NULL ) {
if (jack_connect (client, ports[j], jack_port_name (input_port))) {
fprintf (stderr, "cannot connect input ports\n");
}
j++;
}
free (ports);
/*if ((ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsInput)) == NULL) {
fprintf(stderr, "Cannot find any physical playback ports\n");
exit(1);
}*/
/*if (jack_connect (client, jack_port_name (output_port), ports[i])) {
fprintf (stderr, "cannot connect output ports\n");
}*/
CEngine *myengine = new CEngine(argc, argv);
myengine->start();
//free (ports);
free(data_array);
for ( int i = 0 ; i < WINDOW_SIZE; i++ ) {
fftw_destroy_plan(fftw_p[i]);
}
free(fftw_p);
fftw_free(fftw_in); fftw_free(fftw_out);
for ( int i = 0 ; i < BINS ; i++ ) {
free(height_map[i]);
}
free(height_map);
jack_client_close (client);
return 0 ;
}