libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/sound/quad.hpp
Go to the documentation of this file.
00001 
00011 /*
00012  *  Copyright (C) 2010 Juan Pedro Bolivar 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_SOUND_QUAD_H
00032 #define PSYNTH_SOUND_QUAD_H
00033 
00034 #include <cstddef>
00035 
00036 #include <psynth/base/compat.hpp>
00037 #include <psynth/sound/metafunctions.hpp>
00038 #include <psynth/sound/stereo.hpp>
00039 
00040 #include <boost/mpl/range_c.hpp>
00041 #include <boost/mpl/vector_c.hpp>
00042 
00043 namespace psynth
00044 {
00045 namespace sound
00046 {
00047 
00054 struct back_left_channel {};
00055 
00057 struct back_right_channel {};
00058 
00062 typedef boost::mpl::vector4<
00063     left_channel,      right_channel,
00064     back_left_channel, back_right_channel> quad_space;
00065 
00067 typedef layout<quad_space> quad_layout;
00068 
00073 template <typename IC>
00074 inline typename type_from_iterator<
00075     planar_frame_iterator<IC, quad_space> >::range
00076 planar_quad_range (std::size_t size, IC l, IC r, IC bl, IC br)
00077 {
00078     typedef typename type_from_iterator<
00079         planar_frame_iterator<IC, quad_space> >::range RRange;
00080 
00081     return RRange (size, planar_frame_iterator<IC, quad_space> (l, r, bl, br));
00082 }
00083 
00084 } /* namespace sound */
00085 } /* namespace psynth */
00086 
00087 #endif /* PSYNTH_SOUND_QUAD */