Search in sources :

Example 6 with ActorCreator

use of im.actor.runtime.actors.ActorCreator in project actor-platform by actorapp.

the class VoiceCaptureActor method onStartMessage.

protected void onStartMessage(String fileName) {
    if (state == STATE_STARTED) {
        return;
    }
    int minBufferSize = AudioRecord.getMinBufferSize(16000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
    bufferSize = 16 * minBufferSize;
    audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, 16000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize);
    audioRecord.startRecording();
    opusActor = system().actorOf(Props.create(new ActorCreator() {

        @Override
        public OpusEncoderActor create() {
            return new OpusEncoderActor();
        }
    }), "actor/opus_encoder");
    opusActor.send(new OpusEncoderActor.Start(fileName));
    state = STATE_STARTED;
    playStartTime = SystemClock.uptimeMillis();
    vibrate(context);
    self().send(new Iterate());
}
Also used : AudioRecord(android.media.AudioRecord) ActorCreator(im.actor.runtime.actors.ActorCreator)

Aggregations

ActorCreator (im.actor.runtime.actors.ActorCreator)6 AudioRecord (android.media.AudioRecord)1 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)1 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)1 AuthState (im.actor.core.AuthState)1 EncryptedMsgActor (im.actor.core.modules.encryption.EncryptedMsgActor)1 KeyManagerActor (im.actor.core.modules.encryption.KeyManagerActor)1 KeyManagerInt (im.actor.core.modules.encryption.KeyManagerInt)1 Actor (im.actor.runtime.actors.Actor)1 ActorRef (im.actor.runtime.actors.ActorRef)1 PreferencesStorage (im.actor.runtime.storage.PreferencesStorage)1 ArrayList (java.util.ArrayList)1