FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

playTone method acting weird

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
YorickPeterse



Joined: 12 Jan 2009
Posts: 6
Location: The Netherlands

PostPosted: Mon Jan 12, 2009 2:52 pm    Post subject: playTone method acting weird Reply with quote

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 Wink )

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
View user's profile Send private message Visit poster's website
YorickPeterse



Joined: 12 Jan 2009
Posts: 6
Location: The Netherlands

PostPosted: Tue Jan 13, 2009 2:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
YorickPeterse



Joined: 12 Jan 2009
Posts: 6
Location: The Netherlands

PostPosted: Sun Jan 18, 2009 9:17 pm    Post subject: Reply with quote

Still nobody ? It's very important so every tip would be greatly appreciated.
Back to top
View user's profile Send private message Visit poster's website
Petr Suchomel
Posted via mailing list.





PostPosted: Mon Jan 19, 2009 8:56 am    Post subject: playTone method acting weird Reply with quote

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

PostPosted: Mon Jan 19, 2009 3:51 pm    Post subject: Reply with quote

Sun Java wireless Toolkit 2.5.2 for CLDC Smile
Back to top
View user's profile Send private message Visit poster's website
YorickPeterse



Joined: 12 Jan 2009
Posts: 6
Location: The Netherlands

PostPosted: Sun Jan 25, 2009 5:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mirnog



Joined: 07 Jan 2009
Posts: 3

PostPosted: Sat Feb 07, 2009 12:35 am    Post subject: Reply with quote

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
View user's profile Send private message
ceimoirley



Joined: 14 Sep 2009
Posts: 3

PostPosted: Mon Sep 14, 2009 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB