!7 cmodule ConcurrentMP3 > DynPrintLogAndEnabled { transient StreamingMP3Encoder encoder; start { dm_vmBus_onMessage_q startedRecording((IVF1) lambda1 started); dm_vmBus_onMessage_q recordedChunk((IVF1) lambda1 gotChunk); dm_vmBus_onMessage_q doneRecording(r done); } void started(File wavFileBeingMade) { if (!enabled) ret; File mp3 = changeExtension(wavFileBeingMade, ".live.mp3"); print("started MP3 encoding: " + mp3); encoder = StreamingMP3Encoder(mp3, dm_audioInputSampleRate()); } void gotChunk(short[] samples) { //print("got " + nSamples(samples)); if (enabled && encoder != null) encoder.addData(samples); } void done { if (encoder == null) ret; File mp3 = encoder.mp3; dispose encoder; vmBus_send newMP3Recording(mp3); print("Wrote " + fileInfo(mp3)); } }