13
0

add some more documentation

This commit is contained in:
Robin Gareus 2016-03-27 22:39:10 +02:00
parent 898525de95
commit 11cbcd793f
2 changed files with 43 additions and 3 deletions

View File

@ -43,29 +43,56 @@ public:
ChanCount(const XMLNode& node);
ChanCount() { reset(); }
// Convenience constructor for making single-typed streams (stereo, mono, etc)
ChanCount(DataType type, uint32_t channels) {
/** Convenience constructor for making single-typed streams (mono, stereo, midi, etc)
* @param type data type
* @param count number of channels
*/
ChanCount(DataType type, uint32_t count) {
reset();
set(type, channels);
set(type, count);
}
/** zero count of all data types */
void reset() {
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
_counts[*t] = 0;
}
}
/** set channel count for given type
* @param type data type
* @param count number of channels
*/
void set(DataType t, uint32_t count) { assert(t != DataType::NIL); _counts[t] = count; }
/** query channel count for given type
* @param type data type
* @returns channel count for given type
*/
uint32_t get(DataType t) const { assert(t != DataType::NIL); return _counts[t]; }
inline uint32_t n (DataType t) const { return _counts[t]; }
/** query number of audio channels
* @returns number of audio channels
*/
inline uint32_t n_audio() const { return _counts[DataType::AUDIO]; }
/** set number of audio channels
* @param a number of audio channels
*/
inline void set_audio(uint32_t a) { _counts[DataType::AUDIO] = a; }
/** query number of midi channels
* @returns number of midi channels
*/
inline uint32_t n_midi() const { return _counts[DataType::MIDI]; }
/** set number of audio channels
* @param m number of midi channels
*/
inline void set_midi(uint32_t m) { _counts[DataType::MIDI] = m; }
/** query total channel count of all data types
* @returns total channel count (audio + midi)
*/
uint32_t n_total() const {
uint32_t ret = 0;
for (uint32_t i=0; i < DataType::num_types; ++i)

View File

@ -33,6 +33,8 @@ namespace ARDOUR {
/** A mapping from one set of channels to another
* (e.g. how to 'connect' two BufferSets).
*
* for plugins the form is "pin" -> "buffer"
*/
class LIBARDOUR_API ChanMapping {
public:
@ -41,7 +43,18 @@ public:
ChanMapping(const ChanMapping&);
uint32_t get(DataType t, uint32_t from, bool* valid);
/** get buffer mapping for given data type and pin
* @param type data type
* @param from pin
* @returns mapped buffer number (or ChanMapping::Invalid)
*/
uint32_t get(DataType t, uint32_t from) { return get (t, from, NULL); }
/** set buffer mapping for given data type
* @param type data type
* @param from pin
* @param to buffer
*/
void set(DataType t, uint32_t from, uint32_t to);
void offset_from(DataType t, int32_t delta);
void offset_to(DataType t, int32_t delta);