This bug caused me some confusion because my channels kept being set to
instruments which no longer exist in the composition.

To reproduce:
- Create a new Rosegarden file, and setup you MIDI play device to some
  multichannel multitimbral device.

- Select the 2nd track, (which should have defaulted to channel out 2) and
  edit its instrument parameters to some Wacky instrument bank & program.

- Delete that track.

- Select the 1st track, and edit its instrument parameters to some
  Nice instrument bank & program. Change its instrument's channel out to
  2.

- Hit Play. Notice your synth is unexpectedly set to Wacky instrument on
- channel 2. Scratch head.

- Search composition for other track that outputs to channel 2, but there
  is none? Edit first track instrument to Nice instrument, again. Synth
  received program change for it. Sigh in relief.

- Hit play again. Synth is again set to play Wacky instrument on channel
  2. Frown.


The cause is that MidiDevice keeps a list of instruments that is always
added to, but never removed from; and Rosegarden sends program changes for
all instruments, used and unsed, at play. If an (unused) instrument apears
later on in the list than a used one, both with the same channel number,
the unused instruments Program Change clobbers the used one.

The fix I want to code is:

1) Since there could be other compositions like this out there, write a
   function that filters out unused instruments from MidiDevices when a
   compisition is loaded.
2) When a track is deleted, tell MidiDevice to delete its instrument too.
3) (Optional) For good measure, re-apply the filter in 1 on save.

Is this approach sound, or is there a reason old instruments are kept
around forever?

-- 
     ,_
     /_)              /| /
    /   i e t e r    / |/ a g e l

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to