~kulthauskante/nsynth/devel

1 by Karsten Krispin
initial commit
1
/*
2
 * nonlimitedSynth - Backend to reacTIVision
3
 *
4
 * Copyright (c) 2007-2008 Karsten Krispin
5
 * 
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *
20
 */
21
 
22
 
23
#include "main.h"
24
48 by Karsten Krispin
removed most of <QtCore/QtGui> includes
25
#include "Configuration/Configuration.h"
1 by Karsten Krispin
initial commit
26
#include "Configuration/Reader/XmlReader.h"
27
28
#include "Synth/SynthManager/SynthManager.h"
29
30
#include "Tangibles/Global/Sinks/SystemSink.h"
49 by Karsten Krispin
- went on implementing a sophisticated metronome system to really sync anything on table
31
#include "Base/Metronome/GlobalMetronome.h"
35 by Karsten Krispin
* added oscillator to Metronome, so that it has real phase now
32
48 by Karsten Krispin
removed most of <QtCore/QtGui> includes
33
#include "Synth/AudioBackends/PortAudioBackend.h"
34
53.1.1 by k at kulthauskante
Changes Done During trip to Hamburg on in April 2011.
35
#include "Helper/SoundFontPlayer.h"
36
1 by Karsten Krispin
initial commit
37
37 by Karsten Krispin
* added interface to TangibleInputWidget to set uncontrolled primary property
38
//#include "Tangibles/Controller/Linear/Sequencer/Sequencer.h"
39
//#include "Tangibles/Audio/Generator/Generator.h"
40
//#include "Tangibles/Controller/Linear/LFOs/SinusController.h"
41
1 by Karsten Krispin
initial commit
42
int main(int argn, char * argv[])
43
{
44
45
	QApplication app(argn, argv);
46
	QString configFilename = "nonlimitedSynth.xml";
47
48
49
	/* Do not ceate anything before configuration instance has been created.
50
		 Otherwise this application's behaviour is undefined. */
51
	Configuration appConfig;
52
	
53
	/* parse arguments */
54
	if(argn > 1)
55
	{
56
		QString arg1(argv[1]);
57
		if(arg1 == "-h" || arg1 == "--help")
58
		{
6 by Karsten Krispin
- small cleanups on AudioInterface 2/2
59
			std::cout << "nonlimitedSynth Help:" << std::endl;
60
			std::cout << "Synopsis:" << std::endl;
33 by Karsten Krispin
* renamed BiquadLowPass to Filter. Filter is all, Low/Band/Highpass. Use the secondary property to decide what kind Filter is.
61
			std::cout << "  $ nSynth [--audio-devs | configFile.xml]" << std::endl;
6 by Karsten Krispin
- small cleanups on AudioInterface 2/2
62
			std::cout << "    --audio-devs: print a list of available devices" << std::endl;
1 by Karsten Krispin
initial commit
63
			exit(0);
64
		}
65
		else if(arg1 == "--audio-devs")
66
		{
67
			PortAudioBackend::displayDevices();
68
			exit(0);
69
		}
70
		else
71
		{
72
			configFilename = QString(argv[1]);
73
		}
74
	}
75
	
76
	/* initialize configuration */
77
	XmlConfigurationReader xmlReader(configFilename);
78
	xmlReader.readIn(appConfig);
79
	
35 by Karsten Krispin
* added oscillator to Metronome, so that it has real phase now
80
53.1.1 by k at kulthauskante
Changes Done During trip to Hamburg on in April 2011.
81
	SoundFontPlayer & sfPlayer = SoundFontPlayer::instance();
82
35 by Karsten Krispin
* added oscillator to Metronome, so that it has real phase now
83
	/* setup the metronome */
49 by Karsten Krispin
- went on implementing a sophisticated metronome system to really sync anything on table
84
	GlobalMetronome & metronome = GlobalMetronome::instance();	
35 by Karsten Krispin
* added oscillator to Metronome, so that it has real phase now
85
	/* dirty hack */
86
	metronome.setBpm(90);
1 by Karsten Krispin
initial commit
87
	/* Initialize master processing */
88
	SynthManager master;
89
	
90
	/* Insert the Main Sink which feeds the audio output */
91
	TangibleSynthProcessing * audioSink  = new SystemSink();
92
	master.insertChild(audioSink);
93
	audioSink->InitialUpdateTangibleInterface(0.5, 0.5, 0.0);
94
	
37 by Karsten Krispin
* added interface to TangibleInputWidget to set uncontrolled primary property
95
96
//	Sequencer * sequencer = new Sequencer(new TangibleConfiguration());
97
//	master.insertChild(sequencer);
98
//	sequencer->InitialUpdateTangibleInterface(0.3, 0.3, 0.5);
99
//	AudioGeneratorProcessing * generator = new AudioGeneratorProcessing(new TangibleConfiguration());
100
//	master.insertChild(generator);
38 by Karsten Krispin
* sequencers triggerRelease-duration is now scaleable via slider
101
//	generator->InitialUpdateTangibleInterface(0.4,0.4, 0.8);
37 by Karsten Krispin
* added interface to TangibleInputWidget to set uncontrolled primary property
102
//
103
//	SinusController * sinController = new SinusController(new TangibleConfiguration());
104
//	master.insertChild(sinController);
105
//	sinController->InitialUpdateTangibleInterface(0.3, 0.5, 0.3);
106
1 by Karsten Krispin
initial commit
107
	qDebug() << "\n\n nonlimitedSynth started...\n";
108
	
109
	/* Run event loop */
110
	return app.exec();
111
}
112