Skip to content

Commit f1f92e2

Browse files
author
Andrzej Kopec
committed
updated set method, removed other setN methods
1 parent b0cf938 commit f1f92e2

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

source/projects/dmx.eurolite/dmx.eurolite.cpp

-57
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,6 @@ void dmx_eurolite_setchannel(t_dmx_eurolite *self, long ch, long val)
116116
*/
117117
void dmx_eurolite_set(t_dmx_eurolite *self, t_symbol *sym, long argc,
118118
t_atom *argv)
119-
{
120-
if (argc < 2)
121-
return;
122-
const int first = atom_getlong(argv);
123-
const int data_count = argc - 1;
124-
std::vector<unsigned char> data;
125-
data.reserve(data_count);
126-
// iterate from the second element of argv to the end
127-
for (int i = 1; i < argc; i++)
128-
{
129-
data.push_back(
130-
static_cast<unsigned char>(clamp((int)atom_getlong(argv + i), 0, 255)));
131-
}
132-
self->dmx->set_channel_array_from(first, data_count, data.data());
133-
}
134-
135-
// a version using std::array instead of std::vector (for testing)
136-
void dmx_eurolite_set1(t_dmx_eurolite *self, t_symbol *sym, long argc,
137-
t_atom *argv)
138119
{
139120
if (argc < 2 || argc > 513)
140121
return;
@@ -149,41 +130,6 @@ void dmx_eurolite_set1(t_dmx_eurolite *self, t_symbol *sym, long argc,
149130
self->dmx->set_channel_array_from(first, data_count, data.data());
150131
}
151132

152-
// a version using C-style array // not much improvement from std::array
153-
void dmx_eurolite_set2(t_dmx_eurolite *self, t_symbol *sym, long argc,
154-
t_atom *argv)
155-
{
156-
if (argc < 2 || argc > 512)
157-
return;
158-
const int first = atom_getlong(argv);
159-
const int data_count = argc - 1;
160-
unsigned char data[512];
161-
int c = data_count;
162-
int i = 0;
163-
while(c--,i++)
164-
{
165-
data[i]=
166-
static_cast<unsigned char>(clamp((int)atom_getlong(argv + i), 0, 255));
167-
}
168-
self->dmx->set_channel_array_from(first, data_count, data);
169-
}
170-
171-
// a version using std::array and memcpy
172-
void dmx_eurolite_set3(t_dmx_eurolite *self, t_symbol *sym, long argc,
173-
t_atom *argv)
174-
{
175-
if (argc < 2 || argc > 513)
176-
return;
177-
const int first = atom_getlong(argv);
178-
const int data_count = argc - 1;
179-
std::array<unsigned char, 512> data;
180-
for (int i = 0; i < data_count; i++)
181-
{
182-
data[i]=
183-
static_cast<unsigned char>(clamp((int)atom_getlong(argv + i), 0, 255));
184-
}
185-
self->dmx->set_channel_memcpy_from(first, data_count, data.data());
186-
}
187133

188134
void dmx_eurolite_assist(t_dmx_eurolite *self, void *unused,
189135
t_assist_function io, long index, char *string_dest)
@@ -239,9 +185,6 @@ void ext_main(void *r)
239185
class_addmethod(this_class, (method)dmx_eurolite_setchannel, "setchannel",
240186
A_DEFLONG, A_DEFLONG, 0);
241187
class_addmethod(this_class, (method)dmx_eurolite_set, "set", A_GIMME, 0);
242-
class_addmethod(this_class, (method)dmx_eurolite_set1, "set1", A_GIMME, 0); // TESTING
243-
class_addmethod(this_class, (method)dmx_eurolite_set2, "set2", A_GIMME, 0); // TESTING
244-
class_addmethod(this_class, (method)dmx_eurolite_set3, "set3", A_GIMME, 0); // TESTING
245188
class_addmethod(this_class, (method)dmx_eurolite_open, "open", 0);
246189
class_addmethod(this_class, (method)dmx_eurolite_close, "close", 0);
247190
class_addmethod(this_class, (method)dmx_eurolite_clear, "clear", 0);

0 commit comments

Comments
 (0)