I posted a few days ago about a project I'm working on in which the phone receives data in the form of integers from a sensor. This data is then conveyed using vibration feedback. As another form of feedback, I would like to generate a sound depending on the data received - either a difference in frequency or volume.
I've done some searching around the wiki and boards, and tried out code, but it doesn't seem to work.
I found a piece of code on the Sun site, and changed it a bit for my program.
In the emulator, it plays a brief tone (less than a second) even though the code says it should play for 4 seconds. When I put it on my phone, I don't get any sound. Status is written on every repaint, which happens right after this block. It always says "Playing.".Code:try { Manager.playTone(ToneControl.C4, 4000, 400); status = "Playing."; } catch (MediaException me) { status = "Failed."; }
I'm testing this on a phone (S60E5) with earphones plugged in, and the sound works fine for everything else. I've also tested it on another phone (S40) and had the same issue.
Are there other methods I can use to generate a tone, or has anyone got any ideas why this isn't working?

Reply With Quote

