void widget_effect_active(GuiWidget *widget) { if (widget->fx == NULL) effects_init(widget); widget->fx->hover = true; widget->fx->timer_id = timer_add_event(FRAME_RATE, bounce_squish_effect, widget->fx); }
void afxEffectVector::ev_init(afxChoreographer* chor, afxEffectList& effects, bool on_server, bool will_stop, F32 time_factor, F32 phrase_dur, S32 group_index) { this->on_server = on_server; this->phrase_dur = phrase_dur; fx_v = new Vector<afxEffectWrapper*>; effects_init(chor, effects, will_stop, time_factor, group_index); fx_v2 = new Vector<afxEffectWrapper*>(fx_v->size()); }
static int mod_host_init(jack_client_t* client, int socket_port) { #ifdef HAVE_FFTW335 /* Make fftw thread-safe */ fftw_make_planner_thread_safe(); fftwf_make_planner_thread_safe(); #endif /* Setup the protocol */ protocol_add_command(EFFECT_ADD, effects_add_cb); protocol_add_command(EFFECT_REMOVE, effects_remove_cb); protocol_add_command(EFFECT_PRESET_LOAD, effects_preset_load_cb); protocol_add_command(EFFECT_PRESET_SAVE, effects_preset_save_cb); protocol_add_command(EFFECT_PRESET_SHOW, effects_preset_show_cb); protocol_add_command(EFFECT_CONNECT, effects_connect_cb); protocol_add_command(EFFECT_DISCONNECT, effects_disconnect_cb); protocol_add_command(EFFECT_BYPASS, effects_bypass_cb); protocol_add_command(EFFECT_PARAM_SET, effects_set_param_cb); protocol_add_command(EFFECT_PARAM_GET, effects_get_param_cb); protocol_add_command(EFFECT_PARAM_MON, effects_monitor_param_cb); protocol_add_command(MONITOR_ADDR_SET, monitor_addr_set_cb); protocol_add_command(MIDI_LEARN, midi_learn_cb); protocol_add_command(MIDI_MAP, midi_map_cb); protocol_add_command(MIDI_UNMAP, midi_unmap_cb); protocol_add_command(CPU_LOAD, cpu_load_cb); protocol_add_command(LOAD_COMMANDS, load_cb); protocol_add_command(SAVE_COMMANDS, save_cb); protocol_add_command(BUNDLE_ADD, bundle_add); protocol_add_command(BUNDLE_REMOVE, bundle_remove); /* skip help and quit for internal client */ if (client == NULL) { protocol_add_command(HELP, help_cb); protocol_add_command(QUIT, quit_cb); } /* Startup the effects */ if (effects_init(client)) return -1; /* Setup the socket */ if (socket_start(socket_port, SOCKET_MSG_BUFFER_SIZE) < 0) return -1; socket_set_receive_cb(protocol_parse); return 0; }
void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effects, bool will_stop, F32 time_factor, S32 group_index, const afxGroupTimingData* group_timing) { afxConstraintMgr* cons_mgr = chor->getConstraintMgr(); for (S32 i = 0; i < effects.size(); i++) { if (dynamic_cast<afxEffectGroupData*>(effects[i])) { afxEffectGroupData* eg = (afxEffectGroupData*)effects[i]; if (eg->getSubstitutionCount() > 0) { // clone the datablock and perform substitutions afxEffectGroupData* orig_db = eg; eg = new afxEffectGroupData(*orig_db, true); orig_db->performSubstitutions(eg, chor, group_index); } if (eg->group_enabled) { if (eg->assign_idx) { for (S32 j = 0; j < eg->group_count; j++) effects_init(chor, eg->fx_list, will_stop, time_factor, j+eg->idx_offset, &eg->timing); } else { for (S32 j = 0; j < eg->group_count; j++) effects_init(chor, eg->fx_list, will_stop, time_factor, group_index, &eg->timing); } } if (eg->isTempClone()) delete eg; } else if (dynamic_cast<afxEffectWrapperData*>(effects[i])) { afxEffectWrapperData* ewd = (afxEffectWrapperData*)effects[i]; if (ewd->getSubstitutionCount() > 0) { // clone the ewd and perform substitutions afxEffectWrapperData* orig_db = ewd; ewd = new afxEffectWrapperData(*orig_db, true); orig_db->performSubstitutions(ewd, chor, group_index); } if (ewd->effect_enabled) { static afxEffectTimingData inherited_timing; bool use_inherited_timing = false; if (ewd->inherit_timing != 0) { if (group_timing) { inherited_timing = ewd->ewd_timing; if ((ewd->inherit_timing & afxEffectDefs::TIMING_DELAY) != 0) inherited_timing.delay = group_timing->delay; if ((ewd->inherit_timing & afxEffectDefs::TIMING_LIFETIME) != 0) inherited_timing.lifetime = group_timing->lifetime; if ((ewd->inherit_timing & afxEffectDefs::TIMING_FADE_IN) != 0) inherited_timing.fade_in_time = group_timing->fade_in_time; if ((ewd->inherit_timing & afxEffectDefs::TIMING_FADE_OUT) != 0) inherited_timing.fade_out_time = group_timing->fade_out_time; } else { Con::warnf("afxEffectVector::effects_init() -- %s::inheritGroupTiming is non-zero but wrapper is not in a group."); } } const afxEffectTimingData& timing = (use_inherited_timing) ? inherited_timing : ewd->ewd_timing; if ( (will_stop || !ewd->requiresStop(timing)) && (chor->testRanking(ewd->ranking_range.low, ewd->ranking_range.high)) && (chor->testLevelOfDetail(ewd->lod_range.low, ewd->lod_range.high)) && (ewd->testExecConditions(chor->getExecConditions())) ) { afxEffectWrapper* effect; effect = afxEffectWrapper::ew_create(chor, ewd, cons_mgr, time_factor, group_index); if (effect) fx_v->push_back(effect); } } else { if (ewd->isTempClone()) delete ewd; } } } }
int main(int argc, char **argv) { int verbose, socket_port, interactive; /* Command line options */ struct arg_lit *_verbose = arg_lit0("v", "verbose,debug", "verbose messages"); struct arg_int *_socket = arg_int0("p", "socket-port", "<port>", "socket port definition"); struct arg_lit *_interactive = arg_lit0("i", "interactive", "interactive mode"); struct arg_lit *_help = arg_lit0("h", "help", "print this help and exit"); struct arg_end *_end = arg_end(20); void *argtable[] = {_verbose, _socket, _interactive, _help, _end}; if (arg_nullcheck(argtable)) { fprintf(stderr, "argtable error: insufficient memory\n"); exit(EXIT_FAILURE); } /* Default value of command line arguments */ _socket->ival[0] = SOCKET_DEFAULT_PORT; /* Run the argument parser */ if (arg_parse(argc, argv, argtable) == 0) { if (_help->count > 0) { fprintf(stdout, "Usage: %s", argv[0]); arg_print_syntax(stdout, argtable, "\n"); arg_print_glossary(stdout, argtable, " %-30s %s\n"); exit(EXIT_SUCCESS); } verbose = _verbose->count; socket_port = _socket->ival[0]; interactive = _interactive->count; } else { arg_print_errors(stderr, _end, argv[0]); exit(EXIT_FAILURE); } arg_freetable(argtable, sizeof(argtable)/sizeof(argtable[0])); /* If verbose or interactive, don't fork */ if (!verbose && !interactive) { int pid; pid = fork(); if (pid != 0) { printf("Forking... child PID: %d\n", pid); FILE *fd; fd = fopen(PID_FILE, "w"); if (fd == NULL) { fprintf(stderr, "can't open PID File\n"); } else { fprintf(fd, "%d\n", pid); fclose(fd); } exit(EXIT_SUCCESS); } } /* Setup the protocol */ protocol_add_command(EFFECT_ADD, effects_add_cb); protocol_add_command(EFFECT_REMOVE, effects_remove_cb); protocol_add_command(EFFECT_CONNECT, effects_connect_cb); protocol_add_command(EFFECT_DISCONNECT, effects_disconnect_cb); protocol_add_command(EFFECT_BYPASS, effects_bypass_cb); protocol_add_command(EFFECT_PARAM_SET, effects_set_param_cb); protocol_add_command(EFFECT_PARAM_GET, effects_get_param_cb); protocol_add_command(EFFECT_PARAM_MON, effects_monitor_param_cb); protocol_add_command(MONITOR_ADDR_SET, monitor_addr_set_cb); protocol_add_command(LOAD_COMMANDS, load_cb); protocol_add_command(SAVE_COMMANDS, save_cb); protocol_add_command(HELP, help_cb); protocol_add_command(QUIT, quit_cb); /* Startup the effects */ if (effects_init()) return -1; /* Setup the socket */ if (socket_start(socket_port, SOCKET_MSG_BUFFER_SIZE) < 0) { exit(EXIT_FAILURE); } socket_set_receive_cb(protocol_parse); /* Interactice mode */ if (interactive) interactive_mode(); /* Verbose */ protocol_verbose(verbose); while (1) socket_run(); protocol_remove_commands(); socket_finish(); effects_finish(); return 0; }