[AD] [ alleg-Bugs-1663211 ] midi.c's reset_controllers doesn't actually reset controller

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Bugs item #1663211, was opened at 2007-02-19 07:38
Message generated for change (Settings changed) made by elias
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=1663211&group_id=5665

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core Library
Group: None
>Status: Open
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Etienne Vouga (evouga)
Assigned to: Elias Pschernig (elias)
Summary: midi.c's reset_controllers doesn't actually reset controller

Initial Comment:
When using raw midi, the controller code to reset controllers is not passed through to the midi driver in reset_controllers. This causes problems in particular when you're playing a MIDI which turns on the sustain pedal, and you then stop the MIDI and start playing a new one: the new MIDI will keep playing with sustain on.

Proposed easy fix:


/* reset_controllers:
 *  Resets volume, pan, pitch bend, etc, to default positions.
 */
static void reset_controllers(int channel)
{
   midi_channel[channel].new_volume = 128;
   midi_channel[channel].new_pitch_bend = 0x2000;

   if (midi_driver->raw_midi) {
      midi_driver->raw_midi(0xB0+channel);
      midi_driver->raw_midi(121);
      midi_driver->raw_midi(0);
   }

   switch (channel % 3) {
      case 0:  midi_channel[channel].pan = ((channel/3) & 1) ? 60 : 68; break;
      case 1:  midi_channel[channel].pan = 104; break;
      case 2:  midi_channel[channel].pan = 24; break;
   }

   if (midi_driver->raw_midi) {
      midi_driver->raw_midi(0xB0+channel);
      midi_driver->raw_midi(10);
      midi_driver->raw_midi(midi_channel[channel].pan);
   }
}

END_OF_STATIC_FUNCTION(reset_controllers);


----------------------------------------------------------------------

Comment By: Elias Pschernig (elias)
Date: 2007-04-12 15:21

Message:
Logged In: YES 
user_id=32894
Originator: NO

Thanks, indeed looks like this was missing, I just applied your change to
SVN as revision 7822.

(For the future, it would be preferable to send a patch, that way there
would have been no need to find the function in midi.c and scan for
possible changes. And sorry for the late reply, I must have not seen this
when it was posted almost two months ago.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105665&aid=1663211&group_id=5665




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/