1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-12 06:01:13 +02:00

Fix drawing MIDI channels with IDs greater than 16

PRL mentioned a while ago that it was possible to get channels greater
than 16 via allegro files.  This makes those channels correctly work with
the CHANNEL_BIT macro (which was supposed to handle them this way before).
This commit is contained in:
Pokechu22 2017-05-30 08:21:28 -07:00 committed by Paul Licameli
parent 62ebb2f95d
commit 896d5d682b

View File

@ -199,8 +199,10 @@ class AUDACITY_DLL_API NoteTrack final
// map all channel numbers mod 16. This will have no effect
// on MIDI files, but it will allow users to at least select
// all channels on non-MIDI event sequence data.
#define ALL_CHANNELS 0xFFFF
#define CHANNEL_BIT(c) (1 << (c & ALL_CHANNELS))
#define NUM_CHANNELS 16
// Bitmask with all NUM_CHANNELS bits set
#define ALL_CHANNELS (1 << NUM_CHANNELS) - 1
#define CHANNEL_BIT(c) (1 << (c % NUM_CHANNELS))
bool IsVisibleChan(int c) const {
return (mVisibleChannels & CHANNEL_BIT(c)) != 0;
}