Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$Hints OFF}{$Warnings OFF}
- {$ifndef main_include}
- library FruityPlug;
- uses
- windows,uPlugin;
- exports
- CreatePlugInstance;
- begin
- allocconsole
- end.
- {$else}
- (*
- TNoteParams=Packed Record
- Position,Length
- :Integer; // in PPQ
- // levels
- Pan :Integer; // default=0
- Vol :Single; // default=100/128
- Note :SmallInt; // default=60
- Color :SmallInt; // 0..15 (=MIDI channel)
- Pitch :Integer; // default=0
- FCut,FRes :Single; // default=0
- End;
- TNotesParams=Record
- Target :Integer; // 0=step seq (not supported yet), 1=piano roll
- Flags :Integer; // see NPF_EmptyFirst
- PatNum :Integer; // -1 for current
- ChanNum :Integer; // -1 for plugin's channel, or selected channel if plugin is an effect
- Count :Integer; // the # of notes in the structure
- NoteParams:Array[0..0] of TNoteParams; // array of notes
- End;
- PNotesParams=^TNotesParams;
- *)
- function TFPC_FLHost.Dispatcher(Sender:Integer;ID,Index,Value:Integer):Integer;
- // mov eax,self; mov eax,[eax+FLHost];mov eax,[eax];pop ebp
- // jmp [eax]//+vmtoffset ComputeLRVol_Old]
- var
- i:integer;
- Notes: PNotesParams;
- begin
- // FHD_AddNotesToPR (17)
- // writeln ('FPC->Dispatcher ID: ', ID);
- if ID = FHD_AddNotesToPR then begin
- Notes := PNotesParams(Value);
- for i := 0 to Notes.Count-1 do begin
- writeln ('Note: ',i, ' ', Notes.NoteParams[i].Position div (TimeInfo.PPQ div 16 ) );
- // writeln ('Notes: ', Notes.Count);
- end;
- Notes.Target := 0;
- //writeln ('Time PPQ: ', TimeInfo.PPQ);
- end;//FHD_AddNotesToPR
- result := FLHost.Dispatcher(Sender,ID,Index,Value);
- end;
- //{$define asm_code}
- (*
- {$i qmidi}
- function TFruityPlugin.TriggerVoice(VoiceParams: PVoiceParams; SetTag: Integer): TVoiceHandle;
- var
- port, p, Note, Vel, res, position, FCut,FRes, Color, i, msg : integer;
- // TVoiceParams=Record
- // InitLevels:TLevelParams;
- // FinalLevels:TLevelParams;
- // End;
- begin
- Note := round_sse(@VoiceParams.InitLevels.Pitch);
- Color := pInteger(SetTag + $1C)^ ;
- Vel := integer(@VoiceParams.InitLevels.Vol);
- Vel := pInteger(Vel)^;
- Vel := qMidiVel (vel);// + random(30);
- // Vel := Vel - random (TSynthEditorForm(EditorForm).progress);
- // if Vel < 0 then Vel := 125;
- // if Vel > 125 then Vel := 125;
- port:=pInteger(integer(DashBoard_FruityPlug) + $0EC)^;
- msg := (port shl 24) or $90;
- msg := msg or (byte(Note ) shl 8 ) or (byte(Vel) shl 16);
- //(* $00000090
- // msg := msg or $90;
- // if port <> -1 then
- // if (msg and $FF000000) <> (port shl 24 ) then exit;
- {
- writeln (clock,' TVoise:'
- , ' N: ', Note // div 100 //);
- , ' V: ', VolToMIDIVel(@VoiceParams.InitLevels.Vol)
- , ' ', qMidiVel (vel)
- //VolToMIDIVel2(@VoiceParams.InitLevels.Vol)
- // , ' Color: ', color
- );
- }
- //MidiIn (msg);
- //!!!
- PlugHost.MIDIOut_Delayed (HostTag,msg);
- voicetag[note] := SetTag;
- Result := TVoiceHandle(integer(@voicetag[note]));
- // MidiIn (msg);
- end;
- procedure TFruityPlugin.Voice_Kill(Handle: TVoiceHandle);
- begin
- end;
- procedure TFruityPlugin.Voice_Release(Handle: TVoiceHandle);
- var port,i,Note,msg : integer;
- begin
- Note := (handle - integer(@voicetag)) div 4;
- // port:=pInteger(integer(DashBoard_FruityPlug) + $0EC)^;
- port:=pInteger(integer(DashBoard_FruityPlug) + $0EC)^;
- msg := (port shl 24) or $80;
- //msg := $01400080 or (Note shl 8 );
- PlugHost.MIDIOut_Delayed (HostTag,msg);
- // MidiIn (msg);
- PlugHost.Voice_Kill(pInteger(Handle)^, true);
- end;
- *)
- function TFruityPlugin.TriggerVoice(VoiceParams: PVoiceParams; SetTag: Integer): TVoiceHandle;
- begin
- VoiceParams.InitLevels.Vol := VoiceParams.InitLevels.Vol + (-0.5 + random );
- result := FPC_FruityPlug.TriggerVoice(VoiceParams, SetTag);
- end;
- procedure TFruityPlugin.Voice_Kill(Handle: TVoiceHandle);
- begin
- FPC_FruityPlug.Voice_Kill(Handle);
- end;
- procedure TFruityPlugin.Voice_Release(Handle: TVoiceHandle);
- begin
- FPC_FruityPlug.Voice_Release(Handle);
- end;
- {$endif}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement