Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? chr(7) produce no sound on newer machines

Status
Not open for further replies.

NasibKalsi

Programmer
Jan 8, 2004
417
CA
Hi All:

I have a small application where I produce different bell sound based on the input. It has been working for years and still work on he older machines.

But on newer computers, for example Toshiba Netbook 10" or Dell notebook, no sound comes out.

I do not think it is windows problem.

Anyone experienced this issue ? I am using Windows XP Pro SP3 32-Bit.

My Best

Nasib Kalsi
 
Here is a routine that I got WAY back when and slightly modified it to recognize the version of Windows and act accordingly.

For newer Windows OS's it will play a WAV file when the function is called.

For older versions of Windows, it will utilize the KB 'bell' like before.

Code:
FUNCTION NiceChime
lcOS = OS(1)
SET BELL ON

IF lcOS = "NT";
      OR VAL(lcOS) >= 5
   mcCordWav = ""

   DO CASE
      CASE FILE('C:\WINNT\Media\Notify.WAV')
         mcCordWav = 'C:\WINNT\Media\Notify.WAV'

      CASE FILE('C:\WINNT\Media\Cord.WAV')
         mcCordWav = 'C:\WINNT\Media\Cord.WAV'

      CASE FILE('C:\WINDOWS\Media\Notify.WAV')
         mcCordWav = 'C:\WINDOWS\Media\Notify.WAV'

      CASE FILE('C:\WINDOWS\Media\Cord.WAV')
         mcCordWav = 'C:\WINDOWS\Media\Cord.WAV'
   ENDCASE

   IF !EMPTY(mcCordWav)
      SET BELL TO mcCordWav
      ??CHR(7)
   ENDIF
ELSE
   SET BELL TO 2600,3     && High note
   ??CHR(7)

   SET BELL TO 2200,3     && Middle note
   ??CHR(7)
ENDIF

SET BELL TO
SET BELL OFF
RETURN .T.

Good Luck,
JRB-Bldr
 
Hi JRB-Bldr

Thanks for your reply.

But the problem is - no sound comes out of the speakers.

I am using FoxPro DOS ver 2.6

I have tested what you have given the example. It look like there is no sound card in the system. However, I can play sound files outside the foxpro.

the command
set bell to "Notify.wav"

gives syntax error. I have to use

set bell to "Notify.wav",3 && play for 3-seconds

but still no sound

I tried both command

set bell on
set bell to 2000,3
?? chr(7)

* or
set bell on
set bell to "c:\windows\media\notify.wav",3
?? chr(7)


but no sound comes out of the laptop,

Any clue ?
 
"no sound comes out of the speakers."

Most typically that is due to workstation issues such as a bad sound card, workstation sound set to Mute, etc. and it should have nothing to do with Foxpro.

Have you ensured that the workstation will 'play' sounds such as the Windows Startup tune, Windows Shutdown tune, etc?

If not, then fix the workstation issues first and then think about getting the FP application to issue sounds to the user.

"It look like there is no sound card in the system"

With laptops there would be no 'sound card' since there is no bus to support a single-purpose card. Instead sounds are generated from chips on the motherboard.

You might want to look for the workstation volume control. It is possible that the sound is turned OFF.

As you might note from my code, if your laptop OS is NT or later, then you need to issue 'sounds' in a different manner than the old Keyboard bell. Therefore you will need to get the laptop sound working on its own before you get any FP sounds working.

Also, if the laptop on its own was not issuing ANY sounds, then nothing you do with Foxpro will resolve it.

If it were me I'd spend about 10 to 15 minutes trying to resolve it and if I could not, then I'd look for Technical Support either from the manufacturer or the seller.

Good Luck,
JRB-Bldr


 
Fox DOS can not talk to the sound card. It can only use the mother board speaker. Most new systems don't have come with a motherboard speaker and they don't bother sending something to the soundcard.

I have seen some systems that have a bios setting to redirect that sound to the soundcard you'll have to check your bios to see if your have one.

Alan
 
Jrbbldr - In windows XP SP3 the sound works fine. Also in vfp9 the sound works fine. Only when I issue ? chr(7) in FP2.6 (dos) version there is no sound. This happens only on the newer laptops. The older laptop the same works just fine. I think the newer laptop do not have legacy drivers.(?)

Alan92rtt: I do not know how the FP2.6 tranmit the chr(7) command to the bios. I think that is where the problem lies.
I do not think it will make a difference if you put the speaker on motherboard or external. As most laptops have the speakers in them.

I tested this only on the laptops.

Any clue ???

thanks,

Nasib Kalsi
 
this is what a programmer here came up with a few years ago.
Code:
PARAMETER times, out
PRIVATE mb, x, nTone
IF TYPE('times') = "L"
	times = 1
	nTone = 1
else
	nTone = iif(times=1,1, iif(times=3,35,75) )
ENDIF
IF EMPTY(out)
	if nTone = 35
		times = 1
		out = .1
	else	
		out = .01
	endif	
ENDIF

IF ! "FOXTOOLS" $ SET('library')
	DO CASE
	CASE "Visual" $ VERSION()
		SET LIBRARY TO "C:\Program Files\Microsoft Visual Studio\vfp98\foxtools.fll" ADDITIVE
	OTHERWISE
		SET LIBRARY TO C:\foxprow\foxtools.fll ADDITIVE
	ENDCASE
ENDIF
mb = regfn("MessageBeep", "I", "I")
&&1=default, 25 = critical,35=question,55=exclamation,75 = asterik

FOR x = 1 TO times
	err = callfn(mb, nTone)
	WAIT "" TIMEOUT out
ENDFOR
RETURN ""
 
Thanks Ftfaprc.

I tried to find the foxtools for windows version of foxpro(2.6) but still looking. I am working in 2.6 os version. VFP 9.0 foxtools produces an error.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top