ardour
midi_channel_filter.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006-2015 Paul Davis
3  Author: David Robillard
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #ifndef __ardour_channel_filter_h__
21 #define __ardour_channel_filter_h__
22 
23 #include <stdint.h>
24 
25 #include <glib.h>
26 
27 #include "ardour/types.h"
28 #include "pbd/signals.h"
29 
30 namespace ARDOUR
31 {
32 
33 class BufferSet;
34 
48 {
49 public:
51 
53  void filter(BufferSet& bufs);
54 
61  bool filter(uint8_t* buf, uint32_t len);
62 
66  bool set_channel_mode(ChannelMode mode, uint16_t mask);
67 
71  bool set_channel_mask(uint16_t mask);
72 
74  void get_mode_and_mask(ChannelMode* mode, uint16_t* mask) const {
75  const uint32_t mm = g_atomic_int_get(&_mode_mask);
76  *mode = static_cast<ChannelMode>((mm & 0xFFFF0000) >> 16);
77  *mask = (mm & 0x0000FFFF);
78  }
79 
81  return static_cast<ChannelMode>((g_atomic_int_get(&_mode_mask) & 0xFFFF0000) >> 16);
82  }
83 
84  uint16_t get_channel_mask() const {
85  return g_atomic_int_get(&_mode_mask) & 0x0000FFFF;
86  }
87 
88  PBD::Signal0<void> ChannelMaskChanged;
89  PBD::Signal0<void> ChannelModeChanged;
90 
91 private:
92  uint32_t _mode_mask;
93 };
94 
95 } /* namespace ARDOUR */
96 
97 #endif /* __ardour_channel_filter_h__ */
PBD::Signal0< void > ChannelModeChanged
void get_mode_and_mask(ChannelMode *mode, uint16_t *mask) const
uint32_t _mode_mask
16 bits mode, 16 bits mask
uint16_t get_channel_mask() const
ChannelMode
Definition: types.h:209
PBD::Signal0< void > ChannelMaskChanged
Definition: amp.h:29
#define LIBARDOUR_API
ChannelMode get_channel_mode() const