Autor Beitrag
GI_PC
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 28.12.06 01:03 
Hallo Leute!
Ich möchte euch fragen wie man im Delphi Sound programmiert.
Ist doch:
z.b

begin
Sound(440);
end;

Aber ich weiss nicht warum immer ein Fehlermeldung in "Sound".

Könnt ihr mir bitte erklären?

Danke.


Moderiert von user profile iconGausi: Topic aus Programmierwerkzeuge verschoben am Do 28.12.2006 um 15:03
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Do 28.12.06 10:47 
Hast du bei uses mmsystem dazugefügt?

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 28.12.06 14:35 
Nein, hab ich nicht, aber ich habe jetz versucht, trotzdem nicht :(


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
program Project2;
{$APPTYPE CONSOLE}
uses
  SysUtils;
 uses mmsystem

begin
  // Insert user code here
  Sound(440);
end.


Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Do 28.12.06 14:45 
YIch weiß nicht ob das einen Unterschied macht wenn du hinter SysUtils einfach ein Komma(,) machst und mmsystems dahinter schreibst

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Do 28.12.06 15:24 
Wie kommt ihr darauf, dass es eine Prozedur "Sound" gibt? Dann könnte ich ja genauso schreiben
ausblenden Delphi-Quelltext
1:
2:
3:
begin
  EgoShooter('Half-Life 2', 1024 * 768, SoundOn);
end;

und mein Half-Life ist fertig :roll:
Such mal hier oder bei [url=www.torry.net]Torry[/url], da gibts bestimmt nen Codeschnipsel (nicht zu Half-Life, zum Sound :lol: ).
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Do 28.12.06 15:29 
Hallo,

meinst du etwas Suche im MSDN BEEP()?

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
JDKDelphi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 115
Erhaltene Danke: 22

WIN2000, XP, WIN 7 , UNIX, LINUX
Assembler für (Z8x, 68xxx,R6000,Intel), DELPHI 6 Enterprise, MAGIC eDeveloper V9+V10, C++, C#,VB, .NET, zertifizierter iBOLT-Programmierer
BeitragVerfasst: Do 28.12.06 15:36 
willst Du nur Pieptöne ausgeben oder auch richtige WAV-Dateien.
Da ist dann die Unit MMSYSTEM genau die richtige Wahl.
Dort gibt's Funktionen zum Ansteuern der Soundkarte, MIDI und vieles mehr.
Ich hatte da mal was gemacht, um mit der Soundkarte ein Messsystem aufzubauen

Gruss

JDKDelphi
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 28.12.06 15:41 
also nicht nur Beep man kann auch do, re, mi, fa...etc spielen.

Na SOUND prozedur das habe ich in ein site gefunden. So etwas wie Tutorial, da stand genau so wie ich vorher gepost habe, aber weiss nicht warum das nicht geht.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
write (chr(7));
write (#7);
end.


das ist nur für beep, das geht, aber in Turbo pascal, baer ich möchte in delphi, wen ich z.b auf ein taste klicke, dann spielt ein sound,

also ist:
ausblenden Delphi-Quelltext
1:
2:
3:
begin
Sound(220); {La}
end;


aber zeigt mir immer ein Fehler meldung beim Sound.

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 28.12.06 15:49 
JDKDelphi, ja das möchte ich auch machen, aber das ist ein Etappe schwerer, das mache ich später,:)

Aber ich interessiere mich auch wie das funtionieren.
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Do 28.12.06 15:54 
user profile iconGI_PC hat folgendes geschrieben:
Na SOUND prozedur das habe ich in ein site gefunden. So etwas wie Tutorial, da stand genau so wie ich vorher gepost habe, aber weiss nicht warum das nicht geht.

Kannst du mal die Addresse von dem Tutorial posten, das würde mich mal interessieren.
JDKDelphi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 115
Erhaltene Danke: 22

WIN2000, XP, WIN 7 , UNIX, LINUX
Assembler für (Z8x, 68xxx,R6000,Intel), DELPHI 6 Enterprise, MAGIC eDeveloper V9+V10, C++, C#,VB, .NET, zertifizierter iBOLT-Programmierer
BeitragVerfasst: Do 28.12.06 15:56 
Titel: SOUND
Hallo GI_PC,

die Funktion SOUND bzw. BEEP gibts eigentlich nicht mehr seit WIN95.

Bei installierter Soundkarte wird diese vom System angesprochen, sonst der Standardlautsprecher im PC mit den Standardsystemsounds.

So einfach wie in Turbo-Pascal geht's leider nicht mehr.

Die Hilfe in Delphi zeigt noch folgendes:

<<<<<< ZITAT: >>>>>>>

The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes.

BOOL Beep(

DWORD dwFreq, // sound frequency, in hertz
DWORD dwDuration // sound duration, in milliseconds
);


Parameters

dwFreq

Windows NT:

Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).

Windows 95:

The parameter is ignored.

dwDuration

Windows NT:

Specifies the duration, in milliseconds, of the sound.

Windows 95:

The parameter is ignored.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Windows 95:

The Beep function ignores the dwFreq and dwDuration parameters. On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.

<<<<<<< ZITAT ENDE >>>>>>

Ich schaue mal nach, was ich noch so in meinem SOURCE-Pool so finde

Gruss

JDKDelphi
GI_PC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Do 28.12.06 15:57 
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 28.12.06 16:36 
Die Funktion Beep für den Systemlautsprecher lässt sich entweder ansprechen indem man SysUtils aus den Uses wirft und stattdessen Windows reinnimmt, oder indem man einfach schreibt:
windows.Beep(500,500); :wink:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
rey003
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win XP
BDS 2006
BeitragVerfasst: Do 28.12.06 17:14 
Hallo
wenn es nur ein kurzer Standartton sein soll geht auch messagebeep(1)! oder? :wink:

_________________
Daniel S.
Stoney
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 122

Mac OS X 10.6 "Snow Leopard", Ubuntu Linux 9.04, Mandriva 2010, Win 7, Win Vista, Win XP
Object Pascal (Turbo Delphi, FPC 2.2.4, Lazarus), C++ (Code::Blocks, XCode), Java (Eclipse)
BeitragVerfasst: Do 28.12.06 19:01 
user profile iconGI_PC hat folgendes geschrieben:
Hier Chryzler :)
www.cybwarrior.com/articles/read.php?id=70

Dieses französische Tutorial zeigt wie man in Turbo Pascal einen Ton erzeugen kann, nicht in Delphi. Da es die Unit crt afaik in Delphi nicht mehr gibt, gibt es logischerweise auch keine Prozedur namens "Sound()" bzw. "NoSound()".