Author Topic: <SOLVED> - [DELPHI] Strange problem in midi key velocity  (Read 208 times)

johnvantelli

  • Posts: 41
Hi,
I'm trying to implement a midi vumeter based on midi note velocity but in my syncproc code I get a runtime "Range Error" on HYBYTE(data).
Here's my code:.. any idea?

Code: [Select]
fSyncs[MIDI_SyncVelocity] := BASS_Mixer_ChannelSetSync(fStream,
        BASS_SYNC_MIDI_EVENT, MIDI_EVENT_NOTE, @SYNC_PROC_MID_Velocity, self);



Code: [Select]
procedure SYNC_PROC_MID_Velocity(Handle: HSYNC; Stream: HSTREAM; data: DWORD;
user: Pointer); stdcall;
var
  ch: Word;
  note, vel: byte;
begin
  ch := HIWORD(data); // MIDI channel
  note := LOBYTE(data); // key number
  vel := HIBYTE(data); // key velocity (0=release) <------------- ERROR
  TSongMid(user).DoNotifyMidiVelocityChange(ch, vel);
end;
« Last Edit: 23 May '17 - 10:43 by johnvantelli »

johnvantelli

  • Posts: 41
Re: [DELPHI] Strange problem in midi key velocity
« Reply #1 on: 23 May '17 - 10:43 »
self solved  ::)

Code: [Select]
vel := HIBYTE(Word(data));