[PD-cvs] externals/frankenstein GArhythm.c, 1.4, 1.5 chords_memory.c, 1.9, 1.10 common.h, 1.18, 1.19
dmorelli
morellid at users.sourceforge.net
Sat Jan 21 16:14:11 CET 2006
Update of /cvsroot/pure-data/externals/frankenstein
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31017
Modified Files:
GArhythm.c chords_memory.c common.h
Log Message:
added an outlet to chords_memory which tells you how new is the chord you are adding
Index: GArhythm.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/GArhythm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** GArhythm.c 15 Dec 2005 12:03:36 -0000 1.4
--- GArhythm.c 21 Jan 2006 15:14:09 -0000 1.5
***************
*** 3,6 ****
--- 3,7 ----
*/
#include <stdlib.h>
+ #include <time.h>
#include "m_pd.h"
***************
*** 50,53 ****
--- 51,55 ----
int i, j, tmp, k;
double rnd;
+
for (i=0; i<MAX_POPULATION; i++)
{
***************
*** 650,654 ****
x->reinsert_last=REINSERT_LAST;
!
if (argc>0)
{
--- 652,657 ----
x->reinsert_last=REINSERT_LAST;
! srand( (unsigned)time( NULL ) );
!
if (argc>0)
{
Index: common.h
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** common.h 21 Jan 2006 00:11:05 -0000 1.18
--- common.h 21 Jan 2006 15:14:09 -0000 1.19
***************
*** 134,158 ****
#define TYPES_NUM 69 // keep me updated
typedef enum {
! /*
! kMaj=0,
! kMin=1,
! kDim=2,
! kAug=3,
! kDom7=4,
! kMaj7=5,
! kMin7=6,
! kMinMaj7=7,
! kDim7=8,
! kHalfDim7=9,
! //pland adding 9ths 30.11.05 and beyond
! kDomb9=10,
! kMaj9=11,
! kDom9=12,
! kMin9=13,
! kHalfDim9=14,
! kMinMaj9=15,
! kDimMaj9=16
! */
! // this enumerators are from maxlib chord
kUnison = 0,
kMaj = 1,
--- 134,138 ----
#define TYPES_NUM 69 // keep me updated
typedef enum {
! // this enumerator is from maxlib chord
kUnison = 0,
kMaj = 1,
Index: chords_memory.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/chords_memory.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** chords_memory.c 21 Jan 2006 02:23:15 -0000 1.9
--- chords_memory.c 21 Jan 2006 15:14:09 -0000 1.10
***************
*** 133,136 ****
--- 133,137 ----
t_outlet *x_outtonalityname; /* chord name, e.g. "Cmajor7" */
t_outlet *x_outchordssequence; /* sequence of chords,a walk */
+ t_outlet *x_outnovelty; /* the degree of novelty of last added chord */
// the matrix : arcs of the graph
// each tonality mode has his matrix
***************
*** 773,777 ****
// add a chord sequence to the graph
! void chords_memory_add(t_chords_memory *x, chord_t chord1, chord_t chord2)
{
// chords are integers
--- 774,778 ----
// add a chord sequence to the graph
! float chords_memory_add(t_chords_memory *x, chord_t chord1, chord_t chord2)
{
// chords are integers
***************
*** 795,798 ****
--- 796,800 ----
post("x->maxweight[%i] = %i",x->fundamental_mode, x->maxweight[x->fundamental_mode]);
}
+ return (float) (((float) x->maxweight[x->fundamental_mode]) / ((float) x->arcs[x->fundamental_mode][chord1int][chord2int]) );
}
***************
*** 802,809 ****
void chords_memory_add_chord(t_chords_memory *x, t_symbol *s) {
chord_t chord1;
chord1 = chords_memory_string2chord(x, s->s_name);
if (x->last_chord_set)
{
! chords_memory_add(x, x->last_chord, chord1);
}
else
--- 804,812 ----
void chords_memory_add_chord(t_chords_memory *x, t_symbol *s) {
chord_t chord1;
+ float ret = 0;
chord1 = chords_memory_string2chord(x, s->s_name);
if (x->last_chord_set)
{
! ret = chords_memory_add(x, x->last_chord, chord1);
}
else
***************
*** 814,817 ****
--- 817,821 ----
if (DEBUG)
post("chord added: %s", s->s_name);
+ outlet_float(x->x_outnovelty, ret);
}
***************
*** 997,1000 ****
--- 1001,1005 ----
x->x_outtonalityname = outlet_new(&x->x_obj, gensym("symbol"));
x->x_outchordssequence = outlet_new(&x->x_obj, gensym("list"));
+ x->x_outnovelty = outlet_new(&x->x_obj, gensym("float"));
srand(time(&a));
chords_memory_init_graph(x);
More information about the Pd-cvs
mailing list