VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
AudioPortAPI Struct Reference

Audio Port Public API. More...

#include <VirtualC64.h>

Public Member Functions

AudioPortStats getStats () const
 Returns statistical information about the components.
 
Retrieving audio data
isize copyMono (float *buffer, isize n)
 Extracts a number of mono samples from the audio buffer Internally, the audio port maintains a ringbuffer storing stereo audio samples.
 
isize copyStereo (float *left, float *right, isize n)
 Extracts a number of stereo samples from the audio buffer.
 
isize copyInterleaved (float *buffer, isize n)
 Extracts a number of stereo samples from the audio buffer.
 
Visualizing waveforms
float draw (u32 *buffer, isize width, isize height, float maxAmp, u32 color, isize sid=-1) const
 Draws a visual representation of the waveform.
 

Detailed Description

Audio Port Public API.

Member Function Documentation

◆ copyInterleaved()

isize copyInterleaved ( float * buffer,
isize n )

Extracts a number of stereo samples from the audio buffer.

This function has to be used if a stereo stream is managed in a single destination buffer. The samples of both channels will be interleaved, that is, a sample for the left channel will be followed by a sample of the right channel and vice versa.

Parameters
bufferPointer to the destinationleft buffer.
nNumber of sound samples to copy.
Returns
Number of actually copied sound sound samples.

◆ copyMono()

isize copyMono ( float * buffer,
isize n )

Extracts a number of mono samples from the audio buffer Internally, the audio port maintains a ringbuffer storing stereo audio samples.

When this function is used, both internal stream are added together and written to to the destination buffer.

Parameters
bufferPointer to the destination buffer
nNumber of sound samples to copy.
Returns
Number of actually copied sound sound samples.

◆ copyStereo()

isize copyStereo ( float * left,
float * right,
isize n )

Extracts a number of stereo samples from the audio buffer.

Parameters
leftPointer to the left channel's destination buffer.
rightPointer to the right channel's destination buffer.
nNumber of sound samples to copy.
Returns
Number of actually copied sound sound samples.

◆ draw()

float draw ( u32 * buffer,
isize width,
isize height,
float maxAmp,
u32 color,
isize sid = -1 ) const

Draws a visual representation of the waveform.

The Mac app uses this function to visualize the contents of the audio buffer in one of it's inspector panels.


The documentation for this struct was generated from the following files: