Stay organized with collections
Save and categorize content based on your preferences.
Visualizer.OnDataCaptureListener
public
static
interface
Visualizer.OnDataCaptureListener
android.media.audiofx.Visualizer.OnDataCaptureListener
|
The OnDataCaptureListener interface defines methods called by the Visualizer to periodically
update the audio visualization capture.
The client application can implement this interface and register the listener with the
Visualizer.setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean)
method.
Summary
Public methods |
abstract
void
|
onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate)
Method called when a new frequency capture is available.
|
abstract
void
|
onWaveFormDataCapture(Visualizer visualizer, byte[] waveform, int samplingRate)
Method called when a new waveform capture is available.
|
Public methods
public abstract void onFftDataCapture (Visualizer visualizer,
byte[] fft,
int samplingRate)
Method called when a new frequency capture is available.
Data in the fft buffer is valid only within the scope of the callback.
Applications which need access to the fft data after returning from the callback
should make a copy of the data instead of holding a reference.
For the explanation of the fft data array layout, and the example
code for processing it, please see the documentation for Visualizer.getFft(byte[])
method.
Parameters |
visualizer |
Visualizer : Visualizer object on which the listener is registered. |
fft |
byte : array of bytes containing the frequency representation. |
samplingRate |
int : sampling rate of the visualized audio. |
public abstract void onWaveFormDataCapture (Visualizer visualizer,
byte[] waveform,
int samplingRate)
Method called when a new waveform capture is available.
Data in the waveform buffer is valid only within the scope of the callback.
Applications which need access to the waveform data after returning from the callback
should make a copy of the data instead of holding a reference.
Parameters |
visualizer |
Visualizer : Visualizer object on which the listener is registered. |
waveform |
byte : array of bytes containing the waveform representation. |
samplingRate |
int : sampling rate of the visualized audio. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Visualizer.OnDataCaptureListener\n\nAdded in [API level 9](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nVisualizer.OnDataCaptureListener\n================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/media/audiofx/Visualizer.OnDataCaptureListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nVisualizer.OnDataCaptureListener\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------------------|\n| android.media.audiofx.Visualizer.OnDataCaptureListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe OnDataCaptureListener interface defines methods called by the Visualizer to periodically\nupdate the audio visualization capture.\nThe client application can implement this interface and register the listener with the\n[Visualizer.setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean)](/reference/android/media/audiofx/Visualizer#setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener,%20int,%20boolean,%20boolean)) method.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onFftDataCapture](/reference/android/media/audiofx/Visualizer.OnDataCaptureListener#onFftDataCapture(android.media.audiofx.Visualizer,%20byte[],%20int))`(`[Visualizer](/reference/android/media/audiofx/Visualizer)` visualizer, byte[] fft, int samplingRate) ` Method called when a new frequency capture is available. |\n| ` abstract void` | ` `[onWaveFormDataCapture](/reference/android/media/audiofx/Visualizer.OnDataCaptureListener#onWaveFormDataCapture(android.media.audiofx.Visualizer,%20byte[],%20int))`(`[Visualizer](/reference/android/media/audiofx/Visualizer)` visualizer, byte[] waveform, int samplingRate) ` Method called when a new waveform capture is available. |\n\nPublic methods\n--------------\n\n### onFftDataCapture\n\nAdded in [API level 9](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onFftDataCapture (Visualizer visualizer, \n byte[] fft, \n int samplingRate)\n```\n\nMethod called when a new frequency capture is available.\n\nData in the fft buffer is valid only within the scope of the callback.\nApplications which need access to the fft data after returning from the callback\nshould make a copy of the data instead of holding a reference.\n\nFor the explanation of the fft data array layout, and the example\ncode for processing it, please see the documentation for [Visualizer.getFft(byte[])](/reference/android/media/audiofx/Visualizer#getFft(byte[])) method.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------|\n| `visualizer` | `Visualizer`: Visualizer object on which the listener is registered. \u003cbr /\u003e |\n| `fft` | `byte`: array of bytes containing the frequency representation. \u003cbr /\u003e |\n| `samplingRate` | `int`: sampling rate of the visualized audio. \u003cbr /\u003e |\n\n### onWaveFormDataCapture\n\nAdded in [API level 9](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onWaveFormDataCapture (Visualizer visualizer, \n byte[] waveform, \n int samplingRate)\n```\n\nMethod called when a new waveform capture is available.\n\nData in the waveform buffer is valid only within the scope of the callback.\nApplications which need access to the waveform data after returning from the callback\nshould make a copy of the data instead of holding a reference.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------|\n| `visualizer` | `Visualizer`: Visualizer object on which the listener is registered. \u003cbr /\u003e |\n| `waveform` | `byte`: array of bytes containing the waveform representation. \u003cbr /\u003e |\n| `samplingRate` | `int`: sampling rate of the visualized audio. \u003cbr /\u003e |"]]