Sample Blackberry Sound Recording Code

Does anyone know a good repository to get sample code for BlackBerry? In particular, samples that will help me study the mechanics of sound recording, perhaps even sample it and make some of them to process the fly signal on it?

I would like to read the incoming sound, sample by sample, if necessary, then process it to get the desired result, in this case, the visualizer.

+3
source share
3 answers

The RIM API contains the JSR 135 Java Mobile Media API for processing audio and video content.
You are fixing a clutter in the BB knowledge base. The only way is to view it, hoping that they will no longer change the site map.
This is Developers-> Resources β†’ Knowledge Base β†’ Java API & Samples β†’ Audio and Video

Audio recording

Basically, it's just for recording sound:

  • create a player with the right sound encoding
  • get RecordControl
  • start recording
  • stop recording

:
RIM 4.6.0 API ref: javax.microedition.media
BlackBerry
How To -
How To -
How To -
How To -
-
Media.

Player, RecordControl :

final class VoiceNotesRecorderThread extends Thread{
   private Player _player;
   private RecordControl _rcontrol;
   private ByteArrayOutputStream _output;
   private byte _data[];

   VoiceNotesRecorderThread() {}

   private int getSize(){
       return (_output != null ? _output.size() : 0);
   }

   private byte[] getVoiceNote(){
      return _data;
   }
}

Thread.run() :

   public void run() {
      try {
          // Create a Player that captures live audio.
          _player = Manager.createPlayer("capture://audio");
          _player.realize();    
          // Get the RecordControl, set the record stream,
          _rcontrol = (RecordControl)_player.getControl("RecordControl");    
          //Create a ByteArrayOutputStream to capture the audio stream.
          _output = new ByteArrayOutputStream();
          _rcontrol.setRecordStream(_output);
          _rcontrol.startRecord();
          _player.start();    
      } catch (final Exception e) {
         UiApplication.getUiApplication().invokeAndWait(new Runnable() {
            public void run() {
               Dialog.inform(e.toString());
            }
         });
      }
   }

thread.stop():

   public void stop() {
      try {
           //Stop recording, capture data from the OutputStream,
           //close the OutputStream and player.
           _rcontrol.commit();
           _data = _output.toByteArray();
           _output.close();
           _player.close();    
      } catch (Exception e) {
         synchronized (UiApplication.getEventLock()) {
            Dialog.inform(e.toString());
         }
      }
   }

, . .

, . . , :

  • -
  • - , .

:
java.net: Java ME Vikram Goyal

+11
0

, . , BlackBerry Component Packs ( -), .

, Eclipse, :

C:\Program \\eclipse3.4\Plugins\net.rim.eide.componentpack4.5.0_4.5.0.16\Components\

, , . , 20% .

, Simulator ( activetextfieldsdemo), , . , .

:
- Eclipse " BlackBerry" - BlackBerry β†’ ... β†’ ... , .
-, BlackBerry "src" Eclipse, .

0

Source: https://habr.com/ru/post/1709265/


All Articles