Nier-Visualizer
Nier-Visualizer copied to clipboard
How to reset the visualizer after playback
When i call mVisualizerManager?.stop() and mVisualizerManager?.release(), i expect it to reset to original position, but it suddenly stop. how to reset the view to zero line after stop pls help
Hi, @tringkishorekumar , thanks for using the library, can you paste the codes here?
I use following renderer
renderers = arrayOf(ColumnarType1Renderer(paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.parseColor("#777777") }))
I pulled out the code from sample to create the visualizer. `fun createNewVisualizerManager() { mVisualizerManager?.release() mVisualizerManager = NierVisualizerManager().apply { when (mStatus) { STATUS_MEDIA_PLAYER -> { mPlayer?.let { init(it.audioSessionId) } } STATUS_AUDIO_RECORD, STATUS_UNKNOWN -> { init(object : NierVisualizerManager.NVDataSource {
private val mBuffer: ByteArray = ByteArray(512)
private val mAudioDataConverter: AbsAudioDataConverter =
AudioDataConverterFactory.getConverterByAudioRecord(mAudioRecord)
override fun getDataSamplingInterval() = 0L
override fun getDataLength() = mBuffer.size
override fun fetchFftData(): ByteArray? {
return null
}
override fun fetchWaveData(): ByteArray? {
mAudioDataConverter.convertWaveDataTo(mBuffer)
return mBuffer
}
})
}
}
}
}`
Once I am done with recording, I am calling like below
mAudioRecordState = STATE_STOP mVisualizerManager?.stop()
The problem here is it stops abrubtly with waves still raised, i want the wave to come to resting position on calling mVisualizerManager?.stop()
same problem here, after play one file i stop mVisualizerManager and then i change the media player and on setOnPreparedListener i will start mVisualizerManager again, i will see 2 wawe!
Sorry for the late reply, I'll improve it in the next release.