Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector Operator initialization #160

Open
scblakely opened this issue Aug 11, 2020 · 3 comments
Open

Vector Operator initialization #160

scblakely opened this issue Aug 11, 2020 · 3 comments
Assignees
Labels

Comments

@scblakely
Copy link

When I tried to use a vector operator, I was having issues with there being no outlets defined.
I think the issue is with this :

template\<class min_class_type\>
void min_dsp64_io(minwrap\<min_class_type\>\* self, const short\* count) {
   int i = 0;

    while (i < self->m_min_object.inlets().size()) {
        self->m_min_object.inlets()[i]->update_signal_connection(count[i] != 0);
        ++i;
    }
    while (i < self->m_min_object.outlets().size()) {
        self->m_min_object.outlets()[i - self->m_min_object.inlets().size()]->update_signal_connection(count[i] != 0);
        ++i;
    }
}

After incrementing for the inlets,

while (i < self->m_min_object.outlets().size())

never executes.

I suspect the intent was

template<class min_class_type>
void min_dsp64_io(minwrap<min_class_type>\* self, const short\* count) {
    int i = 0;

    while (i < self->m_min_object.inlets().size()) {
        self->m_min_object.inlets()[i]->update_signal_connection(count[i] != 0);
        ++i;
    }
    while (i - self->m_min_object.inlets().size() < self->m_min_object.outlets().size()) {
        self->m_min_object.outlets()[i - self->m_min_object.inlets().size()]->update_signal_connection(count[i] != 0);
        ++i;
    }
}

or maybe

template<class min_class_type>
void min_dsp64_io(minwrap<min_class_type>* self, const short* count) {
    int i = 0;

    while (i < self->m_min_object.inlets().size()) {
        self->m_min_object.inlets()[i]->update_signal_connection(count[i] != 0);
        ++i;
    }
    i = 0;
    while (i < self->m_min_object.outlets().size()) {
        self->m_min_object.outlets()[i]->update_signal_connection(count[i + m_min_object.inlets().size()] != 0);
        ++i;
    }
}
@robtherich robtherich added the bug label Jan 21, 2021
@x37v x37v self-assigned this Jan 22, 2021
@x37v
Copy link
Contributor

x37v commented Jan 22, 2021

@scblakely I'm planning to look into this, I'm wondering if you can provide a small code example that shows the problem that you're seeing?

@scblakely
Copy link
Author

Basically, if you define inputs and outputs for your object, you ht this issue

class sitool_tilde : public object<sitool_tilde>, public vector_operator<> {
public:
    MIN_DESCRIPTION	{"example"};
    MIN_TAGS		{"utilities"};
    MIN_AUTHOR		{"Simon Blakely"};
    MIN_RELATED		{""};

    long rb_sampleRate;
    long vectorSize;
    long sampleChannels;
    long maxvector;

    float** m_input;


    size_t m_blockSize;
    size_t m_reserve;
    size_t m_minfill;

    float** m_scratch;

    int m_sampleRate;
    size_t m_channels;

    int channels = 1;
    float ratio = 1;

    fifo<number>* in_fifo[2];
    fifo<number>* out_fifo[2];

    inlet<>  audio_in_0 { this, "(signal) audio in channel 0", "signal" };
    inlet<>  audio_in_1 { this, "(signal) audio in channel 1", "signal" };
    inlet<>  messages_in { this, "(anything) incoming messages" };
    inlet<>  ratio_in { this, "(float) pitch shift ratio" };
    outlet<> audio_out_0 { this, "(signal) audio out channel 0", "signal" };
    outlet<> audio_out_1 { this, "(signal) audio out channel 1", "signal" };
    outlet<> messages_out { this, "(anything) outgoing messages" };
   ...

The outlets never get added by the template.

@x37v
Copy link
Contributor

x37v commented Jan 26, 2021

great, thanks @scblakely !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants