mixer.h File Reference

#include "CrabClaw/types.h"

Defines

#define CC_MIXER_BUFFER_BYTES   16384
#define CC_MIXER_FMT_16BIT_MONO   3
 16-bit Mono stream type.
#define CC_MIXER_FMT_16BIT_STEREO   4
 16-bit Stereo stream type.
#define CC_MIXER_FMT_8BIT_MONO   1
 8-bit Mono stream type.
#define CC_MIXER_FMT_8BIT_STEREO   2
 8-bit Stereo stream type.

Typedefs

typedef int(* cc_stream_update )(void *user, int smp_req, void **data)
 Stream update function type.

Functions

int cc_mixer_init (void)
 Initialize CrabClaw's mixer.
void cc_mixer_shutdown (void)
 Shut down CrabClaw's mixer.
int cc_mixer_stream_start (uint32 fmt, int freq, cc_stream_update func, void *data, void **stream)
 Start a new CrabClaw stream.
int cc_mixer_stream_stop (void *stream)
 Stop a CrabClaw stream.
void cc_mixer_update (void)
 Update all sound streams in progress.

Define Documentation

#define CC_MIXER_BUFFER_BYTES   16384

#define CC_MIXER_FMT_16BIT_MONO   3

16-bit Mono stream type.

Since:
1.0.0

#define CC_MIXER_FMT_16BIT_STEREO   4

16-bit Stereo stream type.

Since:
1.0.0

#define CC_MIXER_FMT_8BIT_MONO   1

8-bit Mono stream type.

Since:
1.0.0

#define CC_MIXER_FMT_8BIT_STEREO   2

8-bit Stereo stream type.

Since:
1.0.0


Typedef Documentation

typedef int(* cc_stream_update)(void *user, int smp_req, void **data)

Stream update function type.

This is the type of the functions used to update a stream in CrabClaw.

Since:
1.0.0
Parameters:
user Data with no purpose to the mixer, only used by user code.
smp_req The number of samples that the mixer requests.
data The buffer with sound data in it. This must be provided by the function itself -- CrabClaw does not allocate the buffer automatically (nor does it free the buffer).
Returns:
The number of samples provided.


Function Documentation

int cc_mixer_init ( void   ) 

Initialize CrabClaw's mixer.

This function initializes the sound system in use in CrabClaw.

Since:
1.0.0
Returns:
0 on success, non-zero on failure.

void cc_mixer_shutdown ( void   ) 

Shut down CrabClaw's mixer.

This function deinitializes the sound system in use in CrabClaw.

Since:
1.0.0

int cc_mixer_stream_start ( uint32  fmt,
int  freq,
cc_stream_update  func,
void *  data,
void **  stream 
)

Start a new CrabClaw stream.

This function allocates resources for a stream to be started with the given parameters.

Since:
1.0.0
Parameters:
fmt The format of the sound generated by the stream.
freq The samplerate of the sound generated by the stream.
func The function that should be called to update the stream.
data The user-specific data to be passed to func.
stream A pointer to be used by the program to recognize the stream.
Returns:
0 on success, non-zero on failure.

int cc_mixer_stream_stop ( void *  stream  ) 

Stop a CrabClaw stream.

This function stops the given stream from playing and frees all resources associated with it.

Since:
1.0.0
Parameters:
stream The stream to stop.
Returns:
0 on success, non-zero on failure.

void cc_mixer_update ( void   ) 

Update all sound streams in progress.

This function updates all of the sound streams that have been started by the program. This function must be called periodically to poll for new sound data.

Since:
1.0.0

SourceForge.net Logo