libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/new_graph/core/oscillator.hpp
Go to the documentation of this file.
00001 
00011 /*
00012  *  Copyright (C) 2011 Juan Pedro BolĂ­var Puente
00013  *
00014  *  This file is part of Psychosynth.
00015  *   
00016  *  Psychosynth is free software: you can redistribute it and/or modify
00017  *  it under the terms of the GNU General Public License as published by
00018  *  the Free Software Foundation, either version 3 of the License, or
00019  *  (at your option) any later version.
00020  *
00021  *  Psychosynth is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU General Public License for more details.
00025  *
00026  *  You should have received a copy of the GNU General Public License
00027  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00028  *
00029  */
00030 
00031 #ifndef PSYNTH_GRAPH_CORE_OSCILLATOR_HPP_
00032 #define PSYNTH_GRAPH_CORE_OSCILLATOR_HPP_
00033 
00034 #include <psynth/synth/oscillator.hpp>
00035 #include <psynth/new_graph/node.hpp>
00036 #include <psynth/new_graph/soft_buffer_port.hpp>
00037 #include <psynth/new_graph/control.hpp>
00038 
00039 namespace psynth
00040 {
00041 namespace graph
00042 {
00043 namespace core
00044 {
00045 
00063 template <class Generator, class Output>
00064 class oscillator : public node
00065 {
00066 public:
00067     oscillator ();
00068     
00069 protected:
00070     void rt_on_context_update (rt_process_context& ctx);
00071     void rt_do_process (rt_process_context& ctx);
00072     
00073     Output _out_output;
00074     soft_sample_in_port _in_modulator;
00075     
00076     in_control<float> _ctl_frequency;
00077     in_control<float> _ctl_amplitude;
00078     in_control<int>   _ctl_modulator;
00079     
00080     synth::oscillator<Generator> _osc;
00081 };
00082 
00083 typedef oscillator<synth::sine_generator, audio_out_port>
00084 audio_sine_oscillator;
00085 typedef oscillator<synth::square_generator, audio_out_port>
00086 audio_square_oscillator;
00087 typedef oscillator<synth::triangle_generator, audio_out_port>
00088 audio_triangle_oscillator;
00089 typedef oscillator<synth::sawtooth_generator, audio_out_port>
00090 audio_sawtooth_oscillator;
00091 typedef oscillator<synth::moogsaw_generator, audio_out_port>
00092 audio_moogsaw_oscillator;
00093 typedef oscillator<synth::exp_generator, audio_out_port>
00094 audio_exp_oscillator;
00095 
00096 typedef oscillator<synth::sine_generator, sample_out_port>
00097 sample_sine_oscillator;
00098 typedef oscillator<synth::square_generator, sample_out_port>
00099 sample_square_oscillator;
00100 typedef oscillator<synth::triangle_generator, sample_out_port>
00101 sample_triangle_oscillator;
00102 typedef oscillator<synth::sawtooth_generator, sample_out_port>
00103 sample_sawtooth_oscillator;
00104 typedef oscillator<synth::moogsaw_generator, sample_out_port>
00105 sample_moogsaw_oscillator;
00106 typedef oscillator<synth::exp_generator, sample_out_port>
00107 sample_exp_oscillator;
00108 
00109 } /* namespace core */
00110 } /* namespace graph */
00111 } /* namespace psynth */
00112 
00113 #endif /* PSYNTH_GRAPH_CORE_OSCILLATOR_HPP_ */
00114