libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/io/jack_output.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_IO_JACK_OUTPUT_H_
00032 #define PSYNTH_IO_JACK_OUTPUT_H_
00033 
00034 #include <psynth/io/output.hpp>
00035 #include <psynth/io/jack_raw_output.hpp>
00036 
00037 namespace psynth
00038 {
00039 namespace io
00040 {
00041 
00042 template <typename Range>
00043 struct jack_support;
00044 
00045 template <typename Range>
00046 struct jack_is_supported
00047 {
00048     typedef typename jack_support<Range>::is_supported type;
00049 };
00050 
00051 template <typename Range>
00052 class jack_output : public async_output<Range>,
00053                     public jack_raw_output
00054 {
00055     typedef async_output<Range> base_type;
00056     
00057 public:
00058     static_assert (jack_support<Range>::is_supported::value,
00059                    "Range output format not supported by JACK.");
00060 
00061     typedef typename base_type::range range;
00062     typedef typename base_type::const_range const_range;
00063     
00064     jack_output (const std::string& client,
00065                  const std::string& server,
00066                  std::size_t        rate,
00067                  callback_type      cb = callback_type ());
00068 
00069     jack_output (const std::string& client,
00070                  std::size_t        rate,
00071                  callback_type      cb = callback_type ());
00072 
00073     std::size_t put (const const_range& data);
00074 
00075     std::size_t buffer_size () const
00076     { return jack_raw_output::buffer_size (); }
00077 };
00078 
00079 } /* namespace io */
00080 } /* namespace psynth */
00081 
00082 #include <psynth/io/jack_output.tpp>
00083 
00084 #endif /* PSYNTH_IO_JACK_OUTPUT_H_ */
00085