000
12.12.2002, 23:52
spacemonkey
|
Ich bin gerade dabei, in Delphi ein kleines Programm zu schreiben, mit dem man die Wave-Lautstärke einstellen kann. Nun bin ich aber auf ein Problem gestoßen, an dem ich mir den Kopf zerbreche: Die Prozedur hier wandelt die prozentuale Lautstärke für beide Kanäle zuerst ins Hex-Format um und packt die dann zusammen in einen String. (FFFF0000 entspräche dann zum Beispiel: link: 100% rechts: 0%). Mein Problem ist nur, dass die Funktion WaveOutSetVolume diesen Parameter in DWord braucht. Frage: Wie kann ich einen String FFFFFFFF in einen DWord umwandeln?
procedure SetVolume(Left, Right : Integer); var c : DWord; BLeft, BRight, BTotal: Variant; begin BLeft:=format('%1.f',[left/100*$FFFF]); BLeft:=inttohex(strtoint(bleft),4); BRight:=format('%1.f',[right/100*$FFFF]); BRight:=inttohex(strtoint(bright),4); BTotal:=concat(BLeft, BRight); //Irgendwie muss BTotal nach c kovertiert werden
try WaveOutSetVolume(0,c); except Application.MessageBox('Lautstärke konnte nicht gesetzt werden!','Fehler',MB_ICONEXCLAMATION); end; end;
Ich hoffe, hier kann mir jemand helfen.
Grüße, chris
--
worker bees can leave even drones can fly away the queen is their slave
|
|
Profil || Suche
|
001
13.12.2002, 23:42
TheTinySteini
|
ROFL.
Erm, naja, sorry... also:
c = ( (left/100) * $FFFF ) shl 16 + (right/100) * $FFFF;
Sollte funktionieren, eventuell musste right und left vertauschen.
--
TheTinySteini Coder Poke646 "Don't Panic" - Hitchhiker's Guide to the Galaxy
|
|
Profil || Suche
|
002
14.12.2002, 19:49
spacemonkey
|
:-) okay, warum einfach wenn's auch umständlich geht. Danke auf jeden Fall.
--
worker bees can leave even drones can fly away the queen is their slave
|
|
Profil || Suche
|
003
04.01.2003, 16:50
The_Overmind
|
DeinDWord := StrToInt('$'+DeinString);
Sorry das das so spät kommt, hab den Thread erst jetzt gefunden :rolleyes:
--
|
|
Profil || Suche
|