WARNING: Complete review of raudio -WIP-
This module has been completely reviewed, old structures still contained OpenAL useless data, a full module revision. Some of the changes: - Redesigned internal MusicData structure - Exposed MusicStream structure data - Reviewed AudioStream structure - Redesigned Sound structure Still some work to do...
This commit is contained in:
parent
632d064b21
commit
b44b7dd310
2 changed files with 249 additions and 256 deletions
438
src/raudio.c
438
src/raudio.c
File diff suppressed because it is too large
Load diff
41
src/raylib.h
41
src/raylib.h
|
@ -406,25 +406,15 @@ typedef struct BoundingBox {
|
||||||
|
|
||||||
// Wave type, defines audio wave data
|
// Wave type, defines audio wave data
|
||||||
typedef struct Wave {
|
typedef struct Wave {
|
||||||
unsigned int sampleCount; // Number of samples
|
unsigned int sampleCount; // Total number of samples
|
||||||
unsigned int sampleRate; // Frequency (samples per second)
|
unsigned int sampleRate; // Frequency (samples per second)
|
||||||
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
||||||
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
||||||
void *data; // Buffer data pointer
|
void *data; // Buffer data pointer
|
||||||
} Wave;
|
} Wave;
|
||||||
|
|
||||||
// Sound source type
|
typedef struct rAudioBuffer rAudioBuffer;
|
||||||
typedef struct Sound {
|
#define AudioBuffer rAudioBuffer // HACK: To avoid CoreAudio (macOS) symbol collision
|
||||||
void *audioBuffer; // Pointer to internal data used by the audio system
|
|
||||||
|
|
||||||
unsigned int source; // Audio source id
|
|
||||||
unsigned int buffer; // Audio buffer id
|
|
||||||
int format; // Audio format specifier
|
|
||||||
} Sound;
|
|
||||||
|
|
||||||
// Music type (file streaming from memory)
|
|
||||||
// NOTE: Anything longer than ~10 seconds should be streamed
|
|
||||||
typedef struct MusicData *Music;
|
|
||||||
|
|
||||||
// Audio stream type
|
// Audio stream type
|
||||||
// NOTE: Useful to create custom audio streams not bound to a specific file
|
// NOTE: Useful to create custom audio streams not bound to a specific file
|
||||||
|
@ -433,13 +423,28 @@ typedef struct AudioStream {
|
||||||
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
||||||
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
||||||
|
|
||||||
void *audioBuffer; // Pointer to internal data used by the audio system.
|
AudioBuffer *buffer; // Pointer to internal data used by the audio system
|
||||||
|
|
||||||
int format; // Audio format specifier
|
|
||||||
unsigned int source; // Audio source id
|
|
||||||
unsigned int buffers[2]; // Audio buffers (double buffering)
|
|
||||||
} AudioStream;
|
} AudioStream;
|
||||||
|
|
||||||
|
// Sound source type
|
||||||
|
typedef struct Sound {
|
||||||
|
unsigned int sampleCount; // Total number of samples
|
||||||
|
AudioStream stream; // Audio stream
|
||||||
|
} Sound;
|
||||||
|
|
||||||
|
// Music stream type (audio file streaming from memory)
|
||||||
|
// NOTE: Anything longer than ~10 seconds should be streamed
|
||||||
|
typedef struct MusicStream {
|
||||||
|
int ctxType; // Type of music context (audio filetype)
|
||||||
|
void *ctxData; // Audio context data, depends on type
|
||||||
|
|
||||||
|
unsigned int sampleCount; // Total number of samples
|
||||||
|
unsigned int sampleLeft; // Number of samples left to end
|
||||||
|
unsigned int loopCount; // Loops count (times music will play), 0 means infinite loop
|
||||||
|
|
||||||
|
AudioStream stream; // Audio stream
|
||||||
|
} MusicStream, *Music;
|
||||||
|
|
||||||
// Head-Mounted-Display device parameters
|
// Head-Mounted-Display device parameters
|
||||||
typedef struct VrDeviceInfo {
|
typedef struct VrDeviceInfo {
|
||||||
int hResolution; // HMD horizontal resolution in pixels
|
int hResolution; // HMD horizontal resolution in pixels
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue