Nier-Visualizer icon indicating copy to clipboard operation
Nier-Visualizer copied to clipboard

How to reset the visualizer after playback

Open kishorekumarek opened this issue 4 years ago • 4 comments

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

kishorekumarek avatar Dec 16 '20 07:12 kishorekumarek

Hi, @tringkishorekumar , thanks for using the library, can you paste the codes here?

bogerchan avatar Dec 16 '20 07:12 bogerchan

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()

kishorekumarek avatar Dec 29 '20 08:12 kishorekumarek

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!

quensh93 avatar Oct 28 '21 07:10 quensh93

Sorry for the late reply, I'll improve it in the next release.

bogerchan avatar Apr 19 '22 15:04 bogerchan