[PD-dev] how to output list with selector
Christof Ressi
info at christofressi.com
Thu Sep 21 10:23:13 CEST 2023
> I've tried `t_symbol *s = atom_gensym("foo")`
Where do you see "atom_gensym"? I guess you confused it with
"atom_getsymbol" (which tries to interpret an atom as a symbol).
> but how do I get a pointer to a "foo" symbol?
gensym("foo")
On 21.09.2023 10:19, Alexandros Drymonitis wrote:
>
> That's what I need, indeed. I can't get my head around how to create
> the selector symbol though. The second argument to outlet_anything is
> a pointer to a t_symbol, but how do I get a pointer to a "foo" symbol?
>
> I've tried `t_symbol *s = atom_gensym("foo")` but I get a warning the
> atom_gensym() expects a const t_atom *a, and when I pass `s` to the
> second argument of outlet_anything and print the output, I get "???"
> instead of "foo". This might be obvious, but it's quite complicated to me.
>
> On 9/21/23 10:00, Christof Ressi wrote:
>>
>>> `outlet_list(x->outlist, &s_list, 3, x->outlist)`;
>> You accidentally passed the outlet itself as the last argument
>> (t_atom *) to outlet_list().
>>
>> Unfortunately, C only offers minimal type checking and happily casts
>> between unrelated pointer types. (With C++ this wouldn't compile in
>> the first place.) However, although this is legal in C, all major
>> compilers issue a warning ("-Wincompatible-pointer-types" on
>> GCC/Clang resp. "warning C4133" with MSVC).
>>
>> Always check the compiler outputs for warnings!||
>>
>> ||
>>
>> ---
>>
>> Now to your actual question:
>>
>>> I'm trying to output a list of values with a selector. For example,
>>> "foo 1 2".
>> The function you're looking for is outlet_anything().
>>
>> BTW, this is covered in the externals-howto:
>> https://github.com/pure-data/externals-howto#outlet-anything
>>
>> Christof
>>
>> On 21.09.2023 08:20, Alexandros Drymonitis wrote:
>>> I'm trying to output a list of values with a selector. For example,
>>> "foo 1 2". I though of creating a vector of t_atom, where a_type of
>>> the first element would be A_SYMBOL, and the other two would be
>>> A_FLOAT, and after a list outlet is created in the new method like
>>> this:
>>>
>>> `x->outlist = outlet_new(x->x_obj, &s_list);`
>>>
>>> I can output the list with a bang like this:
>>>
>>> `outlet_list(x->outlist, &s_list, 3, x->outlist)`;
>>>
>>> But Pd complains with this error:
>>>
>>> ```
>>> print: listconsistency check failed: atom_string
>>> consistency check failed: atom_string
>>> consistency check failed: atom_string
>>> ```
>>>
>>> What I would like, is to get the output of the object and route it
>>> with [route foo]. How do I go about this?
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Pd-dev mailing list
>>> Pd-dev at lists.iem.at
>>> https://lists.puredata.info/listinfo/pd-dev
>>
>> _______________________________________________
>> Pd-dev mailing list
>> Pd-dev at lists.iem.at
>> https://lists.puredata.info/listinfo/pd-dev
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20230921/c917ec7b/attachment.htm>
More information about the Pd-dev
mailing list