syntax = "proto2"; package rst.audition; option java_outer_classname = "SoundChunkType"; /** * Objects of this represent a chunk of an audio stream. * * The audio information for one or more @ref .channels is stored in * @ref .data as a sequence of @ref .sample_count encoded samples, the * encoding of which is described by @ref .endianness and @ref * .sample_type. * * Depending on the sample rate (@ref .rate), such a chunk of audio * corresponds to a certain amount of time during which its samples * have been recorded. * * Interpretation of RSB timestamps: * * create: * Capture time of the audio buffer. More precisely, the * timestamp should correspond to the first sample contained * in the buffer. * * @author David Klotz */ // @constraint(len(.data) == 8 * .channels * .sample_count * TODO(.sample_type)) // @create_collection message SoundChunk { /** * The possible data types for representing individual samples. */ enum SampleType { /** * Signed 8-bit samples. */ SAMPLE_S8 = 0; /** * Unsigned 8-bit samples. */ SAMPLE_U8 = 1; /** * Signed 16-bit samples. */ SAMPLE_S16 = 2; /** * Unsigned 16-bit samples. */ SAMPLE_U16 = 4; /** * Signed 24-bit samples. */ SAMPLE_S24 = 8; /** * Unsigned 24-bit samples. */ SAMPLE_U24 = 16; } /** * The possible byte-orders for representing samples. */ enum EndianNess { /** * Samples are represented with little Endian byte-order. */ ENDIAN_LITTLE = 0; /** * Samples are represented with big Endian byte-order. */ ENDIAN_BIG = 1; } /** * The sequences of bytes representing the samples of this sound * chunk. * * The value of this field must be interpreted according to the * values of the @ref .sample_count, @ref .channels, @ref * .sample_type and @ref .endianness fields. */ required bytes data = 1; /** * The number of samples contained in @ref .data. */ // @unit(number) required uint32 sample_count = 2; /** * The number of channels for which samples are stored in @ref * .data. */ // @unit(number) optional uint32 channels = 3 [default = 1]; /** * The rate with which the samples stored in @ref .data haven been * recorded or should be played. */ // @unit(hz) optional uint32 rate = 4 [default = 44100]; /** * The data type used for the representation of samples in @ref * .data. */ optional SampleType sample_type = 5 [default = SAMPLE_S16]; /** * The Endianness used for the representation of samples in @ref * .data. */ optional EndianNess endianness = 6 [default = ENDIAN_LITTLE]; // TODO: interleaving type? }