en:docs:fapi:dosbeep

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
en:docs:fapi:dosbeep [2018/08/25 07:28] – created prokusheven:docs:fapi:dosbeep [2020/12/06 10:18] – 244 prokushev
Line 9: Line 9:
 ==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.+  * 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 NO_ERROR
Line 22: Line 22:
 ==Example Code== ==Example Code==
 ===C Binding=== ===C Binding===
 +<code c>
  
-  #define INCL_DOSPROCESS +#define INCL_DOSPROCESS 
-   + 
-  USHORT  rc = DosBeep(Frequency, Duration); +USHORT  rc = DosBeep(Frequency, Duration); 
-   + 
-  USHORT  Frequency;     /* Hertz (Hz) */ +USHORT  Frequency;     /* Hertz (Hz) */ 
-  USHORT  Duration;      /* Length of sound */ +USHORT  Duration;      /* Length of sound */ 
-   + 
-  USHORT  rc;            /* return code */+USHORT  rc;            /* return code */ 
 +</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. 
  
-  #define INCL_DOSPROCESS +<code c> 
-  #define BEEP_FREQUENCY 1380 +#define INCL_DOSPROCESS 
-  #define BEEP_DURATION 1000 +#define BEEP_FREQUENCY 1380 
-   +#define BEEP_DURATION 1000
-  USHORT  rc; +
-   +
-  rc = DosBeep(BEEP_FREQUENCY, +
-              BEEP_DURATION);+
  
 +USHORT  rc;
 +
 +rc = DosBeep(BEEP_FREQUENCY,
 +             BEEP_DURATION);
 +</code>
 ===MASM Binding=== ===MASM Binding===
 +<code asm>
 +EXTRN  DosBeep:FAR
 +INCL_DOSPROCESS     EQU 1
  
-  EXTRN  DosBeep:FAR +PUSH   WORD    Frequency     ;Frequency (in Hertz) 
-  INCL_DOSPROCESS     EQU 1 +PUSH   WORD    Duration      ;Length of sound (in milliseconds) 
-   +CALL   DosBeep 
-  PUSH   WORD    Frequency     ;Frequency (in Hertz) +</code>
-  PUSH   WORD    Duration      ;Length of sound (in milliseconds) +
-  CALL   DosBeep+
  
 Returns WORD Returns WORD
Line 57: Line 61:
  
 Text based on http://www.edm2.com/index.php/OS2_API:CPI:LEGACY:DosBeep Text based on http://www.edm2.com/index.php/OS2_API:CPI:LEGACY:DosBeep
 +
 +
 +{{page>en:templates:fapi}}