diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-12-15 11:05:41 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-12-15 11:05:41 +0000 |
commit | 5e7ae490c1616696a733287b62c08416726653ae (patch) | |
tree | 9d9d933e7c4afacbb8608cce17e7de779be0b0fe /libs/midi++2/midi++/midnam_patch.h | |
parent | bf7e792e3e499b665c20fc196e53cf05bb99e0c7 (diff) |
* first working prototype of changing program changes by scroll wheel (still some automation points issues)
git-svn-id: svn://localhost/ardour2/branches/3.0@4324 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/midi++/midnam_patch.h')
-rw-r--r-- | libs/midi++2/midi++/midnam_patch.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 1fa73a56b6..24838294ec 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -133,12 +133,15 @@ private: PatchNameList _patch_name_list; }; +#include <iostream> + class ChannelNameSet : public PBD::Stateful { public: typedef std::set<uint8_t> AvailableForChannels; typedef std::list<boost::shared_ptr<PatchBank> > PatchBanks; typedef std::map<PatchPrimaryKey, boost::shared_ptr<Patch> > PatchMap; + typedef std::list<PatchPrimaryKey> PatchList; ChannelNameSet() {}; virtual ~ChannelNameSet() {}; @@ -158,12 +161,39 @@ public: boost::shared_ptr<Patch> previous_patch(PatchPrimaryKey& key) { assert(key.is_sane()); - return (*(--_patch_map.find(key))).second; + std::cerr << "finding patch with " << key.msb << "/" << key.lsb << "/" <<key.program_number << std::endl; + for (PatchList::const_iterator i = _patch_list.begin(); + i != _patch_list.end(); + ++i) { + if ((*i) == key) { + if (i != _patch_list.begin()) { + std::cerr << "got it!" << std::endl; + --i; + return _patch_map[*i]; + } + } + } + + return boost::shared_ptr<Patch>(); } boost::shared_ptr<Patch> next_patch(PatchPrimaryKey& key) { assert(key.is_sane()); - return (*(++_patch_map.find(key))).second; + std::cerr << "finding patch with " << key.msb << "/" << key.lsb << "/" <<key.program_number << std::endl; + for (PatchList::const_iterator i = _patch_list.begin(); + i != _patch_list.end(); + ++i) { + if ((*i) == key) { + if (++i != _patch_list.end()) { + std::cerr << "got it!" << std::endl; + return _patch_map[*i]; + } else { + --i; + } + } + } + + return boost::shared_ptr<Patch>(); } XMLNode& get_state (void); @@ -174,6 +204,7 @@ private: AvailableForChannels _available_for_channels; PatchBanks _patch_banks; PatchMap _patch_map; + PatchList _patch_list; }; class Note : public PBD::Stateful |