AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Warum ist diese Soundkomponente stumm?

Ein Thema von implementation · begonnen am 6. Dez 2008 · letzter Beitrag vom 11. Dez 2008
 
Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#5

Re: Warum ist diese Soundkomponente stumm?

  Alt 9. Dez 2008, 16:46
Es kommt kein Ton weil er nicht hötbar ist.

Delphi-Quellcode:
const
  NOTE_ON = $90;
  NOTE_OFF = $80;

var
  MidiNote: Cardinal;

  function MakeMidiNote(Octave, Note, Velocity: Byte): Cardinal; { Cardinal = DWORD }
  begin
    // 0..127 Octave
    // Note 0..11 -> C, C#, D, D#, E, F, F#, G, G#, A, A#, H
    // Velocity 0..127 -> Lautstärke der Note

    Result := (((Octave + 2) * 12 or Note mod 12) shl 8) or (Velocity shl 16);
  end;

procedure TPianokey.MouseDown(Button:TMouseButton; Shift: TShiftstate; X, Y: Integer);
begin
  inherited MouseDown(Button,Shift,X,Y);
  if (Button=mbLeft) and (midiOut<>0) then
  begin
    // midiOutShortMsg(midiOut, $FF0090+(256*FNote));

    MidiNote := MakeMidiNote(Octave, FNote, 100);
    midiOutShortMsg(midiOut, MidiNote or NOTE_ON);
  end;
end;

procedure TPianokey.MouseUp(Button:TMouseButton; Shift: TShiftstate; X, Y: Integer);
begin
  inherited MouseUp(Button,Shift,X,Y);
  if (Button=mbLeft) and (midiOut<>0) then
  begin
   // midiOutShortMsg(midiOut, $80+(256*FNote));
   midiOutShortMsg(midiOut, MidiNote or NOTE_OFF);
  end;
end;
Auf diese Weise lässt es sich besser lesen.
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:10 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz