|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
Error message with playSound method |
carlosfx
|
Post subject: Error message with playSound method |
Post rating: 0
|
Posted: Wed 12 Sep, 2012, 19:23
|
|
User rating: 0
Joined: Thu 30 Jun, 2011, 20:11 Posts: 41 Location: Spain,
|
Dear Support Team,
I am trying to add an alert sound to my program. I found the PlaySound method that you give on the T3 indicator alert. I use it, but I don't find any .wav file that this method is able to play.
I get the following error message:
line with format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame, not supported.
I am using Ubuntu as OS, and I would run the strategy on it, on Mac OS and maybe also on windows.
Thanks in advance!
PS: Sorry that I put this message on the wrong forum before...
|
|
|
|
 |
API Support
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 07:25
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
First of all find a java program which plays sound. Compile and test it. If it works, then integrate into your strategy.
|
|
|
|
 |
carlosfx
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 08:57
|
|
User rating: 0
Joined: Thu 30 Jun, 2011, 20:11 Posts: 41 Location: Spain,
|
I know that my doubts are maybe stupid, but I am not a programmer. I was looking for solutions before posting it. I got the PlaySound method from this link. https://www.dukascopy.com/wiki/#Create_A ... end_changeI had permission problems, but could solve it. Anyway it didn't work. Then I tried with this piece of code (also from the forum). private void playSound(String wavFile, int repeats) { try { AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File(wavFile)); AudioFormat af = audioInputStream.getFormat(); int nSize = (int) (af.getFrameSize() * audioInputStream.getFrameLength()); byte[] audio = new byte[nSize]; DataLine.Info info = new DataLine.Info(Clip.class, af, nSize); audioInputStream.read(audio, 0, nSize);
for (int i = 0; i < repeats; i++) { Clip clip = (Clip) AudioSystem.getLine(info); clip.open(af, audio, 0, nSize); clip.start(); } } catch (Exception e) { console.getOut().println(e.getMessage()); } } It didn't work either. Both give the same errors. I try to play a bell.wav file downloaded from internet. I would appreciate some help. Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 09:10
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
carlosfx wrote: line with format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame, not supported. This is neither JForex-API nor Java problem.
|
|
|
|
 |
carlosfx
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 09:46
|
|
User rating: 0
Joined: Thu 30 Jun, 2011, 20:11 Posts: 41 Location: Spain,
|
Thanks a lot. I see. It is only my problem. The problem of a Dukascopy customer. But that is not your matter, is it?
|
|
|
|
 |
API Support
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 09:54
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Quote: But that is not your matter, is it? See the second sentence in the forum's header.
|
|
|
|
 |
carlosfx
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 10:20
|
|
User rating: 0
Joined: Thu 30 Jun, 2011, 20:11 Posts: 41 Location: Spain,
|
Depends on what you consider programming questions.
Dukascopy team posted a method to play .wav files. I'm trying to use that method. It doesn't work. It is probably a problem of the .wav file I'm trying to play, so from your point of view you are right.
But it is because the method has some requirements which are not filled by the file I 'm trying to play. It would be good to know what kind of files is the method provided by support team able to play, and maybe how or where can we get that kind of files. So from my point of view I try to program something and I have problems running it. And that is a programming question. I think it would be really easy for you to help me, but forget it. I'm a medical doctor, I see lots of patients which don't have a real medical condition, but they think they have. It's up to me helping somehow if it is on my hand or acting arrogant and telling "this is not a medical condition, good bye". What kind of doctor do you like to find?
|
|
|
|
 |
carlosfx
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 10:33
|
|
User rating: 0
Joined: Thu 30 Jun, 2011, 20:11 Posts: 41 Location: Spain,
|
The only thing you needed to do was attaching a bell sound file which can be played with that method, or a link to a sounds library which can be used. It takes probably 1 min, and the people you are supposed to help here (today me) would have been very satisfied with you. Instead of that you chose not helping, losing your time, my time, etc. Don't worry. I will find the solution on my own, as I am learning Java from 0. Thanks anyway and good luck with your doctors  .
|
|
|
|
 |
API Support
|
Post subject: Re: Error message with playSound method |
Post rating: 0
|
Posted: Thu 13 Sep, 2012, 10:47
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|