×

Discussion Board

Results 1 to 6 of 6

Hybrid View

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    22

    DeviceControl 7650

    will there be a full working version of the DeviceControl Class on the Nokia 7650 at any time? just i thought it was the top phone from Nokia. And i have try to get the Vibra and Light calls to work with no joy at all... is there anything else that dont run?

    bit let down..

    aNt

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    229

    RE: DeviceControl 7650

    It seems that the Sound class doesn't work either, at least if you're trying to use normal ringtone data, although I've not got wave files to work either.

    At least the DirectGraphics seems to work pretty well, although there are differences between the real device and the current version of the SDK emulator.

    Sorry,
    Steve

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    46

    RE: DeviceControl 7650

    Hi,

    Nokia 7650 supports Nokia UI API only partially. Vibration and Backlight features are not supported. Sound part works except the consructor Sound(int freq, int duration). Here is the simple example that shows how to play notes from bytearray and how to play WAV file.

    //Example for playing sounds in Nokia 7650

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import com.nokia.mid.sound.*;
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;

    public class soundPlayer extends MIDlet implements CommandListener {

    private Display display = null;
    private Form form = null;
    private Command playWAV, playTone;

    private Sound sound = null;

    // The sound byte arrays are in Nokia Smart Messaging
    // Ringing Tone format.
    private final static byte[] BYTES =
    {
    (byte)0x02, (byte)0x4a, (byte)0x3a, (byte)0x69,
    (byte)0x8c, (byte)0xe9, (byte)0x71, (byte)0x99,
    (byte)0xbd, (byte)0xc9, (byte)0xd5, (byte)0xb5,
    (byte)0xb9, (byte)0xbc, (byte)0x04, (byte)0x00,
    (byte)0x10, (byte)0xd9, (byte)0x65, (byte)0x13,
    (byte)0x82, (byte)0x4c, (byte)0x40, (byte)0x8c,
    (byte)0x09, (byte)0xc4, (byte)0x00
    };

    private final static String PATH = "/blah.wav";

    public soundPlayer() {
    form = new Form("SoundPlayer"
    form.append("Select type"
    playWAV = new Command("playWAV", Command.OK, 1);
    playTone = new Command("playTone", Command.OK, 2);
    form.addCommand(playWAV);
    form.addCommand(playTone);
    form.setCommandListener(this);
    }

    protected void destroyApp(boolean p0) throws MIDletStateChangeException {

    }


    protected void startApp() throws MIDletStateChangeException {
    try{
    display = Display.getDisplay(this);
    display.setCurrent(form);
    }
    catch(Exception e){}
    }


    protected void pauseApp() {

    }


    public void commandAction(Command p0, Displayable p1) {
    if(p0 == playWAV)
    {
    playWAVSound();
    }
    else if(p0 == playTone)
    {
    playToneSound();
    }
    }

    private void playWAVSound()
    {
    try {
    InputStream tune = this.getClass().getResourceAsStream("/blah.wav"
    byte[] buf = new byte[100000];


    tune.read(buf,0,buf.length);

    sound = new Sound(buf, Sound.FORMAT_WAV);
    sound.init(buf, Sound.FORMAT_WAV);
    sound.play(1);

    } catch (Exception e) {}


    }

    private void playToneSound()
    {
    sound = new Sound(BYTES, Sound.FORMAT_TONE);
    sound.init(BYTES, Sound.FORMAT_TONE);
    sound.play(2); //play bytes twice
    }
    }

    I hope this helps. It is important that the byte array where file is read is big enough otherwise sound is not played.

    best regards,

    Petri/Forum Nokia

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    22

    RE: DeviceControl 7650

    so the sound isnt that hot ither.. can the DeviceGraphics do levels of transprence (blends)? or is it just a mask effect?.

    mind u i would like it to get the audio as a buffer, so to stream it or effect the sound... not sure how fast it is...

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    229

    RE: DeviceControl 7650

    Petri,

    Thanks ever so much for that sample code, I (for one) really appreciate your help.

    My code works now. The problem was I was only using the constructor, and not calling init after constructing the Sound object.

    For anyone else:
    sounds[i]=new Sound(data,Sound.FORMAT_TONE);

    by itself doesn't work. You must call the init method afterwards, like:
    sounds[i]=new Sound(data,Sound.FORMAT_TONE); sounds[i].init(data,Sound.FORMAT_TONE);

    This works perfectly on the real 7650. I still maintain the device isn't working properly though. The documentation clearly states that the constructor constructs and initialises the Sound object ready for playing, but it doesn't. The first code segment, without the init call, works fine on several other devices, but not the 7650.

    Anyway, a thousand thanks once again,

    Steve

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    RE: DeviceControl 7650

    hi
    When I tried the play tone function. it sounds good in 6310i emulator, but it sounds crape in real 7650 phone.

    do you have the same experience ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •