DosBeep (OS/2 1.x): Difference between revisions
Appearance
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
This call generates sound from the speaker. | This call generates sound from the speaker. | ||
Line 14: | Line 9: | ||
==Return Code== | ==Return Code== | ||
;rc (USHORT) - return:Return code descriptions are: | |||
Return code descriptions are: | |||
*0 NO_ERROR | *0 NO_ERROR | ||
*395 ERROR_INVALID_FREQUENCY | *395 ERROR_INVALID_FREQUENCY | ||
==Remarks== | ==Remarks== | ||
DosBeep executes synchronously. An application program that invokes DosBeep waits until the specified number of milliseconds expire before it resumes execution. | DosBeep executes synchronously. An application program that invokes DosBeep waits until the specified number of milliseconds expire before it resumes execution. | ||
== | ==Bindings== | ||
===C | ===C=== | ||
<PRE> | <PRE> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
Line 29: | Line 23: | ||
USHORT rc = DosBeep(Frequency, Duration); | USHORT rc = DosBeep(Frequency, Duration); | ||
USHORT Frequency; | USHORT Frequency; /* Hertz (Hz) */ | ||
USHORT Duration; | USHORT Duration; /* Length of sound */ | ||
USHORT rc; | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
===MASM=== | |||
<PRE> | |||
EXTRN DosBeep:FAR | |||
INCL_DOSPROCESS EQU 1 | |||
PUSH WORD Frequency ;Frequency (in Hertz) | |||
PUSH WORD Duration ;Length of sound (in milliseconds) | |||
CALL DosBeep | |||
Returns WORD | |||
</PRE> | |||
==Example Code== | |||
This example generates a beep for 1 second (1,000 milliseconds) at a frequency of 1,380. | This example generates a beep for 1 second (1,000 milliseconds) at a frequency of 1,380. | ||
<PRE> | <PRE> | ||
Line 44: | Line 52: | ||
rc = DosBeep(BEEP_FREQUENCY, | rc = DosBeep(BEEP_FREQUENCY, | ||
BEEP_DURATION); | BEEP_DURATION); | ||
</PRE> | </PRE> | ||
[[Category:Dos]] | [[Category:Dos]] |
Revision as of 03:43, 1 December 2019
This call generates sound from the speaker.
Syntax
DosBeep (Frequency, Duration)
Parameters
- Frequency (USHORT) - input
- Tone in Hertz (cycles per second) in the range 37 through 32767.
- Duration (USHORT) - input
- Length of the sound in milliseconds.
Return Code
- rc (USHORT) - return
- Return code descriptions are:
- 0 NO_ERROR
- 395 ERROR_INVALID_FREQUENCY
Remarks
DosBeep executes synchronously. An application program that invokes DosBeep waits until the specified number of milliseconds expire before it resumes execution.
Bindings
C
#define INCL_DOSPROCESS USHORT rc = DosBeep(Frequency, Duration); USHORT Frequency; /* Hertz (Hz) */ USHORT Duration; /* Length of sound */ USHORT rc; /* return code */
MASM
EXTRN DosBeep:FAR INCL_DOSPROCESS EQU 1 PUSH WORD Frequency ;Frequency (in Hertz) PUSH WORD Duration ;Length of sound (in milliseconds) CALL DosBeep Returns WORD
Example Code
This example generates a beep for 1 second (1,000 milliseconds) at a frequency of 1,380.
#define INCL_DOSPROCESS #define BEEP_FREQUENCY 1380 #define BEEP_DURATION 1000 USHORT rc; rc = DosBeep(BEEP_FREQUENCY, BEEP_DURATION);