LMMS
Loading...
Searching...
No Matches
dr_mp3.h File Reference
#include <stddef.h>

Go to the source code of this file.

Classes

struct  drmp3dec_frame_info
struct  drmp3dec
struct  drmp3_seek_point
struct  drmp3_allocation_callbacks
struct  drmp3_config
struct  drmp3

Macros

#define DRMP3_STRINGIFY(x)
#define DRMP3_XSTRINGIFY(x)
#define DRMP3_VERSION_MAJOR   0
#define DRMP3_VERSION_MINOR   6
#define DRMP3_VERSION_REVISION   26
#define DRMP3_VERSION_STRING   DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
#define DRMP3_TRUE   1
#define DRMP3_FALSE   0
#define DRMP3_API   extern
#define DRMP3_PRIVATE   static
#define DRMP3_SUCCESS   0
#define DRMP3_ERROR   -1 /* A generic error. */
#define DRMP3_INVALID_ARGS   -2
#define DRMP3_INVALID_OPERATION   -3
#define DRMP3_OUT_OF_MEMORY   -4
#define DRMP3_OUT_OF_RANGE   -5
#define DRMP3_ACCESS_DENIED   -6
#define DRMP3_DOES_NOT_EXIST   -7
#define DRMP3_ALREADY_EXISTS   -8
#define DRMP3_TOO_MANY_OPEN_FILES   -9
#define DRMP3_INVALID_FILE   -10
#define DRMP3_TOO_BIG   -11
#define DRMP3_PATH_TOO_LONG   -12
#define DRMP3_NAME_TOO_LONG   -13
#define DRMP3_NOT_DIRECTORY   -14
#define DRMP3_IS_DIRECTORY   -15
#define DRMP3_DIRECTORY_NOT_EMPTY   -16
#define DRMP3_END_OF_FILE   -17
#define DRMP3_NO_SPACE   -18
#define DRMP3_BUSY   -19
#define DRMP3_IO_ERROR   -20
#define DRMP3_INTERRUPT   -21
#define DRMP3_UNAVAILABLE   -22
#define DRMP3_ALREADY_IN_USE   -23
#define DRMP3_BAD_ADDRESS   -24
#define DRMP3_BAD_SEEK   -25
#define DRMP3_BAD_PIPE   -26
#define DRMP3_DEADLOCK   -27
#define DRMP3_TOO_MANY_LINKS   -28
#define DRMP3_NOT_IMPLEMENTED   -29
#define DRMP3_NO_MESSAGE   -30
#define DRMP3_BAD_MESSAGE   -31
#define DRMP3_NO_DATA_AVAILABLE   -32
#define DRMP3_INVALID_DATA   -33
#define DRMP3_TIMEOUT   -34
#define DRMP3_NO_NETWORK   -35
#define DRMP3_NOT_UNIQUE   -36
#define DRMP3_NOT_SOCKET   -37
#define DRMP3_NO_ADDRESS   -38
#define DRMP3_BAD_PROTOCOL   -39
#define DRMP3_PROTOCOL_UNAVAILABLE   -40
#define DRMP3_PROTOCOL_NOT_SUPPORTED   -41
#define DRMP3_PROTOCOL_FAMILY_NOT_SUPPORTED   -42
#define DRMP3_ADDRESS_FAMILY_NOT_SUPPORTED   -43
#define DRMP3_SOCKET_NOT_SUPPORTED   -44
#define DRMP3_CONNECTION_RESET   -45
#define DRMP3_ALREADY_CONNECTED   -46
#define DRMP3_NOT_CONNECTED   -47
#define DRMP3_CONNECTION_REFUSED   -48
#define DRMP3_NO_HOST   -49
#define DRMP3_IN_PROGRESS   -50
#define DRMP3_CANCELLED   -51
#define DRMP3_MEMORY_ALREADY_MAPPED   -52
#define DRMP3_AT_END   -53
#define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME   1152
#define DRMP3_MAX_SAMPLES_PER_FRAME   (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2)
#define DRMP3_INLINE

Typedefs

typedef signed char drmp3_int8
typedef unsigned char drmp3_uint8
typedef signed short drmp3_int16
typedef unsigned short drmp3_uint16
typedef signed int drmp3_int32
typedef unsigned int drmp3_uint32
typedef signed long long drmp3_int64
typedef unsigned long long drmp3_uint64
typedef drmp3_uint32 drmp3_uintptr
typedef drmp3_uint8 drmp3_bool8
typedef drmp3_uint32 drmp3_bool32
typedef drmp3_int32 drmp3_result
typedef size_t(* drmp3_read_proc) (void *pUserData, void *pBufferOut, size_t bytesToRead)
typedef drmp3_bool32(* drmp3_seek_proc) (void *pUserData, int offset, drmp3_seek_origin origin)

Enumerations

enum  drmp3_seek_origin { drmp3_seek_origin_start , drmp3_seek_origin_current }

Functions

DRMP3_API void drmp3_version (drmp3_uint32 *pMajor, drmp3_uint32 *pMinor, drmp3_uint32 *pRevision)
DRMP3_API const char * drmp3_version_string (void)
DRMP3_API void drmp3dec_init (drmp3dec *dec)
DRMP3_API int drmp3dec_decode_frame (drmp3dec *dec, const drmp3_uint8 *mp3, int mp3_bytes, void *pcm, drmp3dec_frame_info *info)
DRMP3_API void drmp3dec_f32_to_s16 (const float *in, drmp3_int16 *out, size_t num_samples)
DRMP3_API drmp3_bool32 drmp3_init (drmp3 *pMP3, drmp3_read_proc onRead, drmp3_seek_proc onSeek, void *pUserData, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_bool32 drmp3_init_memory (drmp3 *pMP3, const void *pData, size_t dataSize, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_bool32 drmp3_init_file (drmp3 *pMP3, const char *pFilePath, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_bool32 drmp3_init_file_w (drmp3 *pMP3, const wchar_t *pFilePath, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API void drmp3_uninit (drmp3 *pMP3)
DRMP3_API drmp3_uint64 drmp3_read_pcm_frames_f32 (drmp3 *pMP3, drmp3_uint64 framesToRead, float *pBufferOut)
DRMP3_API drmp3_uint64 drmp3_read_pcm_frames_s16 (drmp3 *pMP3, drmp3_uint64 framesToRead, drmp3_int16 *pBufferOut)
DRMP3_API drmp3_bool32 drmp3_seek_to_pcm_frame (drmp3 *pMP3, drmp3_uint64 frameIndex)
DRMP3_API drmp3_uint64 drmp3_get_pcm_frame_count (drmp3 *pMP3)
DRMP3_API drmp3_uint64 drmp3_get_mp3_frame_count (drmp3 *pMP3)
DRMP3_API drmp3_bool32 drmp3_get_mp3_and_pcm_frame_count (drmp3 *pMP3, drmp3_uint64 *pMP3FrameCount, drmp3_uint64 *pPCMFrameCount)
DRMP3_API drmp3_bool32 drmp3_calculate_seek_points (drmp3 *pMP3, drmp3_uint32 *pSeekPointCount, drmp3_seek_point *pSeekPoints)
DRMP3_API drmp3_bool32 drmp3_bind_seek_table (drmp3 *pMP3, drmp3_uint32 seekPointCount, drmp3_seek_point *pSeekPoints)
DRMP3_API float * drmp3_open_and_read_pcm_frames_f32 (drmp3_read_proc onRead, drmp3_seek_proc onSeek, void *pUserData, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_int16drmp3_open_and_read_pcm_frames_s16 (drmp3_read_proc onRead, drmp3_seek_proc onSeek, void *pUserData, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API float * drmp3_open_memory_and_read_pcm_frames_f32 (const void *pData, size_t dataSize, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_int16drmp3_open_memory_and_read_pcm_frames_s16 (const void *pData, size_t dataSize, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API float * drmp3_open_file_and_read_pcm_frames_f32 (const char *filePath, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API drmp3_int16drmp3_open_file_and_read_pcm_frames_s16 (const char *filePath, drmp3_config *pConfig, drmp3_uint64 *pTotalFrameCount, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API voiddrmp3_malloc (size_t sz, const drmp3_allocation_callbacks *pAllocationCallbacks)
DRMP3_API void drmp3_free (void *p, const drmp3_allocation_callbacks *pAllocationCallbacks)

Macro Definition Documentation

◆ DRMP3_ACCESS_DENIED

#define DRMP3_ACCESS_DENIED   -6

◆ DRMP3_ADDRESS_FAMILY_NOT_SUPPORTED

#define DRMP3_ADDRESS_FAMILY_NOT_SUPPORTED   -43

◆ DRMP3_ALREADY_CONNECTED

#define DRMP3_ALREADY_CONNECTED   -46

◆ DRMP3_ALREADY_EXISTS

#define DRMP3_ALREADY_EXISTS   -8

◆ DRMP3_ALREADY_IN_USE

#define DRMP3_ALREADY_IN_USE   -23

◆ DRMP3_API

#define DRMP3_API   extern

◆ DRMP3_AT_END

#define DRMP3_AT_END   -53

◆ DRMP3_BAD_ADDRESS

#define DRMP3_BAD_ADDRESS   -24

◆ DRMP3_BAD_MESSAGE

#define DRMP3_BAD_MESSAGE   -31

◆ DRMP3_BAD_PIPE

#define DRMP3_BAD_PIPE   -26

◆ DRMP3_BAD_PROTOCOL

#define DRMP3_BAD_PROTOCOL   -39

◆ DRMP3_BAD_SEEK

#define DRMP3_BAD_SEEK   -25

◆ DRMP3_BUSY

#define DRMP3_BUSY   -19

◆ DRMP3_CANCELLED

#define DRMP3_CANCELLED   -51

◆ DRMP3_CONNECTION_REFUSED

#define DRMP3_CONNECTION_REFUSED   -48

◆ DRMP3_CONNECTION_RESET

#define DRMP3_CONNECTION_RESET   -45

◆ DRMP3_DEADLOCK

#define DRMP3_DEADLOCK   -27

◆ DRMP3_DIRECTORY_NOT_EMPTY

#define DRMP3_DIRECTORY_NOT_EMPTY   -16

◆ DRMP3_DOES_NOT_EXIST

#define DRMP3_DOES_NOT_EXIST   -7

◆ DRMP3_END_OF_FILE

#define DRMP3_END_OF_FILE   -17

◆ DRMP3_ERROR

#define DRMP3_ERROR   -1 /* A generic error. */

◆ DRMP3_FALSE

#define DRMP3_FALSE   0

◆ DRMP3_IN_PROGRESS

#define DRMP3_IN_PROGRESS   -50

◆ DRMP3_INLINE

#define DRMP3_INLINE

◆ DRMP3_INTERRUPT

#define DRMP3_INTERRUPT   -21

◆ DRMP3_INVALID_ARGS

#define DRMP3_INVALID_ARGS   -2

◆ DRMP3_INVALID_DATA

#define DRMP3_INVALID_DATA   -33

◆ DRMP3_INVALID_FILE

#define DRMP3_INVALID_FILE   -10

◆ DRMP3_INVALID_OPERATION

#define DRMP3_INVALID_OPERATION   -3

◆ DRMP3_IO_ERROR

#define DRMP3_IO_ERROR   -20

◆ DRMP3_IS_DIRECTORY

#define DRMP3_IS_DIRECTORY   -15

◆ DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME

#define DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME   1152

◆ DRMP3_MAX_SAMPLES_PER_FRAME

#define DRMP3_MAX_SAMPLES_PER_FRAME   (DRMP3_MAX_PCM_FRAMES_PER_MP3_FRAME*2)

◆ DRMP3_MEMORY_ALREADY_MAPPED

#define DRMP3_MEMORY_ALREADY_MAPPED   -52

◆ DRMP3_NAME_TOO_LONG

#define DRMP3_NAME_TOO_LONG   -13

◆ DRMP3_NO_ADDRESS

#define DRMP3_NO_ADDRESS   -38

◆ DRMP3_NO_DATA_AVAILABLE

#define DRMP3_NO_DATA_AVAILABLE   -32

◆ DRMP3_NO_HOST

#define DRMP3_NO_HOST   -49

◆ DRMP3_NO_MESSAGE

#define DRMP3_NO_MESSAGE   -30

◆ DRMP3_NO_NETWORK

#define DRMP3_NO_NETWORK   -35

◆ DRMP3_NO_SPACE

#define DRMP3_NO_SPACE   -18

◆ DRMP3_NOT_CONNECTED

#define DRMP3_NOT_CONNECTED   -47

◆ DRMP3_NOT_DIRECTORY

#define DRMP3_NOT_DIRECTORY   -14

◆ DRMP3_NOT_IMPLEMENTED

#define DRMP3_NOT_IMPLEMENTED   -29

◆ DRMP3_NOT_SOCKET

#define DRMP3_NOT_SOCKET   -37

◆ DRMP3_NOT_UNIQUE

#define DRMP3_NOT_UNIQUE   -36

◆ DRMP3_OUT_OF_MEMORY

#define DRMP3_OUT_OF_MEMORY   -4

◆ DRMP3_OUT_OF_RANGE

#define DRMP3_OUT_OF_RANGE   -5

◆ DRMP3_PATH_TOO_LONG

#define DRMP3_PATH_TOO_LONG   -12

◆ DRMP3_PRIVATE

#define DRMP3_PRIVATE   static

◆ DRMP3_PROTOCOL_FAMILY_NOT_SUPPORTED

#define DRMP3_PROTOCOL_FAMILY_NOT_SUPPORTED   -42

◆ DRMP3_PROTOCOL_NOT_SUPPORTED

#define DRMP3_PROTOCOL_NOT_SUPPORTED   -41

◆ DRMP3_PROTOCOL_UNAVAILABLE

#define DRMP3_PROTOCOL_UNAVAILABLE   -40

◆ DRMP3_SOCKET_NOT_SUPPORTED

#define DRMP3_SOCKET_NOT_SUPPORTED   -44

◆ DRMP3_STRINGIFY

#define DRMP3_STRINGIFY ( x)
Value:
#x

◆ DRMP3_SUCCESS

#define DRMP3_SUCCESS   0

◆ DRMP3_TIMEOUT

#define DRMP3_TIMEOUT   -34

◆ DRMP3_TOO_BIG

#define DRMP3_TOO_BIG   -11

◆ DRMP3_TOO_MANY_LINKS

#define DRMP3_TOO_MANY_LINKS   -28

◆ DRMP3_TOO_MANY_OPEN_FILES

#define DRMP3_TOO_MANY_OPEN_FILES   -9

◆ DRMP3_TRUE

#define DRMP3_TRUE   1

◆ DRMP3_UNAVAILABLE

#define DRMP3_UNAVAILABLE   -22

◆ DRMP3_VERSION_MAJOR

#define DRMP3_VERSION_MAJOR   0

◆ DRMP3_VERSION_MINOR

#define DRMP3_VERSION_MINOR   6

◆ DRMP3_VERSION_REVISION

#define DRMP3_VERSION_REVISION   26

◆ DRMP3_VERSION_STRING

◆ DRMP3_XSTRINGIFY

#define DRMP3_XSTRINGIFY ( x)
Value:
unsigned x[BMAX+1]
Definition inflate.c:1586
#define DRMP3_STRINGIFY(x)
Definition dr_mp3.h:93

Typedef Documentation

◆ drmp3_bool32

◆ drmp3_bool8

◆ drmp3_int16

typedef signed short drmp3_int16

◆ drmp3_int32

typedef signed int drmp3_int32

◆ drmp3_int64

typedef signed long long drmp3_int64

◆ drmp3_int8

typedef signed char drmp3_int8

◆ drmp3_read_proc

typedef size_t(* drmp3_read_proc) (void *pUserData, void *pBufferOut, size_t bytesToRead)

◆ drmp3_result

◆ drmp3_seek_proc

typedef drmp3_bool32(* drmp3_seek_proc) (void *pUserData, int offset, drmp3_seek_origin origin)

◆ drmp3_uint16

typedef unsigned short drmp3_uint16

◆ drmp3_uint32

typedef unsigned int drmp3_uint32

◆ drmp3_uint64

typedef unsigned long long drmp3_uint64

◆ drmp3_uint8

typedef unsigned char drmp3_uint8

◆ drmp3_uintptr

Enumeration Type Documentation

◆ drmp3_seek_origin

Enumerator
drmp3_seek_origin_start 
drmp3_seek_origin_current 

Function Documentation

◆ drmp3_bind_seek_table()

DRMP3_API drmp3_bool32 drmp3_bind_seek_table ( drmp3 * pMP3,
drmp3_uint32 seekPointCount,
drmp3_seek_point * pSeekPoints )

◆ drmp3_calculate_seek_points()

DRMP3_API drmp3_bool32 drmp3_calculate_seek_points ( drmp3 * pMP3,
drmp3_uint32 * pSeekPointCount,
drmp3_seek_point * pSeekPoints )

◆ drmp3_free()

DRMP3_API void drmp3_free ( void * p,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_get_mp3_and_pcm_frame_count()

DRMP3_API drmp3_bool32 drmp3_get_mp3_and_pcm_frame_count ( drmp3 * pMP3,
drmp3_uint64 * pMP3FrameCount,
drmp3_uint64 * pPCMFrameCount )

◆ drmp3_get_mp3_frame_count()

DRMP3_API drmp3_uint64 drmp3_get_mp3_frame_count ( drmp3 * pMP3)

◆ drmp3_get_pcm_frame_count()

DRMP3_API drmp3_uint64 drmp3_get_pcm_frame_count ( drmp3 * pMP3)

◆ drmp3_init()

DRMP3_API drmp3_bool32 drmp3_init ( drmp3 * pMP3,
drmp3_read_proc onRead,
drmp3_seek_proc onSeek,
void * pUserData,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_init_file()

DRMP3_API drmp3_bool32 drmp3_init_file ( drmp3 * pMP3,
const char * pFilePath,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_init_file_w()

DRMP3_API drmp3_bool32 drmp3_init_file_w ( drmp3 * pMP3,
const wchar_t * pFilePath,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_init_memory()

DRMP3_API drmp3_bool32 drmp3_init_memory ( drmp3 * pMP3,
const void * pData,
size_t dataSize,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_malloc()

DRMP3_API void * drmp3_malloc ( size_t sz,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_and_read_pcm_frames_f32()

DRMP3_API float * drmp3_open_and_read_pcm_frames_f32 ( drmp3_read_proc onRead,
drmp3_seek_proc onSeek,
void * pUserData,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_and_read_pcm_frames_s16()

DRMP3_API drmp3_int16 * drmp3_open_and_read_pcm_frames_s16 ( drmp3_read_proc onRead,
drmp3_seek_proc onSeek,
void * pUserData,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_file_and_read_pcm_frames_f32()

DRMP3_API float * drmp3_open_file_and_read_pcm_frames_f32 ( const char * filePath,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_file_and_read_pcm_frames_s16()

DRMP3_API drmp3_int16 * drmp3_open_file_and_read_pcm_frames_s16 ( const char * filePath,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_memory_and_read_pcm_frames_f32()

DRMP3_API float * drmp3_open_memory_and_read_pcm_frames_f32 ( const void * pData,
size_t dataSize,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_open_memory_and_read_pcm_frames_s16()

DRMP3_API drmp3_int16 * drmp3_open_memory_and_read_pcm_frames_s16 ( const void * pData,
size_t dataSize,
drmp3_config * pConfig,
drmp3_uint64 * pTotalFrameCount,
const drmp3_allocation_callbacks * pAllocationCallbacks )

◆ drmp3_read_pcm_frames_f32()

DRMP3_API drmp3_uint64 drmp3_read_pcm_frames_f32 ( drmp3 * pMP3,
drmp3_uint64 framesToRead,
float * pBufferOut )

◆ drmp3_read_pcm_frames_s16()

DRMP3_API drmp3_uint64 drmp3_read_pcm_frames_s16 ( drmp3 * pMP3,
drmp3_uint64 framesToRead,
drmp3_int16 * pBufferOut )

◆ drmp3_seek_to_pcm_frame()

DRMP3_API drmp3_bool32 drmp3_seek_to_pcm_frame ( drmp3 * pMP3,
drmp3_uint64 frameIndex )

◆ drmp3_uninit()

DRMP3_API void drmp3_uninit ( drmp3 * pMP3)

◆ drmp3_version()

DRMP3_API void drmp3_version ( drmp3_uint32 * pMajor,
drmp3_uint32 * pMinor,
drmp3_uint32 * pRevision )

◆ drmp3_version_string()

DRMP3_API const char * drmp3_version_string ( void )

◆ drmp3dec_decode_frame()

DRMP3_API int drmp3dec_decode_frame ( drmp3dec * dec,
const drmp3_uint8 * mp3,
int mp3_bytes,
void * pcm,
drmp3dec_frame_info * info )

◆ drmp3dec_f32_to_s16()

DRMP3_API void drmp3dec_f32_to_s16 ( const float * in,
drmp3_int16 * out,
size_t num_samples )

◆ drmp3dec_init()

DRMP3_API void drmp3dec_init ( drmp3dec * dec)