static void init_feed(FEED *feed) { feed->sock = 0; feed->converter = NULL; feed->src_data_in = NULL; feed->src_data_size = 0; init_unit(&(feed->unit)); feed->thread_id = 0; feed->running = 0; feed->cbuf = NULL; init_fader(&(feed->unit.fader), 1.0); return; }
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; }
int main(void) { init_pwm(); init_fader(); //teste HSV Methode //Rot (0,255,X): // V= 50, 16% duty und 12mA // V=100, 30% duty und 23mA // V=255, 71% duty und 597mA //runHSV(0,4095,4095); //rot //runHSV(1320,4095,4095); //grün //runHSV(2640,4095,4095); //blau runHSV(0,0,1000); //weiß //teste Slot Animation /*HSV_anim anim1 = {0,4095,4095,+3960,0,0,500}; runSlot(anim1);*/ //teste Program Animation /*newProgram(); //FLASH HSV_anim anim2 = {0,4095,0,0,0,3000,500}; setSlot(anim2); HSV_anim anim3 = {1320,4095,0,0,0,3000,500}; setSlot(anim3); HSV_anim anim4 = {2640,4095,0,0,0,3000,500}; setSlot(anim4); runProgram();*/ /*newProgram(); //pulsierendes Weiß HSV_anim anim2 = {0,0,10,0,0,1010,100}; setSlot(anim2); HSV_anim anim3 = {0,0,1010,0,0,-1000,100}; setSlot(anim3); runProgram();*/ sei(); while(1){ faderThread(); } }
void alsa_iface(lua_State *lstate) { init_fader(&(unit.fader), 1.0); add_method(lstate, "cards", cards); add_method(lstate, "new", new_obj); return; }