|
libpsynth 0.2.1
|
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 /* 00032 * Copyright 2005-2007 Adobe Systems Incorporated 00033 * 00034 * Use, modification and distribution are subject to the Boost 00035 * Software License, Version 1.0. (See accompanying file 00036 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). 00037 */ 00038 00039 #ifndef PSYNTH_SOUND_DEVICE_N_H 00040 #define PSYNTH_SOUND_DEVICE_N_H 00041 00042 #include <cstddef> 00043 #include <boost/type_traits.hpp> 00044 #include <boost/mpl/range_c.hpp> 00045 #include <boost/mpl/vector_c.hpp> 00046 00047 #include <psynth/base/compat.hpp> 00048 #include <psynth/sound/util.hpp> 00049 #include <psynth/sound/metafunctions.hpp> 00050 00051 namespace psynth 00052 { 00053 namespace sound 00054 { 00055 00060 template <int N> 00061 struct devicen_channel {}; 00062 00063 template <int N> 00064 struct devicen_space; 00065 00070 template <> 00071 struct devicen_space<1> : public boost::mpl::vector1<devicen_channel<0> > {}; 00072 00077 template <> 00078 struct devicen_space<2> : public boost::mpl::vector2< 00079 devicen_channel<0>, 00080 devicen_channel<1> > {}; 00081 00086 template <> 00087 struct devicen_space<3> : public boost::mpl::vector3< 00088 devicen_channel<0>, 00089 devicen_channel<1>, 00090 devicen_channel<2> > {}; 00091 00096 template <> 00097 struct devicen_space<4> : public boost::mpl::vector4< 00098 devicen_channel<0>, 00099 devicen_channel<1>, 00100 devicen_channel<2>, 00101 devicen_channel<3> > {}; 00102 00107 template <> 00108 struct devicen_space<5> : public boost::mpl::vector5< 00109 devicen_channel<0>, 00110 devicen_channel<1>, 00111 devicen_channel<2>, 00112 devicen_channel<3>, 00113 devicen_channel<4> > {}; 00114 00119 template <int N> struct devicen_layout : public layout<devicen_space<N> > {}; 00120 00125 template <typename IC> 00126 inline typename type_from_iterator< 00127 planar_frame_iterator<IC,devicen_space<2> > >::range 00128 planar_devicen_range (std::size_t size, IC c0, IC c1) 00129 { 00130 typedef typename type_from_iterator<planar_frame_iterator< 00131 IC, devicen_space<2> > >::range range; 00132 return range (size, typename range::iterator (c0, c1)); 00133 } 00134 00139 } /* namespace sound */ 00140 } /* namespace psynth */ 00141 00142 #endif /* PSYNTH_SOUND_DEVICEN */
1.7.4