Skip to content

Commit

Permalink
trunc~
Browse files Browse the repository at this point in the history
changelog and new release date for today

Update trunc~-help.pd

Update trunc~-help.pd
  • Loading branch information
porres committed Jul 2, 2024
1 parent f1ae572 commit b3f62e3
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This work is free. You can redistribute it and/or modify it under the terms of t

Current Release: Cyclone 0.9-0 (this release needs at least Pd Vanilla 0.55-0)

Released June 23rd 2024
Released July 2nd 2024

Find Cyclone's latest releases at: https://github.com/porres/pd-cyclone/releases or directly via Pd's external manager (Help => Find Externals). Please report bugs at https://github.com/porres/pd-cyclone/issues.

Expand Down
104 changes: 28 additions & 76 deletions cyclone_objects/binaries/audio/trunc.c
Original file line number Diff line number Diff line change
@@ -1,87 +1,39 @@
/* code generated thanks to Schiavoni's Pure Data external Generator */
// Porres 2017-2023, part of ELSE

#include "m_pd.h"
#include <common/api.h>
#include "math.h"
#include <math.h>

// ---------------------------------------------------
// Class definition
// ---------------------------------------------------
static t_class *trunc_class;

// ---------------------------------------------------
// Data structure definition
// ---------------------------------------------------
typedef struct _trunc {
t_object x_obj;
t_outlet * x_outlet_dsp_0;
} t_trunc;

// ---------------------------------------------------
// Functions signature
// ---------------------------------------------------
void * trunc_new(void);// Constructor
void trunc_destroy(t_trunc *x); //Destructor
static t_int * trunc_perform(t_int *w); //Perform function
static void trunc_dsp(t_trunc *x, t_signal **sp); //DSP function

// ---------------------------------------------------
// Perform
// ---------------------------------------------------
static t_int * trunc_perform(t_int *w)
{
t_trunc *x = (t_trunc *)(w[1]); // Seu objeto
int n = (int)(w[2]); // Número de samples no bloco
t_float *in1 = (t_float *)(w[3]); // bloco de entrada
t_float *out1 = (t_float *)(w[4]); // bloco de saida

//interagir com todas as amostras do bloco (de 0 a n)
int i = 0;
for (i = 0 ; i < n ; i++){
out1[i] = trunc(in1[i]); // trunc~
}
return (w + 5); // proximo bloco
typedef struct _trunc{
t_object x_obj;
}t_trunc;

static t_int * trunc_perform(t_int *w){
int n = (int)(w[1]);
t_float *in = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);
while(n--)
*out++ = trunc(*in++);
return(w+4);
}

// ---------------------------------------------------
// DSP Function
// ---------------------------------------------------
static void trunc_dsp(t_trunc *x, t_signal **sp)
{
dsp_add(trunc_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec);
static void trunc_dsp(t_trunc *x, t_signal **sp){
x = NULL;
signal_setmultiout(&sp[1], sp[0]->s_nchans);
dsp_add(trunc_perform, 3, (t_int)(sp[0]->s_length * sp[0]->s_nchans),
sp[0]->s_vec, sp[1]->s_vec);
}

// ---------------------------------------------------
// Constructor of the class
// ---------------------------------------------------
void * trunc_new(void)
{
t_trunc *x = (t_trunc *) pd_new(trunc_class);
x->x_outlet_dsp_0 = outlet_new(&x->x_obj, &s_signal);
return (void *) x;
void *trunc_new(void){
t_trunc *x = (t_trunc *)pd_new(trunc_class);
outlet_new(&x->x_obj, &s_signal);
return(void *)x;
}

// ---------------------------------------------------
// Destroy the class
// ---------------------------------------------------
void trunc_destroy(t_trunc *x)
{
outlet_free(x->x_outlet_dsp_0);
void trunc_tilde_setup(void){
trunc_class = class_new(gensym("trunc~"),
(t_newmethod) trunc_new, 0, sizeof (t_trunc), CLASS_MULTICHANNEL, 0);
class_addmethod(trunc_class, nullfn, gensym("signal"), 0);
class_addmethod(trunc_class, (t_method) trunc_dsp, gensym("dsp"), A_CANT, 0);
}

// ---------------------------------------------------
// Setup
// ---------------------------------------------------
CYCLONE_OBJ_API void trunc_tilde_setup(void) {
trunc_class = class_new(gensym("trunc~"),
(t_newmethod) trunc_new, // Constructor
(t_method) trunc_destroy, // Destructor
sizeof (t_trunc),
CLASS_DEFAULT,
0);//Must always ends with a zero

class_addmethod(trunc_class, nullfn, gensym("signal"), 0);
class_addmethod(trunc_class, (t_method) trunc_dsp, gensym("dsp"), A_CANT, 0);
}
// EOF---------------------------------------------------


2 changes: 1 addition & 1 deletion cyclone_objects/binaries/cyclone_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void print_cyclone(t_cyclone *x){
sys_getversion(&major, &minor, &bugfix);
post("");
post("--------------------------------------------------------------------");
post(":: Cyclone %d.%d-%d; Released June 23rd 2024", cyclone_major, cyclone_minor, cyclone_bugfix);
post(":: Cyclone %d.%d-%d; Released July 2nd 2024", cyclone_major, cyclone_minor, cyclone_bugfix);
post(":: License: BSD-3-Clause (aka Revised BSD License)");
post(":: Copyright © 2003-2024 - Krzysztof Czaja, Hans-Christoph Steiner,");
post(":: Fred Jan Kraan, Alexandre Porres, Derek Kwan, Matt Barber\n\:: and others.");
Expand Down
1 change: 1 addition & 0 deletions documentation/extra_files/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cyclone 0.9-0 (needs at least Pd Vanilla 0.55-0):
- [xbendin]/[xbendin2]/[xbendout]/[xbendout2] have been deprecated, use [midiformat] and [midiparse] instead (I doubt anyone is using such badly designed and silly objects anyway)
- The documentation has been revised and considering PlugData users, and many ELSE alternatives were added in a new 'see also' section (because ELSE is also part of PlugData), as well as Vanilla alternatives/related objects
- Added a browser plugin for objects on right click on an empty spot of the patch
- [trunc~] is now borrowed and equivalent to ELSE's [trunc~] which has multichannel support
- Fixed a bug in [zl.group] where it did not load the default arg
- Fixed regression bugs in [offer], list input works now and other things that were funny seems ok now (we introduced this bug in 0.3)
- [buffer~]: Added support for 64-bit audio files in [buffer~] (Pd 0.55 in double precision is required for this); object has been rewritten and now uses [file which] with 0.55's functionality that allows finding files in the parent. Added support for arguments in the 'read' message and implemented 'replace' message (the object doesn't really behave 100% like the MAX original because that one is bugged as fuck)
Expand Down
2 changes: 1 addition & 1 deletion documentation/extra_files/cyclone-meta.pd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
#X text 27 142 FOLLOWING DEVELOPERS: Hans-Christoph Steiner (2005-2013) and Fred Jan Kraan (dec/2014 - feb/2016);
#X text 27 73 VERSION: 0.9-0, f 60;
#X text 27 172 CURRENT DEVELOPERS (since february 2016): Alexandre Torres Porres \, Derek Kwan and Matt Barber (Actually \, since about 2020 \, virtually just Porres)., f 60;
#X text 27 91 RELEASE_DATE: Released June 23rd 2024, f 60;
#X text 27 91 RELEASE_DATE: Released July 2nd 2024, f 60;
12 changes: 6 additions & 6 deletions documentation/help_files/pink~-help.pd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#N canvas 299 60 565 549 10;
#N canvas 355 101 565 549 10;
#X declare -stdpath ./;
#X obj 226 168 cyclone/pink~;
#X text 63 86 [pink~] generates pink noise. This is not an actual MAX clone but an object that is borrowed from ELSE which has more functionalities and is backwards compatible to MAX's object since the original just outputs pink noise!, f 75;
Expand Down Expand Up @@ -67,9 +67,9 @@
#X obj 3 2 ./header pink~;
#X text 22 61 Pink noise generator;
#X obj 62 211 declare -stdpath ./;
#X obj 413 319 open-else;
#X text 51 296 Plugdata users actually have the object from ELSE instead \, and those with ELSE can just use the original instead.;
#X msg 413 292 pink~;
#X text 454 291 click;
#X obj 331 318 open-else;
#X msg 331 291 pink~;
#X text 372 290 click;
#X text 116 291 Plugdata users can just use the original object from ELSE instead (same with those with ELSE)., f 33;
#X connect 0 0 18 0;
#X connect 24 0 22 0;
#X connect 23 0 22 0;
75 changes: 48 additions & 27 deletions documentation/help_files/trunc~-help.pd
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
#N canvas 413 30 566 546 10;
#X obj 7 407 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 7 455 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 7 492 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 116 464 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 116 421 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 144 464 signal;
#X text 197 502 (none);
#X obj 7 524 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 216 174 nbx 8 14 -127 127 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 219 148 hsl 180 15 -127 127 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 216 199 sig~;
#X obj 216 232 cyclone/trunc~;
#X text 144 421 signal;
#X text 78 95 [trunc~] converts signals with fractional values such as 1.75 to 1 (negative values are modified so that -1.75 becomes -1).;
#X text 199 421 - a signal whose values will be truncated;
#X text 197 464 - the truncated input signal;
#X text 73 295 The truncated value =>;
#N canvas 413 38 570 582 10;
#X obj 7 437 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 7 485 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 7 522 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 116 494 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 116 451 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 144 494 signal;
#X text 197 532 (none);
#X obj 7 554 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 216 204 nbx 8 14 -127 127 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 219 178 hsl 180 15 -127 127 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 216 229 sig~;
#X obj 216 262 cyclone/trunc~;
#X text 144 451 signal;
#X text 199 451 - a signal whose values will be truncated;
#X text 197 494 - the truncated input signal;
#X text 73 325 The truncated value =>;
#X obj 499 69 cyclone/dsponoff~;
#X text 24 59 Truncate signal values;
#X obj 216 265 cyclone/snapshot~ 1;
#X obj 216 295 nbx 9 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 216 295 cyclone/snapshot~ 1;
#X obj 216 325 nbx 9 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 5 6 header trunc~;
#X obj 410 360 open-else;
#X text 457 337 click;
#X msg 410 338 trunc~;
#X text 80 338 Note that Plugdata users actually get [else/trunc~] instead \, which also has multichannel capabilities and is more powerful., f 51;
#X obj 370 394 open-else;
#X text 417 371 click;
#X msg 370 372 trunc~;
#X text 78 95 [trunc~] truncates a signal towards zero \, that means only the integer value is considered. This is not an actual MAX clone but an object that is borrowed from ELSE which has more functionalities (support for multichannel connections) and is backwards compatible to MAX's.;
#X text 149 367 Plugdata users can just use the original object from ELSE instead (same with those with ELSE)., f 33;
#N canvas 795 189 422 372 multichannel 0;
#X obj 105 130 snake~ in;
#X listbox 105 104 12 0 0 0 - - - 0;
#X obj 289 119 setdsp~ 0;
#X text 100 28 Multichannel support example.;
#X listbox 105 307 7 0 0 0 - - - 12;
#X obj 105 75 cyclone/loadmess -1.75 1.2;
#X obj 105 163 cyclone/trunc~;
#X obj 105 281 cyclone/snapshot~ 1;
#X obj 105 188 snake~ out;
#X listbox 162 243 7 0 0 0 - - - 12;
#X obj 162 217 cyclone/snapshot~ 1;
#X connect 0 0 6 0;
#X connect 1 0 0 0;
#X connect 5 0 1 0;
#X connect 6 0 8 0;
#X connect 7 0 4 0;
#X connect 8 0 7 0;
#X connect 8 1 10 0;
#X connect 10 0 9 0;
#X restore 396 291 pd multichannel;
#X connect 8 0 10 0;
#X connect 9 0 8 0;
#X connect 10 0 11 0;
#X connect 11 0 19 0;
#X connect 19 0 20 0;
#X connect 24 0 22 0;
#X connect 11 0 18 0;
#X connect 18 0 19 0;
#X connect 23 0 21 0;

0 comments on commit b3f62e3

Please sign in to comment.