Is it me or Applet.play?

D

David Segall

I have written an applet, based on a couple of other applets on the
Internet, that plays DTMF tones from an input phone number.

My applet plays some, but not all, of the tones but there is no
individual tone that cannot be played. The two second sleep is more
than enough to play a tone and, in any case, the status message is
followed by silence sometimes. A simplified form of the play loop to
play numbers is shown below.

for (int i = 0; i < phoneCount; i++) {
appletParent.showStatus("Dial in progress ..." + sepPhone);
appletParent.play(appletParent.getCodeBase( ),
"audio/"+sepPhone+".au");
sleep(2000);
}

What should I look for in order to fix the problem?
 
T

Thomas Hawtin

David said:
I have written an applet, based on a couple of other applets on the
Internet, that plays DTMF tones from an input phone number.

My applet plays some, but not all, of the tones but there is no
individual tone that cannot be played. The two second sleep is more
than enough to play a tone and, in any case, the status message is
followed by silence sometimes. A simplified form of the play loop to
play numbers is shown below.

for (int i = 0; i < phoneCount; i++) {
appletParent.showStatus("Dial in progress ..." + sepPhone);
appletParent.play(appletParent.getCodeBase( ),
"audio/"+sepPhone+".au");
sleep(2000);
}

What should I look for in order to fix the problem?


It's probably a bug. There have been problems with playing short sounds
(apparently, my machine doesn't have a sound card).

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6251460

The fixed version of J2SE 5.0 does not appear to be available quite yet.
Even when it is, not everyone is going to upgrade immediately. I believe
the usual workaround is to add silence to the end of the clip.

Tom Hawtin
 
D

David Segall

Andrew Thompson said:
URL? Pleas link to (complete, short) code.
<http://www.physci.org/codes/sscce.jsp>
If I could do this I would have. I don't have a suitable web site and,
as you can see from my code fragment, a post here would require at
least one binary which you would be the first to criticize. Are you
offering space at www.physci.org to post my problem?

The other difficulty with your advice to produce a "Short, Self
Contained, Correct (Compilable), Example" is that it requires a
thorough understanding of the problem. The advice is good in that it
will probably obviate the need for a post if the poster can do it. The
advice is useless in most circumstances because the poster cannot
isolate the problem to the extent that it is both short and self
contained.

Debugging is the art of asking the right questions and Usenet provides
an ideal environment for this. Post your sscce.jsp link as a way of
speeding up the process but, if you want to help, please also post a
short, self contained, question that elicits the information that is
missing from the original post.
 
A

Andrew Thompson

If I could do this I would have. I don't have a suitable web site

'GeoCities' +
<http://www.google.com/search?hl=en&q=free+"web+host"> ?

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"If no one out there understands, start your own revolution and cut out the
middle man."
Billy Bragg 'Waiting For The Great Leap Forward'
 
A

Andrew Thompson

please also post a
short, self contained, question that elicits the information that is
missing from the original post.

<short enough for you?>
Can you provide the code that breaks?
</short enough for you?>

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Get off your f**kin cross. We need the f**kin space to nail the next fool
martyr."
Tool 'Eulogy'
 
R

Roedy Green

The
advice is useless in most circumstances because the poster cannot
isolate the problem to the extent that it is both short and self
contained.

That is not quite true. Most of the time the user has made NO ATTEMPT
to do so. One of the reasons old timers are so big on SCCSE's in that
in creating them, novices often solve their own problems. It is a
powerful technique to isolate the problem -- to separate out the
factors that could and could not be the culprits.

There are two goals:

1. getting the problem solved

2. getting you to become a more competent, independent programmer,
perhaps one capable of helping others.

In presenting an SCCSE (or an explanation of why there is not one) to
the old timers, it proves the naive user has at least made an effort
to solve the problem and is not just playing Marilyn Monroe to get
gallants to do her homework.

If you present without one, you are not asking anyone to analyse your
problem, but merely to tell you of any gotchas in the general area you
may be unaware of, or to suggest a whack-on-the-side-of-the-head fresh
approaches to solving the problem. Usually only old timers want that
level of advice.
 
D

David Segall

Andrew Thompson said:
<short enough for you?>
Yes, but I did not think it was missing from the original post.
Can you provide the code that breaks?

for (int i = 0; i < phoneCount; i++) {
appletParent.showStatus("Dial in progress ..." + sepPhone);
appletParent.play(appletParent.getCodeBase( ),
"audio/"+sepPhone+".au");
sleep(2000);
}
The code "works" to the extent the loop is executed for each digit in
the phone number and displays the digit in the status bar. It also
correctly plays any one digit phone number. However, it fails to play
all the digits in a longer phone number. I am using the 1.5_04 SDK.
 
D

David Segall

Roedy Green said:
but merely to tell you of any gotchas in the general area you
may be unaware of, or to suggest a whack-on-the-side-of-the-head fresh
approaches to solving the problem.
That's exactly what I want. Any ideas?
 
D

David Segall

Stan said:
I've never used sound in Java but I think I read something about
invokeLater...
this might help:
http://forum.java.sun.com/thread.jspa?threadID=585270&messageID=3006016

Stan Dickerson
Thanks Stan. I think my problem is the one referenced by Tom Hawtin's
response - http://bugs.sun.com/bugdatabase/view...bug_id=6251460. I am
busy trying to publish my SSCCE
<http://www.physci.org/codes/sscce.jsp> to confirm it. The SSCCE
appears to work with JRE 1.4. Publication has been delayed because
first I need to set up a web site!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top