Package client.teavm

Klasse ImportedApi

java.lang.Object
client.teavm.ImportedApi
Alle implementierten Schnittstellen:
IImportedApi, IImportEventParameters

public class ImportedApi extends Object implements IImportedApi, IImportEventParameters
TeaVM JavaScript Interop (JSO)-based implementation of IImportedApi.

This class provides a standard bridge between the TeaVM Web Worker and the browser main thread using TeaVM's @Import and @JSBody mechanisms. It is the default implementation for general browser environments.

Data Conversion

  • Audio samples: Converts 16-bit signed PCM samples (shorts) to 32-bit floats in the range of -1.0 to 1.0. A lookup table is used for high performance.
  • Video frame: Transfers RGBA pixel data as a byte array (4 bytes per pixel).
  • Oscilloscope data: Forwards waveform and envelope data to JavaScript for visualization.

Synchronization

Unlike ImportedApiSAB, which uses shared memory and atomic operations, this implementation relies on TeaVM's standard JavaScript interop, where data is typically passed via callbacks or message passing (depending on how the JavaScript side is implemented).