File: main.cpp

package info (click to toggle)
pd-flext 0.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,960 kB
  • sloc: cpp: 12,978; makefile: 223; sh: 149
file content (66 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* 
flext tutorial - signal 2 

Copyright (c) 2002-2022 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

-------------------------------------------------------------------------

This is an object showing varous parameters of the pd audio system
*/

// include flext header
#include <flext.h>

// check for appropriate flext version
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
#error You need at least flext version 0.4.0
#endif


// define the class that stands for a pd/Max object
// Attention: the class name must be the same as the object name!! (without the ~)

class signal2:
	// inherit from flext dsp class
	public flext_dsp
{
	// obligatory flext header (class name,base class name)
	FLEXT_HEADER(signal2,flext_dsp)
 
public:
	// constructor
	signal2();

protected:
	void m_bang();  // method for bang

private:
	FLEXT_CALLBACK(m_bang)  // callback for method "m_bang" 
};

// instantiate the class
FLEXT_NEW_DSP("signal2~",signal2)


signal2::signal2()
{ 
	// define inlets:
	// first inlet must always by of type anything (or signal for dsp objects)
	AddInAnything();  // add one inlet for any message
	
	// add outlets for sample rate and block size
	AddOutFloat(1);
	AddOutInt(1);
	
	// register methods
	FLEXT_ADDBANG(0,m_bang);  // register method "m_bang" for bang message into inlet 0
} 

void signal2::m_bang()
{
	// output various parameters of the audio system
	ToOutFloat(0,Samplerate()); 
	ToOutInt(1,Blocksize());
}