libpsynth 0.2.1
/home/raskolnikov/dev/psynth/trunk/src/psynth/sound/stereo.hpp
Go to the documentation of this file.
00001 
00011 #ifndef PSYNTH_SOUND_STEREO_HPP_
00012 #define PSYNTH_SOUND_STEREO_HPP_
00013 
00014 /*
00015  *  Copyright (C) 2010 Juan Pedro Bolivar Puente
00016  *
00017  *  This file is part of Psychosynth.
00018  *   
00019  *  Psychosynth is free software: you can redistribute it and/or modify
00020  *  it under the terms of the GNU General Public License as published by
00021  *  the Free Software Foundation, either version 3 of the License, or
00022  *  (at your option) any later version.
00023  *
00024  *  Psychosynth is distributed in the hope that it will be useful,
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027  *  GNU General Public License for more details.
00028  *
00029  *  You should have received a copy of the GNU General Public License
00030  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00031  *
00032  */
00033 
00034 #include <cstddef>
00035 #include <boost/mpl/range_c.hpp>
00036 #include <boost/mpl/vector_c.hpp>
00037 
00038 #include <psynth/base/compat.hpp>
00039 #include <psynth/sound/metafunctions.hpp>
00040 #include <psynth/sound/planar_frame_iterator.hpp>
00041 
00042 namespace psynth
00043 {
00044 namespace sound
00045 {
00046 
00053 struct left_channel {};    
00054 
00056 struct right_channel {};
00057  
00061 typedef boost::mpl::vector2 <left_channel, right_channel> stereo_space;
00062 
00064 typedef layout<stereo_space> stereo_layout;
00065 
00067 typedef layout<stereo_space, boost::mpl::vector2_c<int, 1, 0> > rlstereo_layout;
00068 
00069 
00074 template <typename IC>
00075 inline
00076 typename type_from_iterator<planar_frame_iterator<IC, stereo_space> >::range
00077 planar_stereo_range (std::size_t size, IC l, IC r)
00078 {
00079     typedef typename type_from_iterator<
00080         planar_frame_iterator<IC, stereo_space> >::range RRange;
00081     return RRange (size, planar_frame_iterator<IC, stereo_space> (l, r));
00082 }
00083 
00084 } /* namespace sound */
00085 } /* namespace psynth */
00086 
00087 #endif /* PSYNTH_SOUND_STEREO */