DosBeep (OS/2 1.x): Difference between revisions
Appearance
m Martini moved page OS2 API:CPI:LEGACY:DosBeep to DosBeep (Legacy) |
mNo edit summary |
||
Line 1: | Line 1: | ||
This call generates sound from the speaker. | This call generates sound from the speaker. | ||
==Syntax== | ==Syntax== | ||
DosBeep (Frequency, Duration) | |||
DosBeep | |||
==Parameters== | ==Parameters== | ||
; Frequency (USHORT) - input : Tone in Hertz (cycles per second) in the range 37 through 32767. | ;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== | ==Return Code== | ||
rc (USHORT) - return | rc (USHORT) - return | ||
Return code descriptions are: | Return code descriptions are: | ||
*0 NO_ERROR | |||
* 0 | *395 ERROR_INVALID_FREQUENCY | ||
* 395 | |||
==Remarks== | ==Remarks== | ||
Line 33: | Line 24: | ||
USHORT rc = DosBeep(Frequency, Duration); | USHORT rc = DosBeep(Frequency, Duration); | ||
USHORT | USHORT Frequency; /* Hertz (Hz) */ | ||
USHORT | USHORT Duration; /* Length of sound */ | ||
USHORT | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
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> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
#define BEEP_FREQUENCY 1380 | #define BEEP_FREQUENCY 1380 | ||
#define BEEP_DURATION 1000 | #define BEEP_DURATION 1000 | ||
USHORT rc; | USHORT rc; | ||
rc = DosBeep(BEEP_FREQUENCY, | |||
BEEP_DURATION); | |||
</PRE> | </PRE> | ||
===MASM Binding=== | ===MASM Binding=== | ||
Line 62: | Line 51: | ||
Returns WORD | Returns WORD | ||
</PRE> | </PRE> | ||
[[Category: | [[Category:Dos]] |
Revision as of 04:09, 6 January 2017
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.
Example Code
C Binding
#define INCL_DOSPROCESS USHORT rc = DosBeep(Frequency, Duration); USHORT Frequency; /* Hertz (Hz) */ USHORT Duration; /* Length of sound */ USHORT rc; /* return 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);
MASM Binding
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