XMMS2
Macros | Typedefs | Enumerations | Functions
xmms_sample.h File Reference
#include <glib.h>
#include <xmms/xmms_streamtype.h>
#include <xmmsc/xmmsc_compiler.h>
#include <xmms/xmms_error.h>

Macros

#define XMMS_SAMPLES8_MIN   -128
 
#define XMMS_SAMPLES8_MAX   127
 
#define XMMS_SAMPLEU8_MAX   255
 
#define XMMS_SAMPLES16_MIN   -32768
 
#define XMMS_SAMPLES16_MAX   32767
 
#define XMMS_SAMPLEU16_MAX   65535
 
#define XMMS_SAMPLES32_MIN   (-2147483647L-1)
 
#define XMMS_SAMPLES32_MAX   2147483647L
 
#define XMMS_SAMPLEU32_MAX   4294967295UL
 

Typedefs

typedef gint8 xmms_samples8_t
 
typedef guint8 xmms_sampleu8_t
 
typedef gint16 xmms_samples16_t
 
typedef guint16 xmms_sampleu16_t
 
typedef gint32 xmms_samples32_t
 
typedef guint32 xmms_sampleu32_t
 
typedef gfloat xmms_samplefloat_t
 
typedef gdouble xmms_sampledouble_t
 
typedef void xmms_sample_t
 

Enumerations

enum  xmms_sample_format_t {
  XMMS_SAMPLE_FORMAT_UNKNOWN, XMMS_SAMPLE_FORMAT_S8, XMMS_SAMPLE_FORMAT_U8, XMMS_SAMPLE_FORMAT_S16,
  XMMS_SAMPLE_FORMAT_U16, XMMS_SAMPLE_FORMAT_S32, XMMS_SAMPLE_FORMAT_U32, XMMS_SAMPLE_FORMAT_FLOAT,
  XMMS_SAMPLE_FORMAT_DOUBLE
}
 

Functions

gint xmms_sample_frame_size_get (const xmms_stream_type_t *st)
 Get number of bytes used for one sample length worth of music. More...
 
gint64 xmms_sample_ms_to_samples (const xmms_stream_type_t *st, gint64 ms)
 convert from milliseconds to samples for this format. More...
 
gint64 xmms_sample_samples_to_ms (const xmms_stream_type_t *st, gint64 samples)
 Convert from samples to milliseconds for this format. More...
 
gint64 xmms_sample_samples_to_bytes (const xmms_stream_type_t *st, gint64 samples)
 Convert from samples to bytes for this format. More...
 
gint64 xmms_sample_bytes_to_samples (const xmms_stream_type_t *st, gint64 bytes, xmms_error_t *error)
 Convert from bytes to samples for this format. More...
 
gint64 xmms_sample_bytes_to_samples_inexact (const xmms_stream_type_t *st, gint64 bytes)
 Convert from bytes to samples for this format. More...
 
gint64 xmms_sample_ms_to_bytes (const xmms_stream_type_t *st, gint64 ms)
 Convert from milliseconds to bytes for this format. More...
 
gint64 xmms_sample_bytes_to_ms (const xmms_stream_type_t *st, gint64 bytes)
 Convert from bytes to milliseconds for this format. More...
 

Macro Definition Documentation

#define XMMS_SAMPLES16_MAX   32767
#define XMMS_SAMPLES16_MIN   -32768
#define XMMS_SAMPLES32_MAX   2147483647L
#define XMMS_SAMPLES32_MIN   (-2147483647L-1)
#define XMMS_SAMPLES8_MAX   127
#define XMMS_SAMPLES8_MIN   -128
#define XMMS_SAMPLEU16_MAX   65535
#define XMMS_SAMPLEU32_MAX   4294967295UL
#define XMMS_SAMPLEU8_MAX   255

Typedef Documentation

typedef void xmms_sample_t
typedef gdouble xmms_sampledouble_t
typedef gfloat xmms_samplefloat_t
typedef gint16 xmms_samples16_t
typedef gint32 xmms_samples32_t
typedef gint8 xmms_samples8_t
typedef guint16 xmms_sampleu16_t
typedef guint32 xmms_sampleu32_t
typedef guint8 xmms_sampleu8_t

Enumeration Type Documentation

Enumerator
XMMS_SAMPLE_FORMAT_UNKNOWN 
XMMS_SAMPLE_FORMAT_S8 
XMMS_SAMPLE_FORMAT_U8 
XMMS_SAMPLE_FORMAT_S16 
XMMS_SAMPLE_FORMAT_U16 
XMMS_SAMPLE_FORMAT_S32 
XMMS_SAMPLE_FORMAT_U32 
XMMS_SAMPLE_FORMAT_FLOAT 
XMMS_SAMPLE_FORMAT_DOUBLE 

Function Documentation

gint64 xmms_sample_bytes_to_ms ( const xmms_stream_type_t st,
gint64  bytes 
)

Convert from bytes to milliseconds for this format.

This is not exact.

Referenced by xmms_output_latency().

gint64 xmms_sample_bytes_to_samples ( const xmms_stream_type_t st,
gint64  bytes,
xmms_error_t error 
)

Convert from bytes to samples for this format.

This is exact. On error 0 is returned and error is set.

gint64 xmms_sample_bytes_to_samples_inexact ( const xmms_stream_type_t st,
gint64  bytes 
)

Convert from bytes to samples for this format.

This is not exact.

Referenced by xmms_sample_bytes_to_ms().

gint xmms_sample_frame_size_get ( const xmms_stream_type_t st)

Get number of bytes used for one sample length worth of music.

That is, (size of one sample) * channels.

Referenced by xmms_output_read(), xmms_sample_bytes_to_samples(), xmms_sample_bytes_to_samples_inexact(), xmms_sample_convert(), xmms_sample_convert_reset(), and xmms_sample_samples_to_bytes().

gint64 xmms_sample_ms_to_bytes ( const xmms_stream_type_t st,
gint64  ms 
)

Convert from milliseconds to bytes for this format.

This is not exact.

gint64 xmms_sample_ms_to_samples ( const xmms_stream_type_t st,
gint64  ms 
)

convert from milliseconds to samples for this format.

Referenced by xmms_sample_ms_to_bytes().

gint64 xmms_sample_samples_to_bytes ( const xmms_stream_type_t st,
gint64  samples 
)

Convert from samples to bytes for this format.

This is exact.

Referenced by xmms_sample_ms_to_bytes().

gint64 xmms_sample_samples_to_ms ( const xmms_stream_type_t st,
gint64  samples 
)

Convert from samples to milliseconds for this format.

Referenced by xmms_sample_bytes_to_ms().