main.cpp
Go to the documentation of this file.00001 #include "common.h"
00002 #include "JackClient.h"
00003 #include "ISoundElement.h"
00004 #include "JackPort.h"
00005 #include <sstream>
00006
00007 #include "Waveform.h"
00008 #include "Amp.h"
00009 #include "Recorder.h"
00010
00011 void Init()
00012 {
00013 new JackClient();
00014 }
00015
00016 void Halt()
00017 {
00018 delete JackClient::GetSingleton();
00019 }
00020
00021
00022 BOOST_PYTHON_MODULE(jackfx)
00023 {
00024 using namespace boost::python;
00025 def("Start", Init);
00026 def("Stop", Halt);
00027
00028 class_<ISoundElement>("SoundElement", no_init)
00029 .def("AddInput", &ISoundElement::AddInput)
00030 .def("RemoveInput", &ISoundElement::RemoveInput)
00031
00032 .def("SetParameter", &ISoundElement::SetParameter)
00033
00034 .def("DelParameter", &ISoundElement::DelParameter)
00035 ;
00036 class_<ISoundSource, bases<ISoundElement> >("SoundSource", no_init);
00037
00038 class_<JackPort>("JackPort", no_init)
00039 .def("ConnectTo", &JackPort::ConnectTo)
00040 ;
00041
00042 class_<JackMidiPort, bases<JackPort> >("JackMidiPort", init<string>())
00043 .def("GetEvents", &JackMidiPort::GetPyEventQueue)
00044 ;
00045
00046 class_<JackAudioPort, bases<JackPort> >("JackAudioPort", no_init);
00047
00048 class_<JackOutput, bases<ISoundElement, JackAudioPort> >("JackSink", init<string>());
00049 class_<JackInput, bases<ISoundSource, JackAudioPort> >("JackSource", init<string>());
00050
00051
00052 class_<Waveform, bases<ISoundSource> >("Waveform", init<Waveform::WaveType>())
00053 .def("SetFrequency", &Waveform::SetFrequency)
00054 .def("SetAmplitude", &Waveform::SetAmplitude)
00055 .def("SetOffset", &Waveform::SetOffset)
00056 .def("SetPhase", &Waveform::SetPhase)
00057 ;
00058
00059 enum_<Waveform::WaveType>("WaveType")
00060 .value("SIN", Waveform::W_SIN)
00061 .value("TRIANGLE", Waveform::W_TRI)
00062 .value("SAWTOOTH", Waveform::W_SAW)
00063 .value("RSAWTOOTH", Waveform::W_RSAW)
00064 .value("SQUARE", Waveform::W_SQU)
00065 ;
00066
00067 class_<Amp, bases<ISoundElement> >("Amp")
00068 .def("SetAmplitude", &Amp::SetAmplitude)
00069 ;
00070
00071 class_<Recorder, bases<ISoundElement> >("Recorder")
00072 .def("Clear", &Recorder::Clear)
00073 .def("Play", &Recorder::Play)
00074 .def("Loop", &Recorder::Loop)
00075 .def("Stop", &Recorder::Stop)
00076 .def("Record", &Recorder::Record)
00077 ;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 }
00093