| View previous topic :: View next topic |
| Author |
Message |
YorickPeterse
Joined: 12 Jan 2009 Posts: 6 Location: The Netherlands
|
Posted: Mon Jan 12, 2009 2:52 pm Post subject: playTone method acting weird |
|
|
Dear members,
Currently I am in the middle of a school project. My task is to write a metronome and audio tuner in Java for a mobile phone.
The metronome is almost finished ( about 98% ), however there is one little problem: the duration of the playTone method can't be specified.
The idea is that a user enters the amount of beats / minute in a textbox, this will be retrieved by Java and it will be converted to the right amount of beats ( 60 000 / amount of beats entered by user ). Now the problem is, no matter what value you enter for the amount of BPM it simply doesn't work. Wrong code you might think, but no. I thought the same but Netbeans gave no errors, so I tried to make another project with only the playTone method in it. I entered only the following lines of code ( can't remember it completely so if there are errors that's the reason )
| Code: |
try {
Manager.playTone(69,500000,100);
}catch (MediaException me) {System.err.println(me);}
|
But this would result in the same problem, so I tried to do it the following way:
| Code: |
try {
Manager.playTone(ToneControl.C4,1000,100);
}catch (MediaException me) {System.err.println(me);}
|
Still no luck, even though all the imports were correct because otherwise it wouldn't work at all.
I added the entire source of the metronome project in a .zip file to make it a bit easier for you.
You can download the project here
I hope there is somebody who can help me.
p.s. I am using Netbeans 6.5 ( full package ) |
|
| Back to top |
|
 |
YorickPeterse
Joined: 12 Jan 2009 Posts: 6 Location: The Netherlands
|
Posted: Tue Jan 13, 2009 2:21 pm Post subject: |
|
|
| Sorry for the early bump, but it's important that I fix this as soon as possible as the entire project ( metronome and audio tuner ) needs to be finished 1st of March 2008. |
|
| Back to top |
|
 |
YorickPeterse
Joined: 12 Jan 2009 Posts: 6 Location: The Netherlands
|
Posted: Sun Jan 18, 2009 9:17 pm Post subject: |
|
|
| Still nobody ? It's very important so every tip would be greatly appreciated. |
|
| Back to top |
|
 |
Petr Suchomel Posted via mailing list.
|
Posted: Mon Jan 19, 2009 8:56 am Post subject: playTone method acting weird |
|
|
Could you specify the platform you are using WTK? Some other SDK?
--Petr
YorickPeterse wrote:
| Quote: | Still nobody ? It's very important so every tip would be greatly appreciated.
|
--
Petr Suchomel <address-removed>
Sun Microsystems, Inc.
Phone +420 2 33009234 (x49234), Fax +420 2 33009311 |
|
| Back to top |
|
 |
YorickPeterse
Joined: 12 Jan 2009 Posts: 6 Location: The Netherlands
|
Posted: Mon Jan 19, 2009 3:51 pm Post subject: |
|
|
Sun Java wireless Toolkit 2.5.2 for CLDC  |
|
| Back to top |
|
 |
YorickPeterse
Joined: 12 Jan 2009 Posts: 6 Location: The Netherlands
|
Posted: Sun Jan 25, 2009 5:20 pm Post subject: |
|
|
Nobody ?
I tried to generate a tone in Java ME using Eclipse, but that gave the same result. The frequency works, however the duration does not. |
|
| Back to top |
|
 |
mirnog
Joined: 07 Jan 2009 Posts: 3
|
Posted: Sat Feb 07, 2009 12:35 am Post subject: |
|
|
im having same problem.
Im using a text box to input number of seconds then do calulatiosn to get it right. The duration is right on the emulator but on my phone 5s loast only 1s and 99s only 4s, but 10s lasts 2s!
| Code: |
int tuneDurSec = 1000 * Integer.parseInt(toneDur.getString()); // 1s = 1000
int tuneVol = Integer.parseInt(toneVol.getString());
// high e = 64;
// B = 59;
// G = 55;
// D = 50;
// A = 45;
// E = 40;
int stringNo = stringChoice.getSelectedIndex();
switch(stringNo){
case 0:
try { Manager.playTone(64, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
case 1:
try { Manager.playTone(59, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
case 2:
try { Manager.playTone(55, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
case 3:
try { Manager.playTone(50, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
case 4:
try { Manager.playTone(45, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
case 5:
try { Manager.playTone(40, tuneDurSec, tuneVol); }
catch (MediaException me) {}
break;
}
|
|
|
| Back to top |
|
 |
ceimoirley
Joined: 14 Sep 2009 Posts: 3
|
Posted: Mon Sep 14, 2009 10:47 am Post subject: |
|
|
I would imagine that this is an oversight by the Sun developers. They test primarily with GlassFish and probably haven't tested "deploy on save" with JBoss. This feature is also intended to be used with directory deploy for even better performance, and I'm not sure if NetBeans can do directory deploy with JBoss. I wonder if deploy on save requires directory deploy?
I would open an RFE ticket (not a bug) to add support for deploy on save to ant projects when using application servers other than GlassFish.
Maybe before you file the RFE, test directory deploy on GlassFish with a J2EE 1.4 ant project to make sure the feature is not limited only to Java EE 5 projects. I can't see why it would be limited to Java EE 5 only?
Also try a J2EE 1.4 Maven project in NetBeans 6.7, because 6.7 adds directory deploy feature to Maven projects.
Also I like your forum very much because i get enough information here and nice tips as well. i'm student and preparing for my exam of testking HP2-T11 for attaining the certification. Although it is not hard to get certified but it keeps me busy. I've also attained certification of another course of testking 70-647 which I had passed last two months back. Also I am trying to complete my pending thesis project of testking E20-001 which i hope will be completed soon. I normally search on topics which you described on your blog these are great and informative. Thanks for sharing. |
|
| Back to top |
|
 |
|