void *memcpy_new(t_symbol *s, long n, long m) { t_memcpy *x; x = (t_memcpy *)object_alloc(memcpy_class); if(x) { x->s_proxy = proxy_new(x,1,&x->s_inletNumber); x->s_outlet = outlet_new(x, 0L); strcpy(x->s_hotbuf, ""); strcpy(x->s_coldbuf, "<none>"); if(strlen(s->s_name) != 0){ strcpy(x->s_coldbuf, s->s_name); } x->s_numChar = 4096; if(m){ n = n <= 1 ? 1 : n; n = n >= 4096 ? 4096 : n; x->s_numChar = n; // x->s_numChar = CLIP(m, 1, 4096); } x->s_mode = 0; if(n == 0){ x->s_mode = 0; }else if(n == 1){ x->s_mode = 1; } // x->s_mode = CLIP(n, 0, 1); } return (x); }
void *multipre_new(t_symbol *s, short ac, t_atom *av) { t_multipre *x; int i; t_atom *pre; x = (t_multipre *)object_alloc(multipre_class); if(x) { x->p_post = (t_atom *)malloc(2 * MAXSIZE * sizeof(t_atom)); pre = x->p_pre; if(ac == 0){ x->p_headlength = 1; atom_setsym(x->p_pre+0, ps_set); }else{ for(i=ac-1;i>0;i--){ x->p_proxy[i] = proxy_new(x,i,&x->p_inletNumber); } x->p_headlength = ac; for (i=0; i<ac; ++i) *pre++ = *av++; } x->p_outlet = outlet_new(x,0L); x->p_numoutlets = ac-1; x->p_bodylength = 1; } return x; }
int main(int argc, char *argv[]) { _cleanup_(proxy_freep) Proxy *p = NULL; int r; log_set_target(LOG_TARGET_JOURNAL_OR_KMSG); log_parse_environment(); log_open(); r = parse_argv(argc, argv); if (r <= 0) goto finish; r = proxy_new(&p, STDIN_FILENO, STDOUT_FILENO, arg_address); if (r < 0) goto finish; r = rename_service(p->destination_bus, p->local_bus); if (r < 0) log_debug_errno(r, "Failed to rename process: %m"); r = proxy_run(p); finish: sd_notify(false, "STOPPING=1\n" "STATUS=Shutting down."); free(arg_address); return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
OpPtr OpNew(SymbolPtr msg, AtomCount argc, AtomPtr argv) { OpPtr self; TTValue v; TTErr err; self = OpPtr(object_alloc(sOpClass)); if (self) { object_obex_store((void*)self, _sym_dumpout, (ObjectPtr)outlet_new(self, NULL)); // dumpout self->outlet = outlet_new(self, "audio.connect"); self->inlet = proxy_new(self, 1, &self->inletnum); v.setSize(2); v.set(0, TT("operator")); v.set(1, TTUInt32(1)); // we set it up with 1 inlet, and later modify to 2 inlets if the connection is made err = TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&self->audioGraphObject, v); if (!self->audioGraphObject->getUnitGenerator()) { object_error(SELF, "cannot load Jamoma DSP object"); return NULL; } attr_args_process(self, argc, argv); } return self; }
void *dict_route_new(t_symbol *s, long argc, t_atom *argv) { t_dict_route *x = (t_dict_route *)object_alloc(s_dict_route_class); long attrstart = attr_args_offset(argc, argv); t_dictionary *d = NULL; // dictionary with our 'prototype' specified by args to this object if (x) { x->outlet_nomatch = outlet_new(x, "dictionary"); x->outlet_dict = outlet_new(x, "dictionary"); x->inlet_tomatch = proxy_new(x, 1, &x->inletnum); if (attrstart) dictobj_dictionaryfromatoms(&d, attrstart, argv); if (!d) { char errorstring[256]; t_max_err err; err = dictobj_dictionaryfromstring(&d, "{ \"schema\" : \"*\" }", true, errorstring); if (err) error("dict.route: %s", errorstring); } x->schema_dict = dictobj_register(d, &x->schema_name); attr_args_process(x, argc, argv); } return x; }
static void parse_properties(GDBusClient *client, const char *path, const char *interface, DBusMessageIter *iter) { GDBusProxy *proxy; if (g_str_equal(interface, DBUS_INTERFACE_INTROSPECTABLE) == TRUE) return; if (g_str_equal(interface, DBUS_INTERFACE_PROPERTIES) == TRUE) return; proxy = proxy_lookup(client, path, interface); if (proxy) { update_properties(proxy, iter, FALSE); return; } proxy = proxy_new(client, path, interface); if (proxy == NULL) return; update_properties(proxy, iter, FALSE); if (client->proxy_added) client->proxy_added(proxy, client->user_data); client->proxy_list = g_list_append(client->proxy_list, proxy); }
static void *run_client(void *userdata) { _cleanup_(client_context_freep) ClientContext *c = userdata; _cleanup_(proxy_freep) Proxy *p = NULL; char comm[16]; int r; r = proxy_new(&p, c->fd, c->fd, arg_address); c->fd = -1; if (r < 0) goto exit; /* set comm to "p$PIDu$UID" and suffix with '*' if truncated */ r = snprintf(comm, sizeof(comm), "p" PID_FMT "u" UID_FMT, p->local_creds.pid, p->local_creds.uid); if (r >= (ssize_t)sizeof(comm)) comm[sizeof(comm) - 2] = '*'; (void) prctl(PR_SET_NAME, comm); r = proxy_set_policy(p, c->policy, arg_configuration); if (r < 0) goto exit; r = proxy_hello_policy(p, c->bus_uid); if (r < 0) goto exit; r = proxy_run(p); exit: return NULL; }
// Create void *out_new(t_symbol *s, long argc, t_atom *argv) { long attrstart = attr_args_offset(argc, argv); // support normal arguments t_out *x = (t_out *)object_alloc(out_class); short i; if(x){ x->dumpout = outlet_new(x, NULL); object_obex_store((void *)x, jps_dumpout, (object *)x->dumpout); // setup the dumpout x->numOutputs = 1; x->attr_preview = 0; x->preview_object = NULL; x->attr_bypass = 0; x->attr_mute = 0; x->attr_mix = 100; // Assume 100%, so that processed signal is passed through if @has_mix is false if(attrstart > 0){ int argument = atom_getlong(argv); x->numOutputs = TTClip(argument, 1, MAX_NUM_CHANNELS); } #ifdef JCOM_OUT_TILDE if(x->numOutputs > 0) dsp_setup((t_pxobject *)x, x->numOutputs); // Create Object and Inlets else dsp_setup((t_pxobject *)x, 1); // Create Object and Inlets x->common.ob.z_misc = Z_NO_INPLACE | Z_PUT_LAST; // Z_PUT_LAST so that thispoly~ gets it's message properly? for(i=0; i < (x->numOutputs); i++) outlet_new((t_pxobject *)x, "signal"); // Create a signal Outlet x->clock = clock_new(x, (method)update_meters); x->clock_is_set = 0; TTObjectInstantiate(kTTSym_audiosignal, &x->audioIn, x->numOutputs); TTObjectInstantiate(kTTSym_audiosignal, &x->audioOut, x->numOutputs); TTObjectInstantiate(kTTSym_audiosignal, &x->audioTemp, x->numOutputs); TTObjectInstantiate(kTTSym_audiosignal, &x->zeroSignal, x->numOutputs); TTObjectInstantiate(TT("crossfade"), &x->xfade, x->numOutputs); x->xfade->setAttributeValue(TT("position"), 1.0); TTObjectInstantiate(TT("gain"), &x->gain, x->numOutputs); TTObjectInstantiate(TT("ramp"), &x->ramp_gain, x->numOutputs); TTObjectInstantiate(TT("ramp"), &x->ramp_xfade, x->numOutputs); // out_alloc(x, sys_getblksize()); // allocates the vectors for the audio signals x->gain->setAttributeValue(TT("linearGain"), 1.0); #else for(i=x->numOutputs-1; i >= 1; i--) x->inlet[i] = proxy_new(x, i, 0L); for(i=x->numOutputs-1; i >= 0; i--) x->outlet[i] = outlet_new(x, 0L); #endif jcom_core_subscriber_new_common(&x->common, jps__jcom_out__, jps_subscribe_out); jcom_core_subscriber_setcustomsubscribe_method(&x->common, &out_subscribe); attr_args_process(x, argc, argv); // handle attribute args jcom_core_subscriber_subscribe((t_jcom_core_subscriber_common*)x); } return (x); // Return the pointer }
void *wlet_new(t_symbol *dir, t_symbol *wlet, long k, long n)//, long stride) { t_wlet *x; x = (t_wlet *)newobject(wlet_class); // create a new instance of this object dsp_setup((t_pxobject *)x, 1); //x->w_proxy[2] = proxy_new(x, 3, &x->w_inletNumber); x->w_proxy[1] = proxy_new(x, 2, &x->w_inletNumber); x->w_proxy[0] = proxy_new(x, 1, &x->w_inletNumber); outlet_new((t_pxobject *)x, "signal"); outlet_new((t_pxobject *)x, "signal"); if(!strcmp(dir->s_name, "forward")) x->w_direction = forward; else if(!strcmp(dir->s_name, "backward")) x->w_direction = backward; else{ error("wavelet: direction must be forward or backward--bailing out"); return 0; } if(n){ if(sys_getblksize() < n) x->w_waveletLength = sys_getblksize(); else x->w_waveletLength = n; }else{ if(sys_getblksize() < 512) x->w_waveletLength = sys_getblksize(); else x->w_waveletLength = 512; } //if(stride) x->w_stride = stride; //else x->w_stride = 1; x->w_tmp = (double *)calloc(x->w_waveletLength, sizeof(double)); //x->w_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, (k) ? k : 4); x->w_workspace = gsl_wavelet_workspace_alloc(x->w_waveletLength); if(k) x->w_k = (size_t)k; else x->w_k = 4; wlet_setupWavelet(x, (!strcmp(wlet->s_name, " ")) ? wlet : gensym("daubechies"), x->w_k); return(x); }
ObjectPtr wrappedClass_new(SymbolPtr name, AtomCount argc, AtomPtr argv) { WrappedClass* wrappedMaxClass = NULL; WrappedInstancePtr self = NULL; TTValue v; TTErr err = kTTErrNone; TTUInt8 numInputs = 1; TTUInt8 numOutputs = 1; long attrstart = attr_args_offset(argc, argv); // support normal arguments // Find the WrappedClass hashtab_lookup(wrappedMaxClasses, name, (ObjectPtr*)&wrappedMaxClass); // If the WrappedClass has a validity check defined, then call the validity check function. // If it returns an error, then we won't instantiate the object. if (wrappedMaxClass) { if (wrappedMaxClass->validityCheck) err = wrappedMaxClass->validityCheck(wrappedMaxClass->validityCheckArgument); else err = kTTErrNone; } else err = kTTErrGeneric; if (!err) self = (WrappedInstancePtr)object_alloc(wrappedMaxClass->maxClass); if (self){ if (wrappedMaxClass->options && !wrappedMaxClass->options->lookup(TT("argumentDefinesNumInlets"), v)) { long argumentOffsetToDefineTheNumberOfInlets = v; if ((attrstart-argumentOffsetToDefineTheNumberOfInlets > 0) && argv+argumentOffsetToDefineTheNumberOfInlets) numInputs = atom_getlong(argv+argumentOffsetToDefineTheNumberOfInlets); } for (TTUInt16 i=numInputs-1; i>0; i--) self->inlets[i-1] = proxy_new(self, i, NULL); object_obex_store((void*)self, _sym_dumpout, (object*)outlet_new(self, NULL)); // dumpout if (wrappedMaxClass->options && !wrappedMaxClass->options->lookup(TT("argumentDefinesNumOutlets"), v)) { long argumentOffsetToDefineTheNumberOfOutlets = v; if ((attrstart-argumentOffsetToDefineTheNumberOfOutlets > 0) && argv+argumentOffsetToDefineTheNumberOfOutlets) numOutputs = atom_getlong(argv+argumentOffsetToDefineTheNumberOfOutlets); } for (TTInt16 i=numOutputs-1; i>=0; i--) self->audioGraphOutlets[i] = outlet_new(self, "audio.connect"); self->wrappedClassDefinition = wrappedMaxClass; v.setSize(3); v.set(0, wrappedMaxClass->ttClassName); v.set(1, numInputs); v.set(2, numOutputs); err = TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&self->audioGraphObject, v); attr_args_process(self, argc, argv); } return ObjectPtr(self); }
void *oscroute_new(t_symbol *s, long argc, t_atom *argv) { short i; t_oscroute *x = (t_oscroute *)object_alloc(oscroute_class); if (x) { x->outlet_overflow = outlet_new(x, 0); // overflow outlet //object_obex_store((void *)x, _sym_dumpout, (object *)x->outlet_overflow); // dumpout x->num_args = argc; if (argc < 1) { // if no args are provided, we provide a way to set the arg using an inlet x->num_args = 1; x->arguments[0] = gensym("/nil"); x->arglen[0] = 4; x->proxy_inlet = proxy_new(x, 1, 0L); x->outlets[0] = outlet_new(x, 0); } else { x->proxy_inlet = 0; for (i=x->num_args-1; i >= 0; i--) { x->outlets[i] = outlet_new(x, 0); // Create Outlet switch(argv[i].a_type) { case A_SYM: //atom_setsym(&(x->arguments[i]), atom_getsym(argv+i)); x->arguments[i] = atom_getsym(argv+i); x->arglen[i] = strlen(atom_getsym(argv+i)->s_name); break; case A_LONG: { char tempstr[256]; snprintf(tempstr, 256, "%ld", atom_getlong(argv+i)); x->arguments[i] = gensym(tempstr); x->arglen[i] = strlen(tempstr); } break; case A_FLOAT: { char tempstr[256]; snprintf(tempstr, 256, "%f", atom_getfloat(argv+i)); x->arguments[i] = gensym(tempstr); x->arglen[i] = strlen(tempstr); } break; default: error("jcom.oscroute - invalid arguments - all args must be symbols"); } } } //attr_args_process(x, argc, argv); //handle attribute args } return (x); // return the pointer to our new instantiation }
/**************************************************************** * Constructor */ void *strstr_new(t_symbol *sym, long argc, t_atom *argv) { t_strstr *x = NULL; x = (t_strstr *)object_alloc(strstr_class); if (x == NULL) { error("strstr: Allocation failed."); return NULL; } // Set inlets, outlets, and proxy x->inl_proxy_ind = 0; x->inl_proxy = proxy_new((t_object *)x, 1, &x->inl_proxy_ind); x->outl_int = intout((t_object *)x); // Set the left string buffer x->i_dstr1 = dstr_new(); // First argument: right string buffer x->i_dstr2 = dstr_new(); if ((argc >= 1) && (attr_args_offset((short)argc, argv) >= 1)) { x->i_dstr2 = str_cat_atom(x, x->i_dstr2, argv); } // Test the string buffers if (DSTR_IS_NULL(x->i_dstr1) || DSTR_IS_NULL(x->i_dstr2)) { object_error((t_object *)x, "Allocation error."); strstr_free(x); return NULL; } // Second argument: mode long mode = 0; if ((argc >= 2) && (attr_args_offset((short)argc, argv) >= 2)) { if ((atom_gettype(argv + 1) == A_LONG) && (atom_getlong(argv + 1) >= 0) && (atom_getlong(argv + 1) <= 1)) { mode = (long)atom_getlong(argv + 1); } else { object_error((t_object *)x, "Arg 2: Mode: 0 or 1 expected"); } } object_attr_setlong(x, gensym("mode"), mode); // Set the float precision object_attr_setlong(x, gensym("fprecision"), 6); // Set the remaining variables x->o_pos = -1; // Process the attributes attr_args_process(x, (short)argc, argv); return x; }
void *odowncast_new(t_symbol *msg, short argc, t_atom *argv) { t_odowncast *x; if((x = (t_odowncast *)object_alloc(odowncast_class))){ x->outlet = outlet_new((t_object *)x, "FullPacket"); x->proxy = proxy_new((t_object *)x, 1, &(x->inlet)); x->timetag_address = NULL; x->doubles = x->ints = x->bundles = x->timetags = 1; attr_args_process(x, argc, argv); } return x; }
/*------------------------------------ spaceballCreate ---*/ static void * spaceballCreate(t_symbol * addOrDelta, const long pollRate) { SpaceballData * xx = static_cast<SpaceballData *>(object_alloc(gClass)); if (xx) { xx->fPollClock = NULL; xx->fPollQueue = NULL; xx->fBufferPos = xx->fDelayCounter = 0; xx->fButtons = 0; xx->fChunkPulseSent = xx->fInited = xx->fNextCharEscaped = xx->fOutputBlocked = false; xx->fReset = xx->fSkipping = xx->fModeDelta = xx->fStopping = false; if ((0 > pollRate) || (MAX_POLL_RATE < pollRate)) { LOG_ERROR_2(xx, OUTPUT_PREFIX "invalid polling rate (%ld) for device", pollRate) xx->fPollRate = SER_SAMPLE_RATE; } else { xx->fPollRate = (pollRate ? pollRate : SER_SAMPLE_RATE); } /* Set up our connections and private data */ xx->fProxy = proxy_new(xx, 1L, &xx->fInletNumber); xx->fErrorBangOut = static_cast<t_outlet *>(bangout(xx)); xx->fChunkSendOut = static_cast<t_outlet *>(bangout(xx)); xx->fDataSendOut = static_cast<t_outlet *>(outlet_new(xx, 0L)); /* list, int */ xx->fSampleBangOut = static_cast<t_outlet *>(bangout(xx)); xx->fDataOut = static_cast<t_outlet *>(outlet_new(xx, 0L)); /* normally just a list */ xx->fPollClock = MAKE_CLOCK(xx, spaceballProcessClock); xx->fPollQueue = MAKE_QELEM(xx, spaceballProcessQueue); if (! (xx->fProxy && xx->fErrorBangOut && xx->fDataSendOut && xx->fChunkSendOut && xx->fSampleBangOut && xx->fDataOut && xx->fPollClock && xx->fPollQueue)) { LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port or clock for device") freeobject(reinterpret_cast<t_object *>(xx)); xx = NULL; } else { xx->fResetDuration = ((2000 + xx->fPollRate - 1) / xx->fPollRate); xx->fInitDuration = ((1000 + xx->fPollRate - 1) / xx->fPollRate); if (addOrDelta != gEmptySymbol) { spaceballSetMode(xx, addOrDelta); } clock_delay(xx->fPollClock, xx->fPollRate); } } return xx; } // spaceballCreate
void *prime_new(long value) { t_prime *x; x = (t_prime *)object_alloc(this_class); // create the new instance and return a pointer to it if (x) { object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->p_out = intout(x); //Create the outlet x->right_inlet = proxy_new(x, 1, 0L); x->p_value = value; //Init the prime value } return(x); // must return a pointer to the new instance }
proxy_t* proxy_init(const char *ip, short port, const char *uri, req_t *parent) { DBGTRACE(); proxy_t *p; int fd; int res; struct sockaddr_in addr; socklen_t addr_len; fd = socket (AF_INET, SOCK_STREAM, 0); memset (&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); res = inet_aton(ip, &addr.sin_addr); if (res < 0) { perror("inet_aton"); return NULL; } addr_len = sizeof(struct sockaddr_in); res = fcntl(fd, F_SETFL, O_NONBLOCK); if (res < 0) { perror("fcntl"); return NULL; } int rc; rc = connect(fd, (struct sockaddr *)&addr, addr_len); if (rc < 0 && errno != EINPROGRESS) { perror("failed to connect"); close(fd); return NULL; } p = proxy_new(); p->parent = parent; p->ip = ip; p->port = port; p->uri = uri; p->conn = conn_new(); p->conn->type = OUTBOUND_HTTP; p->conn->data = p; p->conn->fd = fd; p->conn->write_handler = proxy_connect_handler; p->conn->close_handler = proxy_close_handler; p->conn->want_write = 1; p->conn->timeout = 30; conn_register_events(p->conn); return p; }
void *rotate_new(t_symbol *s, long argc, t_atom *argv) { #if NOCP t_rotate *x = (t_rotate *)object_alloc(rotate_class); #else t_rotate *x = (t_rotate *)object_alloc(rotate_class);; #endif if(x){ object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->inlets[2] = proxy_new(x, 3, &x->inletnum); x->inlets[1] = proxy_new(x, 2, &x->inletnum); x->inlets[0] = proxy_new(x, 1, &x->inletnum); x->outlets[2] = outlet_new(x, 0); x->outlets[1] = outlet_new(x, 0); x->outlets[0] = outlet_new(x, 0); x->numsets = 1; attr_args_process(x,argc,argv); //handle attribute args } return x; }
void *cs_new(Symbol *msg, long argc, Atom *argv) { t_cs *x; // Declare an object (based on our struct) x = (t_cs *)object_alloc(this_class); // Create object, store pointer to it (get 1 inlet free) if (x) { object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->out3 = intout(x); x->out2 = intout(x); x->out1 = intout(x); // Create the outlet x->inlets[0] = proxy_new(x, 2, 0L); // Create inlet 3 x->inlets[1] = proxy_new(x, 1, 0L); // Create inlet 2 // Set defaults x->attr_autopack = 1; x->attr_mode = ps_rgb2hsl; x->attr_outputtype = ps_split; x->val1 = x->val2 = x->val3 = 1; attr_args_process(x,argc,argv); //handle attribute args } return(x); // must return a pointer to the new instance }
void *slide_new(t_symbol *s, short argc, t_atom *argv) { t_slide *x; short i; x = (t_slide *)object_alloc(slide_class); if(x) { x->s_outlist = (t_atom *)malloc(MAXSIZE * sizeof(t_atom)); x->s_deltaflag = (long *)malloc(MAXSIZE * sizeof(long)); x->s_in = (double *)malloc(MAXSIZE * sizeof(double)); x->s_out = (double *)malloc(MAXSIZE * sizeof(double)); x->s_proxy = proxy_new(x,1,&x->s_inletNumber); x->s_outlet2 = intout(x); x->s_outlet = outlet_new(x, 0L); for(i=0;i<MAXSIZE;i++){ x->s_outlist[i].a_type = A_FLOAT; // x->s_deltaflag[i] = 0; } x->s_thresh = 0.00001; // defaults x->s_slide = 1.0; // defaults if(argc > 0){ if ((argv[0].a_type == A_LONG)&&(argv[0].a_w.w_long > 0)){ x->s_slide = 1/(double)argv[0].a_w.w_long; // look at first argument } else if ((argv[0].a_type == A_FLOAT)&&(argv[0].a_w.w_float > 0)){ x->s_slide = 1/(double)argv[0].a_w.w_float; } else x->s_slide = 1.0; } // default value if(argc > 1){ if((argv[1].a_type == A_LONG) && (argv[1].a_w.w_long >= 0.000001) && (argv[1].a_w.w_long <= 1.0)){ x->s_thresh = (double)argv[1].a_w.w_long; // look at first argument } else if ((argv[1].a_type == A_FLOAT)&& (argv[1].a_w.w_long >= 0.000001) && (argv[1].a_w.w_long <= 1.0)){ x->s_thresh = (double)argv[1].a_w.w_float; } else x->s_thresh = 0.00001; // default value } x->s_stopflag = 1; } return x; }
ProxyDlg::ProxyDlg(const ProxyItemList &list, const QStringList &methods, const QString &def, QWidget *parent) : QDialog(parent) { setAttribute(Qt::WA_DeleteOnClose); d = new Private; setupUi(this); setWindowTitle(CAP(caption())); setModal(QApplication::activeModalWidget() ? true: false); d->list = list; d->last = -1; d->pe_settings = new ProxyEdit(gb_prop); replaceWidget(lb_proxyedit, d->pe_settings); d->pe_settings->fixTabbing(cb_type, pb_close); hookEdit(); connect(pb_new, SIGNAL(clicked()), SLOT(proxy_new())); connect(pb_remove, SIGNAL(clicked()), SLOT(proxy_remove())); connect(pb_save, SIGNAL(clicked()), SLOT(doSave())); connect(pb_close, SIGNAL(clicked()), SLOT(reject())); gb_prop->setEnabled(false); pb_remove->setEnabled(false); pb_save->setDefault(true); cb_type->insertStringList(methods); connect(cb_type, SIGNAL(activated(int)), SLOT(cb_activated(int))); int defIdx = -1; int i = 0; for(ProxyItemList::ConstIterator it = d->list.begin(); it != d->list.end(); ++it) { lbx_proxy->insertItem((*it).name); if ((*it).id == def) defIdx= i; ++i; } if(!list.isEmpty()) { if(defIdx < 0) defIdx = 0; lbx_proxy->setCurrentItem(defIdx); selectCurrent(); } cb_type->setWhatsThis( tr("If you require a proxy server to connect, select the type of proxy here.") + " " + tr("Consult your network administrator if necessary.")); // TODO: whatsthis for name }
/*------------------------------------ senseXCreate ---*/ static void * senseXCreate(const long onDelay, const long offDelay) { SenseXData * xx = static_cast<SenseXData *>(object_alloc(gClass)); if (xx) { long actOffDelay; long actOnDelay; if (0 > offDelay) { LOG_ERROR_1(xx, OUTPUT_PREFIX "off delay is not valid") actOffDelay = 0; } else { actOffDelay = offDelay; } if (0 > onDelay) { LOG_ERROR_1(xx, OUTPUT_PREFIX "on delay is not valid") actOnDelay = 0; } else { actOnDelay = onDelay; } xx->fOffDelay = actOffDelay; xx->fOnDelay = actOnDelay; xx->fStopping = false; xx->fPollClock = MAKE_CLOCK(xx, senseXProcessClock); xx->fPollQueue = MAKE_QELEM(xx, senseXProcessQueue); xx->fResultOut = static_cast<t_outlet *>(intout(xx)); xx->fProxy = proxy_new(xx, 1L, &xx->fInletNumber); xx->fState = kAwaitingFirstMessage; if (! (xx->fResultOut && xx->fProxy)) { LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port for object") freeobject(reinterpret_cast<t_object *>(xx)); xx = NULL; } } return xx; } // senseXCreate
// Our object's new instance routine. This will be called each time our object is // instantiated and is where we will set up our inlets and outlets, and any state // variables we may have. void *ppn_new(void) { t_ppn *x; if(x = (t_ppn *)object_alloc(ppn_class)) { // Set up a proxy to handle two inlets. The second argument to proxy_new() is an id // that will allow us to identify this particular proxy, and the third argument // is a pointer to a location where the id value of the inlet will be written. // Don't access the value of x->in directly--instead use proxy_getinlet() to // determine the inlet number. x->proxy = proxy_new((t_object *)x, 1, &x->in); x->outlet = outlet_new(x, NULL); x->delay_time_ms = deltime; return x; } return NULL; }
void *change_new(void) { short i; t_change *x; // Declare an object (based on our struct) x = (t_change *)object_alloc(change_class); // Create object, store pointer to it (get 1 inlet free) if(x){ object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->change_Out[1] = bangout(x); // Create Outlets (right to left order) x->change_Out[0] = outlet_new(x, 0); // ... // Create Right Inlet (inletnum is 1) x->inlet_right = proxy_new(x, 1, 0L); // Init the temp storage for(i=0; i<MAX_LIST_SIZE; i++) atom_setsym(&(x->last_input_list[i]), _sym_nothing); } x->last_input_type = msg_new; // Makes sure that first message receive goes to left outlet return (x); // Return pointer to our instance }
GDBusProxy *g_dbus_proxy_new(GDBusClient *client, const char *path, const char *interface) { GDBusProxy *proxy; if (client == NULL) return NULL; proxy = proxy_lookup(client, path, interface); if (proxy) return g_dbus_proxy_ref(proxy); proxy = proxy_new(client, path, interface); if (proxy == NULL) return NULL; get_all_properties(proxy); return g_dbus_proxy_ref(proxy); }
void* testequals_new(t_symbol *s, long argc, t_atom *argv) { t_testequals *x = (t_testequals*)object_alloc(s_testequals_class); long attrstart = attr_args_offset((short)argc, argv); if (attrstart) x->x_operand = atom_getfloat(argv); x->x_outlet = outlet_new(x, NULL); x->x_inlet = proxy_new(x, 1, NULL); x->x_tolerance = 2; #ifdef C74_X64 x->x_single_precision = false; #else x->x_single_precision = true; #endif attr_args_process(x, (short)argc, argv); autocolorbox((t_object*)x); return x; }
void *sieve_new(t_symbol *msg, short argc, t_atom *argv) { t_sieve *x; long attrstart; long argument = 0; attrstart = attr_args_offset(argc, argv); if (attrstart && argv) argument = atom_getlong(argv); // support a normal int argument for bwc x = (t_sieve *)object_alloc(s_sieve_class);;// create the new instance and return a pointer to it if(x){ object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->value = argument; x->outlet = intout(x); x->right_inlet = proxy_new(x, 1, 0L); attr_args_process(x,argc,argv); //handle attribute args } return(x); }
void *pack_new(t_symbol *msg, short argc, t_atom *argv) { t_pack *x; short i; x = (t_pack *)object_alloc(pack_class);; if(x){ object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout x->my_outlet = outlet_new(x,0L); // create an outlet (this is my outlet) and store the pointer in the struct if(argc==0) // If no arguments x->mylistlen = 2; // default number of list elements else{ if(argv[0].a_type == A_LONG) // If first arg is a long x->mylistlen = argv[0].a_w.w_long; // number of list elements is based on first argument else x->mylistlen = 2; // else use the default } // Create Inlets (inlets beyond the default (num 0) inlet for (i = x->mylistlen-1; i >= 1; i--) x->myproxies[i] = proxy_new(x, i, &x->inletnum); // Set defaults before I go loading in values from the attributes for(i=0; i<MAX_LIST_LENGTH; i++) x->triggerlist[i] = 0; // inlets do not trigger output, except... x->triggerlist[0] = 1; // first inlet triggers output x->triggerlistlen = 1; // handle attribute args attr_args_process(x,argc,argv); // Initialize the internal list for (i=0; i< MAX_LIST_LENGTH; i++) atom_setlong(x->mylist+i, 0); } return (x); // return the pointer to our new instantiation }
void *buddy_new(long num) { t_buddy *x; short i; t_member *m; x = (t_buddy *)object_alloc(buddy_class); if (num < 2) num = 2; x->b_num = num; x->b_id = 0; x->b_mem = (t_member *)sysmem_newptr((unsigned short)(num * sizeof(t_member))); for (i=num-1,m = x->b_mem + i; i >= 0; i--,m--) { if (i) m->m_proxy = proxy_new(x,(long)i,&x->b_id); m->m_out = outlet_new(x,0L); m->m_on = 0; m->m_argc = 1; atom_setlong(&m->m_argv[0], 0); } return x; }
void *buddy_new(long num) { t_buddy *x; short i; t_member *m; x = (t_buddy *)newobject(buddy_class); if (num < 2) num = 2; x->b_num = num; x->b_id = 0; x->b_mem = (t_member *)getbytes((unsigned short)(num * sizeof(t_member))); for (i=num-1,m = x->b_mem + i; i >= 0; i--,m--) { if (i) m->m_proxy = proxy_new(x,(long)i,&x->b_id); m->m_out = outlet_new(x,0L); m->m_on = 0; m->m_argc = 1; m->m_argv[0].a_type = A_LONG; m->m_argv[0].a_w.w_long = 0; } return x; }
void *memset_new(t_symbol *s, long n) { t_memset *x; x = (t_memset *)object_alloc(memset_class); if(x) { x->s_proxy = proxy_new(x,1,&x->s_inletNumber); x->s_outlet = outlet_new(x,0L); strcpy(x->s_hotbuf, ""); if(strlen(s->s_name) != 0){ strcpy(x->s_coldbuf, s->s_name); }else{ strcpy(x->s_coldbuf, "/"); } if(n){ x->s_mode = 0; }else{ x->s_mode = 0; } } return (x); }