<commit_before>/* 
 * jcom.metro
 * External for Jamoma: send bangs at regular intervals
 * By <NAME>, Copyright © 2007
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "Jamoma.h"

// Data Structure for this object
typedef struct _jcom_metro{
	t_pxobject 	obj;
	void		*outlet;
	double		attr_period;
	long		attr_active;
	t_object	*event;
} t_jcom_metro;

// Prototypes for methods
void*		jcom_metro_new(t_symbol *s, long argc, t_atom *argv);
void		jcom_metro_free(t_jcom_metro *x);
void		jcom_metro_int(t_jcom_metro *x, long toggle);
void		jcom_metro_tick(t_jcom_metro *x);
t_max_err	metro_attr_setperiod(t_jcom_metro *x, void *attr, long argc, t_atom *argv);

// Globals
static t_class*	jcom_metro_class;


/************************************************************************************/
// Main() Function

int main(void)				// main recieves a copy of the Max function macros table
{
	t_class *c;
	
	jamoma_init();

	// Define our class
	c = class_new("jcom.metro", (method)jcom_metro_new, (method)jcom_metro_free, 
		sizeof(t_jcom_metro), (method)NULL, A_GIMME, 0);

	// Make methods accessible for our class:
	class_addmethod(c, (method)jcom_metro_int,			"int",		A_FLOAT,	0);
 	class_addmethod(c, (method)jamoma_time_dsp,			"dsp",		A_CANT,		0L);
	class_addmethod(c, (method)object_obex_dumpout,		"dumpout",	A_CANT,		0);

	// Add attributes to our class:
	CLASS_ATTR_DOUBLE(c,	"period",	0, t_jcom_metro, attr_period);
	CLASS_ATTR_ACCESSORS(c,	"period",	0, metro_attr_setperiod);
	CLASS_ATTR_LABEL(c,		"period",	0, "Interval");
	
	// Setup our class to work with MSP
	class_dspinit(c);

	// Finalize our class
	class_register(CLASS_BOX, c);
	jcom_metro_class = c;
	return 0;
}


/************************************************************************************/
// Object Life

// Create
void *jcom_metro_new(t_symbol *s, long argc, t_atom *argv)<commit_msg>jcom.metro should (in theory) build against the Max 4 SDK now<commit_after>/* 
 * jcom.metro
 * External for Jamoma: send bangs at regular intervals
 * By <NAME>, Copyright © 2007
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "Jamoma.h"

// Data Structure for this object
typedef struct _jcom_metro{
	t_pxobject 	obj;
	void		*obex;
	void		*outlet;
	double		attr_period;
	long		attr_active;
	t_object	*event;
} t_jcom_metro;

// Prototypes for methods
void*		jcom_metro_new(t_symbol *s, long argc, t_atom *argv);
void		jcom_metro_free(t_jcom_metro *x);
void		jcom_metro_int(t_jcom_metro *x, long toggle);
void		jcom_metro_tick(t_jcom_metro *x);
t_max_err	metro_attr_setperiod(t_jcom_metro *x, void *attr, long argc, t_atom *argv);

// Globals
static t_class*	jcom_metro_class;


/************************************************************************************/
// Main() Function

int main(void)				// main recieves a copy of the Max function macros table
{
	t_class	*c;
	long	offset;
	
	jamoma_init();

	// Define our class
	c = class_new("jcom.metro", (method)jcom_metro_new, (method)jcom_metro_free, 
		sizeof(t_jcom_metro), (method)NULL, A_GIMME, 0);

	offset = calcoffset(t_in, common);
	class_obexoffset_set(c, offset + calcoffset(t_jcom_core_subscriber_common, obex));

	// Make methods accessible for our class:
	class_addmethod(c, (method)jcom_metro_int,			"int",		A_FLOAT,	0);
 	class_addmethod(c, (method)jamoma_time_dsp,			"dsp",		A_CANT,		0L);
	class_addmethod(c, (method)object_obex_dumpout,		"dumpout",	A_CANT,		0);

	// Add attributes to our class:
	class_addattr(c, 
		attr_offset_new("interval", _sym_float64, 0,
		(method)0, (method)metro_attr_setperiod, calcoffset(t_jcom_metro, attr_period))
	);	
	
	// Setup our class to work with MSP
	class_dspinit(c);

	// Finalize our class
	class_register(CLASS_BOX, c);
	jcom_metro_class = c;
	return 0;
}


/************************************************************************************/
// Object Life

// Create
void *jcom_metro_new(t_symbol *s, long argc, t_atom *argv)
{'fraction_non_alphanumeric': 0.19017199017199019, 'fraction_numerical': 0.0063882063882063885, 'mean_word_length': 5.103448275862069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6431415', 'n_tokens_mistral': 1646, 'n_tokens_neox': 1553, 'n_words': 369}