~ubuntu-branches/ubuntu/natty/pd-zexy/natty

« back to all changes in this revision

Viewing changes to src/sleepgrain.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, IOhannes m zmölnig, Jonas Smedegaard
  • Date: 2010-08-20 12:17:41 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100820121741-4kxozn8b9rhee9fr
Tags: 2.2.3-1
* New upstream version

[ IOhannes m zmölnig ]
* Adopt package, on behalf of Multimedia Team.
  Closes: #546964
* Simply debian/rules with CDBS, and don't unconditionally strip
  binaries.
  Closes: #437763
* Install into /usr/lib/pd/extra/zexy/. Document usage in REAME.Debian
  and warn about change in NEWS.
* git'ify package. Add Vcs-* stanzas to control file.
* Use dpkg source format 3.0 (quilt). Drop build-dependency on quilt.

[ Jonas Smedegaard ]
* Enable CDBS copyright-check routine.
* Add copyright and licensing header to debian/rules.
* Add myself as uploader.
* Rewrite debian/copyright using rev. 135 of draft DEP5 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
 *
 
3
 * zexy - implementation file
 
4
 *
 
5
 * copyleft (c) IOhannes m zm�lnig
 
6
 *
 
7
 *   1999:forum::f�r::uml�ute:2004
 
8
 *
 
9
 *   institute of electronic music and acoustics (iem)
 
10
 *
 
11
 ******************************************************
 
12
 *
 
13
 * license: GNU General Public License v.2
 
14
 *
 
15
 ******************************************************/
 
16
 
 
17
/*
 
18
  sleepgrain :  get (and set?) the sleepgrain of Pd
 
19
*/
 
20
 
 
21
#include "zexy.h"
 
22
 
 
23
EXTERN int* get_sys_sleepgrain(void ) ;
 
24
 
 
25
/* ------------------------- sleepgrain ------------------------------- */
 
26
 
 
27
 
 
28
static t_class *sleepgrain_class;
 
29
 
 
30
typedef struct _sleepgrain
 
31
{
 
32
  t_object x_obj;
 
33
 
 
34
} t_sleepgrain;
 
35
 
 
36
 
 
37
static void sleepgrain_bang(t_sleepgrain *x)
 
38
{
 
39
  int*current=get_sys_sleepgrain();
 
40
  t_float f=*current;
 
41
  outlet_float(x->x_obj.ob_outlet, f);
 
42
}
 
43
 
 
44
static void sleepgrain_float(t_sleepgrain *x, t_float f)
 
45
{
 
46
  int value=(int)f;
 
47
  int*current=get_sys_sleepgrain();
 
48
 
 
49
  if(value<=0) {
 
50
    pd_error(x, "[sleepgrain]: sleepgrain cannot be <= 0");
 
51
    return;
 
52
  }
 
53
 
 
54
  *current=value;
 
55
 
 
56
  //  outlet_float(x->x_obj.ob_outlet, f);
 
57
}
 
58
 
 
59
static void *sleepgrain_new(void)
 
60
{
 
61
  t_sleepgrain *x = (t_sleepgrain *)pd_new(sleepgrain_class);
 
62
  outlet_new(&x->x_obj, 0);
 
63
  return (x);
 
64
}
 
65
 
 
66
void sleepgrain_setup(void)
 
67
{
 
68
  sleepgrain_class = class_new(gensym("sleepgrain"), (t_newmethod)sleepgrain_new, 
 
69
                                     0, sizeof(t_sleepgrain), 0, A_NULL);
 
70
  
 
71
  class_addbang  (sleepgrain_class, sleepgrain_bang);
 
72
  class_addfloat (sleepgrain_class, sleepgrain_float);
 
73
  zexy_register("sleepgrain");
 
74
}