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());
}
Aggregations