[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

working with internal speaker

Posted on 2002-05-22
3
Medium Priority
?
388 Views
Last Modified: 2013-11-20
how can i work with internal speaker in mfc?
( i want have a function simular sound in c++ that work only with internal speaker)
0
Comment
Question by:jCISCO3640
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:mblat
ID: 7030411
Beep
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
  DWORD dwDuration   // sound duration
);
Parameters
dwFreq
Windows NT/ 2000: [in] Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
dwDuration
Windows NT/ 2000: [in] Specifies the duration, in milliseconds, of the sound.
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.
0
 

Author Comment

by:jCISCO3640
ID: 7034207
i want use it in win98
0
 
LVL 4

Accepted Solution

by:
mblat earned 150 total points
ID: 7035568
That should work under Win98....

/* Speaker control.  Call this function with a non-zero argument to
   turn the speaker on at the desired frequency.
   Call it with zero to turn the speaker off.  */
void Beep(int nFreq)
{
   int tmp;

   if (nFreq != 0)
   {
      // Set up the divisor for the desired frequency
      long fq = 1190000L / (long)nFreq;

      // Set up the frequency control timer
      _outp(67, 0xb6);
      _outp(66, fq & 0xff);
      _outp(66, (fq >> 8) & 0xff);

      // Turn on the speaker
      tmp = _inp(97);
      _outp(97, tmp | 0x03);
   }
   else
   {
      // Turn off the speaker
      tmp = _inp(97);
      _outp(97, tmp & 0xfc);
   }
}
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question