Home

Michael Heilmann's Arcadia Media

This is the documentation for Michael Heilmann's Arcadia Media provides procedural creation and manipulation of audial entities, like sample buffers, and visual entities, like pixel buffers.

Documentation

Arcadia_Media_PixelBuffer

Arcadia_Media_PixelBuffer extends Arcadia_Object.

Arcadia_Media_PixelBuffer is a two-dimensional array of pixels.

The following terms and definitions are used througout its documentation:

  • pixel: A pixel is uniquely adressed by the index of its column and its row.
  • number of columns: The number of columns of the pixel rectangle. A column is adressed by zero-based consecutive integral ascending indices (0,1,2,...). The number of columns is also called the width of the pixel rectangle.
  • number of rows: The number of rows of the pixel rectangle. A row is adressed by zero-based consecutive integral ascending indices (0,1,2,...). The number of rows is also called the height of the pixel rectangle.
  • pixel format: The pixel format of the pixels of the pixel buffer as defined by Arcadia_Media_PixelFormat.
  • line padding: The number of Bytes after a line.
  • line stride: The number of Bytes of a line which comprises the Bytes of the actual pixels plus the line padding. <number of columns> * <bytes per pixel> + <line padding>

Arcadia_Media_PixelBuffer_create

Arcadia_Media_PixelBuffer*
Arcadia_Media_PixelBuffer_create
  (
    Arcadia_Thread* thread,
    Arcadia_Integer32Value linePadding,
    Arcadia_Integer32Value numberOfColumns,
    Arcadia_Integer32Value numberOfRows,
    Arcadia_Media_PixelFormat pixelFormat,
  )
Create a pixel buffer of the specified line padding, number of columns, number of rows, and pixel format. It is filled with opaque black.

Parameters

A pointer to the Arcadia_Thread object.
The number of Bytes after the end of a line. Must be non-negative.
Arcadia_Integer32Value numberOfColumns
The number of columns of the pixel buffer. Must be non-negative.
The number of rows of the pixel buffer. Must be non-negative.
The pixel format of the pixel buffer.

Errors

Arcadia_Status_AllocationFailed
An allocation failed.
Arcadia_Status_ArgumentValueInvalid
At least one of linePadding, numberOfColumns, numberOfRows is negative.

Return value

A pointer to the Arcadia_Media_PixelBuffer object.

Arcadia_Media_PixelBuffer_getHeight

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getHeight
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the height of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The height of this pixel buffer.

Arcadia_Media_PixelBuffer_getLinePadding

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getLinePadding
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the line padding of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The line padding of this pixel buffer.

Arcadia_Media_PixelBuffer_getLineStride

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getLineStride
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the line stride of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The line stride of this pixel buffer.

Arcadia_Media_PixelBuffer_getNumberOfColumns

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getNumberOfColumns
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the number of columns of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The number of columns of this pixel buffer.

Arcadia_Media_PixelBuffer_getNumberOfRows

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getNumberOfRows
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the number of rows of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The number of rows of this pixel buffer.

Arcadia_Media_PixelBuffer_getPixelFormat

Arcadia_Media_PixelFormat
Arcadia_Media_PixelBuffer_getPixelFormat
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the pixel format of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The pixel format of this pixel buffer.

Arcadia_Media_PixelBuffer_getWidth

Arcadia_Integer32Value
Arcadia_Media_PixelBuffer_getWidth
  (
    Arcadia_Thread* thread
    Arcadia_Media_PixelBuffer* self
  )
Get the width of this pixel buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this pixel buffer.

Return value

The width of this pixel buffer.

Arcadia_Media_PixelFormat

typedef enum Arcadia_Media_PixelFormat Arcadia_Media_PixelFormat; An enumeration of pixel formats.

Elements

Arcadia_Media_PixelFormat_AlphaBlueGreenRedNatural8
Four Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the alpha component. The second value denotes the intensity of the blue component, the third value denotes the intensity of the green component, and the fourth value denotes the intensity of the red component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_AlphaGrayNatural8
Two Arcadia_Natural8Value values layout out consecutively in memory. The first value denotes the intensity of the alpha component. The second value denotes the intensity of the luminance component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_AlphaRedGreenBlueNatural8
Four Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the alpha component. The second value denotes the intensity of the red component, the third value denotes the intensity of the green component, and the fourth value denotes the intensity of the blue component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_BlueGreenRedNatural8
Three Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the blue component, the second value denotes the intensity of the green component, and the third value denotes the intensity of the red component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_BlueGreenRedAlphaNatural8
Four Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the blue component, the second value denotes the intensity of the green component, and the third value denotes the intensity of the red component. The fourth value denotes the intensity of the alpha component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_GrayNatural8
One Arcadia_Natural8Value value. The value denotes the intensity of the luminance component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_GrayAlphaNatural8
Two Arcadia_Natural8Value values layout out consecutively in memory. The first value denotes the intensity of the luminance component. The second value denotes the intensity of the alpha component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_RedGreenBlueNatural8
Three Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the red component, the second value denotes the intensity of the green component, and the third value denotes the intensity of the blue component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.
Arcadia_Media_PixelFormat_RedGreenBlueAlphaNatural8
Four Arcadia_Natural8Value values layed out consecutively in memory. The first value denotes the intensity of the red component, the second value denotes the intensity of the green component, and the third value denotes the intensity of the blue component. The fourth value denotes the intensity of the alpha component. A component value of 0 indicates least intensity. A component value of 255 indicates greatest intensity.

Arcadia_Media_PixelFormat_getNumberOfComponents

Arcadia_SizeValue
Arcadia_Media_PixelFormat_getNumberOfComponents
  (
    Arcadia_Thread* thread,
    Arcadia_Media_PixelFormat self
  )
Get the number of components of a pixel of a pixel format.

Parameters

A pointer to the Arcadia_Thread object.
Arcadia_Media_PixelFormat self
This pixel format.

Return value

The number of components of a pixel of this pixel format.

Arcadia_Media_PixelFormat_getNumberOfBytes

Arcadia_SizeValue
Arcadia_Media_PixelFormat_getNumberOfBytes
  (
    Arcadia_Thread* thread,
    Arcadia_Media_PixelFormat self
  )
Get the number of Bytes of a pixel of a pixel format.

Parameters

A pointer to the Arcadia_Thread object.
Arcadia_Media_PixelFormat self
This pixel format.

Return value

The number of Bytes of a pixel of this pixel format.

Arcadia_Media_SampleBuffer

Arcadia_Media_SampleBuffer extends Arcadia_Object.

Arcadia_Media_SampleBuffer is a one-dimensional array of samples.

The following terms and definitions are used througout its documentation:

  • sample: An integral value representing an amplitude value. A sample is uniquely identified by a zero-based integral index.
  • length: The length, in seconds, of the sample buffer.
  • sample rate: The sample rate of the sample buffer.
  • sample format: The sample format of the samples of the sample buffer as defined by Arcadia_Media_SampleFormat.

Arcadia_Media_SampleBuffer_create

Arcadia_Media_SampleBuffer*
Arcadia_Media_SampleBuffer_create
  (
    Arcadia_Thread* thread,
    Arcadia_Integer32Value length,
    Arcadia_Integer32Value sampleRate,
    Arcadia_Media_SampleFormat sampleFormat,
  )
Create a sample buffer of the specified length, sample rate, and sample format. It is filled with silence.

Parameters

A pointer to the Arcadia_Thread object.
The length of the sample buffer. Must be non-negative.
The sample rate, in Hertz, of the sample buffer. Must be non-negative.
The sample format of the sample buffer.

Errors

Arcadia_Status_AllocationFailed
An allocation failed.
Arcadia_Status_ArgumentValueInvalid
At least one of length, sampleRate is negative.

Return value

A pointer to the Arcadia_Media_SampleBuffer object.

Arcadia_Media_SampleBuffer_getLength

Arcadia_Integer32Value
Arcadia_Media_SampleBuffer_getLength
  (
    Arcadia_Thread* thread
    Arcadia_Media_SampleBuffer* self
  )
Get the length of this sample buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this sample buffer.

Return value

The length of this sample buffer.

Arcadia_Media_SampleBuffer_getSampleFormat

Arcadia_Media_SampleFormat
Arcadia_Media_SampleBuffer_getSampleFormat
  (
    Arcadia_Thread* thread
    Arcadia_Media_SampleBuffer* self
  )
Get the sample format of this sample buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this sample buffer.

Return value

The sample format of this sample buffer.

Arcadia_Media_SampleBuffer_getSampleRate

Arcadia_Integer32Value
Arcadia_Media_SampleBuffer_getSampleRate
  (
    Arcadia_Thread* thread
    Arcadia_Media_SampleBuffer* self
  )
Get the sample rate of this sample buffer.

Parameters

A pointer to the Arcadia_Thread object.
A pointer to this sample buffer.

Return value

The sample rate of this sample buffer.

Arcadia_Media_SampleFormat

typedef enum Arcadia_Media_SampleFormat Arcadia_Media_SampleFormat; An enumeration of sample formats.

Elements

Arcadia_Media_SampleFormat_Integer16
One Arcadia_Integer16Value. Maximal amplitude at \(+2^{16-1}-1\), minimal amplitude at \(-2^{16-1}\), silence at \(0\). This is an asymmetricc format as the distance of the minimal amplitude value and the distance of the maximal amplitude value from the silence value are not equal.
Arcadia_Media_SampleFormat_Integer8
One Arcadia_Integer8Value. Maximal amplitude at \(+2^{8-1}-1\), minimal amplitude at \(-2^{8-1}\), silence at \(0\). This is an asymmetricc format as the distance of the minimal amplitude value and the distance of the maximal amplitude value from the silence value are not equal.
Arcadia_Media_SampleFormat_Natural16
One Arcadia_Natural8Value. Maximal amplitude at \(2^{16}-1\), minimal amplitude at \(0\). Silence at \(\textit{ceil}\left(\frac{2^{16}-1}{2}\right)\). This is a symmetric format at the distance of the minimal amplitude value and the maximal amplitude value from the silience value are equal.
Arcadia_Media_SampleFormat_Natural8
One Arcadia_Natural8Value. Maximal amplitude at \(2^{8}-1\), minimal amplitude at \(0\). Silence at \(\textit{ceil}\left(\frac{2^{8}-1}{2}\right)\). This is a symmetric format at the distance of the minimal amplitude value and the maximal amplitude value from the silience value are equal.

Arcadia_Media_SampleFormat_getNumberOfBytes

Arcadia_SizeValue
Arcadia_Media_SampleFormat_getNumberOfBytes
  (
    Arcadia_Thread* thread,
    Arcadia_Medial_SampleFormat self
  )
Get the number of Bytes of a sample of this sample format.

Parameters

A pointer to the Arcadia_Thread object.
Arcadia_Media_SampleFormat self
This sample format.

Return value

The number of Bytes of a sample of this sample format.