Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Warum ist diese Soundkomponente stumm? (https://www.delphipraxis.net/125451-warum-ist-diese-soundkomponente-stumm.html)

implementation 6. Dez 2008 09:14


Warum ist diese Soundkomponente stumm?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ich habe den Quelltext der angehängten Komponente einem Buch entnommen
Dort funktioniert er auch, doch bei mir ist dieKomponente stumm und gibt keinen Ton von sich.

Bei der angehängten Komponente handelt essich um eine Klaviertaste (TPianokey), die per midiOut einen Ton ausgibt.

Warum funktioniert die Komponente bei mir nicht?

mkinzler 6. Dez 2008 10:18

Re: Warum ist diese Soundkomponente stumm?
 
Gibt es keine Beschreibung hierzu?

turboPASCAL 6. Dez 2008 21:13

Re: Warum ist diese Soundkomponente stumm?
 
Hilft dir das weiter ?
http://www.delphipraxis.net/internal...t.php?t=147889

implementation 9. Dez 2008 15:14

Re: Warum ist diese Soundkomponente stumm?
 
hab ich mir angeguckt

ich stelle dieses thema auch rein, weil ich nicht weiß warum es nicht funktioniert
dann brauch ich auch keine einweisung

daher hilft mir das jetzt leider nicht weiter

turboPASCAL 9. Dez 2008 16:46

Re: Warum ist diese Soundkomponente stumm?
 
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. ;)

implementation 10. Dez 2008 15:29

Re: Warum ist diese Soundkomponente stumm?
 
hab verstanden --> keine Lautstärke

aber klappt immer noch nicht

turboPASCAL 10. Dez 2008 15:33

Re: Warum ist diese Soundkomponente stumm?
 
Hast du das so in der Komponente ersetzt ?

implementation 10. Dez 2008 15:34

Re: Warum ist diese Soundkomponente stumm?
 
ja habe ich

DeddyH 10. Dez 2008 15:36

Re: Warum ist diese Soundkomponente stumm?
 
MIDI wird generell aber abgespielt?

implementation 10. Dez 2008 15:38

Re: Warum ist diese Soundkomponente stumm?
 
wie meinst du das

ja, das dings im link hat bei mir funktioniert


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:49 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz