diff options
| author | Ray <[email protected]> | 2019-07-23 22:21:01 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-07-23 22:21:01 +0200 |
| commit | b44b7dd3102ad7390d11f44f4fc6183797c2061b (patch) | |
| tree | 89227438c2631010226f1bc05a407e33edf0df19 /src/raylib.h | |
| parent | 632d064b21b6c3f2d092f016d1380b625184966a (diff) | |
| download | raylib-b44b7dd3102ad7390d11f44f4fc6183797c2061b.tar.gz raylib-b44b7dd3102ad7390d11f44f4fc6183797c2061b.zip | |
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...
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/src/raylib.h b/src/raylib.h index d28dffdb..3dfcd2eb 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -406,40 +406,45 @@ typedef struct BoundingBox { // Wave type, defines audio wave data typedef struct Wave { - unsigned int sampleCount; // Number of samples - unsigned int sampleRate; // Frequency (samples per second) - unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) - unsigned int channels; // Number of channels (1-mono, 2-stereo) - void *data; // Buffer data pointer + unsigned int sampleCount; // Total number of samples + unsigned int sampleRate; // Frequency (samples per second) + unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) + unsigned int channels; // Number of channels (1-mono, 2-stereo) + void *data; // Buffer data pointer } Wave; -// Sound source type -typedef struct Sound { - 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; +typedef struct rAudioBuffer rAudioBuffer; +#define AudioBuffer rAudioBuffer // HACK: To avoid CoreAudio (macOS) symbol collision // Audio stream type // NOTE: Useful to create custom audio streams not bound to a specific file typedef struct AudioStream { - unsigned int sampleRate; // Frequency (samples per second) - unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) - unsigned int channels; // Number of channels (1-mono, 2-stereo) - - void *audioBuffer; // Pointer to internal data used by the audio system. + unsigned int sampleRate; // Frequency (samples per second) + unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) + unsigned int channels; // Number of channels (1-mono, 2-stereo) - int format; // Audio format specifier - unsigned int source; // Audio source id - unsigned int buffers[2]; // Audio buffers (double buffering) + AudioBuffer *buffer; // Pointer to internal data used by the audio system } 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 typedef struct VrDeviceInfo { int hResolution; // HMD horizontal resolution in pixels |
