Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reset the visualizer after playback #39

Open
kishorekumarek opened this issue Dec 16, 2020 · 4 comments
Open

How to reset the visualizer after playback #39

kishorekumarek opened this issue Dec 16, 2020 · 4 comments

Comments

@kishorekumarek
Copy link

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

@bogerchan
Copy link
Owner

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

@kishorekumarek
Copy link
Author

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

@quensh93
Copy link

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!

@bogerchan
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants