Jump to content

DosBeep: Difference between revisions

From EDM2
m Martini moved page OS2 API:DosBeep to OS2 API:CPI:DosBeep
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==DosBeep==
To produce a beep from the speaker DosBeep is called with the frequency and the length of the beep as arguments.
 
 
===Syntax===


rc = DosBeep( ''ulFrequency'', ''ulDuration'' );
==Syntax==
DosBeep( ''ulFrequency'', ''ulDuration'' )


===Parameters===
===Parameters===
 
; ULONG ''ulFrequency'' (input): The frequency in Hertz (Hz) of the beep to be generated. In the range of 0x25 to 0x7FFF (37 to 32767).
; ULONG ''ulFrequency'' (input)
; ULONG ''ulDuration'' (input): The duration of the beep to be generated. In milliseconds.
: The frequency in Hertz (Hz) of the beep to be generated. In the range of 0x25 to 0x7FFF (37 to 32767).
; ULONG ''ulDuration'' (input)
: The duration of the beep to be generated. In milliseconds.


===Returns===
===Returns===
 
;APIRET  rc
*0 NO_ERROR
APIRET  rc
*395 ERROR_INVALID_FREQUENCY
0       NO_ERROR
395     ERROR_INVALID_FREQUENCY


===Include Info===
===Include Info===
  #define INCL_DOSPROCESS
  #define INCL_DOSPROCESS
  #include <os2.h>
  #include <os2.h>
===Usage Explanation===
To produce a beep from the speaker DosBeep is called with the frequency and the length of the beep as arguments.
===Relevant Structures===
===Gotchas===


===Sample Code===
===Sample Code===
 
<code>
  #define INCL_DOSPROCESS
  #define INCL_DOSPROCESS
  #include <os2.h>
  #include <os2.h>
Line 44: Line 28:
  }                                              /* be called now when the      */
  }                                              /* be called now when the      */
                                                 /* frequency is 400 Hz          */
                                                 /* frequency is 400 Hz          */
</code>


===See Also===
===See Also===
* [[DosDevConfig]]
* [[DosDevIOCtl]]
* [[DosPhysicalDisk]]


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 22:14, 7 January 2024

To produce a beep from the speaker DosBeep is called with the frequency and the length of the beep as arguments.

Syntax

DosBeep( ulFrequency, ulDuration )

Parameters

ULONG ulFrequency (input)
The frequency in Hertz (Hz) of the beep to be generated. In the range of 0x25 to 0x7FFF (37 to 32767).
ULONG ulDuration (input)
The duration of the beep to be generated. In milliseconds.

Returns

APIRET rc
  • 0 NO_ERROR
  • 395 ERROR_INVALID_FREQUENCY

Include Info

#define INCL_DOSPROCESS
#include <os2.h>

Sample Code

#define INCL_DOSPROCESS
#include <os2.h>
#include <stdio.h>    /* For printf */

if(DosBeep(400, 300)) /* Beep a 400 Hz tone for 0.3 seconds */
{
    printf("Invalid frequency to DosBeep()\n"); /* In case of error, should not */
}                                               /* be called now when the       */
                                                /* frequency is 400 Hz          */

See Also