Top Description Inners Fields Constructors Methods
org.lwjgl.util.opus

public Class OpusHead

extends Struct<OpusHead>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Ogg Opus bitstream information. This contains the basic playback parameters for a stream, and corresponds to the initial ID header packet of an Ogg Opus stream.

Layout


struct OpusHead {
    int version;
    int channel_count;
    unsigned int pre_skip;
    opus_uint32 input_sample_rate;
    int output_gain;
    int mapping_family;
    int stream_count;
    int coupled_count;
    unsigned char mapping[255];
}

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
OpusHead.Buffer

An array of OpusHead structs.

Field Summary

Modifier and TypeField and Description
public static final int
ALIGNOF

The struct alignment in bytes.

public static final int
CHANNEL_COUNT

The struct member offsets.

public static final int
COUPLED_COUNT

The struct member offsets.

public static final int
INPUT_SAMPLE_RATE

The struct member offsets.

public static final int
MAPPING

The struct member offsets.

public static final int
MAPPING_FAMILY

The struct member offsets.

public static final int
OUTPUT_GAIN

The struct member offsets.

public static final int
PRE_SKIP

The struct member offsets.

public static final int
SIZEOF

The struct size in bytes.

public static final int
STREAM_COUNT

The struct member offsets.

public static final int
VERSION

The struct member offsets.

Inherited from org.lwjgl.system.Struct:
containerDEFAULT_ALIGN_ASDEFAULT_PACK_ALIGNMENT

Constructor Summary

AccessConstructor and Description
protected
OpusHead(long address, ByteBuffer container)

public
OpusHead(ByteBuffer container)

Creates a OpusHead instance at the current position of the specified ByteBuffer container.

Method Summary

Modifier and TypeMethod and Description
public static OpusHead
calloc()

Returns a new OpusHead instance allocated with memCalloc.

public static OpusHead.Buffer
calloc(int
the buffer capacity
capacity
)

Returns a new OpusHead.Buffer instance allocated with memCalloc.

public static OpusHead
calloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new OpusHead instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static OpusHead.Buffer
calloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new OpusHead.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

public int
channel_count()

the number of channels, in the range 1...255.

public int
coupled_count()

the number of coupled Opus streams in each Ogg packet, in the range 0...127.

protected OpusHead
create(long
the struct memory address
address
,
ByteBuffer
an optional container buffer, to be referenced strongly by the struct instance.
container
)

Implements abstract org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.
public static OpusHead
create()

Returns a new OpusHead instance allocated with BufferUtils.

public static OpusHead
create(long address)

Returns a new OpusHead instance for the specified memory address.

public static OpusHead.Buffer
create(int
the buffer capacity
capacity
)

Returns a new OpusHead.Buffer instance allocated with BufferUtils.

public static OpusHead.Buffer
create(long
the memory address
address
,
int
the buffer capacity
capacity
)

Create a OpusHead.Buffer instance at the specified memory.

public static OpusHead
createSafe(long address)

Like create, but returns null if address is NULL.

public static OpusHead.Buffer
createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

public int
input_sample_rate()

the sampling rate of the original input.

public static OpusHead
malloc()

Returns a new OpusHead instance allocated with memAlloc.

public static OpusHead.Buffer
malloc(int
the buffer capacity
capacity
)

Returns a new OpusHead.Buffer instance allocated with memAlloc.

public static OpusHead
malloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new OpusHead instance allocated on the specified MemoryStack.

public static OpusHead.Buffer
malloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new OpusHead.Buffer instance allocated on the specified MemoryStack.

public ByteBuffer
mapping()

the mapping from coded stream channels to output channels.

public byte
mapping(int index)

the mapping from coded stream channels to output channels.

public int
mapping_family()

the channel mapping family, in the range 0...255.

public static int
nchannel_count(long struct)

Unsafe version of channel_count.

public static int
ncoupled_count(long struct)

Unsafe version of coupled_count.

public static int
ninput_sample_rate(long struct)

Unsafe version of input_sample_rate.

public static ByteBuffer
nmapping(long struct)

Unsafe version of mapping.

public static byte
nmapping(long struct, int index)

Unsafe version of mapping.

public static int
nmapping_family(long struct)

Unsafe version of mapping_family.

public static int
noutput_gain(long struct)

Unsafe version of output_gain.

public static int
npre_skip(long struct)

Unsafe version of pre_skip.

public static int
nstream_count(long struct)

Unsafe version of stream_count.

public static int
nversion(long struct)

Unsafe version of version.

public int
output_gain()

the gain to apply to the decoded output, in dB, as a Q8 value in the range -32768...32767.

public int
pre_skip()

the number of samples that should be discarded from the beginning of the stream

public int
sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).
public int
stream_count()

the number of Opus streams in each Ogg packet, in the range 1...255.

public int
version()

the Ogg Opus format version, in the range 0...255.

Inherited from org.lwjgl.system.Struct:
__array__array__array__checkContainer__checkMalloc__create__getContainer__getContainer__member__member__member__padding__padding__struct__struct__union__unionclearfreeisNullvalidate

Field Detail

ALIGNOFback to summary
public static final int ALIGNOF

The struct alignment in bytes.

CHANNEL_COUNTback to summary
public static final int CHANNEL_COUNT

The struct member offsets.

COUPLED_COUNTback to summary
public static final int COUPLED_COUNT

The struct member offsets.

INPUT_SAMPLE_RATEback to summary
public static final int INPUT_SAMPLE_RATE

The struct member offsets.

MAPPINGback to summary
public static final int MAPPING

The struct member offsets.

MAPPING_FAMILYback to summary
public static final int MAPPING_FAMILY

The struct member offsets.

OUTPUT_GAINback to summary
public static final int OUTPUT_GAIN

The struct member offsets.

PRE_SKIPback to summary
public static final int PRE_SKIP

The struct member offsets.

SIZEOFback to summary
public static final int SIZEOF

The struct size in bytes.

STREAM_COUNTback to summary
public static final int STREAM_COUNT

The struct member offsets.

VERSIONback to summary
public static final int VERSION

The struct member offsets.

Constructor Detail

OpusHeadback to summary
protected OpusHead(long address, ByteBuffer container)
OpusHeadback to summary
public OpusHead(ByteBuffer container)

Creates a OpusHead instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

The created instance holds a strong reference to the container object.

Method Detail

callocback to summary
public static OpusHead calloc()

Returns a new OpusHead instance allocated with memCalloc. The instance must be explicitly freed.

callocback to summary
public static OpusHead.Buffer calloc(int capacity)

Returns a new OpusHead.Buffer instance allocated with memCalloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

callocback to summary
public static OpusHead calloc(MemoryStack stack)

Returns a new OpusHead instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
stack:MemoryStack

the stack from which to allocate

callocback to summary
public static OpusHead.Buffer calloc(int capacity, MemoryStack stack)

Returns a new OpusHead.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

channel_countback to summary
public int channel_count()

the number of channels, in the range 1...255.

coupled_countback to summary
public int coupled_count()

the number of coupled Opus streams in each Ogg packet, in the range 0...127.

This must satisfy 0 <= coupled_count <= stream_count and coupled_count + stream_count <= 255. The coupled streams appear first, before all uncoupled streams, in an Ogg Opus packet.

createback to summary
protected OpusHead create(long address, ByteBuffer container)

Implements abstract org.lwjgl.system.Struct.create.

Doc from org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.

Effectively, every Struct instance is a factory for more instances of the same type. This is used by StructBuffer.

Parameters
address:long

the struct memory address

container:ByteBuffer

an optional container buffer, to be referenced strongly by the struct instance.

Annotations
@Override
createback to summary
public static OpusHead create()

Returns a new OpusHead instance allocated with BufferUtils.

createback to summary
public static OpusHead create(long address)

Returns a new OpusHead instance for the specified memory address.

createback to summary
public static OpusHead.Buffer create(int capacity)

Returns a new OpusHead.Buffer instance allocated with BufferUtils.

Parameters
capacity:int

the buffer capacity

createback to summary
public static OpusHead.Buffer create(long address, int capacity)

Create a OpusHead.Buffer instance at the specified memory.

Parameters
address:long

the memory address

capacity:int

the buffer capacity

createSafeback to summary
public static OpusHead createSafe(long address)

Like create, but returns null if address is NULL.

Annotations
@Nullable
createSafeback to summary
public static OpusHead.Buffer createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

Annotations
@Nullable
input_sample_rateback to summary
public int input_sample_rate()

the sampling rate of the original input.

All Opus audio is coded at 48 kHz, and should also be decoded at 48 kHz for playback (unless the target hardware does not support this sampling rate). However, this field may be used to resample the audio back to the original sampling rate, for example, when saving the output to a file.

Annotations
@NativeType:opus_uint32
mallocback to summary
public static OpusHead malloc()

Returns a new OpusHead instance allocated with memAlloc. The instance must be explicitly freed.

mallocback to summary
public static OpusHead.Buffer malloc(int capacity)

Returns a new OpusHead.Buffer instance allocated with memAlloc. The instance must be explicitly freed.

Parameters
capacity:int

the buffer capacity

mallocback to summary
public static OpusHead malloc(MemoryStack stack)

Returns a new OpusHead instance allocated on the specified MemoryStack.

Parameters
stack:MemoryStack

the stack from which to allocate

mallocback to summary
public static OpusHead.Buffer malloc(int capacity, MemoryStack stack)

Returns a new OpusHead.Buffer instance allocated on the specified MemoryStack.

Parameters
capacity:int

the buffer capacity

stack:MemoryStack

the stack from which to allocate

mappingback to summary
public ByteBuffer mapping()

the mapping from coded stream channels to output channels.

Let index=mapping[k] be the value for channel k. If index < 2*coupled_count, then it refers to the left channel from stream (index/2) if even, and the right channel from stream (index/2) if odd. Otherwise, it refers to the output of the uncoupled stream (index-coupled_count).

Annotations
@NativeType:unsigned char[255]
mappingback to summary
public byte mapping(int index)

the mapping from coded stream channels to output channels.

Let index=mapping[k] be the value for channel k. If index < 2*coupled_count, then it refers to the left channel from stream (index/2) if even, and the right channel from stream (index/2) if odd. Otherwise, it refers to the output of the uncoupled stream (index-coupled_count).

Annotations
@NativeType:unsigned char
mapping_familyback to summary
public int mapping_family()

the channel mapping family, in the range 0...255.

Channel mapping family 0 covers mono or stereo in a single stream. Channel mapping family 1 covers 1 to 8 channels in one or more streams, using the Vorbis speaker assignments. Channel mapping family 255 covers 1 to 255 channels in one or more streams, but without any defined speaker assignment.

nchannel_countback to summary
public static int nchannel_count(long struct)

Unsafe version of channel_count.

ncoupled_countback to summary
public static int ncoupled_count(long struct)

Unsafe version of coupled_count.

ninput_sample_rateback to summary
public static int ninput_sample_rate(long struct)

Unsafe version of input_sample_rate.

nmappingback to summary
public static ByteBuffer nmapping(long struct)

Unsafe version of mapping.

nmappingback to summary
public static byte nmapping(long struct, int index)

Unsafe version of mapping.

nmapping_familyback to summary
public static int nmapping_family(long struct)

Unsafe version of mapping_family.

noutput_gainback to summary
public static int noutput_gain(long struct)

Unsafe version of output_gain.

npre_skipback to summary
public static int npre_skip(long struct)

Unsafe version of pre_skip.

nstream_countback to summary
public static int nstream_count(long struct)

Unsafe version of stream_count.

nversionback to summary
public static int nversion(long struct)

Unsafe version of version.

output_gainback to summary
public int output_gain()

the gain to apply to the decoded output, in dB, as a Q8 value in the range -32768...32767.

The libopusfile API will automatically apply this gain to the decoded output before returning it, scaling it by pow(10,output_gain/(20.0*256)). You can adjust this behavior with OpusFile#op_set_gain_offset.

pre_skipback to summary
public int pre_skip()

the number of samples that should be discarded from the beginning of the stream

Annotations
@NativeType:unsigned int
sizeofback to summary
public int sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Doc from org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).

Annotations
@Override
stream_countback to summary
public int stream_count()

the number of Opus streams in each Ogg packet, in the range 1...255.

versionback to summary
public int version()

the Ogg Opus format version, in the range 0...255.

The top 4 bits represent a "major" version, and the bottom four bits represent backwards-compatible "minor" revisions. The current specification describes version 1. This library will recognize versions up through 15 as backwards compatible with the current specification. An earlier draft of the specification described a version 0, but the only difference between version 1 and version 0 is that version 0 did not specify the semantics for handling the version field.

org.lwjgl.util.opus back to summary

public Class OpusHead.Buffer

extends StructBuffer<OpusHead, OpusHead.Buffer>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable

An array of OpusHead structs.

Field Summary

Modifier and TypeField and Description
private static final OpusHead

Constructor Summary

AccessConstructor and Description
public
Buffer(ByteBuffer container)

Creates a new OpusHead.Buffer instance backed by the specified container.

public
Buffer(long address, int cap)

pack-priv
Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the value of the OpusHead#channel_count field.
channel_count
()

public int

Returns:

the value of the OpusHead#coupled_count field.
coupled_count
()

protected OpusHead
public int

Returns:

the value of the OpusHead#input_sample_rate field.
input_sample_rate
()

public ByteBuffer

Returns:

a ByteBuffer view of the OpusHead#mapping field.
mapping
()

public byte

Returns:

the value at the specified index of the OpusHead#mapping field.
mapping
(int index)

public int

Returns:

the value of the OpusHead#mapping_family field.
mapping_family
()

public int

Returns:

the value of the OpusHead#output_gain field.
output_gain
()

public int

Returns:

the value of the OpusHead#pre_skip field.
pre_skip
()

protected OpusHead.Buffer
public int

Returns:

the value of the OpusHead#stream_count field.
stream_count
()

public int

Returns:

the value of the OpusHead#version field.
version
()

Inherited from org.lwjgl.system.StructBuffer:
applyapplyforEachgetgetgetgetiteratorparallelStreamputputsizeofspliteratorstream

Field Detail

ELEMENT_FACTORYback to summary
private static final OpusHead ELEMENT_FACTORY

Constructor Detail

Bufferback to summary
public Buffer(ByteBuffer container)

Creates a new OpusHead.Buffer instance backed by the specified container.

Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by OpusHead#SIZEOF, and its mark will be undefined.

The created buffer instance holds a strong reference to the container object.

Bufferback to summary
public Buffer(long address, int cap)
Bufferback to summary
pack-priv Buffer(long address, ByteBuffer container, int mark, int pos, int lim, int cap)

Method Detail

channel_countback to summary
public int channel_count()
Returns:int

the value of the OpusHead#channel_count field.

coupled_countback to summary
public int coupled_count()
Returns:int

the value of the OpusHead#coupled_count field.

getElementFactoryback to summary
protected OpusHead getElementFactory()

Implements abstract org.lwjgl.system.StructBuffer.getElementFactory.

Annotations
@Override
input_sample_rateback to summary
public int input_sample_rate()
Returns:int

the value of the OpusHead#input_sample_rate field.

Annotations
@NativeType:opus_uint32
mappingback to summary
public ByteBuffer mapping()
Returns:ByteBuffer

a ByteBuffer view of the OpusHead#mapping field.

Annotations
@NativeType:unsigned char[255]
mappingback to summary
public byte mapping(int index)
Returns:byte

the value at the specified index of the OpusHead#mapping field.

Annotations
@NativeType:unsigned char
mapping_familyback to summary
public int mapping_family()
Returns:int

the value of the OpusHead#mapping_family field.

output_gainback to summary
public int output_gain()
Returns:int

the value of the OpusHead#output_gain field.

pre_skipback to summary
public int pre_skip()
Returns:int

the value of the OpusHead#pre_skip field.

Annotations
@NativeType:unsigned int
selfback to summary
protected OpusHead.Buffer self()

Implements abstract org.lwjgl.system.CustomBuffer.self.

Annotations
@Override
stream_countback to summary
public int stream_count()
Returns:int

the value of the OpusHead#stream_count field.

versionback to summary
public int version()
Returns:int

the value of the OpusHead#version field.