コード例 #1
0
ファイル: sine.c プロジェクト: kronocharia/RTDSPlab
/********************************** Main routine ************************************/
void main()
{

	// initialize board and the audio port
	init_hardware();
	sine_init();
    // Loop endlessley generating a sine wave 
   while(1)
    {
 		// Calculate next sample
 		sample = sinegen();		
     	/* Send a sample to the audio port if it is ready to transmit.
           Note: DSK6713_AIC23_write() returns false if the port if is not ready */

        //  send to LEFT channel (poll until ready)
        while (!DSK6713_AIC23_write(H_Codec, ((Int32)(sample * L_Gain))))
        {};
		// send same sample to RIGHT channel (poll until ready)
        while (!DSK6713_AIC23_write(H_Codec, ((Int32)(sample * R_Gain))))
        {};
        
		// Set the sampling frequency. This function updates the frequency only if it 
		// has changed. Frequency set must be one of the supported sampling freq.
		set_samp_freq(&sampling_freq, Config, &H_Codec);
	
	}

}
コード例 #2
0
ファイル: local.c プロジェクト: AkiraShirase/audacity
void localinit(void)
{
    falloc_init();
/*    probe_init(true);*/
    sound_init();
#ifdef CMTSTUFF
    seqext_init();
#endif
    sine_init();
    stk_init();
}
コード例 #3
0
/********************************** Main routine ************************************/
void main(){      

 
	// initialize board and the audio port
  init_hardware();
	
  /* initialize hardware interrupts */
  init_HWI();
  
  sine_init();
  	 		
  /* loop indefinitely, waiting for interrupts */  					
  while(1) {}
  
}
コード例 #4
0
ファイル: gen.c プロジェクト: pmyadlowsky/mash
static int new_obj(lua_State *lstate) {
	GEN *gen;
	lua_Number duration, gain;
	char gentype[64];
	duration = -1.0;
	gain = 1.0;
	strcpy(gentype, lua_tostring(lstate, -2));
	lua_remove(lstate, -2);
	getnumber(lstate, "duration", &duration);
	getnumber(lstate, "gain", &gain);
	gen = (GEN *)malloc(sizeof(GEN));
	gen->data = NULL;
	gen->init = NULL;
	gen->generate = NULL;
	gen->phase = 0.0;
	if (strcmp(gentype, "fm") == 0) {
		fm_init(lstate, gen);
		gen->generate = fm_generate;
		}
	else if (strcmp(gentype, "sine") == 0) {
		sine_init(lstate, gen);
		gen->generate = sine_generate;
		}
	else if (strcmp(gentype, "white") == 0) {
		gen->generate = white_generate;
		}
	lua_pop(lstate, 1);
	lua_newtable(lstate);
	init_fader(&(gen->unit.fader), gain);
	gen->running = 0;
	lua_pushstring(lstate, "intern");
	lua_pushlightuserdata(lstate, (void *)gen);
	lua_settable(lstate, -3);
	add_method(lstate, "play", gen_play);
	add_fader_methods(lstate);
	add_method(lstate, "stop", gen_stop);
	gen->final_frame = duration * jack_sr;
	gen->pos = 0;
	return 1;
	}