Update C sources, add new functions and rename package to
This commit is contained in:
parent
391c25482d
commit
08aa518a46
156 changed files with 34542 additions and 19573 deletions
265
raylib/audio.c
265
raylib/audio.c
|
@ -19,7 +19,7 @@
|
|||
* Required types and functions are defined in the same module.
|
||||
*
|
||||
* #define USE_OPENAL_BACKEND
|
||||
* Use OpenAL Soft audio backend usage
|
||||
* Use OpenAL Soft audio backend
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_WAV
|
||||
* #define SUPPORT_FILEFORMAT_OGG
|
||||
|
@ -75,20 +75,19 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(USE_OPENAL_BACKEND)
|
||||
#define USE_MINI_AL 1 // Set to 1 to use mini_al; 0 to use OpenAL.
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO_STANDALONE)
|
||||
#include "audio.h"
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
||||
#else
|
||||
#include "raylib.h"
|
||||
#include "config.h" // Defines module configuration flags
|
||||
#include "raylib.h" // Declares module functions
|
||||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
#endif
|
||||
|
||||
#if !defined(USE_OPENAL_BACKEND)
|
||||
#define USE_MINI_AL 1 // Set to 1 to use mini_al; 0 to use OpenAL.
|
||||
#endif
|
||||
|
||||
#include "external/mini_al.h" // Implemented in mini_al.c. Cannot implement this here because it conflicts with Win32 APIs such as CloseWindow(), etc.
|
||||
|
||||
#if !defined(USE_MINI_AL) || (USE_MINI_AL == 0)
|
||||
|
@ -166,6 +165,7 @@
|
|||
typedef enum {
|
||||
MUSIC_AUDIO_OGG = 0,
|
||||
MUSIC_AUDIO_FLAC,
|
||||
MUSIC_AUDIO_MP3,
|
||||
MUSIC_MODULE_XM,
|
||||
MUSIC_MODULE_MOD
|
||||
} MusicContextType;
|
||||
|
@ -179,6 +179,9 @@ typedef struct MusicData {
|
|||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
drflac *ctxFlac; // FLAC audio context
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
drmp3 ctxMp3; // MP3 audio context
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
jar_xm_context_t *ctxXm; // XM chiptune context
|
||||
#endif
|
||||
|
@ -220,6 +223,9 @@ static Wave LoadOGG(const char *fileName); // Load OGG file
|
|||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
static Wave LoadFLAC(const char *fileName); // Load FLAC file
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
static Wave LoadMP3(const char *fileName); // Load MP3 file
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO_STANDALONE)
|
||||
bool IsFileExtension(const char *fileName, const char *ext); // Check file extension
|
||||
|
@ -304,7 +310,7 @@ static mal_uint32 OnSendAudioDataToDevice(mal_device *pDevice, mal_uint32 frameC
|
|||
(void)pDevice;
|
||||
|
||||
// Mixing is basically just an accumulation. We need to initialize the output buffer to 0.
|
||||
memset(pFramesOut, 0, frameCount*pDevice->channels*mal_get_sample_size_in_bytes(pDevice->format));
|
||||
memset(pFramesOut, 0, frameCount*pDevice->channels*mal_get_bytes_per_sample(pDevice->format));
|
||||
|
||||
// Using a mutex here for thread-safety which makes things not real-time. This is unlikely to be necessary for this project, but may
|
||||
// want to consider how you might want to avoid this.
|
||||
|
@ -338,11 +344,7 @@ static mal_uint32 OnSendAudioDataToDevice(mal_device *pDevice, mal_uint32 frameC
|
|||
framesToReadRightNow = sizeof(tempBuffer)/sizeof(tempBuffer[0])/DEVICE_CHANNELS;
|
||||
}
|
||||
|
||||
// If we're not looping, we need to make sure we flush the internal buffers of the DSP pipeline to ensure we get the
|
||||
// last few samples.
|
||||
bool flushDSP = !audioBuffer->looping;
|
||||
|
||||
mal_uint32 framesJustRead = mal_dsp_read_frames_ex(&audioBuffer->dsp, framesToReadRightNow, tempBuffer, flushDSP);
|
||||
mal_uint32 framesJustRead = (mal_uint32)mal_dsp_read(&audioBuffer->dsp, framesToReadRightNow, tempBuffer, audioBuffer->dsp.pUserData);
|
||||
if (framesJustRead > 0)
|
||||
{
|
||||
float *framesOut = (float *)pFramesOut + (framesRead*device.channels);
|
||||
|
@ -402,7 +404,7 @@ static mal_uint32 OnAudioBufferDSPRead(mal_dsp *pDSP, mal_uint32 frameCount, voi
|
|||
isSubBufferProcessed[0] = audioBuffer->isSubBufferProcessed[0];
|
||||
isSubBufferProcessed[1] = audioBuffer->isSubBufferProcessed[1];
|
||||
|
||||
mal_uint32 frameSizeInBytes = mal_get_sample_size_in_bytes(audioBuffer->dsp.config.formatIn)*audioBuffer->dsp.config.channelsIn;
|
||||
mal_uint32 frameSizeInBytes = mal_get_bytes_per_sample(audioBuffer->dsp.formatConverterIn.config.formatIn)*audioBuffer->dsp.formatConverterIn.config.channels;
|
||||
|
||||
// Fill out every frame until we find a buffer that's marked as processed. Then fill the remainder with 0.
|
||||
mal_uint32 framesRead = 0;
|
||||
|
@ -648,7 +650,7 @@ void SetMasterVolume(float volume)
|
|||
// Create a new audio buffer. Initially filled with silence
|
||||
AudioBuffer *CreateAudioBuffer(mal_format format, mal_uint32 channels, mal_uint32 sampleRate, mal_uint32 bufferSizeInFrames, AudioBufferUsage usage)
|
||||
{
|
||||
AudioBuffer *audioBuffer = (AudioBuffer *)calloc(sizeof(*audioBuffer) + (bufferSizeInFrames*channels*mal_get_sample_size_in_bytes(format)), 1);
|
||||
AudioBuffer *audioBuffer = (AudioBuffer *)calloc(sizeof(*audioBuffer) + (bufferSizeInFrames*channels*mal_get_bytes_per_sample(format)), 1);
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "CreateAudioBuffer() : Failed to allocate memory for audio buffer");
|
||||
|
@ -664,10 +666,13 @@ AudioBuffer *CreateAudioBuffer(mal_format format, mal_uint32 channels, mal_uint3
|
|||
dspConfig.channelsOut = DEVICE_CHANNELS;
|
||||
dspConfig.sampleRateIn = sampleRate;
|
||||
dspConfig.sampleRateOut = DEVICE_SAMPLE_RATE;
|
||||
mal_result resultMAL = mal_dsp_init(&dspConfig, OnAudioBufferDSPRead, audioBuffer, &audioBuffer->dsp);
|
||||
dspConfig.onRead = OnAudioBufferDSPRead;
|
||||
dspConfig.pUserData = audioBuffer;
|
||||
dspConfig.allowDynamicSampleRate = MAL_TRUE; // <-- Required for pitch shifting.
|
||||
mal_result resultMAL = mal_dsp_init(&dspConfig, &audioBuffer->dsp);
|
||||
if (resultMAL != MAL_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "LoadSoundFromWave() : Failed to create data conversion pipeline");
|
||||
TraceLog(LOG_ERROR, "CreateAudioBuffer() : Failed to create data conversion pipeline");
|
||||
free(audioBuffer);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -695,7 +700,7 @@ void DeleteAudioBuffer(AudioBuffer *audioBuffer)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "DeleteAudioBuffer() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -708,7 +713,7 @@ bool IsAudioBufferPlaying(AudioBuffer *audioBuffer)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "IsAudioBufferPlaying() : No audio buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -736,7 +741,7 @@ void StopAudioBuffer(AudioBuffer *audioBuffer)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "StopAudioBuffer() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -755,7 +760,7 @@ void PauseAudioBuffer(AudioBuffer *audioBuffer)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "PauseAudioBuffer() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -767,7 +772,7 @@ void ResumeAudioBuffer(AudioBuffer *audioBuffer)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "ResumeAudioBuffer() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -779,7 +784,7 @@ void SetAudioBufferVolume(AudioBuffer *audioBuffer, float volume)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "SetAudioBufferVolume() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -791,7 +796,7 @@ void SetAudioBufferPitch(AudioBuffer *audioBuffer, float pitch)
|
|||
{
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
TraceLog(LOG_ERROR, "SetAudioBufferPitch() : No audio buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -799,7 +804,7 @@ void SetAudioBufferPitch(AudioBuffer *audioBuffer, float pitch)
|
|||
|
||||
// Pitching is just an adjustment of the sample rate. Note that this changes the duration of the sound - higher pitches
|
||||
// will make the sound faster; lower pitches make it slower.
|
||||
mal_uint32 newOutputSampleRate = (mal_uint32)((((float)audioBuffer->dsp.config.sampleRateOut / (float)audioBuffer->dsp.config.sampleRateIn) / pitch) * audioBuffer->dsp.config.sampleRateIn);
|
||||
mal_uint32 newOutputSampleRate = (mal_uint32)((((float)audioBuffer->dsp.src.config.sampleRateOut / (float)audioBuffer->dsp.src.config.sampleRateIn) / pitch) * audioBuffer->dsp.src.config.sampleRateIn);
|
||||
mal_dsp_set_output_sample_rate(&audioBuffer->dsp, newOutputSampleRate);
|
||||
}
|
||||
|
||||
|
@ -857,6 +862,9 @@ Wave LoadWave(const char *fileName)
|
|||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (IsFileExtension(fileName, ".flac")) wave = LoadFLAC(fileName);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (IsFileExtension(fileName, ".mp3")) wave = LoadMP3(fileName);
|
||||
#endif
|
||||
else TraceLog(LOG_WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
|
||||
|
||||
|
@ -915,13 +923,13 @@ Sound LoadSoundFromWave(Wave wave)
|
|||
mal_format formatIn = ((wave.sampleSize == 8) ? mal_format_u8 : ((wave.sampleSize == 16) ? mal_format_s16 : mal_format_f32));
|
||||
mal_uint32 frameCountIn = wave.sampleCount; // Is wave->sampleCount actually the frame count? That terminology needs to change, if so.
|
||||
|
||||
mal_uint32 frameCount = mal_convert_frames(NULL, DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, NULL, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
mal_uint32 frameCount = (mal_uint32)mal_convert_frames(NULL, DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, NULL, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
if (frameCount == 0) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Failed to get frame count for format conversion");
|
||||
|
||||
AudioBuffer* audioBuffer = CreateAudioBuffer(DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, frameCount, AUDIO_BUFFER_USAGE_STATIC);
|
||||
if (audioBuffer == NULL) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Failed to create audio buffer");
|
||||
|
||||
frameCount = mal_convert_frames(audioBuffer->buffer, audioBuffer->dsp.config.formatIn, audioBuffer->dsp.config.channelsIn, audioBuffer->dsp.config.sampleRateIn, wave.data, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
frameCount = (mal_uint32)mal_convert_frames(audioBuffer->buffer, audioBuffer->dsp.formatConverterIn.config.formatIn, audioBuffer->dsp.formatConverterIn.config.channels, audioBuffer->dsp.src.config.sampleRateIn, wave.data, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
if (frameCount == 0) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Format conversion failed");
|
||||
|
||||
sound.audioBuffer = audioBuffer;
|
||||
|
@ -1023,7 +1031,7 @@ void UpdateSound(Sound sound, const void *data, int samplesCount)
|
|||
StopAudioBuffer(audioBuffer);
|
||||
|
||||
// TODO: May want to lock/unlock this since this data buffer is read at mixing time.
|
||||
memcpy(audioBuffer->buffer, data, samplesCount*audioBuffer->dsp.config.channelsIn*mal_get_sample_size_in_bytes(audioBuffer->dsp.config.formatIn));
|
||||
memcpy(audioBuffer->buffer, data, samplesCount*audioBuffer->dsp.formatConverterIn.config.channels*mal_get_bytes_per_sample(audioBuffer->dsp.formatConverterIn.config.formatIn));
|
||||
#else
|
||||
ALint sampleRate, sampleSize, channels;
|
||||
alGetBufferi(sound.buffer, AL_FREQUENCY, &sampleRate);
|
||||
|
@ -1049,6 +1057,89 @@ void UpdateSound(Sound sound, const void *data, int samplesCount)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Export wave data to file
|
||||
void ExportWave(Wave wave, const char *fileName)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
if (IsFileExtension(fileName, ".wav"))
|
||||
{
|
||||
// Basic WAV headers structs
|
||||
typedef struct {
|
||||
char chunkID[4];
|
||||
int chunkSize;
|
||||
char format[4];
|
||||
} RiffHeader;
|
||||
|
||||
typedef struct {
|
||||
char subChunkID[4];
|
||||
int subChunkSize;
|
||||
short audioFormat;
|
||||
short numChannels;
|
||||
int sampleRate;
|
||||
int byteRate;
|
||||
short blockAlign;
|
||||
short bitsPerSample;
|
||||
} WaveFormat;
|
||||
|
||||
typedef struct {
|
||||
char subChunkID[4];
|
||||
int subChunkSize;
|
||||
} WaveData;
|
||||
|
||||
RiffHeader riffHeader;
|
||||
WaveFormat waveFormat;
|
||||
WaveData waveData;
|
||||
|
||||
// Fill structs with data
|
||||
riffHeader.chunkID[0] = 'R';
|
||||
riffHeader.chunkID[1] = 'I';
|
||||
riffHeader.chunkID[2] = 'F';
|
||||
riffHeader.chunkID[3] = 'F';
|
||||
riffHeader.chunkSize = 44 - 4 + wave.sampleCount*wave.sampleSize/8;
|
||||
riffHeader.format[0] = 'W';
|
||||
riffHeader.format[1] = 'A';
|
||||
riffHeader.format[2] = 'V';
|
||||
riffHeader.format[3] = 'E';
|
||||
|
||||
waveFormat.subChunkID[0] = 'f';
|
||||
waveFormat.subChunkID[1] = 'm';
|
||||
waveFormat.subChunkID[2] = 't';
|
||||
waveFormat.subChunkID[3] = ' ';
|
||||
waveFormat.subChunkSize = 16;
|
||||
waveFormat.audioFormat = 1;
|
||||
waveFormat.numChannels = wave.channels;
|
||||
waveFormat.sampleRate = wave.sampleRate;
|
||||
waveFormat.byteRate = wave.sampleRate*wave.sampleSize/8;
|
||||
waveFormat.blockAlign = wave.sampleSize/8;
|
||||
waveFormat.bitsPerSample = wave.sampleSize;
|
||||
|
||||
waveData.subChunkID[0] = 'd';
|
||||
waveData.subChunkID[1] = 'a';
|
||||
waveData.subChunkID[2] = 't';
|
||||
waveData.subChunkID[3] = 'a';
|
||||
waveData.subChunkSize = wave.sampleCount*wave.channels*wave.sampleSize/8;
|
||||
|
||||
FILE *wavFile = fopen(fileName, "wb");
|
||||
|
||||
if (wavFile == NULL) return;
|
||||
|
||||
fwrite(&riffHeader, 1, sizeof(RiffHeader), wavFile);
|
||||
fwrite(&waveFormat, 1, sizeof(WaveFormat), wavFile);
|
||||
fwrite(&waveData, 1, sizeof(WaveData), wavFile);
|
||||
|
||||
fwrite(wave.data, 1, wave.sampleCount*wave.channels*wave.sampleSize/8, wavFile);
|
||||
|
||||
fclose(wavFile);
|
||||
|
||||
success = true;
|
||||
}
|
||||
else if (IsFileExtension(fileName, ".raw")) { } // TODO: Support additional file formats to export wave sample data
|
||||
|
||||
if (success) TraceLog(LOG_INFO, "Wave exported successfully: %s", fileName);
|
||||
else TraceLog(LOG_WARNING, "Wave could not be exported.");
|
||||
}
|
||||
|
||||
// Play a sound
|
||||
void PlaySound(Sound sound)
|
||||
{
|
||||
|
@ -1153,7 +1244,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
|||
|
||||
mal_uint32 frameCountIn = wave->sampleCount; // Is wave->sampleCount actually the frame count? That terminology needs to change, if so.
|
||||
|
||||
mal_uint32 frameCount = mal_convert_frames(NULL, formatOut, channels, sampleRate, NULL, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
mal_uint32 frameCount = (mal_uint32)mal_convert_frames(NULL, formatOut, channels, sampleRate, NULL, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
if (frameCount == 0)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "WaveFormat() : Failed to get frame count for format conversion.");
|
||||
|
@ -1162,7 +1253,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
|||
|
||||
void *data = malloc(frameCount*channels*(sampleSize/8));
|
||||
|
||||
frameCount = mal_convert_frames(data, formatOut, channels, sampleRate, wave->data, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
frameCount = (mal_uint32)mal_convert_frames(data, formatOut, channels, sampleRate, wave->data, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
if (frameCount == 0)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "WaveFormat() : Format conversion failed.");
|
||||
|
@ -1284,7 +1375,7 @@ Wave WaveCopy(Wave wave)
|
|||
void WaveCrop(Wave *wave, int initSample, int finalSample)
|
||||
{
|
||||
if ((initSample >= 0) && (initSample < finalSample) &&
|
||||
(finalSample > 0) && (finalSample < wave->sampleCount))
|
||||
(finalSample > 0) && ((unsigned int)finalSample < wave->sampleCount))
|
||||
{
|
||||
int sampleCount = finalSample - initSample;
|
||||
|
||||
|
@ -1304,9 +1395,9 @@ float *GetWaveData(Wave wave)
|
|||
{
|
||||
float *samples = (float *)malloc(wave.sampleCount*wave.channels*sizeof(float));
|
||||
|
||||
for (int i = 0; i < wave.sampleCount; i++)
|
||||
for (unsigned int i = 0; i < wave.sampleCount; i++)
|
||||
{
|
||||
for (int j = 0; j < wave.channels; j++)
|
||||
for (unsigned int j = 0; j < wave.channels; j++)
|
||||
{
|
||||
if (wave.sampleSize == 8) samples[wave.channels*i + j] = (float)(((unsigned char *)wave.data)[wave.channels*i + j] - 127)/256.0f;
|
||||
else if (wave.sampleSize == 16) samples[wave.channels*i + j] = (float)((short *)wave.data)[wave.channels*i + j]/32767.0f;
|
||||
|
@ -1325,13 +1416,14 @@ float *GetWaveData(Wave wave)
|
|||
Music LoadMusicStream(const char *fileName)
|
||||
{
|
||||
Music music = (MusicData *)malloc(sizeof(MusicData));
|
||||
bool musicLoaded = true;
|
||||
|
||||
if (IsFileExtension(fileName, ".ogg"))
|
||||
{
|
||||
// Open ogg audio stream
|
||||
music->ctxOgg = stb_vorbis_open_filename(fileName, NULL, NULL);
|
||||
|
||||
if (music->ctxOgg == NULL) TraceLog(LOG_WARNING, "[%s] OGG audio file could not be opened", fileName);
|
||||
if (music->ctxOgg == NULL) musicLoaded = false;
|
||||
else
|
||||
{
|
||||
stb_vorbis_info info = stb_vorbis_get_info(music->ctxOgg); // Get Ogg file info
|
||||
|
@ -1343,7 +1435,7 @@ Music LoadMusicStream(const char *fileName)
|
|||
music->ctxType = MUSIC_AUDIO_OGG;
|
||||
music->loopCount = -1; // Infinite loop by default
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] FLAC total samples: %i", fileName, music->totalSamples);
|
||||
TraceLog(LOG_DEBUG, "[%s] OGG total samples: %i", fileName, music->totalSamples);
|
||||
TraceLog(LOG_DEBUG, "[%s] OGG sample rate: %i", fileName, info.sample_rate);
|
||||
TraceLog(LOG_DEBUG, "[%s] OGG channels: %i", fileName, info.channels);
|
||||
TraceLog(LOG_DEBUG, "[%s] OGG memory required: %i", fileName, info.temp_memory_required);
|
||||
|
@ -1354,7 +1446,7 @@ Music LoadMusicStream(const char *fileName)
|
|||
{
|
||||
music->ctxFlac = drflac_open_file(fileName);
|
||||
|
||||
if (music->ctxFlac == NULL) TraceLog(LOG_WARNING, "[%s] FLAC audio file could not be opened", fileName);
|
||||
if (music->ctxFlac == NULL) musicLoaded = false;
|
||||
else
|
||||
{
|
||||
music->stream = InitAudioStream(music->ctxFlac->sampleRate, music->ctxFlac->bitsPerSample, music->ctxFlac->channels);
|
||||
|
@ -1370,6 +1462,27 @@ Music LoadMusicStream(const char *fileName)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (IsFileExtension(fileName, ".mp3"))
|
||||
{
|
||||
drmp3_init_file(&music->ctxMp3, fileName, NULL);
|
||||
|
||||
if (music->ctxMp3.framesRemaining <= 0) musicLoaded = false;
|
||||
else
|
||||
{
|
||||
music->stream = InitAudioStream(music->ctxMp3.sampleRate, 16, music->ctxMp3.channels);
|
||||
music->totalSamples = (unsigned int)music->ctxMp3.framesRemaining*music->ctxMp3.channels;
|
||||
music->samplesLeft = music->totalSamples;
|
||||
music->ctxType = MUSIC_AUDIO_MP3;
|
||||
music->loopCount = -1; // Infinite loop by default
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] MP3 total samples: %i", fileName, music->totalSamples);
|
||||
TraceLog(LOG_DEBUG, "[%s] MP3 sample rate: %i", fileName, music->ctxMp3.sampleRate);
|
||||
//TraceLog(LOG_DEBUG, "[%s] MP3 bits per sample: %i", fileName, music->ctxMp3.bitsPerSample);
|
||||
TraceLog(LOG_DEBUG, "[%s] MP3 channels: %i", fileName, music->ctxMp3.channels);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
else if (IsFileExtension(fileName, ".xm"))
|
||||
{
|
||||
|
@ -1389,7 +1502,7 @@ Music LoadMusicStream(const char *fileName)
|
|||
TraceLog(LOG_DEBUG, "[%s] XM number of samples: %i", fileName, music->totalSamples);
|
||||
TraceLog(LOG_DEBUG, "[%s] XM track length: %11.6f sec", fileName, (float)music->totalSamples/48000.0f);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] XM file could not be opened", fileName);
|
||||
else musicLoaded = false;
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
|
@ -1408,10 +1521,32 @@ Music LoadMusicStream(const char *fileName)
|
|||
TraceLog(LOG_DEBUG, "[%s] MOD number of samples: %i", fileName, music->samplesLeft);
|
||||
TraceLog(LOG_DEBUG, "[%s] MOD track length: %11.6f sec", fileName, (float)music->totalSamples/48000.0f);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] MOD file could not be opened", fileName);
|
||||
else musicLoaded = false;
|
||||
}
|
||||
#endif
|
||||
else TraceLog(LOG_WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
|
||||
else musicLoaded = false;
|
||||
|
||||
if (!musicLoaded)
|
||||
{
|
||||
if (music->ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close(music->ctxOgg);
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (music->ctxType == MUSIC_AUDIO_FLAC) drflac_free(music->ctxFlac);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (music->ctxType == MUSIC_AUDIO_MP3) drmp3_uninit(&music->ctxMp3);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
else if (music->ctxType == MUSIC_MODULE_XM) jar_xm_free_context(music->ctxXm);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
else if (music->ctxType == MUSIC_MODULE_MOD) jar_mod_unload(&music->ctxMod);
|
||||
#endif
|
||||
|
||||
free(music);
|
||||
music = NULL;
|
||||
|
||||
TraceLog(LOG_WARNING, "[%s] Music file could not be opened", fileName);
|
||||
}
|
||||
|
||||
return music;
|
||||
}
|
||||
|
@ -1425,6 +1560,9 @@ void UnloadMusicStream(Music music)
|
|||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (music->ctxType == MUSIC_AUDIO_FLAC) drflac_free(music->ctxFlac);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (music->ctxType == MUSIC_AUDIO_MP3) drmp3_uninit(&music->ctxMp3);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
else if (music->ctxType == MUSIC_MODULE_XM) jar_xm_free_context(music->ctxXm);
|
||||
#endif
|
||||
|
@ -1516,7 +1654,10 @@ void StopMusicStream(Music music)
|
|||
{
|
||||
case MUSIC_AUDIO_OGG: stb_vorbis_seek_start(music->ctxOgg); break;
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
case MUSIC_MODULE_FLAC: /* TODO: Restart FLAC context */ break;
|
||||
case MUSIC_AUDIO_FLAC: /* TODO: Restart FLAC context */ break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
case MUSIC_AUDIO_MP3: /* TODO: Restart MP3 context */ break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
case MUSIC_MODULE_XM: /* TODO: Restart XM context */ break;
|
||||
|
@ -1566,6 +1707,14 @@ void UpdateMusicStream(Music music)
|
|||
|
||||
} break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
case MUSIC_AUDIO_MP3:
|
||||
{
|
||||
// NOTE: Returns the number of samples to process
|
||||
unsigned int numSamplesMp3 = (unsigned int)drmp3_read_f32(&music->ctxMp3, samplesCount*music->stream.channels, (float *)pcm);
|
||||
|
||||
} break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
case MUSIC_MODULE_XM: jar_xm_generate_samples_16bit(music->ctxXm, pcm, samplesCount); break;
|
||||
#endif
|
||||
|
@ -1650,6 +1799,13 @@ void UpdateMusicStream(Music music)
|
|||
|
||||
} break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
case MUSIC_AUDIO_MP3:
|
||||
{
|
||||
// NOTE: Returns the number of samples to process
|
||||
unsigned int numSamplesMp3 = (unsigned int)drmp3_read_f32(&music->ctxMp3, samplesCount*music->stream.channels, (float *)pcm);
|
||||
} break;
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
case MUSIC_MODULE_XM: jar_xm_generate_samples_16bit(music->ctxXm, pcm, samplesCount); break;
|
||||
#endif
|
||||
|
@ -2239,6 +2395,33 @@ static Wave LoadFLAC(const char *fileName)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
// Load MP3 file into Wave structure
|
||||
// NOTE: Using dr_mp3 library
|
||||
static Wave LoadMP3(const char *fileName)
|
||||
{
|
||||
Wave wave;
|
||||
|
||||
// Decode an entire MP3 file in one go
|
||||
uint64_t totalSampleCount;
|
||||
drmp3_config *config;
|
||||
wave.data = drmp3_open_and_decode_file_f32(fileName, config, &totalSampleCount);
|
||||
|
||||
wave.channels = config->outputChannels;
|
||||
wave.sampleRate = config->outputSampleRate;
|
||||
wave.sampleCount = (int)totalSampleCount/wave.channels;
|
||||
wave.sampleSize = 16;
|
||||
|
||||
// NOTE: Only support up to 2 channels (mono, stereo)
|
||||
if (wave.channels > 2) TraceLog(LOG_WARNING, "[%s] MP3 channels number (%i) not supported", fileName, wave.channels);
|
||||
|
||||
if (wave.data == NULL) TraceLog(LOG_WARNING, "[%s] MP3 data could not be loaded", fileName);
|
||||
else TraceLog(LOG_INFO, "[%s] MP3 file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1) ? "Mono" : "Stereo");
|
||||
|
||||
return wave;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Some required functions for audio standalone module version
|
||||
#if defined(AUDIO_STANDALONE)
|
||||
// Check file extension
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !noaudio
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "external/stb_vorbis.c"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !android
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -244,8 +244,8 @@ void SetCameraMode(Camera camera, int mode)
|
|||
distance.y = sqrtf(dx*dx + dy*dy);
|
||||
|
||||
// Camera angle calculation
|
||||
cameraAngle.x = asinf(fabsf(dx)/distance.x); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
||||
cameraAngle.y = -asinf(fabsf(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
|
||||
cameraAngle.x = asinf( (float)fabs(dx)/distance.x); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
||||
cameraAngle.y = -asinf( (float)fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
|
||||
|
||||
// NOTE: Just testing what cameraAngle means
|
||||
//cameraAngle.x = 0.0f*DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -std=gnu99 -Wno-missing-braces -Wno-unused-result
|
||||
#cgo CFLAGS: -std=gnu99 -Wno-missing-braces -Wno-unused-result -Wno-stringop-overflow
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build android
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "external/android/native_app_glue/android_native_app_glue.c"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build darwin
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "external/glfw/src/context.c"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build linux,!arm,!arm64
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "external/glfw/src/context.c"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build linux,arm,!android
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#cgo linux,arm LDFLAGS: -L/opt/vc/lib -L/opt/vc/lib64 -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lvcos -lvchiq_arm -ldl
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build windows
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "external/glfw/src/context.c"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#define RAYLIB_VERSION "2.0-dev"
|
||||
#define RAYLIB_VERSION "2.1-dev"
|
||||
|
||||
// Edit to control what features Makefile'd raylib is compiled with
|
||||
#if defined(RAYLIB_CMAKE)
|
||||
|
@ -86,10 +86,12 @@
|
|||
//#define SUPPORT_FILEFORMAT_PKM 1
|
||||
//#define SUPPORT_FILEFORMAT_PVR 1
|
||||
|
||||
// Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
|
||||
// Support image export functionality (.png, .bmp, .tga, .jpg)
|
||||
#define SUPPORT_IMAGE_EXPORT 1
|
||||
// Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
|
||||
// If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()
|
||||
#define SUPPORT_IMAGE_MANIPULATION 1
|
||||
// Support proedural image generation functionality (gradient, spot, perlin-noise, cellular)
|
||||
// Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)
|
||||
#define SUPPORT_IMAGE_GENERATION 1
|
||||
|
||||
|
||||
|
@ -124,7 +126,7 @@
|
|||
#define SUPPORT_FILEFORMAT_XM 1
|
||||
#define SUPPORT_FILEFORMAT_MOD 1
|
||||
//#define SUPPORT_FILEFORMAT_FLAC 1
|
||||
//#define SUPPORT_FILEFORMAT_MP3 1
|
||||
#define SUPPORT_FILEFORMAT_MP3 1
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
@ -133,10 +135,6 @@
|
|||
// Show TraceLog() output messages
|
||||
// NOTE: By default LOG_DEBUG traces not shown
|
||||
#define SUPPORT_TRACELOG 1
|
||||
// Support saving image data fileformats
|
||||
// NOTE: Requires stb_image_write library
|
||||
#define SUPPORT_SAVE_PNG 1
|
||||
//#define SUPPORT_SAVE_BMP 1
|
||||
|
||||
|
||||
#endif //defined(RAYLIB_CMAKE)
|
||||
|
|
542
raylib/core.c
542
raylib/core.c
|
@ -5,7 +5,7 @@
|
|||
* PLATFORMS SUPPORTED:
|
||||
* - PLATFORM_DESKTOP: Windows (Win32, Win64)
|
||||
* - PLATFORM_DESKTOP: Linux (X11 desktop mode)
|
||||
* - PLATFORM_DESKTOP: FreeBSD (X11 desktop)
|
||||
* - PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop)
|
||||
* - PLATFORM_DESKTOP: OSX/macOS
|
||||
* - PLATFORM_ANDROID: Android 4.0 (ARM, ARM64)
|
||||
* - PLATFORM_RPI: Raspberry Pi 0,1,2,3 (Raspbian)
|
||||
|
@ -15,7 +15,7 @@
|
|||
* CONFIGURATION:
|
||||
*
|
||||
* #define PLATFORM_DESKTOP
|
||||
* Windowing and input system configured for desktop platforms: Windows, Linux, OSX, FreeBSD
|
||||
* Windowing and input system configured for desktop platforms: Windows, Linux, OSX, FreeBSD, OpenBSD, NetBSD, DragonFly
|
||||
* NOTE: Oculus Rift CV1 requires PLATFORM_DESKTOP for mirror rendering - View [rlgl] module to enable it
|
||||
*
|
||||
* #define PLATFORM_ANDROID
|
||||
|
@ -57,7 +57,7 @@
|
|||
* Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* rglfw - Manage graphic device, OpenGL context and inputs on PLATFORM_DESKTOP (Windows, Linux, OSX. FreeBSD)
|
||||
* rglfw - Manage graphic device, OpenGL context and inputs on PLATFORM_DESKTOP (Windows, Linux, OSX. FreeBSD, OpenBSD, NetBSD, DragonFly)
|
||||
* raymath - 3D math functionality (Vector2, Vector3, Matrix, Quaternion)
|
||||
* camera - Multiple 3D camera modes (free, orbital, 1st person, 3rd person)
|
||||
* gestures - Gestures system for touch-ready devices (or simulated from mouse inputs)
|
||||
|
@ -95,7 +95,9 @@
|
|||
#define RAYMATH_IMPLEMENTATION // Define external out-of-line implementation of raymath here
|
||||
#include "raymath.h" // Required for: Vector3 and Matrix functions
|
||||
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
||||
|
||||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
|
@ -121,6 +123,7 @@
|
|||
#include <string.h> // Required for: strrchr(), strcmp()
|
||||
//#include <errno.h> // Macros for reporting and retrieving error conditions through error codes
|
||||
#include <ctype.h> // Required for: tolower() [Used in IsFileExtension()]
|
||||
#include <dirent.h> // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()]
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <direct.h> // Required for: _getch(), _chdir()
|
||||
|
@ -132,16 +135,24 @@
|
|||
#define CHDIR chdir
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(PLATFORM_WEB)
|
||||
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
||||
#elif defined(__APPLE__)
|
||||
#include <unistd.h> // Required for: usleep()
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
#if defined(PLATFORM_WEB)
|
||||
#define GLFW_INCLUDE_ES2
|
||||
#endif
|
||||
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
|
||||
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
|
||||
// NOTE: GLFW3 already includes gl.h (OpenGL) headers
|
||||
|
||||
// Support retrieving native window handlers
|
||||
#if defined(_WIN32)
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#include <GLFW/glfw3native.h> // WARNING: It requires customization to avoid windows.h inclusion!
|
||||
#elif defined(__linux__)
|
||||
//#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
|
||||
//GLFW_EXPOSE_NATIVE_WAYLAND
|
||||
//GLFW_EXPOSE_NATIVE_MIR
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
|
||||
// NOTE: Those functions require linking with winmm library
|
||||
|
@ -150,6 +161,16 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(PLATFORM_WEB)
|
||||
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
||||
#elif defined(__APPLE__)
|
||||
#include <unistd.h> // Required for: usleep()
|
||||
#include <objc/message.h> // Required for: objc_msgsend(), sel_registerName()
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#define GLFW_EXPOSE_NATIVE_NSGL
|
||||
#include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
//#include <android/sensor.h> // Android sensors functions (accelerometer, gyroscope, light...)
|
||||
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
|
||||
|
@ -220,14 +241,46 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Window/Graphics related variables
|
||||
//-----------------------------------------------------------------------------------
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
static GLFWwindow *window; // Native window (graphic device)
|
||||
#endif
|
||||
|
||||
static bool windowReady = false; // Check if window has been initialized successfully
|
||||
static bool windowMinimized = false; // Check if window has been minimized
|
||||
static const char *windowTitle = NULL; // Window text title...
|
||||
|
||||
#if defined(__APPLE__)
|
||||
static int windowNeedsUpdating = 2; // Times the Cocoa window needs to be updated initially
|
||||
#endif
|
||||
|
||||
static unsigned int displayWidth, displayHeight;// Display width and height (monitor, device-screen, LCD, ...)
|
||||
static int screenWidth, screenHeight; // Screen width and height (used render area)
|
||||
static int renderWidth, renderHeight; // Framebuffer width and height (render area, including black bars if required)
|
||||
static int renderOffsetX = 0; // Offset X from render area (must be divided by 2)
|
||||
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
|
||||
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
|
||||
static Matrix downscaleView; // Matrix to downscale view (in case screen size bigger than display size)
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
static EGL_DISPMANX_WINDOW_T nativeWindow; // Native window (graphic device)
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP)
|
||||
static EGLDisplay display; // Native display device (physical screen connection)
|
||||
static EGLSurface surface; // Surface to draw on, framebuffers (connected to context)
|
||||
static EGLContext context; // Graphic context, mode in which drawing can be done
|
||||
static EGLConfig config; // Graphic config
|
||||
static uint64_t baseTime; // Base time measure for hi-res timer
|
||||
static bool windowShouldClose = false; // Flag to set window for closing
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
extern EGLNativeWindowType uwpWindow; // Native EGL window handler for UWP (external, defined in UWP App)
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
static struct android_app *androidApp; // Android activity
|
||||
static struct android_poll_source *source; // Android events polling source
|
||||
|
@ -238,104 +291,86 @@ static bool appEnabled = true; // Used to detec if app is activ
|
|||
static bool contextRebindRequired = false; // Used to know context rebind required
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
static EGL_DISPMANX_WINDOW_T nativeWindow; // Native window (graphic device)
|
||||
// Inputs related variables
|
||||
//-----------------------------------------------------------------------------------
|
||||
// Keyboard states
|
||||
static char previousKeyState[512] = { 0 }; // Registers previous frame key state
|
||||
static char currentKeyState[512] = { 0 }; // Registers current frame key state
|
||||
static int lastKeyPressed = -1; // Register last key pressed
|
||||
static int exitKey = KEY_ESCAPE; // Default exit key (ESC)
|
||||
|
||||
// Keyboard input variables
|
||||
#if defined(PLATFORM_RPI)
|
||||
// NOTE: For keyboard we will use the standard input (but reconfigured...)
|
||||
static struct termios defaultKeyboardSettings; // Used to store default keyboard settings
|
||||
static int defaultKeyboardMode; // Used to store default keyboard mode
|
||||
#endif
|
||||
|
||||
// Mouse input variables
|
||||
// Mouse states
|
||||
static Vector2 mousePosition; // Mouse position on screen
|
||||
static float mouseScale = 1.0f; // Mouse default scale
|
||||
static bool cursorHidden = false; // Track if cursor is hidden
|
||||
static bool cursorOnScreen = false; // Tracks if cursor is inside client area
|
||||
static Vector2 touchPosition[MAX_TOUCH_POINTS]; // Touch position on screen
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
|
||||
static char previousMouseState[3] = { 0 }; // Registers previous mouse button state
|
||||
static char currentMouseState[3] = { 0 }; // Registers current mouse button state
|
||||
static int previousMouseWheelY = 0; // Registers previous mouse wheel variation
|
||||
static int currentMouseWheelY = 0; // Registers current mouse wheel variation
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
static int mouseStream = -1; // Mouse device file descriptor
|
||||
static bool mouseReady = false; // Flag to know if mouse is ready
|
||||
static pthread_t mouseThreadId; // Mouse reading thread id
|
||||
|
||||
// Touch input variables
|
||||
static int touchStream = -1; // Touch device file descriptor
|
||||
static bool touchReady = false; // Flag to know if touch interface is ready
|
||||
static pthread_t touchThreadId; // Touch reading thread id
|
||||
|
||||
// Gamepad input variables
|
||||
static int gamepadStream[MAX_GAMEPADS] = { -1 };// Gamepad device file descriptor
|
||||
static pthread_t gamepadThreadId; // Gamepad reading thread id
|
||||
static char gamepadName[64]; // Gamepad name holder
|
||||
#endif
|
||||
#if defined(PLATFORM_WEB)
|
||||
static bool toggleCursorLock = false; // Ask for cursor pointer lock on next click
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP)
|
||||
static EGLDisplay display; // Native display device (physical screen connection)
|
||||
static EGLSurface surface; // Surface to draw on, framebuffers (connected to context)
|
||||
static EGLContext context; // Graphic context, mode in which drawing can be done
|
||||
static EGLConfig config; // Graphic config
|
||||
static uint64_t baseTime; // Base time measure for hi-res timer
|
||||
static bool windowShouldClose = false; // Flag to set window for closing
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
extern EGLNativeWindowType uwpWindow; // Native EGL window handler for UWP (external, defined in UWP App)
|
||||
#endif
|
||||
|
||||
// Screen related variables
|
||||
static unsigned int displayWidth, displayHeight; // Display width and height (monitor, device-screen, LCD, ...)
|
||||
static int screenWidth, screenHeight; // Screen width and height (used render area)
|
||||
static int renderWidth, renderHeight; // Framebuffer width and height (render area, including black bars if required)
|
||||
static int renderOffsetX = 0; // Offset X from render area (must be divided by 2)
|
||||
static int renderOffsetY = 0; // Offset Y from render area (must be divided by 2)
|
||||
static bool fullscreen = false; // Fullscreen mode (useful only for PLATFORM_DESKTOP)
|
||||
static Matrix downscaleView; // Matrix to downscale view (in case screen size bigger than display size)
|
||||
|
||||
static bool cursorHidden = false; // Track if cursor is hidden
|
||||
static bool cursorOnScreen = false; // Tracks if cursor is inside client area
|
||||
// Gamepads states
|
||||
static int lastGamepadButtonPressed = -1; // Register last gamepad button pressed
|
||||
static int gamepadAxisCount = 0; // Register number of available gamepad axis
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
|
||||
// Register mouse states
|
||||
static char previousMouseState[3] = { 0 }; // Registers previous mouse button state
|
||||
static char currentMouseState[3] = { 0 }; // Registers current mouse button state
|
||||
static int previousMouseWheelY = 0; // Registers previous mouse wheel variation
|
||||
static int currentMouseWheelY = 0; // Registers current mouse wheel variation
|
||||
|
||||
// Register gamepads states
|
||||
static bool gamepadReady[MAX_GAMEPADS] = { false }; // Flag to know if gamepad is ready
|
||||
static float gamepadAxisState[MAX_GAMEPADS][MAX_GAMEPAD_AXIS]; // Gamepad axis state
|
||||
static char previousGamepadState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Previous gamepad buttons state
|
||||
static char currentGamepadState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Current gamepad buttons state
|
||||
|
||||
// Keyboard configuration
|
||||
static int exitKey = KEY_ESCAPE; // Default exit key (ESC)
|
||||
#endif
|
||||
|
||||
// Register keyboard states
|
||||
static char previousKeyState[512] = { 0 }; // Registers previous frame key state
|
||||
static char currentKeyState[512] = { 0 }; // Registers current frame key state
|
||||
|
||||
static int lastKeyPressed = -1; // Register last key pressed
|
||||
static int lastGamepadButtonPressed = -1; // Register last gamepad button pressed
|
||||
static int gamepadAxisCount = 0; // Register number of available gamepad axis
|
||||
|
||||
static Vector2 mousePosition; // Mouse position on screen
|
||||
static float mouseScale = 1.0f; // Mouse default scale
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
static bool toggleCursorLock = false; // Ask for cursor pointer lock on next click
|
||||
#endif
|
||||
|
||||
static Vector2 touchPosition[MAX_TOUCH_POINTS]; // Touch position on screen
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
static char **dropFilesPath; // Store dropped files paths as strings
|
||||
static int dropFilesCount = 0; // Count stored strings
|
||||
#if defined(PLATFORM_RPI)
|
||||
static int gamepadStream[MAX_GAMEPADS] = { -1 };// Gamepad device file descriptor
|
||||
static pthread_t gamepadThreadId; // Gamepad reading thread id
|
||||
static char gamepadName[64]; // Gamepad name holder
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
// Timming system variables
|
||||
//-----------------------------------------------------------------------------------
|
||||
static double currentTime = 0.0; // Current time measure
|
||||
static double previousTime = 0.0; // Previous time measure
|
||||
static double updateTime = 0.0; // Time measure for frame update
|
||||
static double drawTime = 0.0; // Time measure for frame draw
|
||||
static double frameTime = 0.0; // Time measure for one frame
|
||||
static double targetTime = 0.0; // Desired time for one frame, if 0 not applied
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
// Config internal variables
|
||||
//-----------------------------------------------------------------------------------
|
||||
static unsigned char configFlags = 0; // Configuration flags (bit based)
|
||||
static bool showLogo = false; // Track if showing logo at init is enabled
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
static char **dropFilesPath; // Store dropped files paths as strings
|
||||
static int dropFilesCount = 0; // Count dropped files strings
|
||||
#endif
|
||||
static char **dirFilesPath; // Store directory files paths as strings
|
||||
static int dirFilesCount = 0; // Count directory files strings
|
||||
|
||||
#if defined(SUPPORT_SCREEN_CAPTURE)
|
||||
static int screenshotCounter = 0; // Screenshots counter
|
||||
#endif
|
||||
|
@ -344,6 +379,7 @@ static int screenshotCounter = 0; // Screenshots counter
|
|||
static int gifFramesCounter = 0; // GIF frames counter
|
||||
static bool gifRecording = false; // GIF recording state
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Other Modules Functions Declaration (required by core)
|
||||
|
@ -357,15 +393,18 @@ extern void UnloadDefaultFont(void); // [Module: text] Unloads default fo
|
|||
// Module specific Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
static bool InitGraphicsDevice(int width, int height); // Initialize graphics device
|
||||
static void SetupFramebufferSize(int displayWidth, int displayHeight);
|
||||
static void SetupFramebuffer(int width, int height); // Setup main framebuffer
|
||||
static void SetupViewport(void); // Set viewport parameters
|
||||
static void SwapBuffers(void); // Copy back buffer to front buffers
|
||||
|
||||
static void InitTimer(void); // Initialize timer
|
||||
static void Wait(float ms); // Wait for some milliseconds (stop program execution)
|
||||
|
||||
static bool GetKeyStatus(int key); // Returns if a key has been pressed
|
||||
static bool GetMouseButtonStatus(int button); // Returns if a mouse button has been pressed
|
||||
static void PollInputEvents(void); // Register user events
|
||||
static void SwapBuffers(void); // Copy back buffer to front buffers
|
||||
|
||||
static void LogoAnimation(void); // Plays raylib logo appearing animation
|
||||
static void SetupViewport(void); // Set viewport parameters
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
|
||||
|
@ -378,7 +417,6 @@ static void CursorEnterCallback(GLFWwindow *window, int enter);
|
|||
static void WindowSizeCallback(GLFWwindow *window, int width, int height); // GLFW3 WindowSize Callback, runs when window is resized
|
||||
static void WindowIconifyCallback(GLFWwindow *window, int iconified); // GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
static void WindowDropCallback(GLFWwindow *window, int count, const char **paths); // GLFW3 Window Drop Callback, runs when drop files into window
|
||||
#endif
|
||||
|
@ -634,7 +672,17 @@ bool IsWindowReady(void)
|
|||
// Check if KEY_ESCAPE pressed or Close icon pressed
|
||||
bool WindowShouldClose(void)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
#if defined(PLATFORM_WEB)
|
||||
// Emterpreter-Async required to run sync code
|
||||
// https://github.com/kripken/emscripten/wiki/Emterpreter#emterpreter-async-run-synchronous-code
|
||||
// By default, this function is never called on a web-ready raylib example because we encapsulate
|
||||
// frame code in a UpdateDrawFrame() function, to allow browser manage execution asynchronously
|
||||
// but now emscripten allows sync code to be executed in an interpreted way, using emterpreter!
|
||||
emscripten_sleep(16);
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
if (windowReady)
|
||||
{
|
||||
// While window minimized, stop loop execution
|
||||
|
@ -757,6 +805,124 @@ int GetScreenHeight(void)
|
|||
return screenHeight;
|
||||
}
|
||||
|
||||
// Get native window handle
|
||||
void *GetWindowHandle(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
// NOTE: Returned handle is: void *HWND (windows.h)
|
||||
return glfwGetWin32Window(window);
|
||||
#elif defined(__linux__)
|
||||
// NOTE: Returned handle is: unsigned long Window (X.h)
|
||||
// typedef unsigned long XID;
|
||||
// typedef XID Window;
|
||||
//unsigned long id = (unsigned long)glfwGetX11Window(window);
|
||||
return NULL; // TODO: Find a way to return value... cast to void *?
|
||||
#elif defined(__APPLE__)
|
||||
// NOTE: Returned handle is: void *id
|
||||
return glfwGetCocoaWindow(window);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get number of monitors
|
||||
int GetMonitorCount(void)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
glfwGetMonitors(&monitorCount);
|
||||
return monitorCount;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get primary monitor width
|
||||
int GetMonitorWidth(int monitor)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
|
||||
return mode->width;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get primary monitor width
|
||||
int GetMonitorHeight(int monitor)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
|
||||
return mode->height;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get primary montior physical width in millimetres
|
||||
int GetMonitorPhysicalWidth(int monitor)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
int physicalWidth;
|
||||
glfwGetMonitorPhysicalSize(monitors[monitor], &physicalWidth, NULL);
|
||||
return physicalWidth;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get primary monitor physical height in millimetres
|
||||
int GetMonitorPhysicalHeight(int monitor)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
int physicalHeight;
|
||||
glfwGetMonitorPhysicalSize(monitors[monitor], NULL, &physicalHeight);
|
||||
return physicalHeight;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
const char *GetMonitorName(int monitor)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int monitorCount;
|
||||
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
return glfwGetMonitorName(monitors[monitor]);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
// Show mouse cursor
|
||||
void ShowCursor()
|
||||
{
|
||||
|
@ -873,7 +1039,7 @@ void EndDrawing(void)
|
|||
// Wait for some milliseconds...
|
||||
if (frameTime < targetTime)
|
||||
{
|
||||
Wait((targetTime - frameTime)*1000.0f);
|
||||
Wait((float)(targetTime - frameTime)*1000.0f);
|
||||
|
||||
currentTime = GetTime();
|
||||
double extraTime = currentTime - previousTime;
|
||||
|
@ -1028,7 +1194,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
|||
// Calculate view matrix from camera look at
|
||||
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
|
||||
|
||||
Matrix matProj;
|
||||
Matrix matProj = MatrixIdentity();
|
||||
|
||||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
|
@ -1040,6 +1206,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
|||
float aspect = (float)screenWidth/(float)screenHeight;
|
||||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
|
||||
// Calculate projection matrix from orthographic
|
||||
matProj = MatrixOrtho(-right, right, -top, top, 0.01, 1000.0);
|
||||
}
|
||||
|
@ -1069,18 +1236,19 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
|||
Vector2 GetWorldToScreen(Vector3 position, Camera camera)
|
||||
{
|
||||
// Calculate projection matrix (from perspective instead of frustum
|
||||
Matrix matProj;
|
||||
Matrix matProj = MatrixIdentity();
|
||||
|
||||
if(camera.type == CAMERA_PERSPECTIVE)
|
||||
if (camera.type == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Calculate projection matrix from perspective
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
|
||||
}
|
||||
else if(camera.type == CAMERA_ORTHOGRAPHIC)
|
||||
else if (camera.type == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
float aspect = (float)screenWidth/(float)screenHeight;
|
||||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
|
||||
// Calculate projection matrix from orthographic
|
||||
matProj = MatrixOrtho(-right, right, -top, top, 0.01, 1000.0);
|
||||
}
|
||||
|
@ -1282,7 +1450,9 @@ void TakeScreenshot(const char *fileName)
|
|||
{
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||
unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight);
|
||||
SavePNG(fileName, imgData, renderWidth, renderHeight, 4); // Save image as PNG
|
||||
|
||||
Image image = { imgData, renderWidth, renderHeight, 1, UNCOMPRESSED_R8G8B8A8 };
|
||||
ExportImage(image, fileName);
|
||||
free(imgData);
|
||||
|
||||
TraceLog(LOG_INFO, "Screenshot taken: %s", fileName);
|
||||
|
@ -1312,6 +1482,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
|||
}
|
||||
}
|
||||
}
|
||||
else result = false;
|
||||
#else
|
||||
if (strcmp(fileExt, ext) == 0) result = true;
|
||||
#endif
|
||||
|
@ -1330,11 +1501,19 @@ const char *GetExtension(const char *fileName)
|
|||
return (dot + 1);
|
||||
}
|
||||
|
||||
// String pointer reverse break: returns right-most occurrence of charset in s
|
||||
static const char *strprbrk(const char *s, const char *charset)
|
||||
{
|
||||
const char *latestMatch = NULL;
|
||||
for (; s = strpbrk(s, charset), s != NULL; latestMatch = s++) { }
|
||||
return latestMatch;
|
||||
}
|
||||
|
||||
// Get pointer to filename for a path string
|
||||
const char *GetFileName(const char *filePath)
|
||||
{
|
||||
const char *fileName = strrchr(filePath, '\\');
|
||||
|
||||
const char *fileName = strprbrk(filePath, "\\/");
|
||||
|
||||
if (!fileName || fileName == filePath) return filePath;
|
||||
|
||||
return fileName + 1;
|
||||
|
@ -1344,14 +1523,16 @@ const char *GetFileName(const char *filePath)
|
|||
// Get directory for a given fileName (with path)
|
||||
const char *GetDirectoryPath(const char *fileName)
|
||||
{
|
||||
char *lastSlash = NULL;
|
||||
const char *lastSlash = NULL;
|
||||
static char filePath[256]; // MAX_DIRECTORY_PATH_SIZE = 256
|
||||
memset(filePath, 0, 256);
|
||||
|
||||
lastSlash = strrchr(fileName, '\\');
|
||||
|
||||
lastSlash = strprbrk(fileName, "\\/");
|
||||
if (!lastSlash) return NULL;
|
||||
|
||||
strncpy(filePath, fileName, strlen(fileName) - (strlen(lastSlash) - 1));
|
||||
filePath[strlen(fileName) - strlen(lastSlash)] = '\0';
|
||||
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
@ -1366,6 +1547,57 @@ const char *GetWorkingDirectory(void)
|
|||
return currentDir;
|
||||
}
|
||||
|
||||
// Get filenames in a directory path (max 256 files)
|
||||
// NOTE: Files count is returned by parameters pointer
|
||||
char **GetDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
{
|
||||
#define MAX_FILEPATH_LENGTH 256
|
||||
#define MAX_DIRECTORY_FILES 512
|
||||
|
||||
ClearDirectoryFiles();
|
||||
|
||||
// Memory allocation for MAX_DIRECTORY_FILES
|
||||
dirFilesPath = (char **)malloc(sizeof(char *)*MAX_DIRECTORY_FILES);
|
||||
for (int i = 0; i < MAX_DIRECTORY_FILES; i++) dirFilesPath[i] = (char *)malloc(sizeof(char)*MAX_FILEPATH_LENGTH);
|
||||
|
||||
int counter = 0;
|
||||
struct dirent *ent;
|
||||
DIR *dir = opendir(dirPath);
|
||||
|
||||
if (dir != NULL) // It's a directory
|
||||
{
|
||||
// TODO: Reading could be done in two passes,
|
||||
// first one to count files and second one to read names
|
||||
// That way we can allocate required memory, instead of a limited pool
|
||||
|
||||
while ((ent = readdir(dir)) != NULL)
|
||||
{
|
||||
strcpy(dirFilesPath[counter], ent->d_name);
|
||||
counter++;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Can not open directory...\n"); // Maybe it's a file...
|
||||
|
||||
dirFilesCount = counter;
|
||||
*fileCount = dirFilesCount;
|
||||
|
||||
return dirFilesPath;
|
||||
}
|
||||
|
||||
// Clear directory files paths buffers
|
||||
void ClearDirectoryFiles(void)
|
||||
{
|
||||
if (dirFilesCount > 0)
|
||||
{
|
||||
for (int i = 0; i < dirFilesCount; i++) free(dirFilesPath[i]);
|
||||
|
||||
free(dirFilesPath);
|
||||
dirFilesCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Change working directory, returns true if success
|
||||
bool ChangeDirectory(const char *dir)
|
||||
{
|
||||
|
@ -1853,6 +2085,10 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
glfwSetErrorCallback(ErrorCallback);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE);
|
||||
#endif
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize GLFW");
|
||||
|
@ -1883,30 +2119,29 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
displayHeight = screenHeight;
|
||||
#endif // defined(PLATFORM_WEB)
|
||||
|
||||
glfwDefaultWindowHints(); // Set default windows hints
|
||||
glfwDefaultWindowHints(); // Set default windows hints:
|
||||
//glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits
|
||||
//glfwWindowHint(GLFW_GREEN_BITS, 8); // Framebuffer green color component bits
|
||||
//glfwWindowHint(GLFW_BLUE_BITS, 8); // Framebuffer blue color component bits
|
||||
//glfwWindowHint(GLFW_ALPHA_BITS, 8); // Framebuffer alpha color component bits
|
||||
//glfwWindowHint(GLFW_DEPTH_BITS, 24); // Depthbuffer bits
|
||||
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
|
||||
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
|
||||
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||
|
||||
// Check some Window creation flags
|
||||
if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); // Resizable window
|
||||
if (configFlags & FLAG_WINDOW_RESIZABLE) glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); // Resizable window
|
||||
else glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Avoid window being resizable
|
||||
|
||||
if (configFlags & FLAG_WINDOW_DECORATED) glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Border and buttons on Window
|
||||
|
||||
if (configFlags & FLAG_WINDOW_TRANSPARENT)
|
||||
{
|
||||
// TODO: Enable transparent window (not ready yet on GLFW 3.2)
|
||||
}
|
||||
if (configFlags & FLAG_WINDOW_UNDECORATED) glfwWindowHint(GLFW_DECORATED, GL_FALSE); // Border and buttons on Window
|
||||
else glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Decorated window
|
||||
// FLAG_WINDOW_TRANSPARENT not supported on HTML5 and not included in any released GLFW version yet
|
||||
#if defined(GLFW_TRANSPARENT_FRAMEBUFFER)
|
||||
if (configFlags & FLAG_WINDOW_TRANSPARENT) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
|
||||
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
|
||||
#endif
|
||||
|
||||
if (configFlags & FLAG_MSAA_4X_HINT)
|
||||
{
|
||||
glfwWindowHint(GLFW_SAMPLES, 4); // Enables multisampling x4 (MSAA), default is 0
|
||||
TraceLog(LOG_INFO, "Trying to enable MSAA x4");
|
||||
}
|
||||
|
||||
//glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits
|
||||
//glfwWindowHint(GLFW_DEPTH_BITS, 16); // Depthbuffer bits (24 by default)
|
||||
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
|
||||
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // Default OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
|
||||
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||
if (configFlags & FLAG_MSAA_4X_HINT) glfwWindowHint(GLFW_SAMPLES, 4); // Tries to enable multisampling x4 (MSAA), default is 0
|
||||
|
||||
// NOTE: When asking for an OpenGL context version, most drivers provide highest supported version
|
||||
// with forward compatibility to older OpenGL versions.
|
||||
|
@ -1925,11 +2160,11 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Profiles Hint: Only 3.3 and above!
|
||||
// Other values: GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE
|
||||
#if defined(__APPLE__)
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // OSX Requires
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // OSX Requires fordward compatibility
|
||||
#else
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE); // Fordward Compatibility Hint: Only 3.3 and above!
|
||||
#endif
|
||||
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
||||
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); // Request OpenGL DEBUG context
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
|
@ -1962,7 +2197,7 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
// At this point we need to manage render size vs screen size
|
||||
// NOTE: This function uses and modifies global module variables:
|
||||
// screenWidth/screenHeight - renderWidth/renderHeight - downscaleView
|
||||
SetupFramebufferSize(displayWidth, displayHeight);
|
||||
SetupFramebuffer(displayWidth, displayHeight);
|
||||
|
||||
window = glfwCreateWindow(displayWidth, displayHeight, windowTitle, glfwGetPrimaryMonitor(), NULL);
|
||||
|
||||
|
@ -2196,7 +2431,7 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
//SetupFramebufferSize(displayWidth, displayHeight);
|
||||
//SetupFramebuffer(displayWidth, displayHeight);
|
||||
|
||||
EGLint numConfigs = 0;
|
||||
if ((eglChooseConfig(display, framebufferAttribs, &config, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0))
|
||||
|
@ -2302,7 +2537,7 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
|
||||
// At this point we need to manage render size vs screen size
|
||||
// NOTE: This function use and modify global module variables: screenWidth/screenHeight and renderWidth/renderHeight and downscaleView
|
||||
SetupFramebufferSize(displayWidth, displayHeight);
|
||||
SetupFramebuffer(displayWidth, displayHeight);
|
||||
|
||||
ANativeWindow_setBuffersGeometry(androidApp->window, renderWidth, renderHeight, displayFormat);
|
||||
//ANativeWindow_setBuffersGeometry(androidApp->window, 0, 0, displayFormat); // Force use of native display size
|
||||
|
@ -2315,7 +2550,7 @@ static bool InitGraphicsDevice(int width, int height)
|
|||
|
||||
// At this point we need to manage render size vs screen size
|
||||
// NOTE: This function use and modify global module variables: screenWidth/screenHeight and renderWidth/renderHeight and downscaleView
|
||||
SetupFramebufferSize(displayWidth, displayHeight);
|
||||
SetupFramebuffer(displayWidth, displayHeight);
|
||||
|
||||
dstRect.x = 0;
|
||||
dstRect.y = 0;
|
||||
|
@ -2417,7 +2652,7 @@ static void SetupViewport(void)
|
|||
|
||||
// Compute framebuffer size relative to screen size and display size
|
||||
// NOTE: Global variables renderWidth/renderHeight and renderOffsetX/renderOffsetY can be modified
|
||||
static void SetupFramebufferSize(int displayWidth, int displayHeight)
|
||||
static void SetupFramebuffer(int width, int height)
|
||||
{
|
||||
// Calculate renderWidth and renderHeight, we have the display size (input params) and the desired screen size (global var)
|
||||
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
|
||||
|
@ -2491,7 +2726,7 @@ static void SetupFramebufferSize(int displayWidth, int displayHeight)
|
|||
// Initialize hi-resolution timer
|
||||
static void InitTimer(void)
|
||||
{
|
||||
srand(time(NULL)); // Initialize random seed
|
||||
srand((unsigned int)time(NULL)); // Initialize random seed
|
||||
|
||||
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
|
||||
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
|
||||
|
@ -2741,6 +2976,15 @@ static void SwapBuffers(void)
|
|||
{
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
glfwSwapBuffers(window);
|
||||
#if __APPLE__
|
||||
// workaround for missing/erroneous initial rendering on macOS
|
||||
if (windowNeedsUpdating) {
|
||||
// Desugared version of Objective C: [glfwGetNSGLContext(window) update]
|
||||
((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window),
|
||||
sel_registerName("update"));
|
||||
windowNeedsUpdating--;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP)
|
||||
|
@ -3079,7 +3323,8 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
|||
// Android: Get input events
|
||||
static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||
{
|
||||
//http://developer.android.com/ndk/reference/index.html
|
||||
// If additional inputs are required check:
|
||||
// https://developer.android.com/ndk/reference/group/input
|
||||
|
||||
int type = AInputEvent_getType(event);
|
||||
|
||||
|
@ -3092,6 +3337,23 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
// Get second touch position
|
||||
touchPosition[1].x = AMotionEvent_getX(event, 1);
|
||||
touchPosition[1].y = AMotionEvent_getY(event, 1);
|
||||
|
||||
// Useful functions for gamepad inputs:
|
||||
//AMotionEvent_getAction()
|
||||
//AMotionEvent_getAxisValue()
|
||||
//AMotionEvent_getButtonState()
|
||||
|
||||
// Gamepad dpad button presses capturing
|
||||
// TODO: That's weird, key input (or button)
|
||||
// shouldn't come as a TYPE_MOTION event...
|
||||
int32_t keycode = AKeyEvent_getKeyCode(event);
|
||||
if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_DOWN)
|
||||
{
|
||||
currentKeyState[keycode] = 1; // Key down
|
||||
lastKeyPressed = keycode;
|
||||
}
|
||||
else currentKeyState[keycode] = 0; // Key up
|
||||
|
||||
}
|
||||
else if (type == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
|
@ -3100,9 +3362,9 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
|
||||
// Save current button and its state
|
||||
// NOTE: Android key action is 0 for down and 1 for up
|
||||
if (AKeyEvent_getAction(event) == 0)
|
||||
if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_DOWN)
|
||||
{
|
||||
currentKeyState[keycode] = 1; // Key down
|
||||
currentKeyState[keycode] = 1; // Key down
|
||||
lastKeyPressed = keycode;
|
||||
}
|
||||
else currentKeyState[keycode] = 0; // Key up
|
||||
|
@ -3140,26 +3402,32 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
else if (flags == AMOTION_EVENT_ACTION_MOVE) gestureEvent.touchAction = TOUCH_MOVE;
|
||||
|
||||
// Register touch points count
|
||||
// NOTE: Documentation says pointerCount is Always >= 1,
|
||||
// but in practice it can be 0 or over a million
|
||||
gestureEvent.pointCount = AMotionEvent_getPointerCount(event);
|
||||
|
||||
// Register touch points id
|
||||
gestureEvent.pointerId[0] = AMotionEvent_getPointerId(event, 0);
|
||||
gestureEvent.pointerId[1] = AMotionEvent_getPointerId(event, 1);
|
||||
// Only enable gestures for 1-3 touch points
|
||||
if ((gestureEvent.pointCount > 0) && (gestureEvent.pointCount < 4))
|
||||
{
|
||||
// Register touch points id
|
||||
// NOTE: Only two points registered
|
||||
gestureEvent.pointerId[0] = AMotionEvent_getPointerId(event, 0);
|
||||
gestureEvent.pointerId[1] = AMotionEvent_getPointerId(event, 1);
|
||||
|
||||
// Register touch points position
|
||||
// NOTE: Only two points registered
|
||||
gestureEvent.position[0] = (Vector2){ AMotionEvent_getX(event, 0), AMotionEvent_getY(event, 0) };
|
||||
gestureEvent.position[1] = (Vector2){ AMotionEvent_getX(event, 1), AMotionEvent_getY(event, 1) };
|
||||
// Register touch points position
|
||||
gestureEvent.position[0] = (Vector2){ AMotionEvent_getX(event, 0), AMotionEvent_getY(event, 0) };
|
||||
gestureEvent.position[1] = (Vector2){ AMotionEvent_getX(event, 1), AMotionEvent_getY(event, 1) };
|
||||
|
||||
// Normalize gestureEvent.position[x] for screenWidth and screenHeight
|
||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
||||
// Normalize gestureEvent.position[x] for screenWidth and screenHeight
|
||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
||||
|
||||
gestureEvent.position[1].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[1].y /= (float)GetScreenHeight();
|
||||
|
||||
gestureEvent.position[1].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[1].y /= (float)GetScreenHeight();
|
||||
|
||||
// Gesture data is sent to gestures system for processing
|
||||
ProcessGestureEvent(gestureEvent);
|
||||
// Gesture data is sent to gestures system for processing
|
||||
ProcessGestureEvent(gestureEvent);
|
||||
}
|
||||
#else
|
||||
|
||||
// Support only simple touch position
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
@ -95,43 +95,90 @@ func SetWindowTitle(title string) {
|
|||
}
|
||||
|
||||
// SetWindowPosition - Set window position on screen (only PLATFORM_DESKTOP)
|
||||
func SetWindowPosition(x, y int32) {
|
||||
func SetWindowPosition(x, y int) {
|
||||
cx := (C.int)(x)
|
||||
cy := (C.int)(y)
|
||||
C.SetWindowPosition(cx, cy)
|
||||
}
|
||||
|
||||
// SetWindowMonitor - Set monitor for the current window (fullscreen mode)
|
||||
func SetWindowMonitor(monitor int32) {
|
||||
func SetWindowMonitor(monitor int) {
|
||||
cmonitor := (C.int)(monitor)
|
||||
C.SetWindowMonitor(cmonitor)
|
||||
}
|
||||
|
||||
// SetWindowMinSize - Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
func SetWindowMinSize(w, h int32) {
|
||||
func SetWindowMinSize(w, h int) {
|
||||
cw := (C.int)(w)
|
||||
ch := (C.int)(h)
|
||||
C.SetWindowMinSize(cw, ch)
|
||||
}
|
||||
|
||||
// SetWindowSize - Set window dimensions
|
||||
func SetWindowSize(w, h int32) {
|
||||
func SetWindowSize(w, h int) {
|
||||
cw := (C.int)(w)
|
||||
ch := (C.int)(h)
|
||||
C.SetWindowSize(cw, ch)
|
||||
}
|
||||
|
||||
// GetScreenWidth - Get current screen width
|
||||
func GetScreenWidth() int32 {
|
||||
func GetScreenWidth() int {
|
||||
ret := C.GetScreenWidth()
|
||||
v := (int32)(ret)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetScreenHeight - Get current screen height
|
||||
func GetScreenHeight() int32 {
|
||||
func GetScreenHeight() int {
|
||||
ret := C.GetScreenHeight()
|
||||
v := (int32)(ret)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorCount - Get number of connected monitors
|
||||
func GetMonitorCount() int {
|
||||
ret := C.GetMonitorCount()
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorWidth - Get primary monitor width
|
||||
func GetMonitorWidth(monitor int) int {
|
||||
cmonitor := (C.int)(monitor)
|
||||
ret := C.GetMonitorWidth(cmonitor)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorHeight - Get primary monitor height
|
||||
func GetMonitorHeight(monitor int) int {
|
||||
cmonitor := (C.int)(monitor)
|
||||
ret := C.GetMonitorHeight(cmonitor)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorPhysicalWidth - Get primary monitor physical width in millimetres
|
||||
func GetMonitorPhysicalWidth(monitor int) int {
|
||||
cmonitor := (C.int)(monitor)
|
||||
ret := C.GetMonitorPhysicalWidth(cmonitor)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorPhysicalHeight - Get primary monitor physical height in millimetres
|
||||
func GetMonitorPhysicalHeight(monitor int) int {
|
||||
cmonitor := (C.int)(monitor)
|
||||
ret := C.GetMonitorPhysicalHeight(cmonitor)
|
||||
v := (int)(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMonitorName - Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
func GetMonitorName(monitor int) string {
|
||||
cmonitor := (C.int)(monitor)
|
||||
ret := C.GetMonitorName(cmonitor)
|
||||
v := C.GoString(ret)
|
||||
return v
|
||||
}
|
||||
|
||||
|
@ -275,7 +322,7 @@ func ColorNormalize(color Color) Vector4 {
|
|||
|
||||
// Vector3ToFloat - Converts Vector3 to float32 slice
|
||||
func Vector3ToFloat(vec Vector3) []float32 {
|
||||
data := make([]float32, 3)
|
||||
data := make([]float32, 0)
|
||||
data[0] = vec.X
|
||||
data[1] = vec.Y
|
||||
data[2] = vec.Z
|
||||
|
@ -285,7 +332,7 @@ func Vector3ToFloat(vec Vector3) []float32 {
|
|||
|
||||
// MatrixToFloat - Converts Matrix to float32 slice
|
||||
func MatrixToFloat(mat Matrix) []float32 {
|
||||
data := make([]float32, 16)
|
||||
data := make([]float32, 0)
|
||||
|
||||
data[0] = mat.M0
|
||||
data[1] = mat.M4
|
||||
|
|
55
raylib/external/alsa/alisp.h
vendored
55
raylib/external/alsa/alisp.h
vendored
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* ALSA lisp implementation
|
||||
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
struct alisp_cfg {
|
||||
int verbose: 1,
|
||||
warning: 1,
|
||||
debug: 1;
|
||||
snd_input_t *in; /* program code */
|
||||
snd_output_t *out; /* program output */
|
||||
snd_output_t *eout; /* error output */
|
||||
snd_output_t *vout; /* verbose output */
|
||||
snd_output_t *wout; /* warning output */
|
||||
snd_output_t *dout; /* debug output */
|
||||
};
|
||||
|
||||
struct alisp_instance;
|
||||
struct alisp_object;
|
||||
struct alisp_seq_iterator;
|
||||
|
||||
struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input);
|
||||
void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg);
|
||||
int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **instance);
|
||||
void alsa_lisp_free(struct alisp_instance *instance);
|
||||
int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
|
||||
const char *id, const char *args, ...)
|
||||
#ifndef DOC_HIDDEN
|
||||
__attribute__ ((format (printf, 4, 5)))
|
||||
#endif
|
||||
;
|
||||
void alsa_lisp_result_free(struct alisp_instance *instance,
|
||||
struct alisp_seq_iterator *result);
|
||||
int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
|
||||
struct alisp_seq_iterator **seq);
|
||||
int alsa_lisp_seq_next(struct alisp_seq_iterator **seq);
|
||||
int alsa_lisp_seq_count(struct alisp_seq_iterator *seq);
|
||||
int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val);
|
||||
int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr);
|
310
raylib/external/alsa/asoundef.h
vendored
310
raylib/external/alsa/asoundef.h
vendored
|
@ -1,310 +0,0 @@
|
|||
/**
|
||||
* \file include/asoundef.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Definitions of constants for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_ASOUNDEF_H
|
||||
#define __ALSA_ASOUNDEF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Digital_Audio_Interface Constants for Digital Audio Interfaces
|
||||
* AES/IEC958 channel status bits.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define IEC958_AES0_PROFESSIONAL (1<<0) /**< 0 = consumer, 1 = professional */
|
||||
#define IEC958_AES0_NONAUDIO (1<<1) /**< 0 = audio, 1 = non-audio */
|
||||
#define IEC958_AES0_PRO_EMPHASIS (7<<2) /**< mask - emphasis */
|
||||
#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /**< emphasis not indicated */
|
||||
#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /**< no emphasis */
|
||||
#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /**< 50/15us emphasis */
|
||||
#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /**< CCITT J.17 emphasis */
|
||||
#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /**< source sample frequency: 0 = locked, 1 = unlocked */
|
||||
#define IEC958_AES0_PRO_FS (3<<6) /**< mask - sample frequency */
|
||||
#define IEC958_AES0_PRO_FS_NOTID (0<<6) /**< fs not indicated */
|
||||
#define IEC958_AES0_PRO_FS_44100 (1<<6) /**< 44.1kHz */
|
||||
#define IEC958_AES0_PRO_FS_48000 (2<<6) /**< 48kHz */
|
||||
#define IEC958_AES0_PRO_FS_32000 (3<<6) /**< 32kHz */
|
||||
#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /**< 0 = copyright, 1 = not copyright */
|
||||
#define IEC958_AES0_CON_EMPHASIS (7<<3) /**< mask - emphasis */
|
||||
#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /**< no emphasis */
|
||||
#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /**< 50/15us emphasis */
|
||||
#define IEC958_AES0_CON_MODE (3<<6) /**< mask - mode */
|
||||
#define IEC958_AES1_PRO_MODE (15<<0) /**< mask - channel mode */
|
||||
#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /**< mode not indicated */
|
||||
#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /**< stereophonic - ch A is left */
|
||||
#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /**< single channel */
|
||||
#define IEC958_AES1_PRO_MODE_TWO (8<<0) /**< two channels */
|
||||
#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /**< primary/secondary */
|
||||
#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /**< vector to byte 3 */
|
||||
#define IEC958_AES1_PRO_USERBITS (15<<4) /**< mask - user bits */
|
||||
#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /**< user bits not indicated */
|
||||
#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /**< 192-bit structure */
|
||||
#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /**< user defined application */
|
||||
#define IEC958_AES1_CON_CATEGORY 0x7f /**< consumer category */
|
||||
#define IEC958_AES1_CON_GENERAL 0x00 /**< general category */
|
||||
#define IEC958_AES1_CON_LASEROPT_MASK 0x07 /**< Laser-optical mask */
|
||||
#define IEC958_AES1_CON_LASEROPT_ID 0x01 /**< Laser-optical ID */
|
||||
#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) /**< IEC958 CD compatible device */
|
||||
#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) /**< non-IEC958 CD compatible device */
|
||||
#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48) /**< Mini-Disc device */
|
||||
#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18) /**< DVD device */
|
||||
#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78) /**< Other laser-optical product */
|
||||
#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07 /**< digital<->digital converter mask */
|
||||
#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02 /**< digital<->digital converter id */
|
||||
#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) /**< PCM coder */
|
||||
#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) /**< Digital signal mixer */
|
||||
#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) /**< Rate converter */
|
||||
#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20) /**< PCM sampler */
|
||||
#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28) /**< Digital sound processor */
|
||||
#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78) /**< Other digital<->digital product */
|
||||
#define IEC958_AES1_CON_MAGNETIC_MASK 0x07 /**< Magnetic device mask */
|
||||
#define IEC958_AES1_CON_MAGNETIC_ID 0x03 /**< Magnetic device ID */
|
||||
#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) /**< Digital Audio Tape */
|
||||
#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) /**< Video recorder */
|
||||
#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40) /**< Digital compact cassette */
|
||||
#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18) /**< Magnetic disc digital audio device */
|
||||
#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78) /**< Other magnetic device */
|
||||
#define IEC958_AES1_CON_BROADCAST1_MASK 0x07 /**< Broadcast mask */
|
||||
#define IEC958_AES1_CON_BROADCAST1_ID 0x04 /**< Broadcast ID */
|
||||
#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00) /**< Digital audio broadcast (Japan) */
|
||||
#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08) /**< Digital audio broadcast (Europe) */
|
||||
#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60) /**< Digital audio broadcast (USA) */
|
||||
#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40) /**< Electronic software delivery */
|
||||
#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20) /**< Used by another standard (IEC 62105) */
|
||||
#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78) /**< Other broadcast product */
|
||||
#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f /**< Broadcast alternative mask */
|
||||
#define IEC958_AES1_CON_BROADCAST2_ID 0x0e /**< Broadcast alternative ID */
|
||||
#define IEC958_AES1_CON_MUSICAL_MASK 0x07 /**< Musical device mask */
|
||||
#define IEC958_AES1_CON_MUSICAL_ID 0x05 /**< Musical device ID */
|
||||
#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) /**< Synthesizer */
|
||||
#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) /**< Microphone */
|
||||
#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78) /**< Other musical device */
|
||||
#define IEC958_AES1_CON_ADC_MASK 0x1f /**< ADC Mask */
|
||||
#define IEC958_AES1_CON_ADC_ID 0x06 /**< ADC ID */
|
||||
#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00) /**< ADC without copyright information */
|
||||
#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60) /**< Other ADC product (with no copyright information) */
|
||||
#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f /**< ADC Copyright mask */
|
||||
#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16 /**< ADC Copyright ID */
|
||||
#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00) /**< ADC with copyright information */
|
||||
#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60) /**< Other ADC with copyright information product */
|
||||
#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f /**< Solid memory based products mask */
|
||||
#define IEC958_AES1_CON_SOLIDMEM_ID 0x08 /**< Solid memory based products ID */
|
||||
#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00) /**< Digital audio recorder and player using solid state memory */
|
||||
#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70) /**< Other solid state memory based product */
|
||||
#define IEC958_AES1_CON_EXPERIMENTAL 0x40 /**< experimental category */
|
||||
#define IEC958_AES1_CON_ORIGINAL (1<<7) /**< this bits depends on the category code */
|
||||
#define IEC958_AES2_PRO_SBITS (7<<0) /**< mask - sample bits */
|
||||
#define IEC958_AES2_PRO_SBITS_20 (2<<0) /**< 20-bit - coordination */
|
||||
#define IEC958_AES2_PRO_SBITS_24 (4<<0) /**< 24-bit - main audio */
|
||||
#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /**< user defined application */
|
||||
#define IEC958_AES2_PRO_WORDLEN (7<<3) /**< mask - source word length */
|
||||
#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /**< source word length not indicated */
|
||||
#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /**< 22-bit or 18-bit */
|
||||
#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /**< 23-bit or 19-bit */
|
||||
#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /**< 24-bit or 20-bit */
|
||||
#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /**< 20-bit or 16-bit */
|
||||
#define IEC958_AES2_CON_SOURCE (15<<0) /**< mask - source number */
|
||||
#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /**< source number unspecified */
|
||||
#define IEC958_AES2_CON_CHANNEL (15<<4) /**< mask - channel number */
|
||||
#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /**< channel number unspecified */
|
||||
#define IEC958_AES3_CON_FS (15<<0) /**< mask - sample frequency */
|
||||
#define IEC958_AES3_CON_FS_44100 (0<<0) /**< 44.1kHz */
|
||||
#define IEC958_AES3_CON_FS_NOTID (1<<0) /**< sample frequency non indicated */
|
||||
#define IEC958_AES3_CON_FS_48000 (2<<0) /**< 48kHz */
|
||||
#define IEC958_AES3_CON_FS_32000 (3<<0) /**< 32kHz */
|
||||
#define IEC958_AES3_CON_FS_22050 (4<<0) /**< 22.05kHz */
|
||||
#define IEC958_AES3_CON_FS_24000 (6<<0) /**< 24kHz */
|
||||
#define IEC958_AES3_CON_FS_88200 (8<<0) /**< 88.2kHz */
|
||||
#define IEC958_AES3_CON_FS_768000 (9<<0) /**< 768kHz */
|
||||
#define IEC958_AES3_CON_FS_96000 (10<<0) /**< 96kHz */
|
||||
#define IEC958_AES3_CON_FS_176400 (12<<0) /**< 176.4kHz */
|
||||
#define IEC958_AES3_CON_FS_192000 (14<<0) /**< 192kHz */
|
||||
#define IEC958_AES3_CON_CLOCK (3<<4) /**< mask - clock accuracy */
|
||||
#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /**< 1000 ppm */
|
||||
#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /**< 50 ppm */
|
||||
#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /**< variable pitch */
|
||||
#define IEC958_AES4_CON_MAX_WORDLEN_24 (1<<0) /**< 0 = 20-bit, 1 = 24-bit */
|
||||
#define IEC958_AES4_CON_WORDLEN (7<<1) /**< mask - sample word length */
|
||||
#define IEC958_AES4_CON_WORDLEN_NOTID (0<<1) /**< not indicated */
|
||||
#define IEC958_AES4_CON_WORDLEN_20_16 (1<<1) /**< 20-bit or 16-bit */
|
||||
#define IEC958_AES4_CON_WORDLEN_22_18 (2<<1) /**< 22-bit or 18-bit */
|
||||
#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /**< 23-bit or 19-bit */
|
||||
#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /**< 24-bit or 20-bit */
|
||||
#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /**< 21-bit or 17-bit */
|
||||
#define IEC958_AES4_CON_ORIGFS (15<<4) /**< mask - original sample frequency */
|
||||
#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /**< original sample frequency not indicated */
|
||||
#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /**< 192kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /**< 12kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /**< 176.4kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /**< 96kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /**< 8kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /**< 88.2kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /**< 16kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /**< 24kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /**< 11.025kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /**< 22.05kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /**< 32kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /**< 48kHz */
|
||||
#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /**< 44.1kHz */
|
||||
#define IEC958_AES5_CON_CGMSA (3<<0) /**< mask - CGMS-A */
|
||||
#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /**< copying is permitted without restriction */
|
||||
#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /**< one generation of copies may be made */
|
||||
#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /**< condition not be used */
|
||||
#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /**< no copying is permitted */
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* \defgroup MIDI_Interface Constants for MIDI v1.0
|
||||
* Constants for MIDI v1.0.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define MIDI_CHANNELS 16 /**< Number of channels per port/cable. */
|
||||
#define MIDI_GM_DRUM_CHANNEL (10-1) /**< Channel number for GM drums. */
|
||||
|
||||
/**
|
||||
* \defgroup MIDI_Commands MIDI Commands
|
||||
* MIDI command codes.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define MIDI_CMD_NOTE_OFF 0x80 /**< note off */
|
||||
#define MIDI_CMD_NOTE_ON 0x90 /**< note on */
|
||||
#define MIDI_CMD_NOTE_PRESSURE 0xa0 /**< key pressure */
|
||||
#define MIDI_CMD_CONTROL 0xb0 /**< control change */
|
||||
#define MIDI_CMD_PGM_CHANGE 0xc0 /**< program change */
|
||||
#define MIDI_CMD_CHANNEL_PRESSURE 0xd0 /**< channel pressure */
|
||||
#define MIDI_CMD_BENDER 0xe0 /**< pitch bender */
|
||||
|
||||
#define MIDI_CMD_COMMON_SYSEX 0xf0 /**< sysex (system exclusive) begin */
|
||||
#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1 /**< MTC quarter frame */
|
||||
#define MIDI_CMD_COMMON_SONG_POS 0xf2 /**< song position */
|
||||
#define MIDI_CMD_COMMON_SONG_SELECT 0xf3 /**< song select */
|
||||
#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6 /**< tune request */
|
||||
#define MIDI_CMD_COMMON_SYSEX_END 0xf7 /**< end of sysex */
|
||||
#define MIDI_CMD_COMMON_CLOCK 0xf8 /**< clock */
|
||||
#define MIDI_CMD_COMMON_START 0xfa /**< start */
|
||||
#define MIDI_CMD_COMMON_CONTINUE 0xfb /**< continue */
|
||||
#define MIDI_CMD_COMMON_STOP 0xfc /**< stop */
|
||||
#define MIDI_CMD_COMMON_SENSING 0xfe /**< active sensing */
|
||||
#define MIDI_CMD_COMMON_RESET 0xff /**< reset */
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* \defgroup MIDI_Controllers MIDI Controllers
|
||||
* MIDI controller numbers.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define MIDI_CTL_MSB_BANK 0x00 /**< Bank selection */
|
||||
#define MIDI_CTL_MSB_MODWHEEL 0x01 /**< Modulation */
|
||||
#define MIDI_CTL_MSB_BREATH 0x02 /**< Breath */
|
||||
#define MIDI_CTL_MSB_FOOT 0x04 /**< Foot */
|
||||
#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05 /**< Portamento time */
|
||||
#define MIDI_CTL_MSB_DATA_ENTRY 0x06 /**< Data entry */
|
||||
#define MIDI_CTL_MSB_MAIN_VOLUME 0x07 /**< Main volume */
|
||||
#define MIDI_CTL_MSB_BALANCE 0x08 /**< Balance */
|
||||
#define MIDI_CTL_MSB_PAN 0x0a /**< Panpot */
|
||||
#define MIDI_CTL_MSB_EXPRESSION 0x0b /**< Expression */
|
||||
#define MIDI_CTL_MSB_EFFECT1 0x0c /**< Effect1 */
|
||||
#define MIDI_CTL_MSB_EFFECT2 0x0d /**< Effect2 */
|
||||
#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10 /**< General purpose 1 */
|
||||
#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11 /**< General purpose 2 */
|
||||
#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12 /**< General purpose 3 */
|
||||
#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13 /**< General purpose 4 */
|
||||
#define MIDI_CTL_LSB_BANK 0x20 /**< Bank selection */
|
||||
#define MIDI_CTL_LSB_MODWHEEL 0x21 /**< Modulation */
|
||||
#define MIDI_CTL_LSB_BREATH 0x22 /**< Breath */
|
||||
#define MIDI_CTL_LSB_FOOT 0x24 /**< Foot */
|
||||
#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25 /**< Portamento time */
|
||||
#define MIDI_CTL_LSB_DATA_ENTRY 0x26 /**< Data entry */
|
||||
#define MIDI_CTL_LSB_MAIN_VOLUME 0x27 /**< Main volume */
|
||||
#define MIDI_CTL_LSB_BALANCE 0x28 /**< Balance */
|
||||
#define MIDI_CTL_LSB_PAN 0x2a /**< Panpot */
|
||||
#define MIDI_CTL_LSB_EXPRESSION 0x2b /**< Expression */
|
||||
#define MIDI_CTL_LSB_EFFECT1 0x2c /**< Effect1 */
|
||||
#define MIDI_CTL_LSB_EFFECT2 0x2d /**< Effect2 */
|
||||
#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30 /**< General purpose 1 */
|
||||
#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31 /**< General purpose 2 */
|
||||
#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32 /**< General purpose 3 */
|
||||
#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33 /**< General purpose 4 */
|
||||
#define MIDI_CTL_SUSTAIN 0x40 /**< Sustain pedal */
|
||||
#define MIDI_CTL_PORTAMENTO 0x41 /**< Portamento */
|
||||
#define MIDI_CTL_SOSTENUTO 0x42 /**< Sostenuto */
|
||||
#define MIDI_CTL_SUSTENUTO 0x42 /**< Sostenuto (a typo in the older version) */
|
||||
#define MIDI_CTL_SOFT_PEDAL 0x43 /**< Soft pedal */
|
||||
#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44 /**< Legato foot switch */
|
||||
#define MIDI_CTL_HOLD2 0x45 /**< Hold2 */
|
||||
#define MIDI_CTL_SC1_SOUND_VARIATION 0x46 /**< SC1 Sound Variation */
|
||||
#define MIDI_CTL_SC2_TIMBRE 0x47 /**< SC2 Timbre */
|
||||
#define MIDI_CTL_SC3_RELEASE_TIME 0x48 /**< SC3 Release Time */
|
||||
#define MIDI_CTL_SC4_ATTACK_TIME 0x49 /**< SC4 Attack Time */
|
||||
#define MIDI_CTL_SC5_BRIGHTNESS 0x4a /**< SC5 Brightness */
|
||||
#define MIDI_CTL_SC6 0x4b /**< SC6 */
|
||||
#define MIDI_CTL_SC7 0x4c /**< SC7 */
|
||||
#define MIDI_CTL_SC8 0x4d /**< SC8 */
|
||||
#define MIDI_CTL_SC9 0x4e /**< SC9 */
|
||||
#define MIDI_CTL_SC10 0x4f /**< SC10 */
|
||||
#define MIDI_CTL_GENERAL_PURPOSE5 0x50 /**< General purpose 5 */
|
||||
#define MIDI_CTL_GENERAL_PURPOSE6 0x51 /**< General purpose 6 */
|
||||
#define MIDI_CTL_GENERAL_PURPOSE7 0x52 /**< General purpose 7 */
|
||||
#define MIDI_CTL_GENERAL_PURPOSE8 0x53 /**< General purpose 8 */
|
||||
#define MIDI_CTL_PORTAMENTO_CONTROL 0x54 /**< Portamento control */
|
||||
#define MIDI_CTL_E1_REVERB_DEPTH 0x5b /**< E1 Reverb Depth */
|
||||
#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c /**< E2 Tremolo Depth */
|
||||
#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d /**< E3 Chorus Depth */
|
||||
#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e /**< E4 Detune Depth */
|
||||
#define MIDI_CTL_E5_PHASER_DEPTH 0x5f /**< E5 Phaser Depth */
|
||||
#define MIDI_CTL_DATA_INCREMENT 0x60 /**< Data Increment */
|
||||
#define MIDI_CTL_DATA_DECREMENT 0x61 /**< Data Decrement */
|
||||
#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62 /**< Non-registered parameter number */
|
||||
#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63 /**< Non-registered parameter number */
|
||||
#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64 /**< Registered parameter number */
|
||||
#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65 /**< Registered parameter number */
|
||||
#define MIDI_CTL_ALL_SOUNDS_OFF 0x78 /**< All sounds off */
|
||||
#define MIDI_CTL_RESET_CONTROLLERS 0x79 /**< Reset Controllers */
|
||||
#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a /**< Local control switch */
|
||||
#define MIDI_CTL_ALL_NOTES_OFF 0x7b /**< All notes off */
|
||||
#define MIDI_CTL_OMNI_OFF 0x7c /**< Omni off */
|
||||
#define MIDI_CTL_OMNI_ON 0x7d /**< Omni on */
|
||||
#define MIDI_CTL_MONO1 0x7e /**< Mono1 */
|
||||
#define MIDI_CTL_MONO2 0x7f /**< Mono2 */
|
||||
|
||||
/** \} */
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_ASOUNDEF_H */
|
65
raylib/external/alsa/asoundlib.h
vendored
65
raylib/external/alsa/asoundlib.h
vendored
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* \file include/asoundlib.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ASOUNDLIB_H
|
||||
#define __ASOUNDLIB_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __inline__ inline
|
||||
#endif
|
||||
|
||||
#include <alsa/asoundef.h>
|
||||
#include <alsa/version.h>
|
||||
#include <alsa/global.h>
|
||||
#include <alsa/input.h>
|
||||
#include <alsa/output.h>
|
||||
#include <alsa/error.h>
|
||||
#include <alsa/conf.h>
|
||||
#include <alsa/pcm.h>
|
||||
#include <alsa/rawmidi.h>
|
||||
#include <alsa/timer.h>
|
||||
#include <alsa/hwdep.h>
|
||||
#include <alsa/control.h>
|
||||
#include <alsa/mixer.h>
|
||||
#include <alsa/seq_event.h>
|
||||
#include <alsa/seq.h>
|
||||
#include <alsa/seqmid.h>
|
||||
#include <alsa/seq_midi_event.h>
|
||||
|
||||
#endif /* __ASOUNDLIB_H */
|
214
raylib/external/alsa/conf.h
vendored
214
raylib/external/alsa/conf.h
vendored
|
@ -1,214 +0,0 @@
|
|||
/**
|
||||
* \file include/conf.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_CONF_H
|
||||
#define __ALSA_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Config Configuration Interface
|
||||
* The configuration functions and types allow you to read, enumerate,
|
||||
* modify and write the contents of ALSA configuration files.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** \brief \c dlsym version for the config evaluate callback. */
|
||||
#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
|
||||
/** \brief \c dlsym version for the config hook callback. */
|
||||
#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
|
||||
|
||||
/** \brief Configuration node type. */
|
||||
typedef enum _snd_config_type {
|
||||
/** Integer number. */
|
||||
SND_CONFIG_TYPE_INTEGER,
|
||||
/** 64-bit integer number. */
|
||||
SND_CONFIG_TYPE_INTEGER64,
|
||||
/** Real number. */
|
||||
SND_CONFIG_TYPE_REAL,
|
||||
/** Character string. */
|
||||
SND_CONFIG_TYPE_STRING,
|
||||
/** Pointer (runtime only, cannot be saved). */
|
||||
SND_CONFIG_TYPE_POINTER,
|
||||
/** Compound node. */
|
||||
SND_CONFIG_TYPE_COMPOUND = 1024
|
||||
} snd_config_type_t;
|
||||
|
||||
/**
|
||||
* \brief Internal structure for a configuration node object.
|
||||
*
|
||||
* The ALSA library uses a pointer to this structure as a handle to a
|
||||
* configuration node. Applications don't access its contents directly.
|
||||
*/
|
||||
typedef struct _snd_config snd_config_t;
|
||||
/**
|
||||
* \brief Type for a configuration compound iterator.
|
||||
*
|
||||
* The ALSA library uses this pointer type as a handle to a configuration
|
||||
* compound iterator. Applications don't directly access the contents of
|
||||
* the structure pointed to by this type.
|
||||
*/
|
||||
typedef struct _snd_config_iterator *snd_config_iterator_t;
|
||||
/**
|
||||
* \brief Internal structure for a configuration private update object.
|
||||
*
|
||||
* The ALSA library uses this structure to save private update information.
|
||||
*/
|
||||
typedef struct _snd_config_update snd_config_update_t;
|
||||
|
||||
extern snd_config_t *snd_config;
|
||||
|
||||
const char *snd_config_topdir(void);
|
||||
|
||||
int snd_config_top(snd_config_t **config);
|
||||
|
||||
int snd_config_load(snd_config_t *config, snd_input_t *in);
|
||||
int snd_config_load_override(snd_config_t *config, snd_input_t *in);
|
||||
int snd_config_save(snd_config_t *config, snd_output_t *out);
|
||||
int snd_config_update(void);
|
||||
int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
|
||||
int snd_config_update_free(snd_config_update_t *update);
|
||||
int snd_config_update_free_global(void);
|
||||
|
||||
int snd_config_update_ref(snd_config_t **top);
|
||||
void snd_config_ref(snd_config_t *top);
|
||||
void snd_config_unref(snd_config_t *top);
|
||||
|
||||
int snd_config_search(snd_config_t *config, const char *key,
|
||||
snd_config_t **result);
|
||||
int snd_config_searchv(snd_config_t *config,
|
||||
snd_config_t **result, ...);
|
||||
int snd_config_search_definition(snd_config_t *config,
|
||||
const char *base, const char *key,
|
||||
snd_config_t **result);
|
||||
|
||||
int snd_config_expand(snd_config_t *config, snd_config_t *root,
|
||||
const char *args, snd_config_t *private_data,
|
||||
snd_config_t **result);
|
||||
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
|
||||
snd_config_t *private_data, snd_config_t **result);
|
||||
|
||||
int snd_config_add(snd_config_t *config, snd_config_t *leaf);
|
||||
int snd_config_delete(snd_config_t *config);
|
||||
int snd_config_delete_compound_members(const snd_config_t *config);
|
||||
int snd_config_copy(snd_config_t **dst, snd_config_t *src);
|
||||
|
||||
int snd_config_make(snd_config_t **config, const char *key,
|
||||
snd_config_type_t type);
|
||||
int snd_config_make_integer(snd_config_t **config, const char *key);
|
||||
int snd_config_make_integer64(snd_config_t **config, const char *key);
|
||||
int snd_config_make_real(snd_config_t **config, const char *key);
|
||||
int snd_config_make_string(snd_config_t **config, const char *key);
|
||||
int snd_config_make_pointer(snd_config_t **config, const char *key);
|
||||
int snd_config_make_compound(snd_config_t **config, const char *key, int join);
|
||||
|
||||
int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
|
||||
int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
|
||||
int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
|
||||
int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
|
||||
int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);
|
||||
int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
|
||||
|
||||
snd_config_type_t snd_config_get_type(const snd_config_t *config);
|
||||
|
||||
int snd_config_set_id(snd_config_t *config, const char *id);
|
||||
int snd_config_set_integer(snd_config_t *config, long value);
|
||||
int snd_config_set_integer64(snd_config_t *config, long long value);
|
||||
int snd_config_set_real(snd_config_t *config, double value);
|
||||
int snd_config_set_string(snd_config_t *config, const char *value);
|
||||
int snd_config_set_ascii(snd_config_t *config, const char *ascii);
|
||||
int snd_config_set_pointer(snd_config_t *config, const void *ptr);
|
||||
int snd_config_get_id(const snd_config_t *config, const char **value);
|
||||
int snd_config_get_integer(const snd_config_t *config, long *value);
|
||||
int snd_config_get_integer64(const snd_config_t *config, long long *value);
|
||||
int snd_config_get_real(const snd_config_t *config, double *value);
|
||||
int snd_config_get_ireal(const snd_config_t *config, double *value);
|
||||
int snd_config_get_string(const snd_config_t *config, const char **value);
|
||||
int snd_config_get_ascii(const snd_config_t *config, char **value);
|
||||
int snd_config_get_pointer(const snd_config_t *config, const void **value);
|
||||
int snd_config_test_id(const snd_config_t *config, const char *id);
|
||||
|
||||
snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
|
||||
snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
|
||||
snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
|
||||
snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
|
||||
|
||||
/**
|
||||
* \brief Helper macro to iterate over the children of a compound node.
|
||||
* \param[in,out] pos Iterator variable for the current node.
|
||||
* \param[in,out] next Temporary iterator variable for the next node.
|
||||
* \param[in] node Handle to the compound configuration node to iterate over.
|
||||
*
|
||||
* Use this macro like a \c for statement, e.g.:
|
||||
* \code
|
||||
* snd_config_iterator_t pos, next;
|
||||
* snd_config_for_each(pos, next, node) {
|
||||
* snd_config_t *entry = snd_config_iterator_entry(pos);
|
||||
* ...
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* This macro allows deleting or removing the current node.
|
||||
*/
|
||||
#define snd_config_for_each(pos, next, node) \
|
||||
for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
|
||||
|
||||
/* Misc functions */
|
||||
|
||||
int snd_config_get_bool_ascii(const char *ascii);
|
||||
int snd_config_get_bool(const snd_config_t *conf);
|
||||
int snd_config_get_ctl_iface_ascii(const char *ascii);
|
||||
int snd_config_get_ctl_iface(const snd_config_t *conf);
|
||||
|
||||
/* Names functions */
|
||||
|
||||
/**
|
||||
* Device-name list element
|
||||
*/
|
||||
typedef struct snd_devname snd_devname_t;
|
||||
|
||||
/**
|
||||
* Device-name list element (definition)
|
||||
*/
|
||||
struct snd_devname {
|
||||
char *name; /**< Device name string */
|
||||
char *comment; /**< Comments */
|
||||
snd_devname_t *next; /**< Next pointer */
|
||||
};
|
||||
|
||||
int snd_names_list(const char *iface, snd_devname_t **list);
|
||||
void snd_names_list_free(snd_devname_t *list);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_CONF_H */
|
622
raylib/external/alsa/control.h
vendored
622
raylib/external/alsa/control.h
vendored
|
@ -1,622 +0,0 @@
|
|||
/**
|
||||
* \file include/control.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_CONTROL_H
|
||||
#define __ALSA_CONTROL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Control Control Interface
|
||||
* The control interface.
|
||||
* See \ref control page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001
|
||||
|
||||
/** IEC958 structure */
|
||||
typedef struct snd_aes_iec958 {
|
||||
unsigned char status[24]; /**< AES/IEC958 channel status bits */
|
||||
unsigned char subcode[147]; /**< AES/IEC958 subcode bits */
|
||||
unsigned char pad; /**< nothing */
|
||||
unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */
|
||||
} snd_aes_iec958_t;
|
||||
|
||||
/** CTL card info container */
|
||||
typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
|
||||
|
||||
/** CTL element identifier container */
|
||||
typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
|
||||
|
||||
/** CTL element identifier list container */
|
||||
typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
|
||||
|
||||
/** CTL element info container */
|
||||
typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
|
||||
|
||||
/** CTL element value container */
|
||||
typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
|
||||
|
||||
/** CTL event container */
|
||||
typedef struct _snd_ctl_event snd_ctl_event_t;
|
||||
|
||||
/** CTL element type */
|
||||
typedef enum _snd_ctl_elem_type {
|
||||
/** Invalid type */
|
||||
SND_CTL_ELEM_TYPE_NONE = 0,
|
||||
/** Boolean contents */
|
||||
SND_CTL_ELEM_TYPE_BOOLEAN,
|
||||
/** Integer contents */
|
||||
SND_CTL_ELEM_TYPE_INTEGER,
|
||||
/** Enumerated contents */
|
||||
SND_CTL_ELEM_TYPE_ENUMERATED,
|
||||
/** Bytes contents */
|
||||
SND_CTL_ELEM_TYPE_BYTES,
|
||||
/** IEC958 (S/PDIF) setting content */
|
||||
SND_CTL_ELEM_TYPE_IEC958,
|
||||
/** 64-bit integer contents */
|
||||
SND_CTL_ELEM_TYPE_INTEGER64,
|
||||
SND_CTL_ELEM_TYPE_LAST = SND_CTL_ELEM_TYPE_INTEGER64
|
||||
} snd_ctl_elem_type_t;
|
||||
|
||||
/** CTL related interface */
|
||||
typedef enum _snd_ctl_elem_iface {
|
||||
/** Card level */
|
||||
SND_CTL_ELEM_IFACE_CARD = 0,
|
||||
/** Hardware dependent device */
|
||||
SND_CTL_ELEM_IFACE_HWDEP,
|
||||
/** Mixer */
|
||||
SND_CTL_ELEM_IFACE_MIXER,
|
||||
/** PCM */
|
||||
SND_CTL_ELEM_IFACE_PCM,
|
||||
/** RawMidi */
|
||||
SND_CTL_ELEM_IFACE_RAWMIDI,
|
||||
/** Timer */
|
||||
SND_CTL_ELEM_IFACE_TIMER,
|
||||
/** Sequencer */
|
||||
SND_CTL_ELEM_IFACE_SEQUENCER,
|
||||
SND_CTL_ELEM_IFACE_LAST = SND_CTL_ELEM_IFACE_SEQUENCER
|
||||
} snd_ctl_elem_iface_t;
|
||||
|
||||
/** Event class */
|
||||
typedef enum _snd_ctl_event_type {
|
||||
/** Elements related event */
|
||||
SND_CTL_EVENT_ELEM = 0,
|
||||
SND_CTL_EVENT_LAST = SND_CTL_EVENT_ELEM
|
||||
}snd_ctl_event_type_t;
|
||||
|
||||
/** Element has been removed (Warning: test this first and if set don't
|
||||
* test the other masks) \hideinitializer */
|
||||
#define SND_CTL_EVENT_MASK_REMOVE (~0U)
|
||||
/** Element value has been changed \hideinitializer */
|
||||
#define SND_CTL_EVENT_MASK_VALUE (1<<0)
|
||||
/** Element info has been changed \hideinitializer */
|
||||
#define SND_CTL_EVENT_MASK_INFO (1<<1)
|
||||
/** Element has been added \hideinitializer */
|
||||
#define SND_CTL_EVENT_MASK_ADD (1<<2)
|
||||
/** Element's TLV value has been changed \hideinitializer */
|
||||
#define SND_CTL_EVENT_MASK_TLV (1<<3)
|
||||
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_NONE ""
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_PLAYBACK "Playback "
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_CAPTURE "Capture "
|
||||
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_NONE ""
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_SWITCH "Switch"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_VOLUME "Volume"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_DEFAULT "Default"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_MASK "Mask"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_CON_MASK "Con Mask"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
|
||||
/** CTL name helper */
|
||||
#define SND_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
|
||||
/** Element name for IEC958 (S/PDIF) */
|
||||
#define SND_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what
|
||||
|
||||
/** Mask for the major Power State identifier */
|
||||
#define SND_CTL_POWER_MASK 0xff00
|
||||
/** ACPI/PCI Power State D0 */
|
||||
#define SND_CTL_POWER_D0 0x0000
|
||||
/** ACPI/PCI Power State D1 */
|
||||
#define SND_CTL_POWER_D1 0x0100
|
||||
/** ACPI/PCI Power State D2 */
|
||||
#define SND_CTL_POWER_D2 0x0200
|
||||
/** ACPI/PCI Power State D3 */
|
||||
#define SND_CTL_POWER_D3 0x0300
|
||||
/** ACPI/PCI Power State D3hot */
|
||||
#define SND_CTL_POWER_D3hot (SND_CTL_POWER_D3|0x0000)
|
||||
/** ACPI/PCI Power State D3cold */
|
||||
#define SND_CTL_POWER_D3cold (SND_CTL_POWER_D3|0x0001)
|
||||
|
||||
/** TLV type - Container */
|
||||
#define SND_CTL_TLVT_CONTAINER 0x0000
|
||||
/** TLV type - basic dB scale */
|
||||
#define SND_CTL_TLVT_DB_SCALE 0x0001
|
||||
/** TLV type - linear volume */
|
||||
#define SND_CTL_TLVT_DB_LINEAR 0x0002
|
||||
/** TLV type - dB range container */
|
||||
#define SND_CTL_TLVT_DB_RANGE 0x0003
|
||||
/** TLV type - dB scale specified by min/max values */
|
||||
#define SND_CTL_TLVT_DB_MINMAX 0x0004
|
||||
/** TLV type - dB scale specified by min/max values (with mute) */
|
||||
#define SND_CTL_TLVT_DB_MINMAX_MUTE 0x0005
|
||||
|
||||
/** Mute state */
|
||||
#define SND_CTL_TLV_DB_GAIN_MUTE -9999999
|
||||
|
||||
/** TLV type - fixed channel map positions */
|
||||
#define SND_CTL_TLVT_CHMAP_FIXED 0x00101
|
||||
/** TLV type - freely swappable channel map positions */
|
||||
#define SND_CTL_TLVT_CHMAP_VAR 0x00102
|
||||
/** TLV type - pair-wise swappable channel map positions */
|
||||
#define SND_CTL_TLVT_CHMAP_PAIRED 0x00103
|
||||
|
||||
/** CTL type */
|
||||
typedef enum _snd_ctl_type {
|
||||
/** Kernel level CTL */
|
||||
SND_CTL_TYPE_HW,
|
||||
/** Shared memory client CTL */
|
||||
SND_CTL_TYPE_SHM,
|
||||
/** INET client CTL (not yet implemented) */
|
||||
SND_CTL_TYPE_INET,
|
||||
/** External control plugin */
|
||||
SND_CTL_TYPE_EXT
|
||||
} snd_ctl_type_t;
|
||||
|
||||
/** Non blocking mode (flag for open mode) \hideinitializer */
|
||||
#define SND_CTL_NONBLOCK 0x0001
|
||||
|
||||
/** Async notification (flag for open mode) \hideinitializer */
|
||||
#define SND_CTL_ASYNC 0x0002
|
||||
|
||||
/** Read only (flag for open mode) \hideinitializer */
|
||||
#define SND_CTL_READONLY 0x0004
|
||||
|
||||
/** CTL handle */
|
||||
typedef struct _snd_ctl snd_ctl_t;
|
||||
|
||||
/** Don't destroy the ctl handle when close */
|
||||
#define SND_SCTL_NOFREE 0x0001
|
||||
|
||||
/** SCTL type */
|
||||
typedef struct _snd_sctl snd_sctl_t;
|
||||
|
||||
int snd_card_load(int card);
|
||||
int snd_card_next(int *card);
|
||||
int snd_card_get_index(const char *name);
|
||||
int snd_card_get_name(int card, char **name);
|
||||
int snd_card_get_longname(int card, char **name);
|
||||
|
||||
int snd_device_name_hint(int card, const char *iface, void ***hints);
|
||||
int snd_device_name_free_hint(void **hints);
|
||||
char *snd_device_name_get_hint(const void *hint, const char *id);
|
||||
|
||||
int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
|
||||
int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);
|
||||
int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode);
|
||||
int snd_ctl_close(snd_ctl_t *ctl);
|
||||
int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
|
||||
static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); }
|
||||
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
|
||||
snd_async_callback_t callback, void *private_data);
|
||||
snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
|
||||
int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
|
||||
int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
|
||||
int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
|
||||
int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
|
||||
int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list);
|
||||
int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
|
||||
int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
|
||||
int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
|
||||
int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
|
||||
int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
|
||||
int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
unsigned int *tlv, unsigned int tlv_size);
|
||||
int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
const unsigned int *tlv);
|
||||
int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
const unsigned int *tlv);
|
||||
#ifdef __ALSA_HWDEP_H
|
||||
int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
|
||||
int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
|
||||
#endif
|
||||
#ifdef __ALSA_PCM_H
|
||||
int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
|
||||
int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
|
||||
int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
|
||||
#endif
|
||||
#ifdef __ALSA_RAWMIDI_H
|
||||
int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
|
||||
int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
|
||||
int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
|
||||
#endif
|
||||
int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);
|
||||
int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);
|
||||
|
||||
int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
|
||||
int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
|
||||
const char *snd_ctl_name(snd_ctl_t *ctl);
|
||||
snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
|
||||
|
||||
const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
|
||||
const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
|
||||
const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
|
||||
|
||||
unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
|
||||
unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
|
||||
void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
|
||||
snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
|
||||
unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
|
||||
unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
|
||||
const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
|
||||
unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
|
||||
|
||||
int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
|
||||
void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
|
||||
|
||||
char *snd_ctl_ascii_elem_id_get(snd_ctl_elem_id_t *id);
|
||||
int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str);
|
||||
int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
|
||||
snd_ctl_elem_value_t *dst,
|
||||
snd_ctl_elem_info_t *info,
|
||||
const char *value);
|
||||
|
||||
size_t snd_ctl_elem_id_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id)
|
||||
int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr);
|
||||
void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj);
|
||||
void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj);
|
||||
void snd_ctl_elem_id_copy(snd_ctl_elem_id_t *dst, const snd_ctl_elem_id_t *src);
|
||||
unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj);
|
||||
snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj);
|
||||
unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj);
|
||||
unsigned int snd_ctl_elem_id_get_subdevice(const snd_ctl_elem_id_t *obj);
|
||||
const char *snd_ctl_elem_id_get_name(const snd_ctl_elem_id_t *obj);
|
||||
unsigned int snd_ctl_elem_id_get_index(const snd_ctl_elem_id_t *obj);
|
||||
void snd_ctl_elem_id_set_numid(snd_ctl_elem_id_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_id_set_interface(snd_ctl_elem_id_t *obj, snd_ctl_elem_iface_t val);
|
||||
void snd_ctl_elem_id_set_device(snd_ctl_elem_id_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val);
|
||||
void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val);
|
||||
|
||||
size_t snd_ctl_card_info_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_card_info_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info)
|
||||
int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
|
||||
void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
|
||||
void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj);
|
||||
void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src);
|
||||
int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
|
||||
const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj);
|
||||
|
||||
size_t snd_ctl_event_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_event_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event)
|
||||
int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
|
||||
void snd_ctl_event_free(snd_ctl_event_t *obj);
|
||||
void snd_ctl_event_clear(snd_ctl_event_t *obj);
|
||||
void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
|
||||
snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
|
||||
|
||||
size_t snd_ctl_elem_list_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list)
|
||||
int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr);
|
||||
void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj);
|
||||
void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj);
|
||||
void snd_ctl_elem_list_copy(snd_ctl_elem_list_t *dst, const snd_ctl_elem_list_t *src);
|
||||
void snd_ctl_elem_list_set_offset(snd_ctl_elem_list_t *obj, unsigned int val);
|
||||
unsigned int snd_ctl_elem_list_get_used(const snd_ctl_elem_list_t *obj);
|
||||
unsigned int snd_ctl_elem_list_get_count(const snd_ctl_elem_list_t *obj);
|
||||
void snd_ctl_elem_list_get_id(const snd_ctl_elem_list_t *obj, unsigned int idx, snd_ctl_elem_id_t *ptr);
|
||||
unsigned int snd_ctl_elem_list_get_numid(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
snd_ctl_elem_iface_t snd_ctl_elem_list_get_interface(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_elem_list_get_device(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_elem_list_get_subdevice(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx);
|
||||
|
||||
size_t snd_ctl_elem_info_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info)
|
||||
int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr);
|
||||
void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj);
|
||||
void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj);
|
||||
void snd_ctl_elem_info_copy(snd_ctl_elem_info_t *dst, const snd_ctl_elem_info_t *src);
|
||||
snd_ctl_elem_type_t snd_ctl_elem_info_get_type(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_readable(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_writable(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_tlv_readable(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_tlv_writable(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_tlv_commandable(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_is_user(const snd_ctl_elem_info_t *obj);
|
||||
pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj);
|
||||
unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj);
|
||||
long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj);
|
||||
long snd_ctl_elem_info_get_max(const snd_ctl_elem_info_t *obj);
|
||||
long snd_ctl_elem_info_get_step(const snd_ctl_elem_info_t *obj);
|
||||
long long snd_ctl_elem_info_get_min64(const snd_ctl_elem_info_t *obj);
|
||||
long long snd_ctl_elem_info_get_max64(const snd_ctl_elem_info_t *obj);
|
||||
long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj);
|
||||
unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj);
|
||||
void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val);
|
||||
const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj);
|
||||
int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx);
|
||||
int snd_ctl_elem_info_set_dimension(snd_ctl_elem_info_t *info,
|
||||
const int dimension[4]);
|
||||
void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr);
|
||||
unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj);
|
||||
snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj);
|
||||
unsigned int snd_ctl_elem_info_get_device(const snd_ctl_elem_info_t *obj);
|
||||
unsigned int snd_ctl_elem_info_get_subdevice(const snd_ctl_elem_info_t *obj);
|
||||
const char *snd_ctl_elem_info_get_name(const snd_ctl_elem_info_t *obj);
|
||||
unsigned int snd_ctl_elem_info_get_index(const snd_ctl_elem_info_t *obj);
|
||||
void snd_ctl_elem_info_set_id(snd_ctl_elem_info_t *obj, const snd_ctl_elem_id_t *ptr);
|
||||
void snd_ctl_elem_info_set_numid(snd_ctl_elem_info_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_info_set_interface(snd_ctl_elem_info_t *obj, snd_ctl_elem_iface_t val);
|
||||
void snd_ctl_elem_info_set_device(snd_ctl_elem_info_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val);
|
||||
void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val);
|
||||
|
||||
int snd_ctl_add_integer_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
|
||||
unsigned int element_count,
|
||||
unsigned int member_count,
|
||||
long min, long max, long step);
|
||||
int snd_ctl_add_integer64_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
|
||||
unsigned int element_count,
|
||||
unsigned int member_count,
|
||||
long long min, long long max,
|
||||
long long step);
|
||||
int snd_ctl_add_boolean_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
|
||||
unsigned int element_count,
|
||||
unsigned int member_count);
|
||||
int snd_ctl_add_enumerated_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
|
||||
unsigned int element_count,
|
||||
unsigned int member_count,
|
||||
unsigned int items,
|
||||
const char *const labels[]);
|
||||
int snd_ctl_add_bytes_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
|
||||
unsigned int element_count,
|
||||
unsigned int member_count);
|
||||
|
||||
int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long imin, long imax, long istep);
|
||||
int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long long imin, long long imax, long long istep);
|
||||
int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count);
|
||||
int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, unsigned int items, const char *const names[]);
|
||||
int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
|
||||
int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
|
||||
|
||||
size_t snd_ctl_elem_value_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value)
|
||||
int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr);
|
||||
void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
|
||||
void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
|
||||
void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src);
|
||||
int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right);
|
||||
void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr);
|
||||
unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj);
|
||||
snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj);
|
||||
unsigned int snd_ctl_elem_value_get_device(const snd_ctl_elem_value_t *obj);
|
||||
unsigned int snd_ctl_elem_value_get_subdevice(const snd_ctl_elem_value_t *obj);
|
||||
const char *snd_ctl_elem_value_get_name(const snd_ctl_elem_value_t *obj);
|
||||
unsigned int snd_ctl_elem_value_get_index(const snd_ctl_elem_value_t *obj);
|
||||
void snd_ctl_elem_value_set_id(snd_ctl_elem_value_t *obj, const snd_ctl_elem_id_t *ptr);
|
||||
void snd_ctl_elem_value_set_numid(snd_ctl_elem_value_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_value_set_interface(snd_ctl_elem_value_t *obj, snd_ctl_elem_iface_t val);
|
||||
void snd_ctl_elem_value_set_device(snd_ctl_elem_value_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int val);
|
||||
void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val);
|
||||
void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val);
|
||||
int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx);
|
||||
long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx);
|
||||
long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx);
|
||||
unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx);
|
||||
unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx);
|
||||
void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
|
||||
void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
|
||||
void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val);
|
||||
void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val);
|
||||
void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val);
|
||||
void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
|
||||
const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj);
|
||||
void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr);
|
||||
void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr);
|
||||
|
||||
int snd_tlv_parse_dB_info(unsigned int *tlv, unsigned int tlv_size,
|
||||
unsigned int **db_tlvp);
|
||||
int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
|
||||
long *min, long *max);
|
||||
int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
|
||||
long volume, long *db_gain);
|
||||
int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
|
||||
long db_gain, long *value, int xdir);
|
||||
int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
long *min, long *max);
|
||||
int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
long volume, long *db_gain);
|
||||
int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
||||
long db_gain, long *value, int xdir);
|
||||
|
||||
/**
|
||||
* \defgroup HControl High level Control Interface
|
||||
* \ingroup Control
|
||||
* The high level control interface.
|
||||
* See \ref hcontrol page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** HCTL element handle */
|
||||
typedef struct _snd_hctl_elem snd_hctl_elem_t;
|
||||
|
||||
/** HCTL handle */
|
||||
typedef struct _snd_hctl snd_hctl_t;
|
||||
|
||||
/**
|
||||
* \brief Compare function for sorting HCTL elements
|
||||
* \param e1 First element
|
||||
* \param e2 Second element
|
||||
* \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
|
||||
*/
|
||||
typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
|
||||
const snd_hctl_elem_t *e2);
|
||||
int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
|
||||
const snd_hctl_elem_t *c2);
|
||||
/**
|
||||
* \brief HCTL callback function
|
||||
* \param hctl HCTL handle
|
||||
* \param mask event mask
|
||||
* \param elem related HCTL element (if any)
|
||||
* \return 0 on success otherwise a negative error code
|
||||
*/
|
||||
typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
|
||||
unsigned int mask,
|
||||
snd_hctl_elem_t *elem);
|
||||
/**
|
||||
* \brief HCTL element callback function
|
||||
* \param elem HCTL element
|
||||
* \param mask event mask
|
||||
* \return 0 on success otherwise a negative error code
|
||||
*/
|
||||
typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
|
||||
unsigned int mask);
|
||||
|
||||
int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
|
||||
int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl);
|
||||
int snd_hctl_close(snd_hctl_t *hctl);
|
||||
int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
|
||||
static __inline__ int snd_hctl_abort(snd_hctl_t *hctl) { return snd_hctl_nonblock(hctl, 2); }
|
||||
int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
|
||||
int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
|
||||
int snd_hctl_poll_descriptors_revents(snd_hctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
|
||||
int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
|
||||
snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
|
||||
snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
|
||||
snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
|
||||
void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
|
||||
void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
|
||||
void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
|
||||
int snd_hctl_load(snd_hctl_t *hctl);
|
||||
int snd_hctl_free(snd_hctl_t *hctl);
|
||||
int snd_hctl_handle_events(snd_hctl_t *hctl);
|
||||
const char *snd_hctl_name(snd_hctl_t *hctl);
|
||||
int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
|
||||
snd_ctl_t *snd_hctl_ctl(snd_hctl_t *hctl);
|
||||
|
||||
snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
|
||||
snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
|
||||
int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
|
||||
int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
|
||||
int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
|
||||
int snd_hctl_elem_tlv_read(snd_hctl_elem_t *elem, unsigned int *tlv, unsigned int tlv_size);
|
||||
int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv);
|
||||
int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv);
|
||||
|
||||
snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);
|
||||
|
||||
void snd_hctl_elem_get_id(const snd_hctl_elem_t *obj, snd_ctl_elem_id_t *ptr);
|
||||
unsigned int snd_hctl_elem_get_numid(const snd_hctl_elem_t *obj);
|
||||
snd_ctl_elem_iface_t snd_hctl_elem_get_interface(const snd_hctl_elem_t *obj);
|
||||
unsigned int snd_hctl_elem_get_device(const snd_hctl_elem_t *obj);
|
||||
unsigned int snd_hctl_elem_get_subdevice(const snd_hctl_elem_t *obj);
|
||||
const char *snd_hctl_elem_get_name(const snd_hctl_elem_t *obj);
|
||||
unsigned int snd_hctl_elem_get_index(const snd_hctl_elem_t *obj);
|
||||
void snd_hctl_elem_set_callback(snd_hctl_elem_t *obj, snd_hctl_elem_callback_t val);
|
||||
void * snd_hctl_elem_get_callback_private(const snd_hctl_elem_t *obj);
|
||||
void snd_hctl_elem_set_callback_private(snd_hctl_elem_t *obj, void * val);
|
||||
|
||||
/** \} */
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* \defgroup SControl Setup Control Interface
|
||||
* \ingroup Control
|
||||
* The setup control interface - set or modify control elements from a configuration file.
|
||||
* \{
|
||||
*/
|
||||
|
||||
int snd_sctl_build(snd_sctl_t **ctl, snd_ctl_t *handle, snd_config_t *config,
|
||||
snd_config_t *private_data, int mode);
|
||||
int snd_sctl_free(snd_sctl_t *handle);
|
||||
int snd_sctl_install(snd_sctl_t *handle);
|
||||
int snd_sctl_remove(snd_sctl_t *handle);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_CONTROL_H */
|
286
raylib/external/alsa/control_external.h
vendored
286
raylib/external/alsa/control_external.h
vendored
|
@ -1,286 +0,0 @@
|
|||
/**
|
||||
* \file include/control_external.h
|
||||
* \brief External control plugin SDK
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 2005
|
||||
*
|
||||
* External control plugin SDK.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef __ALSA_CONTROL_EXTERNAL_H
|
||||
#define __ALSA_CONTROL_EXTERNAL_H
|
||||
|
||||
#include "control.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup CtlPlugin_SDK External Control Plugin SDK
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define the object entry for external control plugins
|
||||
*/
|
||||
#define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
|
||||
|
||||
/**
|
||||
* Define the symbols of the given control plugin with versions
|
||||
*/
|
||||
#define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
|
||||
|
||||
/**
|
||||
* Define the control plugin
|
||||
*/
|
||||
#define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
|
||||
int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
|
||||
snd_config_t *root, snd_config_t *conf, int mode)
|
||||
|
||||
/** External control plugin handle */
|
||||
typedef struct snd_ctl_ext snd_ctl_ext_t;
|
||||
/** Callback table of control ext */
|
||||
typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
|
||||
/** Key to access a control pointer */
|
||||
typedef unsigned long snd_ctl_ext_key_t;
|
||||
#ifdef DOC_HIDDEN
|
||||
/* redefine typedef's for stupid doxygen */
|
||||
typedef snd_ctl_ext snd_ctl_ext_t;
|
||||
typedef snd_ctl_ext_callback snd_ctl_ext_callback_t;
|
||||
#endif
|
||||
/** Callback to handle TLV commands. */
|
||||
typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
|
||||
unsigned int *tlv, unsigned int tlv_size);
|
||||
|
||||
/*
|
||||
* Protocol version
|
||||
*/
|
||||
#define SND_CTL_EXT_VERSION_MAJOR 1 /**< Protocol major version */
|
||||
#define SND_CTL_EXT_VERSION_MINOR 0 /**< Protocol minor version */
|
||||
#define SND_CTL_EXT_VERSION_TINY 1 /**< Protocol tiny version */
|
||||
/**
|
||||
* external plugin protocol version
|
||||
*/
|
||||
#define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
|
||||
(SND_CTL_EXT_VERSION_MINOR<<8) |\
|
||||
(SND_CTL_EXT_VERSION_TINY))
|
||||
|
||||
/** Handle of control ext */
|
||||
struct snd_ctl_ext {
|
||||
/**
|
||||
* protocol version; #SND_CTL_EXT_VERSION must be filled here
|
||||
* before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
unsigned int version;
|
||||
/**
|
||||
* Index of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
int card_idx;
|
||||
/**
|
||||
* ID string of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
char id[16];
|
||||
/**
|
||||
* Driver name of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
char driver[16];
|
||||
/**
|
||||
* short name of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
char name[32];
|
||||
/**
|
||||
* Long name of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
char longname[80];
|
||||
/**
|
||||
* Mixer name of this card; must be filled before calling #snd_ctl_ext_create()
|
||||
*/
|
||||
char mixername[80];
|
||||
/**
|
||||
* poll descriptor
|
||||
*/
|
||||
int poll_fd;
|
||||
|
||||
/**
|
||||
* callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
|
||||
*/
|
||||
const snd_ctl_ext_callback_t *callback;
|
||||
/**
|
||||
* private data, which can be used freely in the driver callbacks
|
||||
*/
|
||||
void *private_data;
|
||||
/**
|
||||
* control handle filled by #snd_ctl_ext_create()
|
||||
*/
|
||||
snd_ctl_t *handle;
|
||||
|
||||
int nonblock; /**< non-block mode; read-only */
|
||||
int subscribed; /**< events subscribed; read-only */
|
||||
|
||||
/**
|
||||
* optional TLV data for the control (since protocol 1.0.1)
|
||||
*/
|
||||
union {
|
||||
snd_ctl_ext_tlv_rw_t *c;
|
||||
const unsigned int *p;
|
||||
} tlv;
|
||||
};
|
||||
|
||||
/** Callback table of ext. */
|
||||
struct snd_ctl_ext_callback {
|
||||
/**
|
||||
* close the control handle; optional
|
||||
*/
|
||||
void (*close)(snd_ctl_ext_t *ext);
|
||||
/**
|
||||
* return the total number of elements; required
|
||||
*/
|
||||
int (*elem_count)(snd_ctl_ext_t *ext);
|
||||
/**
|
||||
* return the element id of the given offset (array index); required
|
||||
*/
|
||||
int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
|
||||
/**
|
||||
* convert the element id to a search key; required
|
||||
*/
|
||||
snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
|
||||
/**
|
||||
* the destructor of the key; optional
|
||||
*/
|
||||
void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
|
||||
/**
|
||||
* get the attribute of the element; required
|
||||
*/
|
||||
int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
|
||||
int *type, unsigned int *acc, unsigned int *count);
|
||||
/**
|
||||
* get the element information of integer type
|
||||
*/
|
||||
int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
|
||||
long *imin, long *imax, long *istep);
|
||||
/**
|
||||
* get the element information of integer64 type
|
||||
*/
|
||||
int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
|
||||
int64_t *imin, int64_t *imax, int64_t *istep);
|
||||
/**
|
||||
* get the element information of enumerated type
|
||||
*/
|
||||
int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
|
||||
/**
|
||||
* get the name of the enumerated item
|
||||
*/
|
||||
int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
|
||||
char *name, size_t name_max_len);
|
||||
/**
|
||||
* read the current values of integer type
|
||||
*/
|
||||
int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
|
||||
/**
|
||||
* read the current values of integer64 type
|
||||
*/
|
||||
int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
|
||||
/**
|
||||
* read the current values of enumerated type
|
||||
*/
|
||||
int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
|
||||
/**
|
||||
* read the current values of bytes type
|
||||
*/
|
||||
int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
|
||||
size_t max_bytes);
|
||||
/**
|
||||
* read the current values of iec958 type
|
||||
*/
|
||||
int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
|
||||
/**
|
||||
* update the current values of integer type with the given values
|
||||
*/
|
||||
int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
|
||||
/**
|
||||
* update the current values of integer64 type with the given values
|
||||
*/
|
||||
int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
|
||||
/**
|
||||
* update the current values of enumerated type with the given values
|
||||
*/
|
||||
int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
|
||||
/**
|
||||
* update the current values of bytes type with the given values
|
||||
*/
|
||||
int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
|
||||
size_t max_bytes);
|
||||
/**
|
||||
* update the current values of iec958 type with the given values
|
||||
*/
|
||||
int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
|
||||
/**
|
||||
* subscribe/unsubscribe the event notification; optional
|
||||
*/
|
||||
void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
|
||||
/**
|
||||
* read a pending notification event; optional
|
||||
*/
|
||||
int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
|
||||
/**
|
||||
* return the number of poll descriptors; optional
|
||||
*/
|
||||
int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
|
||||
/**
|
||||
* fill the poll descriptors; optional
|
||||
*/
|
||||
int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
|
||||
/**
|
||||
* mangle the revents of poll descriptors
|
||||
*/
|
||||
int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
};
|
||||
|
||||
/**
|
||||
* The access type bits stored in get_attribute callback
|
||||
*/
|
||||
typedef enum snd_ctl_ext_access {
|
||||
SND_CTL_EXT_ACCESS_READ = (1<<0),
|
||||
SND_CTL_EXT_ACCESS_WRITE = (1<<1),
|
||||
SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
|
||||
SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
|
||||
SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
|
||||
SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
|
||||
SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
|
||||
SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
|
||||
SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
|
||||
SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
|
||||
} snd_ctl_ext_access_t;
|
||||
|
||||
/**
|
||||
* find_elem callback returns this if no matching control element is found
|
||||
*/
|
||||
#define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
|
||||
|
||||
int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
|
||||
int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_CONTROL_EXTERNAL_H */
|
85
raylib/external/alsa/error.h
vendored
85
raylib/external/alsa/error.h
vendored
|
@ -1,85 +0,0 @@
|
|||
/**
|
||||
* \file include/error.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_ERROR_H
|
||||
#define __ALSA_ERROR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Error Error handling
|
||||
* Error handling macros and functions.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
|
||||
#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
|
||||
#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */
|
||||
|
||||
const char *snd_strerror(int errnum);
|
||||
|
||||
/**
|
||||
* \brief Error handler callback.
|
||||
* \param file Source file name.
|
||||
* \param line Line number.
|
||||
* \param function Function name.
|
||||
* \param err Value of \c errno, or 0 if not relevant.
|
||||
* \param fmt \c printf(3) format.
|
||||
* \param ... \c printf(3) arguments.
|
||||
*
|
||||
* A function of this type is called by the ALSA library when an error occurs.
|
||||
* This function usually shows the message on the screen, and/or logs it.
|
||||
*/
|
||||
typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
|
||||
extern snd_lib_error_handler_t snd_lib_error;
|
||||
extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
|
||||
#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */
|
||||
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
|
||||
#else
|
||||
#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, ##args) /**< Shows a sound error message. */
|
||||
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args) /**< Shows a system error message (related to \c errno). */
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Local error handler function type */
|
||||
typedef void (*snd_local_error_handler_t)(const char *file, int line,
|
||||
const char *func, int err,
|
||||
const char *fmt, va_list arg);
|
||||
|
||||
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
|
||||
|
||||
#endif /* __ALSA_ERROR_H */
|
||||
|
161
raylib/external/alsa/global.h
vendored
161
raylib/external/alsa/global.h
vendored
|
@ -1,161 +0,0 @@
|
|||
/**
|
||||
* \file include/global.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_GLOBAL_H_
|
||||
#define __ALSA_GLOBAL_H_
|
||||
|
||||
/* for timeval and timespec */
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Global Global defines and functions
|
||||
* Global defines and functions.
|
||||
* \par
|
||||
* The ALSA library implementation uses these macros and functions.
|
||||
* Most applications probably do not need them.
|
||||
* \{
|
||||
*/
|
||||
|
||||
const char *snd_asoundlib_version(void);
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
/** do not print warning (gcc) when function parameter is not used */
|
||||
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif
|
||||
|
||||
#ifdef PIC /* dynamic build */
|
||||
|
||||
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
|
||||
#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
|
||||
/**
|
||||
* \hideinitializer
|
||||
* \brief Appends the build version to the name of a versioned dynamic symbol.
|
||||
*/
|
||||
#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
|
||||
|
||||
#else /* static build */
|
||||
|
||||
struct snd_dlsym_link {
|
||||
struct snd_dlsym_link *next;
|
||||
const char *dlsym_name;
|
||||
const void *dlsym_ptr;
|
||||
};
|
||||
|
||||
extern struct snd_dlsym_link *snd_dlsym_start;
|
||||
|
||||
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
|
||||
#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
|
||||
/**
|
||||
* \hideinitializer
|
||||
* \brief Appends the build version to the name of a versioned dynamic symbol.
|
||||
*/
|
||||
#define SND_DLSYM_BUILD_VERSION(name, version) \
|
||||
static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
|
||||
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
|
||||
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
|
||||
__SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
|
||||
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
|
||||
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
|
||||
snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __STRING
|
||||
/** \brief Return 'x' argument as string */
|
||||
#define __STRING(x) #x
|
||||
#endif
|
||||
|
||||
/** \brief Returns the version of a dynamic symbol as a string. */
|
||||
#define SND_DLSYM_VERSION(version) __STRING(version)
|
||||
|
||||
void *snd_dlopen(const char *file, int mode);
|
||||
void *snd_dlsym(void *handle, const char *name, const char *version);
|
||||
int snd_dlclose(void *handle);
|
||||
|
||||
|
||||
/** \brief alloca helper macro. */
|
||||
#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
|
||||
|
||||
/**
|
||||
* \brief Internal structure for an async notification client handler.
|
||||
*
|
||||
* The ALSA library uses a pointer to this structure as a handle to an async
|
||||
* notification object. Applications don't access its contents directly.
|
||||
*/
|
||||
typedef struct _snd_async_handler snd_async_handler_t;
|
||||
|
||||
/**
|
||||
* \brief Async notification callback.
|
||||
*
|
||||
* See the #snd_async_add_handler function for details.
|
||||
*/
|
||||
typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
|
||||
|
||||
int snd_async_add_handler(snd_async_handler_t **handler, int fd,
|
||||
snd_async_callback_t callback, void *private_data);
|
||||
int snd_async_del_handler(snd_async_handler_t *handler);
|
||||
int snd_async_handler_get_fd(snd_async_handler_t *handler);
|
||||
int snd_async_handler_get_signo(snd_async_handler_t *handler);
|
||||
void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
|
||||
|
||||
struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
|
||||
struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
|
||||
int snd_shm_area_destroy(struct snd_shm_area *area);
|
||||
|
||||
int snd_user_file(const char *file, char **result);
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
struct timeval {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_usec; /* microseconds */
|
||||
};
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_nsec; /* nanoseconds */
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Timestamp */
|
||||
typedef struct timeval snd_timestamp_t;
|
||||
/** Hi-res timestamp */
|
||||
typedef struct timespec snd_htimestamp_t;
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_GLOBAL_H */
|
172
raylib/external/alsa/hwdep.h
vendored
172
raylib/external/alsa/hwdep.h
vendored
|
@ -1,172 +0,0 @@
|
|||
/**
|
||||
* \file include/hwdep.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_HWDEP_H
|
||||
#define __ALSA_HWDEP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup HwDep Hardware Dependant Interface
|
||||
* The Hardware Dependant Interface.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
|
||||
|
||||
/** HwDep information container */
|
||||
typedef struct _snd_hwdep_info snd_hwdep_info_t;
|
||||
|
||||
/** HwDep DSP status container */
|
||||
typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
|
||||
|
||||
/** HwDep DSP image container */
|
||||
typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
|
||||
|
||||
/** HwDep interface */
|
||||
typedef enum _snd_hwdep_iface {
|
||||
SND_HWDEP_IFACE_OPL2 = 0, /**< OPL2 raw driver */
|
||||
SND_HWDEP_IFACE_OPL3, /**< OPL3 raw driver */
|
||||
SND_HWDEP_IFACE_OPL4, /**< OPL4 raw driver */
|
||||
SND_HWDEP_IFACE_SB16CSP, /**< SB16CSP driver */
|
||||
SND_HWDEP_IFACE_EMU10K1, /**< EMU10K1 driver */
|
||||
SND_HWDEP_IFACE_YSS225, /**< YSS225 driver */
|
||||
SND_HWDEP_IFACE_ICS2115, /**< ICS2115 driver */
|
||||
SND_HWDEP_IFACE_SSCAPE, /**< Ensoniq SoundScape ISA card (MC68EC000) */
|
||||
SND_HWDEP_IFACE_VX, /**< Digigram VX cards */
|
||||
SND_HWDEP_IFACE_MIXART, /**< Digigram miXart cards */
|
||||
SND_HWDEP_IFACE_USX2Y, /**< Tascam US122, US224 & US428 usb */
|
||||
SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
|
||||
SND_HWDEP_IFACE_BLUETOOTH, /**< Bluetooth audio */
|
||||
SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */
|
||||
SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */
|
||||
SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */
|
||||
SND_HWDEP_IFACE_HDA, /**< HD-audio */
|
||||
SND_HWDEP_IFACE_USB_STREAM, /**< direct access to usb stream */
|
||||
SND_HWDEP_IFACE_FW_DICE, /**< TC DICE FireWire device */
|
||||
SND_HWDEP_IFACE_FW_FIREWORKS, /**< Echo Audio Fireworks based device */
|
||||
SND_HWDEP_IFACE_FW_BEBOB, /**< BridgeCo BeBoB based device */
|
||||
SND_HWDEP_IFACE_FW_OXFW, /**< Oxford OXFW970/971 based device */
|
||||
SND_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
|
||||
SND_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
|
||||
SND_HWDEP_IFACE_LINE6, /* Line6 USB processors */
|
||||
SND_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */
|
||||
SND_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */
|
||||
|
||||
SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_FW_FIREFACE, /**< last known hwdep interface */
|
||||
} snd_hwdep_iface_t;
|
||||
|
||||
/** open for reading */
|
||||
#define SND_HWDEP_OPEN_READ (O_RDONLY)
|
||||
/** open for writing */
|
||||
#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
|
||||
/** open for reading and writing */
|
||||
#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
|
||||
/** open mode flag: open in nonblock mode */
|
||||
#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
|
||||
|
||||
/** HwDep handle type */
|
||||
typedef enum _snd_hwdep_type {
|
||||
/** Kernel level HwDep */
|
||||
SND_HWDEP_TYPE_HW,
|
||||
/** Shared memory client HwDep (not yet implemented) */
|
||||
SND_HWDEP_TYPE_SHM,
|
||||
/** INET client HwDep (not yet implemented) */
|
||||
SND_HWDEP_TYPE_INET
|
||||
} snd_hwdep_type_t;
|
||||
|
||||
/** HwDep handle */
|
||||
typedef struct _snd_hwdep snd_hwdep_t;
|
||||
|
||||
int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
|
||||
int snd_hwdep_close(snd_hwdep_t *hwdep);
|
||||
int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
|
||||
int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep);
|
||||
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
|
||||
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
|
||||
int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
|
||||
int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
|
||||
int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
|
||||
ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
|
||||
ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
|
||||
|
||||
size_t snd_hwdep_info_sizeof(void);
|
||||
/** allocate #snd_hwdep_info_t container on stack */
|
||||
#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
|
||||
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
|
||||
void snd_hwdep_info_free(snd_hwdep_info_t *obj);
|
||||
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
|
||||
|
||||
unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
|
||||
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
|
||||
const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
|
||||
const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
|
||||
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
|
||||
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);
|
||||
|
||||
size_t snd_hwdep_dsp_status_sizeof(void);
|
||||
/** allocate #snd_hwdep_dsp_status_t container on stack */
|
||||
#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
|
||||
int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
|
||||
void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
|
||||
void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
|
||||
|
||||
unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
|
||||
const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
|
||||
unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
|
||||
unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
|
||||
unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);
|
||||
|
||||
size_t snd_hwdep_dsp_image_sizeof(void);
|
||||
/** allocate #snd_hwdep_dsp_image_t container on stack */
|
||||
#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
|
||||
int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
|
||||
void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
|
||||
void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
|
||||
|
||||
unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
|
||||
const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
|
||||
const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
|
||||
size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);
|
||||
|
||||
void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
|
||||
void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
|
||||
void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
|
||||
void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_HWDEP_H */
|
||||
|
83
raylib/external/alsa/input.h
vendored
83
raylib/external/alsa/input.h
vendored
|
@ -1,83 +0,0 @@
|
|||
/**
|
||||
* \file include/input.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_INPUT_H
|
||||
#define __ALSA_INPUT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Input Input Interface
|
||||
*
|
||||
* The input functions present an interface similar to the stdio functions
|
||||
* on top of different underlying input sources.
|
||||
*
|
||||
* The #snd_config_load function uses such an input handle to be able to
|
||||
* load configurations not only from standard files but also from other
|
||||
* sources, e.g. from memory buffers.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Internal structure for an input object.
|
||||
*
|
||||
* The ALSA library uses a pointer to this structure as a handle to an
|
||||
* input object. Applications don't access its contents directly.
|
||||
*/
|
||||
typedef struct _snd_input snd_input_t;
|
||||
|
||||
/** Input type. */
|
||||
typedef enum _snd_input_type {
|
||||
/** Input from a stdio stream. */
|
||||
SND_INPUT_STDIO,
|
||||
/** Input from a memory buffer. */
|
||||
SND_INPUT_BUFFER
|
||||
} snd_input_type_t;
|
||||
|
||||
int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode);
|
||||
int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close);
|
||||
int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, ssize_t size);
|
||||
int snd_input_close(snd_input_t *input);
|
||||
int snd_input_scanf(snd_input_t *input, const char *format, ...)
|
||||
#ifndef DOC_HIDDEN
|
||||
__attribute__ ((format (scanf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
char *snd_input_gets(snd_input_t *input, char *str, size_t size);
|
||||
int snd_input_getc(snd_input_t *input);
|
||||
int snd_input_ungetc(snd_input_t *input, int c);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_INPUT_H */
|
317
raylib/external/alsa/mixer.h
vendored
317
raylib/external/alsa/mixer.h
vendored
|
@ -1,317 +0,0 @@
|
|||
/**
|
||||
* \file include/mixer.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_MIXER_H
|
||||
#define __ALSA_MIXER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Mixer Mixer Interface
|
||||
* The mixer interface.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Mixer handle */
|
||||
typedef struct _snd_mixer snd_mixer_t;
|
||||
/** Mixer elements class handle */
|
||||
typedef struct _snd_mixer_class snd_mixer_class_t;
|
||||
/** Mixer element handle */
|
||||
typedef struct _snd_mixer_elem snd_mixer_elem_t;
|
||||
|
||||
/**
|
||||
* \brief Mixer callback function
|
||||
* \param mixer Mixer handle
|
||||
* \param mask event mask
|
||||
* \param elem related mixer element (if any)
|
||||
* \return 0 on success otherwise a negative error code
|
||||
*/
|
||||
typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
|
||||
unsigned int mask,
|
||||
snd_mixer_elem_t *elem);
|
||||
|
||||
/**
|
||||
* \brief Mixer element callback function
|
||||
* \param elem Mixer element
|
||||
* \param mask event mask
|
||||
* \return 0 on success otherwise a negative error code
|
||||
*/
|
||||
typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
|
||||
unsigned int mask);
|
||||
|
||||
/**
|
||||
* \brief Compare function for sorting mixer elements
|
||||
* \param e1 First element
|
||||
* \param e2 Second element
|
||||
* \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
|
||||
*/
|
||||
typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
|
||||
const snd_mixer_elem_t *e2);
|
||||
|
||||
/**
|
||||
* \brief Event callback for the mixer class
|
||||
* \param class_ Mixer class
|
||||
* \param mask Event mask (SND_CTL_EVENT_*)
|
||||
* \param helem HCTL element which invoked the event
|
||||
* \param melem Mixer element associated to HCTL element
|
||||
* \return zero if success, otherwise a negative error value
|
||||
*/
|
||||
typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
|
||||
snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
|
||||
|
||||
|
||||
/** Mixer element type */
|
||||
typedef enum _snd_mixer_elem_type {
|
||||
/* Simple mixer elements */
|
||||
SND_MIXER_ELEM_SIMPLE,
|
||||
SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
|
||||
} snd_mixer_elem_type_t;
|
||||
|
||||
int snd_mixer_open(snd_mixer_t **mixer, int mode);
|
||||
int snd_mixer_close(snd_mixer_t *mixer);
|
||||
snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
|
||||
snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
|
||||
int snd_mixer_handle_events(snd_mixer_t *mixer);
|
||||
int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
|
||||
int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
|
||||
int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
|
||||
int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
|
||||
int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
|
||||
int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
|
||||
int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
|
||||
int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
int snd_mixer_load(snd_mixer_t *mixer);
|
||||
void snd_mixer_free(snd_mixer_t *mixer);
|
||||
int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
|
||||
int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
|
||||
void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
|
||||
void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
|
||||
void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
|
||||
unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
|
||||
int snd_mixer_class_unregister(snd_mixer_class_t *clss);
|
||||
|
||||
snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
|
||||
snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
|
||||
void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
|
||||
void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
|
||||
void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
|
||||
snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
|
||||
|
||||
int snd_mixer_class_register(snd_mixer_class_t *class_, snd_mixer_t *mixer);
|
||||
int snd_mixer_elem_new(snd_mixer_elem_t **elem,
|
||||
snd_mixer_elem_type_t type,
|
||||
int compare_weight,
|
||||
void *private_data,
|
||||
void (*private_free)(snd_mixer_elem_t *elem));
|
||||
int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class_);
|
||||
int snd_mixer_elem_remove(snd_mixer_elem_t *elem);
|
||||
void snd_mixer_elem_free(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_elem_info(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_elem_value(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_elem_attach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
|
||||
int snd_mixer_elem_detach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
|
||||
int snd_mixer_elem_empty(snd_mixer_elem_t *melem);
|
||||
void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
|
||||
|
||||
size_t snd_mixer_class_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_mixer_class_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
|
||||
int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
|
||||
void snd_mixer_class_free(snd_mixer_class_t *obj);
|
||||
void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
|
||||
snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *class_);
|
||||
snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *class_);
|
||||
void *snd_mixer_class_get_private(const snd_mixer_class_t *class_);
|
||||
snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *class_);
|
||||
int snd_mixer_class_set_event(snd_mixer_class_t *class_, snd_mixer_event_t event);
|
||||
int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
|
||||
int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *));
|
||||
int snd_mixer_class_set_compare(snd_mixer_class_t *class_, snd_mixer_compare_t compare);
|
||||
|
||||
/**
|
||||
* \defgroup SimpleMixer Simple Mixer Interface
|
||||
* \ingroup Mixer
|
||||
* The simple mixer interface.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/* Simple mixer elements API */
|
||||
|
||||
/** Mixer simple element channel identifier */
|
||||
typedef enum _snd_mixer_selem_channel_id {
|
||||
/** Unknown */
|
||||
SND_MIXER_SCHN_UNKNOWN = -1,
|
||||
/** Front left */
|
||||
SND_MIXER_SCHN_FRONT_LEFT = 0,
|
||||
/** Front right */
|
||||
SND_MIXER_SCHN_FRONT_RIGHT,
|
||||
/** Rear left */
|
||||
SND_MIXER_SCHN_REAR_LEFT,
|
||||
/** Rear right */
|
||||
SND_MIXER_SCHN_REAR_RIGHT,
|
||||
/** Front center */
|
||||
SND_MIXER_SCHN_FRONT_CENTER,
|
||||
/** Woofer */
|
||||
SND_MIXER_SCHN_WOOFER,
|
||||
/** Side Left */
|
||||
SND_MIXER_SCHN_SIDE_LEFT,
|
||||
/** Side Right */
|
||||
SND_MIXER_SCHN_SIDE_RIGHT,
|
||||
/** Rear Center */
|
||||
SND_MIXER_SCHN_REAR_CENTER,
|
||||
SND_MIXER_SCHN_LAST = 31,
|
||||
/** Mono (Front left alias) */
|
||||
SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
|
||||
} snd_mixer_selem_channel_id_t;
|
||||
|
||||
/** Mixer simple element - register options - abstraction level */
|
||||
enum snd_mixer_selem_regopt_abstract {
|
||||
/** no abstraction - try use all universal controls from driver */
|
||||
SND_MIXER_SABSTRACT_NONE = 0,
|
||||
/** basic abstraction - Master,PCM,CD,Aux,Record-Gain etc. */
|
||||
SND_MIXER_SABSTRACT_BASIC,
|
||||
};
|
||||
|
||||
/** Mixer simple element - register options */
|
||||
struct snd_mixer_selem_regopt {
|
||||
/** structure version */
|
||||
int ver;
|
||||
/** v1: abstract layer selection */
|
||||
enum snd_mixer_selem_regopt_abstract abstract;
|
||||
/** v1: device name (must be NULL when playback_pcm or capture_pcm != NULL) */
|
||||
const char *device;
|
||||
/** v1: playback PCM connected to mixer device (NULL == none) */
|
||||
snd_pcm_t *playback_pcm;
|
||||
/** v1: capture PCM connected to mixer device (NULL == none) */
|
||||
snd_pcm_t *capture_pcm;
|
||||
};
|
||||
|
||||
/** Mixer simple element identifier */
|
||||
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
|
||||
|
||||
const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
|
||||
|
||||
int snd_mixer_selem_register(snd_mixer_t *mixer,
|
||||
struct snd_mixer_selem_regopt *options,
|
||||
snd_mixer_class_t **classp);
|
||||
void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
|
||||
snd_mixer_selem_id_t *id);
|
||||
const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
|
||||
unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
|
||||
snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
|
||||
const snd_mixer_selem_id_t *id);
|
||||
|
||||
int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
|
||||
int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
|
||||
int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
|
||||
|
||||
int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
|
||||
int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
|
||||
int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
|
||||
int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
|
||||
int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
|
||||
int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
|
||||
int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
|
||||
int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
|
||||
int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
|
||||
int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
|
||||
int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
|
||||
int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
|
||||
int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
|
||||
int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
|
||||
int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
|
||||
int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
|
||||
int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
|
||||
int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
|
||||
int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
|
||||
long *min, long *max);
|
||||
int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
|
||||
long *min, long *max);
|
||||
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
|
||||
long min, long max);
|
||||
int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
|
||||
long *min, long *max);
|
||||
int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
|
||||
long *min, long *max);
|
||||
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
|
||||
long min, long max);
|
||||
|
||||
int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem);
|
||||
int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
|
||||
int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
|
||||
int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx);
|
||||
|
||||
size_t snd_mixer_selem_id_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
|
||||
int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
|
||||
void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
|
||||
void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
|
||||
const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
|
||||
unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
|
||||
void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
|
||||
void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
|
||||
|
||||
/** \} */
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_MIXER_H */
|
||||
|
112
raylib/external/alsa/mixer_abst.h
vendored
112
raylib/external/alsa/mixer_abst.h
vendored
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* \file include/mixer_abst.h
|
||||
* \brief Mixer abstract implementation interface library for the ALSA library
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \date 2005
|
||||
*
|
||||
* Mixer abstact implementation interface library for the ALSA library
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_MIXER_ABST_H
|
||||
#define __ALSA_MIXER_ABST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Mixer_Abstract Mixer Abstact Module Interface
|
||||
* The mixer abstact module interface.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define SM_PLAY 0
|
||||
#define SM_CAPT 1
|
||||
|
||||
#define SM_CAP_GVOLUME (1<<1)
|
||||
#define SM_CAP_GSWITCH (1<<2)
|
||||
#define SM_CAP_PVOLUME (1<<3)
|
||||
#define SM_CAP_PVOLUME_JOIN (1<<4)
|
||||
#define SM_CAP_PSWITCH (1<<5)
|
||||
#define SM_CAP_PSWITCH_JOIN (1<<6)
|
||||
#define SM_CAP_CVOLUME (1<<7)
|
||||
#define SM_CAP_CVOLUME_JOIN (1<<8)
|
||||
#define SM_CAP_CSWITCH (1<<9)
|
||||
#define SM_CAP_CSWITCH_JOIN (1<<10)
|
||||
#define SM_CAP_CSWITCH_EXCL (1<<11)
|
||||
#define SM_CAP_PENUM (1<<12)
|
||||
#define SM_CAP_CENUM (1<<13)
|
||||
/* SM_CAP_* 24-31 => private for module use */
|
||||
|
||||
#define SM_OPS_IS_ACTIVE 0
|
||||
#define SM_OPS_IS_MONO 1
|
||||
#define SM_OPS_IS_CHANNEL 2
|
||||
#define SM_OPS_IS_ENUMERATED 3
|
||||
#define SM_OPS_IS_ENUMCNT 4
|
||||
|
||||
#define sm_selem(x) ((sm_selem_t *)((x)->private_data))
|
||||
#define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
|
||||
|
||||
typedef struct _sm_selem {
|
||||
snd_mixer_selem_id_t *id;
|
||||
struct sm_elem_ops *ops;
|
||||
unsigned int caps;
|
||||
unsigned int capture_group;
|
||||
} sm_selem_t;
|
||||
|
||||
typedef struct _sm_class_basic {
|
||||
char *device;
|
||||
snd_ctl_t *ctl;
|
||||
snd_hctl_t *hctl;
|
||||
snd_ctl_card_info_t *info;
|
||||
} sm_class_basic_t;
|
||||
|
||||
struct sm_elem_ops {
|
||||
int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
|
||||
int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
|
||||
int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);
|
||||
int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
|
||||
int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue);
|
||||
int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir);
|
||||
int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
|
||||
int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value);
|
||||
int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir);
|
||||
int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value);
|
||||
int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value);
|
||||
int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf);
|
||||
int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp);
|
||||
int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item);
|
||||
};
|
||||
|
||||
int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
|
||||
|
||||
int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info);
|
||||
void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
|
||||
void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
|
||||
void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_MIXER_ABST_H */
|
||||
|
86
raylib/external/alsa/output.h
vendored
86
raylib/external/alsa/output.h
vendored
|
@ -1,86 +0,0 @@
|
|||
/**
|
||||
* \file include/output.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_OUTPUT_H
|
||||
#define __ALSA_OUTPUT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Output Output Interface
|
||||
*
|
||||
* The output functions present an interface similar to the stdio functions
|
||||
* on top of different underlying output destinations.
|
||||
*
|
||||
* Many PCM debugging functions (\c snd_pcm_xxx_dump_xxx) use such an output
|
||||
* handle to be able to write not only to the screen but also to other
|
||||
* destinations, e.g. to files or to memory buffers.
|
||||
*
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Internal structure for an output object.
|
||||
*
|
||||
* The ALSA library uses a pointer to this structure as a handle to an
|
||||
* output object. Applications don't access its contents directly.
|
||||
*/
|
||||
typedef struct _snd_output snd_output_t;
|
||||
|
||||
/** Output type. */
|
||||
typedef enum _snd_output_type {
|
||||
/** Output to a stdio stream. */
|
||||
SND_OUTPUT_STDIO,
|
||||
/** Output to a memory buffer. */
|
||||
SND_OUTPUT_BUFFER
|
||||
} snd_output_type_t;
|
||||
|
||||
int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode);
|
||||
int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close);
|
||||
int snd_output_buffer_open(snd_output_t **outputp);
|
||||
size_t snd_output_buffer_string(snd_output_t *output, char **buf);
|
||||
int snd_output_close(snd_output_t *output);
|
||||
int snd_output_printf(snd_output_t *output, const char *format, ...)
|
||||
#ifndef DOC_HIDDEN
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
|
||||
int snd_output_puts(snd_output_t *output, const char *str);
|
||||
int snd_output_putc(snd_output_t *output, int c);
|
||||
int snd_output_flush(snd_output_t *output);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_OUTPUT_H */
|
||||
|
1329
raylib/external/alsa/pcm.h
vendored
1329
raylib/external/alsa/pcm.h
vendored
File diff suppressed because it is too large
Load diff
70
raylib/external/alsa/pcm_external.h
vendored
70
raylib/external/alsa/pcm_external.h
vendored
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* \file include/pcm_external.h
|
||||
* \brief External PCM plugin SDK
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 2005
|
||||
*
|
||||
* Extern PCM plugin SDK.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef __ALSA_PCM_EXTERNAL_H
|
||||
#define __ALSA_PCM_EXTERNAL_H
|
||||
|
||||
#include "pcm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Plugin_SDK External PCM plugin SDK
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define the object entry for external PCM plugins
|
||||
*/
|
||||
#define SND_PCM_PLUGIN_ENTRY(name) _snd_pcm_##name##_open
|
||||
|
||||
/**
|
||||
* Define the symbols of the given plugin with versions
|
||||
*/
|
||||
#define SND_PCM_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_PCM_PLUGIN_ENTRY(name), SND_PCM_DLSYM_VERSION);
|
||||
|
||||
/**
|
||||
* Define the plugin
|
||||
*/
|
||||
#define SND_PCM_PLUGIN_DEFINE_FUNC(plugin) \
|
||||
int SND_PCM_PLUGIN_ENTRY(plugin) (snd_pcm_t **pcmp, const char *name,\
|
||||
snd_config_t *root, snd_config_t *conf, \
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
|
||||
#include "pcm_ioplug.h"
|
||||
#include "pcm_extplug.h"
|
||||
|
||||
int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
|
||||
int *cchannelsp, int *hwctlp);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_PCM_EXTERNAL_H */
|
206
raylib/external/alsa/pcm_extplug.h
vendored
206
raylib/external/alsa/pcm_extplug.h
vendored
|
@ -1,206 +0,0 @@
|
|||
/**
|
||||
* \file include/pcm_extplug.h
|
||||
* \brief External Filter-Plugin SDK
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 2005
|
||||
*
|
||||
* External Filter-Plugin SDK
|
||||
*/
|
||||
|
||||
/*
|
||||
* ALSA external PCM plugin SDK (draft version)
|
||||
*
|
||||
* Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_PCM_EXTPLUG_H
|
||||
#define __ALSA_PCM_EXTPLUG_H
|
||||
|
||||
/**
|
||||
* \defgroup PCM_ExtPlug External Filter plugin SDK
|
||||
* \ingroup Plugin_SDK
|
||||
* See the \ref pcm page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** hw constraints for extplug */
|
||||
enum {
|
||||
SND_PCM_EXTPLUG_HW_FORMAT, /**< format */
|
||||
SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */
|
||||
SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */
|
||||
};
|
||||
|
||||
/** Handle of external filter plugin */
|
||||
typedef struct snd_pcm_extplug snd_pcm_extplug_t;
|
||||
/** Callback table of extplug */
|
||||
typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
|
||||
#ifdef DOC_HIDDEN
|
||||
/* redefine typedefs for stupid doxygen */
|
||||
typedef snd_pcm_extplug snd_pcm_extplug_t;
|
||||
typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Protocol version
|
||||
*/
|
||||
#define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */
|
||||
#define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */
|
||||
#define SND_PCM_EXTPLUG_VERSION_TINY 2 /**< Protocol tiny version */
|
||||
/**
|
||||
* Filter-plugin protocol version
|
||||
*/
|
||||
#define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
|
||||
(SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
|
||||
(SND_PCM_EXTPLUG_VERSION_TINY))
|
||||
|
||||
/** Handle of extplug */
|
||||
struct snd_pcm_extplug {
|
||||
/**
|
||||
* protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here
|
||||
* before calling #snd_pcm_extplug_create()
|
||||
*/
|
||||
unsigned int version;
|
||||
/**
|
||||
* name of this plugin; must be filled before calling #snd_pcm_extplug_create()
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
* callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create()
|
||||
*/
|
||||
const snd_pcm_extplug_callback_t *callback;
|
||||
/**
|
||||
* private data, which can be used freely in the driver callbacks
|
||||
*/
|
||||
void *private_data;
|
||||
/**
|
||||
* PCM handle filled by #snd_pcm_extplug_create()
|
||||
*/
|
||||
snd_pcm_t *pcm;
|
||||
/**
|
||||
* stream direction; read-only status
|
||||
*/
|
||||
snd_pcm_stream_t stream;
|
||||
/**
|
||||
* format hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
snd_pcm_format_t format;
|
||||
/**
|
||||
* subformat hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
snd_pcm_subformat_t subformat;
|
||||
/**
|
||||
* channels hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
unsigned int channels;
|
||||
/**
|
||||
* rate hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
unsigned int rate;
|
||||
/**
|
||||
* slave_format hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
snd_pcm_format_t slave_format;
|
||||
/**
|
||||
* slave_subformat hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
snd_pcm_subformat_t slave_subformat;
|
||||
/**
|
||||
* slave_channels hw parameter; filled after hw_params is caled
|
||||
*/
|
||||
unsigned int slave_channels;
|
||||
};
|
||||
|
||||
/** Callback table of extplug */
|
||||
struct snd_pcm_extplug_callback {
|
||||
/**
|
||||
* transfer between source and destination; this is a required callback
|
||||
*/
|
||||
snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
|
||||
const snd_pcm_channel_area_t *dst_areas,
|
||||
snd_pcm_uframes_t dst_offset,
|
||||
const snd_pcm_channel_area_t *src_areas,
|
||||
snd_pcm_uframes_t src_offset,
|
||||
snd_pcm_uframes_t size);
|
||||
/**
|
||||
* close the PCM; optional
|
||||
*/
|
||||
int (*close)(snd_pcm_extplug_t *ext);
|
||||
/**
|
||||
* hw_params; optional
|
||||
*/
|
||||
int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
|
||||
/**
|
||||
* hw_free; optional
|
||||
*/
|
||||
int (*hw_free)(snd_pcm_extplug_t *ext);
|
||||
/**
|
||||
* dump; optional
|
||||
*/
|
||||
void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
|
||||
/**
|
||||
* init; optional initialization called at prepare or reset
|
||||
*/
|
||||
int (*init)(snd_pcm_extplug_t *ext);
|
||||
/**
|
||||
* query the channel maps; optional; since v1.0.2
|
||||
*/
|
||||
snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);
|
||||
/**
|
||||
* get the channel map; optional; since v1.0.2
|
||||
*/
|
||||
snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);
|
||||
/**
|
||||
* set the channel map; optional; since v1.0.2
|
||||
*/
|
||||
int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);
|
||||
};
|
||||
|
||||
|
||||
int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
|
||||
snd_config_t *root, snd_config_t *slave_conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
|
||||
|
||||
/* clear hw_parameter setting */
|
||||
void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
|
||||
|
||||
/* hw_parameter setting */
|
||||
int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
|
||||
int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
|
||||
int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
|
||||
int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
|
||||
|
||||
/**
|
||||
* set the parameter constraint with a single value
|
||||
*/
|
||||
static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
|
||||
{
|
||||
return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the parameter constraint for slave PCM with a single value
|
||||
*/
|
||||
static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
|
||||
{
|
||||
return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __ALSA_PCM_EXTPLUG_H */
|
234
raylib/external/alsa/pcm_ioplug.h
vendored
234
raylib/external/alsa/pcm_ioplug.h
vendored
|
@ -1,234 +0,0 @@
|
|||
/**
|
||||
* \file include/pcm_ioplug.h
|
||||
* \brief External I/O-Plugin SDK
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 2005
|
||||
*
|
||||
* External I/O-Plugin SDK
|
||||
*/
|
||||
|
||||
/*
|
||||
* ALSA external PCM plugin SDK
|
||||
*
|
||||
* Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_PCM_IOPLUG_H
|
||||
#define __ALSA_PCM_IOPLUG_H
|
||||
|
||||
/**
|
||||
* \defgroup PCM_IOPlug External I/O plugin SDK
|
||||
* \ingroup Plugin_SDK
|
||||
* See the \ref pcm page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** hw constraints for ioplug */
|
||||
enum {
|
||||
SND_PCM_IOPLUG_HW_ACCESS = 0, /**< access type */
|
||||
SND_PCM_IOPLUG_HW_FORMAT, /**< format */
|
||||
SND_PCM_IOPLUG_HW_CHANNELS, /**< channels */
|
||||
SND_PCM_IOPLUG_HW_RATE, /**< rate */
|
||||
SND_PCM_IOPLUG_HW_PERIOD_BYTES, /**< period bytes */
|
||||
SND_PCM_IOPLUG_HW_BUFFER_BYTES, /**< buffer bytes */
|
||||
SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */
|
||||
SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */
|
||||
};
|
||||
|
||||
/** I/O plugin handle */
|
||||
typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
|
||||
/** Callback table of ioplug */
|
||||
typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
|
||||
#ifdef DOC_HIDDEN
|
||||
/* redefine typedefs for stupid doxygen */
|
||||
typedef snd_pcm_ioplug snd_pcm_ioplug_t;
|
||||
typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* bit flags for additional conditions
|
||||
*/
|
||||
#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0) /**< list up this PCM */
|
||||
#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1) /**< monotonic timestamps */
|
||||
|
||||
/*
|
||||
* Protocol version
|
||||
*/
|
||||
#define SND_PCM_IOPLUG_VERSION_MAJOR 1 /**< Protocol major version */
|
||||
#define SND_PCM_IOPLUG_VERSION_MINOR 0 /**< Protocol minor version */
|
||||
#define SND_PCM_IOPLUG_VERSION_TINY 2 /**< Protocol tiny version */
|
||||
/**
|
||||
* IO-plugin protocol version
|
||||
*/
|
||||
#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
|
||||
(SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
|
||||
(SND_PCM_IOPLUG_VERSION_TINY))
|
||||
|
||||
/** Handle of ioplug */
|
||||
struct snd_pcm_ioplug {
|
||||
/**
|
||||
* protocol version; #SND_PCM_IOPLUG_VERSION must be filled here
|
||||
* before calling #snd_pcm_ioplug_create()
|
||||
*/
|
||||
unsigned int version;
|
||||
/**
|
||||
* name of this plugin; must be filled before calling #snd_pcm_ioplug_create()
|
||||
*/
|
||||
const char *name;
|
||||
unsigned int flags; /**< SND_PCM_IOPLUG_FLAG_XXX */
|
||||
int poll_fd; /**< poll file descriptor */
|
||||
unsigned int poll_events; /**< poll events */
|
||||
unsigned int mmap_rw; /**< pseudo mmap mode */
|
||||
/**
|
||||
* callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
|
||||
*/
|
||||
const snd_pcm_ioplug_callback_t *callback;
|
||||
/**
|
||||
* private data, which can be used freely in the driver callbacks
|
||||
*/
|
||||
void *private_data;
|
||||
/**
|
||||
* PCM handle filled by #snd_pcm_extplug_create()
|
||||
*/
|
||||
snd_pcm_t *pcm;
|
||||
|
||||
snd_pcm_stream_t stream; /**< stream direcion; read-only */
|
||||
snd_pcm_state_t state; /**< current PCM state; read-only */
|
||||
volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */
|
||||
volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */
|
||||
int nonblock; /**< non-block mode; read-only */
|
||||
|
||||
snd_pcm_access_t access; /**< access type; filled after hw_params is called */
|
||||
snd_pcm_format_t format; /**< PCM format; filled after hw_params is called */
|
||||
unsigned int channels; /**< number of channels; filled after hw_params is called */
|
||||
unsigned int rate; /**< rate; filled after hw_params is called */
|
||||
snd_pcm_uframes_t period_size; /**< period size; filled after hw_params is called */
|
||||
snd_pcm_uframes_t buffer_size; /**< buffer size; filled after hw_params is called */
|
||||
};
|
||||
|
||||
/** Callback table of ioplug */
|
||||
struct snd_pcm_ioplug_callback {
|
||||
/**
|
||||
* start the PCM; required, called inside mutex lock
|
||||
*/
|
||||
int (*start)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* stop the PCM; required, called inside mutex lock
|
||||
*/
|
||||
int (*stop)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* get the current DMA position; required, called inside mutex lock
|
||||
*/
|
||||
snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* transfer the data; optional, called inside mutex lock
|
||||
*/
|
||||
snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
|
||||
const snd_pcm_channel_area_t *areas,
|
||||
snd_pcm_uframes_t offset,
|
||||
snd_pcm_uframes_t size);
|
||||
/**
|
||||
* close the PCM; optional
|
||||
*/
|
||||
int (*close)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* hw_params; optional
|
||||
*/
|
||||
int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
|
||||
/**
|
||||
* hw_free; optional
|
||||
*/
|
||||
int (*hw_free)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* sw_params; optional
|
||||
*/
|
||||
int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
|
||||
/**
|
||||
* prepare; optional
|
||||
*/
|
||||
int (*prepare)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* drain; optional
|
||||
*/
|
||||
int (*drain)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* toggle pause; optional, called inside mutex lock
|
||||
*/
|
||||
int (*pause)(snd_pcm_ioplug_t *io, int enable);
|
||||
/**
|
||||
* resume; optional
|
||||
*/
|
||||
int (*resume)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* poll descriptors count; optional
|
||||
*/
|
||||
int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* poll descriptors; optional
|
||||
*/
|
||||
int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
|
||||
/**
|
||||
* mangle poll events; optional
|
||||
*/
|
||||
int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
|
||||
/**
|
||||
* dump; optional
|
||||
*/
|
||||
void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
|
||||
/**
|
||||
* get the delay for the running PCM; optional; since v1.0.1
|
||||
*/
|
||||
int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
|
||||
/**
|
||||
* query the channel maps; optional; since v1.0.2
|
||||
*/
|
||||
snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* get the channel map; optional; since v1.0.2
|
||||
*/
|
||||
snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
|
||||
/**
|
||||
* set the channel map; optional; since v1.0.2
|
||||
*/
|
||||
int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
|
||||
};
|
||||
|
||||
|
||||
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
|
||||
|
||||
/* update poll_fd and mmap_rw */
|
||||
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
|
||||
|
||||
/* get a mmap area (for mmap_rw only) */
|
||||
const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
|
||||
|
||||
/* clear hw_parameter setting */
|
||||
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
|
||||
|
||||
/* hw_parameter setting */
|
||||
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
|
||||
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
|
||||
|
||||
/* change PCM status */
|
||||
int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __ALSA_PCM_IOPLUG_H */
|
230
raylib/external/alsa/pcm_old.h
vendored
230
raylib/external/alsa/pcm_old.h
vendored
|
@ -1,230 +0,0 @@
|
|||
/*
|
||||
* Old ALSA 0.9.x API
|
||||
*/
|
||||
|
||||
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
|
||||
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
|
||||
snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
|
||||
void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
|
||||
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
|
||||
snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
|
||||
void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
|
||||
int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
|
||||
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
|
||||
void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
|
||||
unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
|
||||
unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
|
||||
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
|
||||
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
|
||||
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
|
||||
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
|
||||
unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
|
||||
unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
|
||||
unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
|
||||
int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
|
||||
unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9");
|
||||
|
||||
snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
|
||||
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
|
||||
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
|
||||
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
|
||||
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
|
||||
unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
|
||||
unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9");
|
||||
|
||||
snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
|
||||
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
|
||||
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
|
||||
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
|
||||
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
|
||||
asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9");
|
||||
asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9");
|
||||
|
||||
int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
|
||||
int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
|
||||
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
|
||||
unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
|
||||
|
||||
#endif /* ALSA_PCM_OLD_HW_PARAMS_API */
|
||||
|
||||
|
||||
#ifdef ALSA_PCM_OLD_SW_PARAMS_API
|
||||
|
||||
asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9");
|
||||
asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9");
|
||||
|
||||
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
|
||||
snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
|
||||
unsigned int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params);
|
||||
int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
|
||||
|
||||
#endif /* ALSA_PCM_OLD_SW_PARAMS_API */
|
202
raylib/external/alsa/pcm_plugin.h
vendored
202
raylib/external/alsa/pcm_plugin.h
vendored
|
@ -1,202 +0,0 @@
|
|||
/**
|
||||
* \file include/pcm_plugin.h
|
||||
* \brief Common PCM plugin code
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \date 2000-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver.
|
||||
* See the \ref pcm_plugins page for more details.
|
||||
*
|
||||
* \warning Using of contents of this header file might be dangerous
|
||||
* in the sense of compatibility reasons. The contents might be
|
||||
* freely changed in future.
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_PCM_PLUGIN_H
|
||||
|
||||
/**
|
||||
* \defgroup PCM_Plugins PCM Plugins
|
||||
* \ingroup PCM
|
||||
* See the \ref pcm_plugins page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
|
||||
#define SND_PCM_PLUGIN_RATE_MAX 192000 /**< maximal rate for the rate plugin */
|
||||
|
||||
/* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
|
||||
#ifdef HAVE_SOFT_FLOAT
|
||||
#define SND_PCM_PLUGIN_ROUTE_FLOAT 0 /**< use integers for route plugin */
|
||||
#else
|
||||
#define SND_PCM_PLUGIN_ROUTE_FLOAT 1 /**< use floats for route plugin */
|
||||
#endif
|
||||
|
||||
#define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
|
||||
|
||||
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||
/** route ttable entry type */
|
||||
typedef float snd_pcm_route_ttable_entry_t;
|
||||
#define SND_PCM_PLUGIN_ROUTE_HALF 0.5 /**< half value */
|
||||
#define SND_PCM_PLUGIN_ROUTE_FULL 1.0 /**< full value */
|
||||
#else
|
||||
/** route ttable entry type */
|
||||
typedef int snd_pcm_route_ttable_entry_t;
|
||||
#define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2) /**< half value */
|
||||
#define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION /**< full value */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hardware plugin
|
||||
*/
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
||||
int card, int device, int subdevice,
|
||||
snd_pcm_stream_t stream, int mode,
|
||||
int mmap_emulation, int sync_ptr_ioctl);
|
||||
int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Copy plugin
|
||||
*/
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear conversion plugin
|
||||
*/
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear<->Float conversion plugin
|
||||
*/
|
||||
int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear<->mu-Law conversion plugin
|
||||
*/
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear<->a-Law conversion plugin
|
||||
*/
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear<->Ima-ADPCM conversion plugin
|
||||
*/
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Route plugin for linear formats
|
||||
*/
|
||||
int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_csize, unsigned int tt_ssize,
|
||||
unsigned int *tt_cused, unsigned int *tt_sused,
|
||||
int schannels);
|
||||
int snd_pcm_route_determine_ttable(snd_config_t *tt,
|
||||
unsigned int *tt_csize,
|
||||
unsigned int *tt_ssize);
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, int schannels,
|
||||
snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_ssize,
|
||||
unsigned int tt_cused, unsigned int tt_sused,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Rate plugin for linear formats
|
||||
*/
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, unsigned int srate,
|
||||
const snd_config_t *converter,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Hooks plugin
|
||||
*/
|
||||
int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* LADSPA plugin
|
||||
*/
|
||||
int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
|
||||
const char *ladspa_path,
|
||||
unsigned int channels,
|
||||
snd_config_t *ladspa_pplugins,
|
||||
snd_config_t *ladspa_cplugins,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Jack plugin
|
||||
*/
|
||||
int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *playback_conf,
|
||||
snd_config_t *capture_conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __ALSA_PCM_PLUGIN_H */
|
156
raylib/external/alsa/pcm_rate.h
vendored
156
raylib/external/alsa/pcm_rate.h
vendored
|
@ -1,156 +0,0 @@
|
|||
/**
|
||||
* \file include/pcm_rate.h
|
||||
* \brief External Rate-Converter-Plugin SDK
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 2006
|
||||
*
|
||||
* External Rate-Converter-Plugin SDK
|
||||
*/
|
||||
|
||||
/*
|
||||
* ALSA external PCM rate-converter plugin SDK (draft version)
|
||||
*
|
||||
* Copyright (c) 2006 Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_PCM_RATE_H
|
||||
#define __ALSA_PCM_RATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Protocol version
|
||||
*/
|
||||
#define SND_PCM_RATE_PLUGIN_VERSION 0x010002
|
||||
|
||||
/** hw_params information for a single side */
|
||||
typedef struct snd_pcm_rate_side_info {
|
||||
snd_pcm_format_t format;
|
||||
unsigned int rate;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_uframes_t period_size;
|
||||
} snd_pcm_rate_side_info_t;
|
||||
|
||||
/** hw_params information */
|
||||
typedef struct snd_pcm_rate_info {
|
||||
struct snd_pcm_rate_side_info in;
|
||||
struct snd_pcm_rate_side_info out;
|
||||
unsigned int channels;
|
||||
} snd_pcm_rate_info_t;
|
||||
|
||||
/** Callback table of rate-converter */
|
||||
typedef struct snd_pcm_rate_ops {
|
||||
/**
|
||||
* close the converter; optional
|
||||
*/
|
||||
void (*close)(void *obj);
|
||||
/**
|
||||
* initialize the converter, called at hw_params
|
||||
*/
|
||||
int (*init)(void *obj, snd_pcm_rate_info_t *info);
|
||||
/**
|
||||
* free the converter; optional
|
||||
*/
|
||||
void (*free)(void *obj);
|
||||
/**
|
||||
* reset the converter, called at prepare; optional
|
||||
*/
|
||||
void (*reset)(void *obj);
|
||||
/**
|
||||
* adjust the pitch, called at sw_params; optional
|
||||
*/
|
||||
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
|
||||
/**
|
||||
* convert the data
|
||||
*/
|
||||
void (*convert)(void *obj,
|
||||
const snd_pcm_channel_area_t *dst_areas,
|
||||
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
|
||||
const snd_pcm_channel_area_t *src_areas,
|
||||
snd_pcm_uframes_t src_offset, unsigned int src_frames);
|
||||
/**
|
||||
* convert an s16 interleaved-data array; exclusive with convert
|
||||
*/
|
||||
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
|
||||
const int16_t *src, unsigned int src_frames);
|
||||
/**
|
||||
* compute the frame size for input
|
||||
*/
|
||||
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
|
||||
/**
|
||||
* compute the frame size for output
|
||||
*/
|
||||
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
|
||||
/**
|
||||
* the protocol version the plugin supports;
|
||||
* new field since version 0x010002
|
||||
*/
|
||||
unsigned int version;
|
||||
/**
|
||||
* return the supported min / max sample rates;
|
||||
* new ops since version 0x010002
|
||||
*/
|
||||
int (*get_supported_rates)(void *obj, unsigned int *rate_min,
|
||||
unsigned int *rate_max);
|
||||
/**
|
||||
* show some status messages for verbose mode;
|
||||
* new ops since version 0x010002
|
||||
*/
|
||||
void (*dump)(void *obj, snd_output_t *out);
|
||||
} snd_pcm_rate_ops_t;
|
||||
|
||||
/** open function type */
|
||||
typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,
|
||||
snd_pcm_rate_ops_t *opsp);
|
||||
|
||||
typedef int (*snd_pcm_rate_open_conf_func_t)(unsigned int version, void **objp,
|
||||
snd_pcm_rate_ops_t *opsp, const snd_config_t *conf);
|
||||
|
||||
/**
|
||||
* Define the object entry for external PCM rate-converter plugins
|
||||
*/
|
||||
#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
|
||||
#define SND_PCM_RATE_PLUGIN_CONF_ENTRY(name) _snd_pcm_rate_##name##_open_conf
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
/* old rate_ops for protocol version 0x010001 */
|
||||
typedef struct snd_pcm_rate_old_ops {
|
||||
void (*close)(void *obj);
|
||||
int (*init)(void *obj, snd_pcm_rate_info_t *info);
|
||||
void (*free)(void *obj);
|
||||
void (*reset)(void *obj);
|
||||
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
|
||||
void (*convert)(void *obj,
|
||||
const snd_pcm_channel_area_t *dst_areas,
|
||||
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
|
||||
const snd_pcm_channel_area_t *src_areas,
|
||||
snd_pcm_uframes_t src_offset, unsigned int src_frames);
|
||||
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
|
||||
const int16_t *src, unsigned int src_frames);
|
||||
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
|
||||
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
|
||||
} snd_pcm_rate_old_ops_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_PCM_RATE_H */
|
159
raylib/external/alsa/rawmidi.h
vendored
159
raylib/external/alsa/rawmidi.h
vendored
|
@ -1,159 +0,0 @@
|
|||
/**
|
||||
* \file include/rawmidi.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_RAWMIDI_H
|
||||
#define __ALSA_RAWMIDI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup RawMidi RawMidi Interface
|
||||
* The RawMidi Interface. See \ref rawmidi page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
|
||||
|
||||
/** RawMidi information container */
|
||||
typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
|
||||
/** RawMidi settings container */
|
||||
typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
|
||||
/** RawMidi status container */
|
||||
typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
|
||||
|
||||
/** RawMidi stream (direction) */
|
||||
typedef enum _snd_rawmidi_stream {
|
||||
/** Output stream */
|
||||
SND_RAWMIDI_STREAM_OUTPUT = 0,
|
||||
/** Input stream */
|
||||
SND_RAWMIDI_STREAM_INPUT,
|
||||
SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
|
||||
} snd_rawmidi_stream_t;
|
||||
|
||||
/** Append (flag to open mode) \hideinitializer */
|
||||
#define SND_RAWMIDI_APPEND 0x0001
|
||||
/** Non blocking mode (flag to open mode) \hideinitializer */
|
||||
#define SND_RAWMIDI_NONBLOCK 0x0002
|
||||
/** Write sync mode (Flag to open mode) \hideinitializer */
|
||||
#define SND_RAWMIDI_SYNC 0x0004
|
||||
|
||||
/** RawMidi handle */
|
||||
typedef struct _snd_rawmidi snd_rawmidi_t;
|
||||
|
||||
/** RawMidi type */
|
||||
typedef enum _snd_rawmidi_type {
|
||||
/** Kernel level RawMidi */
|
||||
SND_RAWMIDI_TYPE_HW,
|
||||
/** Shared memory client RawMidi (not yet implemented) */
|
||||
SND_RAWMIDI_TYPE_SHM,
|
||||
/** INET client RawMidi (not yet implemented) */
|
||||
SND_RAWMIDI_TYPE_INET,
|
||||
/** Virtual (sequencer) RawMidi */
|
||||
SND_RAWMIDI_TYPE_VIRTUAL
|
||||
} snd_rawmidi_type_t;
|
||||
|
||||
int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
|
||||
const char *name, int mode);
|
||||
int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
|
||||
const char *name, int mode, snd_config_t *lconf);
|
||||
int snd_rawmidi_close(snd_rawmidi_t *rmidi);
|
||||
int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
|
||||
int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
|
||||
int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
|
||||
int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
|
||||
size_t snd_rawmidi_info_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
|
||||
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
|
||||
void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
|
||||
void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
|
||||
unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
|
||||
unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
|
||||
snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
|
||||
int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
|
||||
unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
|
||||
const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
|
||||
const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
|
||||
const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
|
||||
unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
|
||||
unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
|
||||
void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
|
||||
void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
|
||||
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
|
||||
int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
|
||||
size_t snd_rawmidi_params_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
|
||||
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
|
||||
void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
|
||||
void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
|
||||
int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
|
||||
size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
|
||||
int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
|
||||
size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
|
||||
int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
|
||||
int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
|
||||
int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
|
||||
int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
|
||||
size_t snd_rawmidi_status_sizeof(void);
|
||||
/** \hideinitializer
|
||||
* \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
|
||||
* \param ptr returned pointer
|
||||
*/
|
||||
#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
|
||||
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
|
||||
void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
|
||||
void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
|
||||
void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
|
||||
size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
|
||||
size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
|
||||
int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
|
||||
int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
|
||||
int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
|
||||
ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
|
||||
ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
|
||||
const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
|
||||
snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
|
||||
snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RAWMIDI_H */
|
||||
|
739
raylib/external/alsa/seq.h
vendored
739
raylib/external/alsa/seq.h
vendored
|
@ -1,739 +0,0 @@
|
|||
/**
|
||||
* \file include/seq.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*/
|
||||
/*
|
||||
* Application interface library for the ALSA driver
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_SEQ_H
|
||||
#define __ALSA_SEQ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Sequencer MIDI Sequencer
|
||||
* MIDI Sequencer Interface.
|
||||
* See \ref seq page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
|
||||
|
||||
/** Sequencer handle */
|
||||
typedef struct _snd_seq snd_seq_t;
|
||||
|
||||
/**
|
||||
* sequencer opening stream types
|
||||
*/
|
||||
#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */
|
||||
#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */
|
||||
#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */
|
||||
|
||||
/**
|
||||
* sequencer opening mode
|
||||
*/
|
||||
#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) */
|
||||
|
||||
/** sequencer handle type */
|
||||
typedef enum _snd_seq_type {
|
||||
SND_SEQ_TYPE_HW, /**< hardware */
|
||||
SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */
|
||||
SND_SEQ_TYPE_INET /**< network (NYI) */
|
||||
} snd_seq_type_t;
|
||||
|
||||
/** special client (port) ids */
|
||||
#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */
|
||||
#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */
|
||||
#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */
|
||||
|
||||
/** known client numbers */
|
||||
#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */
|
||||
|
||||
/*
|
||||
*/
|
||||
int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
|
||||
int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);
|
||||
const char *snd_seq_name(snd_seq_t *seq);
|
||||
snd_seq_type_t snd_seq_type(snd_seq_t *seq);
|
||||
int snd_seq_close(snd_seq_t *handle);
|
||||
int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
|
||||
int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
|
||||
int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
|
||||
int snd_seq_client_id(snd_seq_t *handle);
|
||||
|
||||
size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
|
||||
size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
|
||||
int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
|
||||
int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
|
||||
|
||||
/** system information container */
|
||||
typedef struct _snd_seq_system_info snd_seq_system_info_t;
|
||||
|
||||
size_t snd_seq_system_info_sizeof(void);
|
||||
/** allocate a #snd_seq_system_info_t container on stack */
|
||||
#define snd_seq_system_info_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_system_info)
|
||||
int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
|
||||
void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
|
||||
void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
|
||||
|
||||
int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
|
||||
int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
|
||||
int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
|
||||
int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
|
||||
int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);
|
||||
int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);
|
||||
|
||||
int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup SeqClient Sequencer Client Interface
|
||||
* Sequencer Client Interface
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** client information container */
|
||||
typedef struct _snd_seq_client_info snd_seq_client_info_t;
|
||||
|
||||
/** client types */
|
||||
typedef enum snd_seq_client_type {
|
||||
SND_SEQ_USER_CLIENT = 1, /**< user client */
|
||||
SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
|
||||
} snd_seq_client_type_t;
|
||||
|
||||
size_t snd_seq_client_info_sizeof(void);
|
||||
/** allocate a #snd_seq_client_info_t container on stack */
|
||||
#define snd_seq_client_info_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_client_info)
|
||||
int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
|
||||
void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
|
||||
void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
|
||||
|
||||
int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
|
||||
snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
|
||||
const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_card(const snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_pid(const snd_seq_client_info_t *info);
|
||||
const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
|
||||
int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
|
||||
|
||||
void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
|
||||
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
|
||||
void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
|
||||
void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
|
||||
void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
|
||||
|
||||
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
|
||||
void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
|
||||
void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
|
||||
int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
|
||||
|
||||
int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
|
||||
int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
|
||||
int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
|
||||
int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
/** client pool information container */
|
||||
typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
|
||||
|
||||
size_t snd_seq_client_pool_sizeof(void);
|
||||
/** allocate a #snd_seq_client_pool_t container on stack */
|
||||
#define snd_seq_client_pool_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_client_pool)
|
||||
int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
|
||||
void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
|
||||
void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
|
||||
|
||||
int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
|
||||
size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
|
||||
size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
|
||||
size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
|
||||
size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
|
||||
size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
|
||||
void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
|
||||
void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
|
||||
void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
|
||||
|
||||
int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
|
||||
int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
|
||||
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup SeqPort Sequencer Port Interface
|
||||
* Sequencer Port Interface
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** port information container */
|
||||
typedef struct _snd_seq_port_info snd_seq_port_info_t;
|
||||
|
||||
/** known port numbers */
|
||||
#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */
|
||||
#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port */
|
||||
|
||||
/** port capabilities (32 bits) */
|
||||
#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */
|
||||
#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */
|
||||
|
||||
#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */
|
||||
#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */
|
||||
|
||||
#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */
|
||||
|
||||
#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
|
||||
#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
|
||||
#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
|
||||
|
||||
/* port type */
|
||||
/** Messages sent from/to this port have device-specific semantics. */
|
||||
#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)
|
||||
/** This port understands MIDI messages. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
|
||||
/** This port is compatible with the General MIDI specification. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)
|
||||
/** This port is compatible with the Roland GS standard. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)
|
||||
/** This port is compatible with the Yamaha XG specification. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)
|
||||
/** This port is compatible with the Roland MT-32. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
|
||||
/** This port is compatible with the General MIDI 2 specification. */
|
||||
#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
|
||||
/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
|
||||
(these are not MIDI messages). */
|
||||
#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)
|
||||
/** Instruments can be downloaded to this port
|
||||
(with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
|
||||
#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
|
||||
/** Instruments can be downloaded to this port
|
||||
(with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */
|
||||
#define SND_SEQ_PORT_TYPE_SAMPLE (1<<12)
|
||||
/** This port is implemented in hardware. */
|
||||
#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)
|
||||
/** This port is implemented in software. */
|
||||
#define SND_SEQ_PORT_TYPE_SOFTWARE (1<<17)
|
||||
/** Messages sent to this port will generate sounds. */
|
||||
#define SND_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)
|
||||
/** This port may connect to other devices
|
||||
(whose characteristics are not known). */
|
||||
#define SND_SEQ_PORT_TYPE_PORT (1<<19)
|
||||
/** This port belongs to an application, such as a sequencer or editor. */
|
||||
#define SND_SEQ_PORT_TYPE_APPLICATION (1<<20)
|
||||
|
||||
|
||||
size_t snd_seq_port_info_sizeof(void);
|
||||
/** allocate a #snd_seq_port_info_t container on stack */
|
||||
#define snd_seq_port_info_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_port_info)
|
||||
int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
|
||||
void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
|
||||
void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
|
||||
|
||||
int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
|
||||
const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
|
||||
const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
|
||||
unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
|
||||
unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
|
||||
int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
|
||||
|
||||
void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
|
||||
void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
|
||||
void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
|
||||
void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
|
||||
void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
|
||||
void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
|
||||
void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
|
||||
void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
|
||||
void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
|
||||
void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
|
||||
void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
|
||||
void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
|
||||
void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
|
||||
|
||||
int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
|
||||
int snd_seq_delete_port(snd_seq_t *handle, int port);
|
||||
int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
|
||||
int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
|
||||
int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
|
||||
int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup SeqSubscribe Sequencer Port Subscription
|
||||
* Sequencer Port Subscription
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** port subscription container */
|
||||
typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
|
||||
|
||||
size_t snd_seq_port_subscribe_sizeof(void);
|
||||
/** allocate a #snd_seq_port_subscribe_t container on stack */
|
||||
#define snd_seq_port_subscribe_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_port_subscribe)
|
||||
int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
|
||||
void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
|
||||
void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
|
||||
|
||||
const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
|
||||
const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
|
||||
int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
|
||||
int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
|
||||
int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
|
||||
int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
|
||||
|
||||
void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
|
||||
void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
|
||||
void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
|
||||
void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
|
||||
void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
|
||||
void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
|
||||
|
||||
int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
|
||||
int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
|
||||
int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
/** subscription query container */
|
||||
typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
|
||||
|
||||
/** type of query subscription */
|
||||
typedef enum {
|
||||
SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */
|
||||
SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */
|
||||
} snd_seq_query_subs_type_t;
|
||||
|
||||
size_t snd_seq_query_subscribe_sizeof(void);
|
||||
/** allocate a #snd_seq_query_subscribe_t container on stack */
|
||||
#define snd_seq_query_subscribe_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_query_subscribe)
|
||||
int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
|
||||
void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
|
||||
void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
|
||||
|
||||
int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
|
||||
const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
|
||||
snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
|
||||
const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
|
||||
int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
|
||||
|
||||
void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
|
||||
void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
|
||||
void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
|
||||
void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
|
||||
void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);
|
||||
|
||||
int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup SeqQueue Sequencer Queue Interface
|
||||
* Sequencer Queue Interface
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** queue information container */
|
||||
typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
|
||||
/** queue status container */
|
||||
typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
|
||||
/** queue tempo container */
|
||||
typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
|
||||
/** queue timer information container */
|
||||
typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
|
||||
|
||||
/** special queue ids */
|
||||
#define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */
|
||||
|
||||
size_t snd_seq_queue_info_sizeof(void);
|
||||
/** allocate a #snd_seq_queue_info_t container on stack */
|
||||
#define snd_seq_queue_info_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_queue_info)
|
||||
int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
|
||||
void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
|
||||
void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
|
||||
|
||||
int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
|
||||
const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
|
||||
int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
|
||||
int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
|
||||
unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
|
||||
|
||||
void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
|
||||
void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
|
||||
void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
|
||||
void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
|
||||
|
||||
int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
|
||||
int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
|
||||
int snd_seq_alloc_queue(snd_seq_t *handle);
|
||||
int snd_seq_free_queue(snd_seq_t *handle, int q);
|
||||
int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
|
||||
int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
|
||||
int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
|
||||
|
||||
int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
|
||||
int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
|
||||
|
||||
/*
|
||||
*/
|
||||
size_t snd_seq_queue_status_sizeof(void);
|
||||
/** allocate a #snd_seq_queue_status_t container on stack */
|
||||
#define snd_seq_queue_status_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_queue_status)
|
||||
int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
|
||||
void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
|
||||
void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
|
||||
|
||||
int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
|
||||
int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
|
||||
snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
|
||||
const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
|
||||
unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
|
||||
|
||||
int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
|
||||
|
||||
/*
|
||||
*/
|
||||
size_t snd_seq_queue_tempo_sizeof(void);
|
||||
/** allocate a #snd_seq_queue_tempo_t container on stack */
|
||||
#define snd_seq_queue_tempo_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_queue_tempo)
|
||||
int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
|
||||
void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
|
||||
void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
|
||||
|
||||
int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
|
||||
unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
|
||||
int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
|
||||
unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
|
||||
unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
|
||||
void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
|
||||
void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
|
||||
void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
|
||||
void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
|
||||
|
||||
int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
|
||||
int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
/** sequencer timer sources */
|
||||
typedef enum {
|
||||
SND_SEQ_TIMER_ALSA = 0, /* ALSA timer */
|
||||
SND_SEQ_TIMER_MIDI_CLOCK = 1, /* Midi Clock (CLOCK event) */
|
||||
SND_SEQ_TIMER_MIDI_TICK = 2 /* Midi Timer Tick (TICK event */
|
||||
} snd_seq_queue_timer_type_t;
|
||||
|
||||
size_t snd_seq_queue_timer_sizeof(void);
|
||||
/** allocate a #snd_seq_queue_timer_t container on stack */
|
||||
#define snd_seq_queue_timer_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_queue_timer)
|
||||
int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
|
||||
void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
|
||||
void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
|
||||
|
||||
int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
|
||||
snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
|
||||
const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
|
||||
unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
|
||||
|
||||
void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);
|
||||
void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
|
||||
void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
|
||||
|
||||
int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
|
||||
int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* \defgroup SeqEvent Sequencer Event API
|
||||
* Sequencer Event API
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
int snd_seq_free_event(snd_seq_event_t *ev);
|
||||
ssize_t snd_seq_event_length(snd_seq_event_t *ev);
|
||||
int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
|
||||
int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
|
||||
int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
|
||||
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
|
||||
int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
|
||||
int snd_seq_drain_output(snd_seq_t *handle);
|
||||
int snd_seq_event_output_pending(snd_seq_t *seq);
|
||||
int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
|
||||
int snd_seq_drop_output(snd_seq_t *handle);
|
||||
int snd_seq_drop_output_buffer(snd_seq_t *handle);
|
||||
int snd_seq_drop_input(snd_seq_t *handle);
|
||||
int snd_seq_drop_input_buffer(snd_seq_t *handle);
|
||||
|
||||
/** event removal conditionals */
|
||||
typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
|
||||
|
||||
/** Remove conditional flags */
|
||||
#define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */
|
||||
#define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */
|
||||
#define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */
|
||||
#define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */
|
||||
#define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */
|
||||
#define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */
|
||||
#define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */
|
||||
#define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */
|
||||
#define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */
|
||||
#define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */
|
||||
|
||||
size_t snd_seq_remove_events_sizeof(void);
|
||||
/** allocate a #snd_seq_remove_events_t container on stack */
|
||||
#define snd_seq_remove_events_alloca(ptr) \
|
||||
__snd_alloca(ptr, snd_seq_remove_events)
|
||||
int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
|
||||
void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
|
||||
void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
|
||||
|
||||
unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
|
||||
int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
|
||||
const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
|
||||
const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
|
||||
int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
|
||||
int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
|
||||
int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
|
||||
|
||||
void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
|
||||
void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
|
||||
void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
|
||||
void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
|
||||
void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
|
||||
void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
|
||||
void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
|
||||
|
||||
int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
|
||||
|
||||
/** \} */
|
||||
|
||||
/**
|
||||
* \defgroup SeqMisc Sequencer Miscellaneous
|
||||
* Sequencer Miscellaneous
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
void snd_seq_set_bit(int nr, void *array);
|
||||
void snd_seq_unset_bit(int nr, void *array);
|
||||
int snd_seq_change_bit(int nr, void *array);
|
||||
int snd_seq_get_bit(int nr, void *array);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup SeqEvType Sequencer Event Type Checks
|
||||
* Sequencer Event Type Checks
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/* event type macros */
|
||||
enum {
|
||||
SND_SEQ_EVFLG_RESULT,
|
||||
SND_SEQ_EVFLG_NOTE,
|
||||
SND_SEQ_EVFLG_CONTROL,
|
||||
SND_SEQ_EVFLG_QUEUE,
|
||||
SND_SEQ_EVFLG_SYSTEM,
|
||||
SND_SEQ_EVFLG_MESSAGE,
|
||||
SND_SEQ_EVFLG_CONNECTION,
|
||||
SND_SEQ_EVFLG_SAMPLE,
|
||||
SND_SEQ_EVFLG_USERS,
|
||||
SND_SEQ_EVFLG_INSTR,
|
||||
SND_SEQ_EVFLG_QUOTE,
|
||||
SND_SEQ_EVFLG_NONE,
|
||||
SND_SEQ_EVFLG_RAW,
|
||||
SND_SEQ_EVFLG_FIXED,
|
||||
SND_SEQ_EVFLG_VARIABLE,
|
||||
SND_SEQ_EVFLG_VARUSR
|
||||
};
|
||||
|
||||
enum {
|
||||
SND_SEQ_EVFLG_NOTE_ONEARG,
|
||||
SND_SEQ_EVFLG_NOTE_TWOARG
|
||||
};
|
||||
|
||||
enum {
|
||||
SND_SEQ_EVFLG_QUEUE_NOARG,
|
||||
SND_SEQ_EVFLG_QUEUE_TICK,
|
||||
SND_SEQ_EVFLG_QUEUE_TIME,
|
||||
SND_SEQ_EVFLG_QUEUE_VALUE
|
||||
};
|
||||
|
||||
/**
|
||||
* Exported event type table
|
||||
*
|
||||
* This table is referred by snd_seq_ev_is_xxx.
|
||||
*/
|
||||
extern const unsigned int snd_seq_event_types[];
|
||||
|
||||
#define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
|
||||
#define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
|
||||
|
||||
/** check the event type */
|
||||
#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
|
||||
|
||||
/** event type check: result events */
|
||||
#define snd_seq_ev_is_result_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
|
||||
/** event type check: note events */
|
||||
#define snd_seq_ev_is_note_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
|
||||
/** event type check: control events */
|
||||
#define snd_seq_ev_is_control_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
|
||||
/** event type check: channel specific events */
|
||||
#define snd_seq_ev_is_channel_type(ev) \
|
||||
(snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
|
||||
|
||||
/** event type check: queue control events */
|
||||
#define snd_seq_ev_is_queue_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
|
||||
/** event type check: system status messages */
|
||||
#define snd_seq_ev_is_message_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
|
||||
/** event type check: system status messages */
|
||||
#define snd_seq_ev_is_subscribe_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
|
||||
/** event type check: sample messages */
|
||||
#define snd_seq_ev_is_sample_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
|
||||
/** event type check: user-defined messages */
|
||||
#define snd_seq_ev_is_user_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
|
||||
/** event type check: instrument layer events */
|
||||
#define snd_seq_ev_is_instr_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
|
||||
/** event type check: fixed length events */
|
||||
#define snd_seq_ev_is_fixed_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
|
||||
/** event type check: variable length events */
|
||||
#define snd_seq_ev_is_variable_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
|
||||
/** event type check: user pointer events */
|
||||
#define snd_seq_ev_is_varusr_type(ev) \
|
||||
snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
|
||||
/** event type check: reserved for kernel */
|
||||
#define snd_seq_ev_is_reserved(ev) \
|
||||
(! snd_seq_event_types[(ev)->type])
|
||||
|
||||
/**
|
||||
* macros to check event flags
|
||||
*/
|
||||
/** prior events */
|
||||
#define snd_seq_ev_is_prior(ev) \
|
||||
(((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
|
||||
|
||||
/** get the data length type */
|
||||
#define snd_seq_ev_length_type(ev) \
|
||||
((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
|
||||
/** fixed length events */
|
||||
#define snd_seq_ev_is_fixed(ev) \
|
||||
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
|
||||
/** variable length events */
|
||||
#define snd_seq_ev_is_variable(ev) \
|
||||
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
|
||||
/** variable length on user-space */
|
||||
#define snd_seq_ev_is_varusr(ev) \
|
||||
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
|
||||
|
||||
/** time-stamp type */
|
||||
#define snd_seq_ev_timestamp_type(ev) \
|
||||
((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
|
||||
/** event is in tick time */
|
||||
#define snd_seq_ev_is_tick(ev) \
|
||||
(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
|
||||
/** event is in real-time */
|
||||
#define snd_seq_ev_is_real(ev) \
|
||||
(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
|
||||
|
||||
/** time-mode type */
|
||||
#define snd_seq_ev_timemode_type(ev) \
|
||||
((ev)->flags & SND_SEQ_TIME_MODE_MASK)
|
||||
/** scheduled in absolute time */
|
||||
#define snd_seq_ev_is_abstime(ev) \
|
||||
(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
|
||||
/** scheduled in relative time */
|
||||
#define snd_seq_ev_is_reltime(ev) \
|
||||
(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
|
||||
|
||||
/** direct dispatched events */
|
||||
#define snd_seq_ev_is_direct(ev) \
|
||||
((ev)->queue == SND_SEQ_QUEUE_DIRECT)
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_SEQ_H */
|
||||
|
325
raylib/external/alsa/seq_event.h
vendored
325
raylib/external/alsa/seq_event.h
vendored
|
@ -1,325 +0,0 @@
|
|||
/**
|
||||
* \file include/seq_event.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_SEQ_EVENT_H
|
||||
#define __ALSA_SEQ_EVENT_H
|
||||
|
||||
/**
|
||||
* \defgroup SeqEvents Sequencer Event Definitions
|
||||
* Sequencer Event Definitions
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sequencer event data type
|
||||
*/
|
||||
typedef unsigned char snd_seq_event_type_t;
|
||||
|
||||
/** Sequencer event type */
|
||||
enum snd_seq_event_type {
|
||||
/** system status; event data type = #snd_seq_result_t */
|
||||
SND_SEQ_EVENT_SYSTEM = 0,
|
||||
/** returned result status; event data type = #snd_seq_result_t */
|
||||
SND_SEQ_EVENT_RESULT,
|
||||
|
||||
/** note on and off with duration; event data type = #snd_seq_ev_note_t */
|
||||
SND_SEQ_EVENT_NOTE = 5,
|
||||
/** note on; event data type = #snd_seq_ev_note_t */
|
||||
SND_SEQ_EVENT_NOTEON,
|
||||
/** note off; event data type = #snd_seq_ev_note_t */
|
||||
SND_SEQ_EVENT_NOTEOFF,
|
||||
/** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
|
||||
SND_SEQ_EVENT_KEYPRESS,
|
||||
|
||||
/** controller; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_CONTROLLER = 10,
|
||||
/** program change; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_PGMCHANGE,
|
||||
/** channel pressure; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_CHANPRESS,
|
||||
/** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
|
||||
SND_SEQ_EVENT_PITCHBEND,
|
||||
/** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_CONTROL14,
|
||||
/** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_NONREGPARAM,
|
||||
/** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_REGPARAM,
|
||||
|
||||
/** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_SONGPOS = 20,
|
||||
/** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_SONGSEL,
|
||||
/** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_QFRAME,
|
||||
/** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_TIMESIGN,
|
||||
/** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
|
||||
SND_SEQ_EVENT_KEYSIGN,
|
||||
|
||||
/** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_START = 30,
|
||||
/** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_CONTINUE,
|
||||
/** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_STOP,
|
||||
/** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_SETPOS_TICK,
|
||||
/** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_SETPOS_TIME,
|
||||
/** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_TEMPO,
|
||||
/** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_CLOCK,
|
||||
/** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_TICK,
|
||||
/** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_QUEUE_SKEW,
|
||||
/** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
|
||||
SND_SEQ_EVENT_SYNC_POS,
|
||||
|
||||
/** Tune request; event data type = none */
|
||||
SND_SEQ_EVENT_TUNE_REQUEST = 40,
|
||||
/** Reset to power-on state; event data type = none */
|
||||
SND_SEQ_EVENT_RESET,
|
||||
/** Active sensing event; event data type = none */
|
||||
SND_SEQ_EVENT_SENSING,
|
||||
|
||||
/** Echo-back event; event data type = any type */
|
||||
SND_SEQ_EVENT_ECHO = 50,
|
||||
/** OSS emulation raw event; event data type = any type */
|
||||
SND_SEQ_EVENT_OSS,
|
||||
|
||||
/** New client has connected; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_CLIENT_START = 60,
|
||||
/** Client has left the system; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_CLIENT_EXIT,
|
||||
/** Client status/info has changed; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_CLIENT_CHANGE,
|
||||
/** New port was created; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_PORT_START,
|
||||
/** Port was deleted from system; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_PORT_EXIT,
|
||||
/** Port status/info has changed; event data type = #snd_seq_addr_t */
|
||||
SND_SEQ_EVENT_PORT_CHANGE,
|
||||
|
||||
/** Ports connected; event data type = #snd_seq_connect_t */
|
||||
SND_SEQ_EVENT_PORT_SUBSCRIBED,
|
||||
/** Ports disconnected; event data type = #snd_seq_connect_t */
|
||||
SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
|
||||
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR0 = 90,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR1,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR2,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR3,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR4,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR5,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR6,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR7,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR8,
|
||||
/** user-defined event; event data type = any (fixed size) */
|
||||
SND_SEQ_EVENT_USR9,
|
||||
|
||||
/** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_SYSEX = 130,
|
||||
/** error event; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_BOUNCE,
|
||||
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_USR_VAR0 = 135,
|
||||
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_USR_VAR1,
|
||||
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_USR_VAR2,
|
||||
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_USR_VAR3,
|
||||
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
|
||||
SND_SEQ_EVENT_USR_VAR4,
|
||||
|
||||
/** NOP; ignored in any case */
|
||||
SND_SEQ_EVENT_NONE = 255
|
||||
};
|
||||
|
||||
|
||||
/** Sequencer event address */
|
||||
typedef struct snd_seq_addr {
|
||||
unsigned char client; /**< Client id */
|
||||
unsigned char port; /**< Port id */
|
||||
} snd_seq_addr_t;
|
||||
|
||||
/** Connection (subscription) between ports */
|
||||
typedef struct snd_seq_connect {
|
||||
snd_seq_addr_t sender; /**< sender address */
|
||||
snd_seq_addr_t dest; /**< destination address */
|
||||
} snd_seq_connect_t;
|
||||
|
||||
|
||||
/** Real-time data record */
|
||||
typedef struct snd_seq_real_time {
|
||||
unsigned int tv_sec; /**< seconds */
|
||||
unsigned int tv_nsec; /**< nanoseconds */
|
||||
} snd_seq_real_time_t;
|
||||
|
||||
/** (MIDI) Tick-time data record */
|
||||
typedef unsigned int snd_seq_tick_time_t;
|
||||
|
||||
/** unioned time stamp */
|
||||
typedef union snd_seq_timestamp {
|
||||
snd_seq_tick_time_t tick; /**< tick-time */
|
||||
struct snd_seq_real_time time; /**< real-time */
|
||||
} snd_seq_timestamp_t;
|
||||
|
||||
|
||||
/**
|
||||
* Event mode flags
|
||||
*
|
||||
* NOTE: only 8 bits available!
|
||||
*/
|
||||
#define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */
|
||||
#define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */
|
||||
#define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */
|
||||
|
||||
#define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */
|
||||
#define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */
|
||||
#define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */
|
||||
|
||||
#define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */
|
||||
#define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */
|
||||
#define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */
|
||||
#define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */
|
||||
|
||||
#define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */
|
||||
#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
|
||||
#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
|
||||
|
||||
|
||||
/** Note event */
|
||||
typedef struct snd_seq_ev_note {
|
||||
unsigned char channel; /**< channel number */
|
||||
unsigned char note; /**< note */
|
||||
unsigned char velocity; /**< velocity */
|
||||
unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
|
||||
unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
|
||||
} snd_seq_ev_note_t;
|
||||
|
||||
/** Controller event */
|
||||
typedef struct snd_seq_ev_ctrl {
|
||||
unsigned char channel; /**< channel number */
|
||||
unsigned char unused[3]; /**< reserved */
|
||||
unsigned int param; /**< control parameter */
|
||||
signed int value; /**< control value */
|
||||
} snd_seq_ev_ctrl_t;
|
||||
|
||||
/** generic set of bytes (12x8 bit) */
|
||||
typedef struct snd_seq_ev_raw8 {
|
||||
unsigned char d[12]; /**< 8 bit value */
|
||||
} snd_seq_ev_raw8_t;
|
||||
|
||||
/** generic set of integers (3x32 bit) */
|
||||
typedef struct snd_seq_ev_raw32 {
|
||||
unsigned int d[3]; /**< 32 bit value */
|
||||
} snd_seq_ev_raw32_t;
|
||||
|
||||
/** external stored data */
|
||||
struct snd_seq_ev_ext {
|
||||
unsigned int len; /**< length of data */
|
||||
void *ptr; /**< pointer to data (note: can be 64-bit) */
|
||||
} __attribute__((packed));
|
||||
/** external stored data */
|
||||
typedef struct snd_seq_ev_ext snd_seq_ev_ext_t;
|
||||
#ifdef DOC_HIDDEN
|
||||
/* redefine typedef for stupid doxygen */
|
||||
typedef snd_seq_ev_ext snd_seq_ev_ext_t;
|
||||
#endif
|
||||
|
||||
/** Result events */
|
||||
typedef struct snd_seq_result {
|
||||
int event; /**< processed event type */
|
||||
int result; /**< status */
|
||||
} snd_seq_result_t;
|
||||
|
||||
/** Queue skew values */
|
||||
typedef struct snd_seq_queue_skew {
|
||||
unsigned int value; /**< skew value */
|
||||
unsigned int base; /**< skew base */
|
||||
} snd_seq_queue_skew_t;
|
||||
|
||||
/** queue timer control */
|
||||
typedef struct snd_seq_ev_queue_control {
|
||||
unsigned char queue; /**< affected queue */
|
||||
unsigned char unused[3]; /**< reserved */
|
||||
union {
|
||||
signed int value; /**< affected value (e.g. tempo) */
|
||||
snd_seq_timestamp_t time; /**< time */
|
||||
unsigned int position; /**< sync position */
|
||||
snd_seq_queue_skew_t skew; /**< queue skew */
|
||||
unsigned int d32[2]; /**< any data */
|
||||
unsigned char d8[8]; /**< any data */
|
||||
} param; /**< data value union */
|
||||
} snd_seq_ev_queue_control_t;
|
||||
|
||||
|
||||
/** Sequencer event */
|
||||
typedef struct snd_seq_event {
|
||||
snd_seq_event_type_t type; /**< event type */
|
||||
unsigned char flags; /**< event flags */
|
||||
unsigned char tag; /**< tag */
|
||||
|
||||
unsigned char queue; /**< schedule queue */
|
||||
snd_seq_timestamp_t time; /**< schedule time */
|
||||
|
||||
snd_seq_addr_t source; /**< source address */
|
||||
snd_seq_addr_t dest; /**< destination address */
|
||||
|
||||
union {
|
||||
snd_seq_ev_note_t note; /**< note information */
|
||||
snd_seq_ev_ctrl_t control; /**< MIDI control information */
|
||||
snd_seq_ev_raw8_t raw8; /**< raw8 data */
|
||||
snd_seq_ev_raw32_t raw32; /**< raw32 data */
|
||||
snd_seq_ev_ext_t ext; /**< external data */
|
||||
snd_seq_ev_queue_control_t queue; /**< queue control */
|
||||
snd_seq_timestamp_t time; /**< timestamp */
|
||||
snd_seq_addr_t addr; /**< address */
|
||||
snd_seq_connect_t connect; /**< connect information */
|
||||
snd_seq_result_t result; /**< operation result code */
|
||||
} data; /**< event data... */
|
||||
} snd_seq_event_t;
|
||||
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __ALSA_SEQ_EVENT_H */
|
||||
|
65
raylib/external/alsa/seq_midi_event.h
vendored
65
raylib/external/alsa/seq_midi_event.h
vendored
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* \file include/seq_midi_event.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_SEQ_MIDI_EVENT_H
|
||||
#define __ALSA_SEQ_MIDI_EVENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup MIDI_Event Sequencer event <-> MIDI byte stream coder
|
||||
* \ingroup Sequencer
|
||||
* Sequencer event <-> MIDI byte stream coder
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** container for sequencer midi event parsers */
|
||||
typedef struct snd_midi_event snd_midi_event_t;
|
||||
|
||||
int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev);
|
||||
int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize);
|
||||
void snd_midi_event_free(snd_midi_event_t *dev);
|
||||
void snd_midi_event_init(snd_midi_event_t *dev);
|
||||
void snd_midi_event_reset_encode(snd_midi_event_t *dev);
|
||||
void snd_midi_event_reset_decode(snd_midi_event_t *dev);
|
||||
void snd_midi_event_no_status(snd_midi_event_t *dev, int on);
|
||||
/* encode from byte stream - return number of written bytes if success */
|
||||
long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev);
|
||||
int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
|
||||
/* decode from event to bytes - return number of written bytes if success */
|
||||
long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_SEQ_MIDI_EVENT_H */
|
||||
|
490
raylib/external/alsa/seqmid.h
vendored
490
raylib/external/alsa/seqmid.h
vendored
|
@ -1,490 +0,0 @@
|
|||
/**
|
||||
* \file include/seqmid.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_SEQMID_H
|
||||
#define __ALSA_SEQMID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup SeqMiddle Sequencer Middle Level Interface
|
||||
* Sequencer Middle Level Interface
|
||||
* \ingroup Sequencer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief initialize event record
|
||||
* \param ev event record pointer
|
||||
*
|
||||
* This macro clears the given event record pointer to the default status.
|
||||
*/
|
||||
#define snd_seq_ev_clear(ev) \
|
||||
memset(ev, 0, sizeof(snd_seq_event_t))
|
||||
|
||||
/**
|
||||
* \brief set the tag for given event
|
||||
* \param ev event record
|
||||
* \param t event tag
|
||||
*
|
||||
* This macro sets the tag to the given event record.
|
||||
*/
|
||||
#define snd_seq_ev_set_tag(ev,t) \
|
||||
((ev)->tag = (t))
|
||||
|
||||
/**
|
||||
* \brief set the explicit destination
|
||||
* \param ev event record
|
||||
* \param c destination client id
|
||||
* \param p destination port id
|
||||
*
|
||||
* This macro sets the client and port id numbers to the given event record.
|
||||
*
|
||||
* \sa snd_seq_ev_set_subs()
|
||||
*/
|
||||
#define snd_seq_ev_set_dest(ev,c,p) \
|
||||
((ev)->dest.client = (c), (ev)->dest.port = (p))
|
||||
|
||||
/**
|
||||
* \brief set broadcasting to subscribers
|
||||
* \param ev event record
|
||||
*
|
||||
* This macro sets the destination as the subscribers.
|
||||
*
|
||||
* \sa snd_seq_ev_set_dest()
|
||||
*/
|
||||
#define snd_seq_ev_set_subs(ev) \
|
||||
((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
|
||||
(ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
|
||||
|
||||
/**
|
||||
* \brief set broadcasting to all clients/ports
|
||||
* \param ev event record
|
||||
*
|
||||
* This macro sets the destination as the broadcasting.
|
||||
*
|
||||
* \sa snd_seq_ev_set_dest()
|
||||
*/
|
||||
#define snd_seq_ev_set_broadcast(ev) \
|
||||
((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
|
||||
(ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
|
||||
|
||||
/**
|
||||
* \brief set the source port
|
||||
* \param ev event record
|
||||
* \param p source port id
|
||||
*
|
||||
* This macro sets the source port id number.
|
||||
*/
|
||||
#define snd_seq_ev_set_source(ev,p) \
|
||||
((ev)->source.port = (p))
|
||||
|
||||
/**
|
||||
* \brief set direct passing mode (without queued)
|
||||
* \param ev event instance
|
||||
*
|
||||
* This macro sets the event to the direct passing mode
|
||||
* to be delivered immediately without queueing.
|
||||
*
|
||||
* \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
|
||||
*/
|
||||
#define snd_seq_ev_set_direct(ev) \
|
||||
((ev)->queue = SND_SEQ_QUEUE_DIRECT)
|
||||
|
||||
/**
|
||||
* \brief set tick-scheduling mode on queue
|
||||
* \param ev event instance
|
||||
* \param q queue id to schedule
|
||||
* \param relative relative time-stamp if non-zero
|
||||
* \param ttick tick time-stamp to be delivered
|
||||
*
|
||||
* This macro sets the scheduling of the event in the
|
||||
* MIDI tick mode.
|
||||
*
|
||||
* \sa snd_seq_ev_schedule_real(), snd_seq_ev_set_direct()
|
||||
*/
|
||||
#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
|
||||
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
|
||||
(ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
|
||||
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
|
||||
(ev)->time.tick = (ttick),\
|
||||
(ev)->queue = (q))
|
||||
|
||||
/**
|
||||
* \brief set real-time-scheduling mode on queue
|
||||
* \param ev event instance
|
||||
* \param q queue id to schedule
|
||||
* \param relative relative time-stamp if non-zero
|
||||
* \param rtime time-stamp to be delivered
|
||||
*
|
||||
* This macro sets the scheduling of the event in the
|
||||
* realtime mode.
|
||||
*
|
||||
* \sa snd_seq_ev_schedule_tick(), snd_seq_ev_set_direct()
|
||||
*/
|
||||
#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
|
||||
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
|
||||
(ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
|
||||
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
|
||||
(ev)->time.time = *(rtime),\
|
||||
(ev)->queue = (q))
|
||||
|
||||
/**
|
||||
* \brief set event priority
|
||||
* \param ev event instance
|
||||
* \param high_prior 1 for high priority mode
|
||||
*/
|
||||
#define snd_seq_ev_set_priority(ev, high_prior) \
|
||||
((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
|
||||
(ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
|
||||
|
||||
/**
|
||||
* \brief set fixed data
|
||||
* \param ev event instance
|
||||
*
|
||||
* Sets the event length mode as fixed size.
|
||||
*
|
||||
* \sa snd_seq_ev_set_variable(), snd_seq_ev_set_varusr()
|
||||
*/
|
||||
#define snd_seq_ev_set_fixed(ev) \
|
||||
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
||||
(ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
|
||||
|
||||
/**
|
||||
* \brief set variable data
|
||||
* \param ev event instance
|
||||
* \param datalen length of the external data
|
||||
* \param dataptr pointer of the external data
|
||||
*
|
||||
* Sets the event length mode as variable length and stores the data.
|
||||
*
|
||||
* \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_varusr()
|
||||
*/
|
||||
#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
|
||||
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
||||
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
|
||||
(ev)->data.ext.len = (datalen),\
|
||||
(ev)->data.ext.ptr = (dataptr))
|
||||
|
||||
/**
|
||||
* \brief set varusr data
|
||||
* \param ev event instance
|
||||
* \param datalen length of the external data
|
||||
* \param dataptr pointer of the external data
|
||||
*
|
||||
* Sets the event length mode as variable user-space data and stores the data.
|
||||
*
|
||||
* \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_variable()
|
||||
*/
|
||||
#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
|
||||
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
|
||||
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
|
||||
(ev)->data.ext.len = (datalen),\
|
||||
(ev)->data.ext.ptr = (dataptr))
|
||||
|
||||
/**
|
||||
* \brief set queue controls
|
||||
* \param ev event record
|
||||
* \param typ event type
|
||||
* \param q queue id
|
||||
* \param val control value
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
|
||||
((ev)->type = (typ),\
|
||||
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
||||
(ev)->data.queue.queue = (q),\
|
||||
(ev)->data.queue.param.value = (val))
|
||||
|
||||
/**
|
||||
* \brief set the start queue event
|
||||
* \param ev event record
|
||||
* \param q queue id to start
|
||||
*
|
||||
* \sa snd_seq_ev_set_queue_stop(), snd_seq_ev_set_queue_continue()
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_start(ev, q) \
|
||||
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
|
||||
|
||||
/**
|
||||
* \brief set the stop queue event
|
||||
* \param ev event record
|
||||
* \param q queue id to stop
|
||||
*
|
||||
* \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_continue()
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_stop(ev, q) \
|
||||
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
|
||||
|
||||
/**
|
||||
* \brief set the stop queue event
|
||||
* \param ev event record
|
||||
* \param q queue id to continue
|
||||
*
|
||||
* \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_stop()
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_continue(ev, q) \
|
||||
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
|
||||
|
||||
/**
|
||||
* \brief set the stop queue event
|
||||
* \param ev event record
|
||||
* \param q queue id to change tempo
|
||||
* \param val the new tempo value
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_tempo(ev, q, val) \
|
||||
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
|
||||
|
||||
/**
|
||||
* \brief set the real-time position of a queue
|
||||
* \param ev event record
|
||||
* \param q queue id to change tempo
|
||||
* \param rtime the new real-time pointer
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
|
||||
((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
|
||||
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
||||
(ev)->data.queue.queue = (q),\
|
||||
(ev)->data.queue.param.time.time = *(rtime))
|
||||
|
||||
/**
|
||||
* \brief set the tick-time position of a queue
|
||||
* \param ev event record
|
||||
* \param q queue id to change tempo
|
||||
* \param ttime the new tick-time
|
||||
*/
|
||||
#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
|
||||
((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
|
||||
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
|
||||
(ev)->data.queue.queue = (q),\
|
||||
(ev)->data.queue.param.time.tick = (ttime))
|
||||
|
||||
/* set and send a queue control event */
|
||||
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
|
||||
|
||||
/**
|
||||
* \brief start the specified queue
|
||||
* \param seq sequencer handle
|
||||
* \param q queue id to start
|
||||
* \param ev optional event record (see #snd_seq_control_queue)
|
||||
*/
|
||||
#define snd_seq_start_queue(seq, q, ev) \
|
||||
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
|
||||
|
||||
/**
|
||||
* \brief stop the specified queue
|
||||
* \param seq sequencer handle
|
||||
* \param q queue id to stop
|
||||
* \param ev optional event record (see #snd_seq_control_queue)
|
||||
*/
|
||||
#define snd_seq_stop_queue(seq, q, ev) \
|
||||
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
|
||||
|
||||
/**
|
||||
* \brief continue the specified queue
|
||||
* \param seq sequencer handle
|
||||
* \param q queue id to continue
|
||||
* \param ev optional event record (see #snd_seq_control_queue)
|
||||
*/
|
||||
#define snd_seq_continue_queue(seq, q, ev) \
|
||||
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
|
||||
|
||||
/**
|
||||
* \brief change the tempo of the specified queue
|
||||
* \param seq sequencer handle
|
||||
* \param q queue id
|
||||
* \param tempo the new tempo value
|
||||
* \param ev optional event record (see #snd_seq_control_queue)
|
||||
*/
|
||||
#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
|
||||
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
|
||||
|
||||
/* create a port - simple version - return the port number */
|
||||
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
|
||||
unsigned int caps, unsigned int type);
|
||||
/* delete the port */
|
||||
int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
|
||||
|
||||
/* simple subscription between this port and another port
|
||||
(w/o exclusive & time conversion)
|
||||
*/
|
||||
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
|
||||
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
|
||||
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
|
||||
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
|
||||
|
||||
/*
|
||||
* set client information
|
||||
*/
|
||||
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
|
||||
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
|
||||
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
|
||||
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
|
||||
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
|
||||
/* sync output queue */
|
||||
int snd_seq_sync_output_queue(snd_seq_t *seq);
|
||||
|
||||
/*
|
||||
* parse the given string and get the sequencer address
|
||||
*/
|
||||
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
|
||||
|
||||
/*
|
||||
* reset client input/output pool
|
||||
*/
|
||||
int snd_seq_reset_pool_output(snd_seq_t *seq);
|
||||
int snd_seq_reset_pool_input(snd_seq_t *seq);
|
||||
|
||||
/**
|
||||
* \brief set note event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param key note key
|
||||
* \param vel velocity
|
||||
* \param dur duration (in tick or msec)
|
||||
*/
|
||||
#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
|
||||
((ev)->type = SND_SEQ_EVENT_NOTE,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.note.channel = (ch),\
|
||||
(ev)->data.note.note = (key),\
|
||||
(ev)->data.note.velocity = (vel),\
|
||||
(ev)->data.note.duration = (dur))
|
||||
|
||||
/**
|
||||
* \brief set note-on event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param key note key
|
||||
* \param vel velocity
|
||||
*/
|
||||
#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
|
||||
((ev)->type = SND_SEQ_EVENT_NOTEON,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.note.channel = (ch),\
|
||||
(ev)->data.note.note = (key),\
|
||||
(ev)->data.note.velocity = (vel))
|
||||
|
||||
/**
|
||||
* \brief set note-off event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param key note key
|
||||
* \param vel velocity
|
||||
*/
|
||||
#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
|
||||
((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.note.channel = (ch),\
|
||||
(ev)->data.note.note = (key),\
|
||||
(ev)->data.note.velocity = (vel))
|
||||
|
||||
/**
|
||||
* \brief set key-pressure event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param key note key
|
||||
* \param vel velocity
|
||||
*/
|
||||
#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
|
||||
((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.note.channel = (ch),\
|
||||
(ev)->data.note.note = (key),\
|
||||
(ev)->data.note.velocity = (vel))
|
||||
|
||||
/**
|
||||
* \brief set MIDI controller event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param cc controller number
|
||||
* \param val control value
|
||||
*/
|
||||
#define snd_seq_ev_set_controller(ev,ch,cc,val) \
|
||||
((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.control.channel = (ch),\
|
||||
(ev)->data.control.param = (cc),\
|
||||
(ev)->data.control.value = (val))
|
||||
|
||||
/**
|
||||
* \brief set program change event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param val program number
|
||||
*/
|
||||
#define snd_seq_ev_set_pgmchange(ev,ch,val) \
|
||||
((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.control.channel = (ch),\
|
||||
(ev)->data.control.value = (val))
|
||||
|
||||
/**
|
||||
* \brief set pitch-bend event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param val pitch bend; zero centered from -8192 to 8191
|
||||
*/
|
||||
#define snd_seq_ev_set_pitchbend(ev,ch,val) \
|
||||
((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.control.channel = (ch),\
|
||||
(ev)->data.control.value = (val))
|
||||
|
||||
/**
|
||||
* \brief set channel pressure event
|
||||
* \param ev event record
|
||||
* \param ch channel number
|
||||
* \param val channel pressure value
|
||||
*/
|
||||
#define snd_seq_ev_set_chanpress(ev,ch,val) \
|
||||
((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
|
||||
snd_seq_ev_set_fixed(ev),\
|
||||
(ev)->data.control.channel = (ch),\
|
||||
(ev)->data.control.value = (val))
|
||||
|
||||
/**
|
||||
* \brief set sysex event
|
||||
* \param ev event record
|
||||
* \param datalen length of sysex data
|
||||
* \param dataptr sysex data pointer
|
||||
*
|
||||
* the sysex data must contain the start byte 0xf0 and the end byte 0xf7.
|
||||
*/
|
||||
#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
|
||||
((ev)->type = SND_SEQ_EVENT_SYSEX,\
|
||||
snd_seq_ev_set_variable(ev, datalen, dataptr))
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_SEQMID_H */
|
||||
|
551
raylib/external/alsa/sound/asoc.h
vendored
551
raylib/external/alsa/sound/asoc.h
vendored
|
@ -1,551 +0,0 @@
|
|||
/*
|
||||
* uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
|
||||
*
|
||||
* Copyright (C) 2012 Texas Instruments Inc.
|
||||
* Copyright (C) 2015 Intel Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
|
||||
* algorithms, equalisers, DAIs, widgets etc.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_UAPI_SND_ASOC_H
|
||||
#define __LINUX_UAPI_SND_ASOC_H
|
||||
|
||||
/*
|
||||
* Maximum number of channels topology kcontrol can represent.
|
||||
*/
|
||||
#define SND_SOC_TPLG_MAX_CHAN 8
|
||||
|
||||
/*
|
||||
* Maximum number of PCM formats capability
|
||||
*/
|
||||
#define SND_SOC_TPLG_MAX_FORMATS 16
|
||||
|
||||
/*
|
||||
* Maximum number of PCM stream configs
|
||||
*/
|
||||
#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
|
||||
|
||||
/*
|
||||
* Maximum number of physical link's hardware configs
|
||||
*/
|
||||
#define SND_SOC_TPLG_HW_CONFIG_MAX 8
|
||||
|
||||
/* individual kcontrol info types - can be mixed with other types */
|
||||
#define SND_SOC_TPLG_CTL_VOLSW 1
|
||||
#define SND_SOC_TPLG_CTL_VOLSW_SX 2
|
||||
#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
|
||||
#define SND_SOC_TPLG_CTL_ENUM 4
|
||||
#define SND_SOC_TPLG_CTL_BYTES 5
|
||||
#define SND_SOC_TPLG_CTL_ENUM_VALUE 6
|
||||
#define SND_SOC_TPLG_CTL_RANGE 7
|
||||
#define SND_SOC_TPLG_CTL_STROBE 8
|
||||
|
||||
|
||||
/* individual widget kcontrol info types - can be mixed with other types */
|
||||
#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
|
||||
#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
|
||||
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
|
||||
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
|
||||
#define SND_SOC_TPLG_DAPM_CTL_PIN 68
|
||||
|
||||
/* DAPM widget types - add new items to the end */
|
||||
#define SND_SOC_TPLG_DAPM_INPUT 0
|
||||
#define SND_SOC_TPLG_DAPM_OUTPUT 1
|
||||
#define SND_SOC_TPLG_DAPM_MUX 2
|
||||
#define SND_SOC_TPLG_DAPM_MIXER 3
|
||||
#define SND_SOC_TPLG_DAPM_PGA 4
|
||||
#define SND_SOC_TPLG_DAPM_OUT_DRV 5
|
||||
#define SND_SOC_TPLG_DAPM_ADC 6
|
||||
#define SND_SOC_TPLG_DAPM_DAC 7
|
||||
#define SND_SOC_TPLG_DAPM_SWITCH 8
|
||||
#define SND_SOC_TPLG_DAPM_PRE 9
|
||||
#define SND_SOC_TPLG_DAPM_POST 10
|
||||
#define SND_SOC_TPLG_DAPM_AIF_IN 11
|
||||
#define SND_SOC_TPLG_DAPM_AIF_OUT 12
|
||||
#define SND_SOC_TPLG_DAPM_DAI_IN 13
|
||||
#define SND_SOC_TPLG_DAPM_DAI_OUT 14
|
||||
#define SND_SOC_TPLG_DAPM_DAI_LINK 15
|
||||
#define SND_SOC_TPLG_DAPM_BUFFER 16
|
||||
#define SND_SOC_TPLG_DAPM_SCHEDULER 17
|
||||
#define SND_SOC_TPLG_DAPM_EFFECT 18
|
||||
#define SND_SOC_TPLG_DAPM_SIGGEN 19
|
||||
#define SND_SOC_TPLG_DAPM_SRC 20
|
||||
#define SND_SOC_TPLG_DAPM_ASRC 21
|
||||
#define SND_SOC_TPLG_DAPM_ENCODER 22
|
||||
#define SND_SOC_TPLG_DAPM_DECODER 23
|
||||
#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
|
||||
|
||||
/* Header magic number and string sizes */
|
||||
#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
|
||||
|
||||
/* string sizes */
|
||||
#define SND_SOC_TPLG_NUM_TEXTS 16
|
||||
|
||||
/* ABI version */
|
||||
#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
|
||||
#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
|
||||
|
||||
/* Max size of TLV data */
|
||||
#define SND_SOC_TPLG_TLV_SIZE 32
|
||||
|
||||
/*
|
||||
* File and Block header data types.
|
||||
* Add new generic and vendor types to end of list.
|
||||
* Generic types are handled by the core whilst vendors types are passed
|
||||
* to the component drivers for handling.
|
||||
*/
|
||||
#define SND_SOC_TPLG_TYPE_MIXER 1
|
||||
#define SND_SOC_TPLG_TYPE_BYTES 2
|
||||
#define SND_SOC_TPLG_TYPE_ENUM 3
|
||||
#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
|
||||
#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
|
||||
#define SND_SOC_TPLG_TYPE_DAI_LINK 6
|
||||
#define SND_SOC_TPLG_TYPE_PCM 7
|
||||
#define SND_SOC_TPLG_TYPE_MANIFEST 8
|
||||
#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
|
||||
#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
|
||||
#define SND_SOC_TPLG_TYPE_PDATA 11
|
||||
#define SND_SOC_TPLG_TYPE_DAI 12
|
||||
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
|
||||
|
||||
/* vendor block IDs - please add new vendor types to end */
|
||||
#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
|
||||
#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
|
||||
#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
|
||||
#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
|
||||
|
||||
#define SND_SOC_TPLG_STREAM_PLAYBACK 0
|
||||
#define SND_SOC_TPLG_STREAM_CAPTURE 1
|
||||
|
||||
/* vendor tuple types */
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
|
||||
#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
|
||||
|
||||
/* DAI flags */
|
||||
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
|
||||
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
|
||||
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
|
||||
|
||||
/* DAI physical PCM data formats.
|
||||
* Add new formats to the end of the list.
|
||||
*/
|
||||
#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
|
||||
#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
|
||||
#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
|
||||
#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
|
||||
#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
|
||||
#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
|
||||
#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
|
||||
|
||||
/* left and right justified also known as MSB and LSB respectively */
|
||||
#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
|
||||
#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
|
||||
|
||||
/* DAI link flags */
|
||||
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
|
||||
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
|
||||
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
|
||||
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
|
||||
|
||||
/*
|
||||
* Block Header.
|
||||
* This header precedes all object and object arrays below.
|
||||
*/
|
||||
struct snd_soc_tplg_hdr {
|
||||
__le32 magic; /* magic number */
|
||||
__le32 abi; /* ABI version */
|
||||
__le32 version; /* optional vendor specific version details */
|
||||
__le32 type; /* SND_SOC_TPLG_TYPE_ */
|
||||
__le32 size; /* size of this structure */
|
||||
__le32 vendor_type; /* optional vendor specific type info */
|
||||
__le32 payload_size; /* data bytes, excluding this header */
|
||||
__le32 index; /* identifier for block */
|
||||
__le32 count; /* number of elements in block */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* vendor tuple for uuid */
|
||||
struct snd_soc_tplg_vendor_uuid_elem {
|
||||
__le32 token;
|
||||
char uuid[16];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* vendor tuple for a bool/byte/short/word value */
|
||||
struct snd_soc_tplg_vendor_value_elem {
|
||||
__le32 token;
|
||||
__le32 value;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* vendor tuple for string */
|
||||
struct snd_soc_tplg_vendor_string_elem {
|
||||
__le32 token;
|
||||
char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct snd_soc_tplg_vendor_array {
|
||||
__le32 size; /* size in bytes of the array, including all elements */
|
||||
__le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
|
||||
__le32 num_elems; /* number of elements in array */
|
||||
union {
|
||||
struct snd_soc_tplg_vendor_uuid_elem uuid[0];
|
||||
struct snd_soc_tplg_vendor_value_elem value[0];
|
||||
struct snd_soc_tplg_vendor_string_elem string[0];
|
||||
};
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Private data.
|
||||
* All topology objects may have private data that can be used by the driver or
|
||||
* firmware. Core will ignore this data.
|
||||
*/
|
||||
struct snd_soc_tplg_private {
|
||||
__le32 size; /* in bytes of private data */
|
||||
union {
|
||||
char data[0];
|
||||
struct snd_soc_tplg_vendor_array array[0];
|
||||
};
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Kcontrol TLV data.
|
||||
*/
|
||||
struct snd_soc_tplg_tlv_dbscale {
|
||||
__le32 min;
|
||||
__le32 step;
|
||||
__le32 mute;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct snd_soc_tplg_ctl_tlv {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
|
||||
union {
|
||||
__le32 data[SND_SOC_TPLG_TLV_SIZE];
|
||||
struct snd_soc_tplg_tlv_dbscale scale;
|
||||
};
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Kcontrol channel data
|
||||
*/
|
||||
struct snd_soc_tplg_channel {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 reg;
|
||||
__le32 shift;
|
||||
__le32 id; /* ID maps to Left, Right, LFE etc */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
|
||||
* Kcontrol ops need get/put/info.
|
||||
* Bytes ext ops need get/put.
|
||||
*/
|
||||
struct snd_soc_tplg_io_ops {
|
||||
__le32 get;
|
||||
__le32 put;
|
||||
__le32 info;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* kcontrol header
|
||||
*/
|
||||
struct snd_soc_tplg_ctl_hdr {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 type;
|
||||
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
__le32 access;
|
||||
struct snd_soc_tplg_io_ops ops;
|
||||
struct snd_soc_tplg_ctl_tlv tlv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Stream Capabilities
|
||||
*/
|
||||
struct snd_soc_tplg_stream_caps {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
__le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
|
||||
__le32 rates; /* supported rates SNDRV_PCM_RATE_* */
|
||||
__le32 rate_min; /* min rate */
|
||||
__le32 rate_max; /* max rate */
|
||||
__le32 channels_min; /* min channels */
|
||||
__le32 channels_max; /* max channels */
|
||||
__le32 periods_min; /* min number of periods */
|
||||
__le32 periods_max; /* max number of periods */
|
||||
__le32 period_size_min; /* min period size bytes */
|
||||
__le32 period_size_max; /* max period size bytes */
|
||||
__le32 buffer_size_min; /* min buffer size bytes */
|
||||
__le32 buffer_size_max; /* max buffer size bytes */
|
||||
__le32 sig_bits; /* number of bits of content */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* FE or BE Stream configuration supported by SW/FW
|
||||
*/
|
||||
struct snd_soc_tplg_stream {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
|
||||
__le64 format; /* SNDRV_PCM_FMTBIT_* */
|
||||
__le32 rate; /* SNDRV_PCM_RATE_* */
|
||||
__le32 period_bytes; /* size of period in bytes */
|
||||
__le32 buffer_bytes; /* size of buffer in bytes */
|
||||
__le32 channels; /* channels */
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*
|
||||
* Describes a physical link's runtime supported hardware config,
|
||||
* i.e. hardware audio formats.
|
||||
*/
|
||||
struct snd_soc_tplg_hw_config {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 id; /* unique ID - - used to match */
|
||||
__le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
|
||||
__u8 clock_gated; /* 1 if clock can be gated to save power */
|
||||
__u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
|
||||
__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
|
||||
__u8 bclk_master; /* 1 for master of BCLK, 0 for slave */
|
||||
__u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */
|
||||
__u8 mclk_direction; /* 0 for input, 1 for output */
|
||||
__le16 reserved; /* for 32bit alignment */
|
||||
__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
|
||||
__le32 bclk_rate; /* BCLK freqency in Hz */
|
||||
__le32 fsync_rate; /* frame clock in Hz */
|
||||
__le32 tdm_slots; /* number of TDM slots in use */
|
||||
__le32 tdm_slot_width; /* width in bits for each slot */
|
||||
__le32 tx_slots; /* bit mask for active Tx slots */
|
||||
__le32 rx_slots; /* bit mask for active Rx slots */
|
||||
__le32 tx_channels; /* number of Tx channels */
|
||||
__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
|
||||
__le32 rx_channels; /* number of Rx channels */
|
||||
__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Manifest. List totals for each payload type. Not used in parsing, but will
|
||||
* be passed to the component driver before any other objects in order for any
|
||||
* global component resource allocations.
|
||||
*
|
||||
* File block representation for manifest :-
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_manifest | 1 |
|
||||
* +-----------------------------------+----+
|
||||
*/
|
||||
struct snd_soc_tplg_manifest {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 control_elems; /* number of control elements */
|
||||
__le32 widget_elems; /* number of widget elements */
|
||||
__le32 graph_elems; /* number of graph elements */
|
||||
__le32 pcm_elems; /* number of PCM elements */
|
||||
__le32 dai_link_elems; /* number of DAI link elements */
|
||||
__le32 dai_elems; /* number of physical DAI elements */
|
||||
__le32 reserved[20]; /* reserved for new ABI element types */
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Mixer kcontrol.
|
||||
*
|
||||
* File block representation for mixer kcontrol :-
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_mixer_control | N |
|
||||
* +-----------------------------------+----+
|
||||
*/
|
||||
struct snd_soc_tplg_mixer_control {
|
||||
struct snd_soc_tplg_ctl_hdr hdr;
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 min;
|
||||
__le32 max;
|
||||
__le32 platform_max;
|
||||
__le32 invert;
|
||||
__le32 num_channels;
|
||||
struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Enumerated kcontrol
|
||||
*
|
||||
* File block representation for enum kcontrol :-
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_enum_control | N |
|
||||
* +-----------------------------------+----+
|
||||
*/
|
||||
struct snd_soc_tplg_enum_control {
|
||||
struct snd_soc_tplg_ctl_hdr hdr;
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 num_channels;
|
||||
struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
|
||||
__le32 items;
|
||||
__le32 mask;
|
||||
__le32 count;
|
||||
char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
__le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Bytes kcontrol
|
||||
*
|
||||
* File block representation for bytes kcontrol :-
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+----+
|
||||
* | struct snd_soc_tplg_bytes_control | N |
|
||||
* +-----------------------------------+----+
|
||||
*/
|
||||
struct snd_soc_tplg_bytes_control {
|
||||
struct snd_soc_tplg_ctl_hdr hdr;
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 max;
|
||||
__le32 mask;
|
||||
__le32 base;
|
||||
__le32 num_regs;
|
||||
struct snd_soc_tplg_io_ops ext_ops;
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* DAPM Graph Element
|
||||
*
|
||||
* File block representation for DAPM graph elements :-
|
||||
* +-------------------------------------+----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-------------------------------------+----+
|
||||
* | struct snd_soc_tplg_dapm_graph_elem | N |
|
||||
* +-------------------------------------+----+
|
||||
*/
|
||||
struct snd_soc_tplg_dapm_graph_elem {
|
||||
char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* DAPM Widget.
|
||||
*
|
||||
* File block representation for DAPM widget :-
|
||||
* +-------------------------------------+-----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-------------------------------------+-----+
|
||||
* | struct snd_soc_tplg_dapm_widget | N |
|
||||
* +-------------------------------------+-----+
|
||||
* | struct snd_soc_tplg_enum_control | 0|1 |
|
||||
* | struct snd_soc_tplg_mixer_control | 0|N |
|
||||
* +-------------------------------------+-----+
|
||||
*
|
||||
* Optional enum or mixer control can be appended to the end of each widget
|
||||
* in the block.
|
||||
*/
|
||||
struct snd_soc_tplg_dapm_widget {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 id; /* SND_SOC_DAPM_CTL */
|
||||
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
|
||||
__le32 reg; /* negative reg = no direct dapm */
|
||||
__le32 shift; /* bits to shift */
|
||||
__le32 mask; /* non-shifted mask */
|
||||
__le32 subseq; /* sort within widget type */
|
||||
__le32 invert; /* invert the power bit */
|
||||
__le32 ignore_suspend; /* kept enabled over suspend */
|
||||
__le16 event_flags;
|
||||
__le16 event_type;
|
||||
__le32 num_kcontrols;
|
||||
struct snd_soc_tplg_private priv;
|
||||
/*
|
||||
* kcontrols that relate to this widget
|
||||
* follow here after widget private data
|
||||
*/
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*
|
||||
* Describes SW/FW specific features of PCM (FE DAI & DAI link).
|
||||
*
|
||||
* File block representation for PCM :-
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_pcm | N |
|
||||
* +-----------------------------------+-----+
|
||||
*/
|
||||
struct snd_soc_tplg_pcm {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
||||
__le32 pcm_id; /* unique ID - used to match with DAI link */
|
||||
__le32 dai_id; /* unique ID - used to match */
|
||||
__le32 playback; /* supports playback mode */
|
||||
__le32 capture; /* supports capture mode */
|
||||
__le32 compress; /* 1 = compressed; 0 = PCM */
|
||||
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
|
||||
__le32 num_streams; /* number of streams */
|
||||
struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
|
||||
__le32 flag_mask; /* bitmask of flags to configure */
|
||||
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*
|
||||
* Describes the physical link runtime supported configs or params
|
||||
*
|
||||
* File block representation for physical link config :-
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_link_config | N |
|
||||
* +-----------------------------------+-----+
|
||||
*/
|
||||
struct snd_soc_tplg_link_config {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
__le32 id; /* unique ID - used to match */
|
||||
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
|
||||
char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
|
||||
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
|
||||
__le32 num_streams; /* number of streams */
|
||||
struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
|
||||
__le32 num_hw_configs; /* number of hw configs */
|
||||
__le32 default_hw_config_id; /* default hw config ID for init */
|
||||
__le32 flag_mask; /* bitmask of flags to configure */
|
||||
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* Describes SW/FW specific features of physical DAI.
|
||||
* It can be used to configure backend DAIs for DPCM.
|
||||
*
|
||||
* File block representation for physical DAI :-
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_hdr | 1 |
|
||||
* +-----------------------------------+-----+
|
||||
* | struct snd_soc_tplg_dai | N |
|
||||
* +-----------------------------------+-----+
|
||||
*/
|
||||
struct snd_soc_tplg_dai {
|
||||
__le32 size; /* in bytes of this structure */
|
||||
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
|
||||
__le32 dai_id; /* unique ID - used to match */
|
||||
__le32 playback; /* supports playback mode */
|
||||
__le32 capture; /* supports capture mode */
|
||||
struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
|
||||
__le32 flag_mask; /* bitmask of flags to configure */
|
||||
__le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
|
||||
struct snd_soc_tplg_private priv;
|
||||
} __attribute__((packed));
|
||||
#endif
|
134
raylib/external/alsa/sound/asound_fm.h
vendored
134
raylib/external/alsa/sound/asound_fm.h
vendored
|
@ -1,134 +0,0 @@
|
|||
#ifndef __SOUND_ASOUND_FM_H
|
||||
#define __SOUND_ASOUND_FM_H
|
||||
|
||||
/*
|
||||
* Advanced Linux Sound Architecture - ALSA
|
||||
*
|
||||
* Interface file between ALSA driver & user space
|
||||
* Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
|
||||
* 4Front Technologies
|
||||
*
|
||||
* Direct FM control
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#define SNDRV_DM_FM_MODE_OPL2 0x00
|
||||
#define SNDRV_DM_FM_MODE_OPL3 0x01
|
||||
|
||||
struct snd_dm_fm_info {
|
||||
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
|
||||
unsigned char rhythm; /* percussion mode flag */
|
||||
};
|
||||
|
||||
/*
|
||||
* Data structure composing an FM "note" or sound event.
|
||||
*/
|
||||
|
||||
struct snd_dm_fm_voice {
|
||||
unsigned char op; /* operator cell (0 or 1) */
|
||||
unsigned char voice; /* FM voice (0 to 17) */
|
||||
|
||||
unsigned char am; /* amplitude modulation */
|
||||
unsigned char vibrato; /* vibrato effect */
|
||||
unsigned char do_sustain; /* sustain phase */
|
||||
unsigned char kbd_scale; /* keyboard scaling */
|
||||
unsigned char harmonic; /* 4 bits: harmonic and multiplier */
|
||||
unsigned char scale_level; /* 2 bits: decrease output freq rises */
|
||||
unsigned char volume; /* 6 bits: volume */
|
||||
|
||||
unsigned char attack; /* 4 bits: attack rate */
|
||||
unsigned char decay; /* 4 bits: decay rate */
|
||||
unsigned char sustain; /* 4 bits: sustain level */
|
||||
unsigned char release; /* 4 bits: release rate */
|
||||
|
||||
unsigned char feedback; /* 3 bits: feedback for op0 */
|
||||
unsigned char connection; /* 0 for serial, 1 for parallel */
|
||||
unsigned char left; /* stereo left */
|
||||
unsigned char right; /* stereo right */
|
||||
unsigned char waveform; /* 3 bits: waveform shape */
|
||||
};
|
||||
|
||||
/*
|
||||
* This describes an FM note by its voice, octave, frequency number (10bit)
|
||||
* and key on/off.
|
||||
*/
|
||||
|
||||
struct snd_dm_fm_note {
|
||||
unsigned char voice; /* 0-17 voice channel */
|
||||
unsigned char octave; /* 3 bits: what octave to play */
|
||||
unsigned int fnum; /* 10 bits: frequency number */
|
||||
unsigned char key_on; /* set for active, clear for silent */
|
||||
};
|
||||
|
||||
/*
|
||||
* FM parameters that apply globally to all voices, and thus are not "notes"
|
||||
*/
|
||||
|
||||
struct snd_dm_fm_params {
|
||||
unsigned char am_depth; /* amplitude modulation depth (1=hi) */
|
||||
unsigned char vib_depth; /* vibrato depth (1=hi) */
|
||||
unsigned char kbd_split; /* keyboard split */
|
||||
unsigned char rhythm; /* percussion mode select */
|
||||
|
||||
/* This block is the percussion instrument data */
|
||||
unsigned char bass;
|
||||
unsigned char snare;
|
||||
unsigned char tomtom;
|
||||
unsigned char cymbal;
|
||||
unsigned char hihat;
|
||||
};
|
||||
|
||||
/*
|
||||
* FM mode ioctl settings
|
||||
*/
|
||||
|
||||
#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
|
||||
#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
|
||||
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
|
||||
#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
|
||||
#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
|
||||
#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
|
||||
/* for OPL3 only */
|
||||
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
|
||||
/* SBI patch management */
|
||||
#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
|
||||
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
|
||||
#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
|
||||
|
||||
/*
|
||||
* Patch Record - fixed size for write
|
||||
*/
|
||||
|
||||
#define FM_KEY_SBI "SBI\032"
|
||||
#define FM_KEY_2OP "2OP\032"
|
||||
#define FM_KEY_4OP "4OP\032"
|
||||
|
||||
struct sbi_patch {
|
||||
unsigned char prog;
|
||||
unsigned char bank;
|
||||
char key[4];
|
||||
char name[25];
|
||||
char extension[7];
|
||||
unsigned char data[32];
|
||||
};
|
||||
|
||||
#endif /* __SOUND_ASOUND_FM_H */
|
349
raylib/external/alsa/sound/emu10k1.h
vendored
349
raylib/external/alsa/sound/emu10k1.h
vendored
|
@ -1,349 +0,0 @@
|
|||
#ifndef __SOUND_EMU10K1_H
|
||||
#define __SOUND_EMU10K1_H
|
||||
|
||||
/*
|
||||
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
|
||||
* Creative Labs, Inc.
|
||||
* Definitions for EMU10K1 (SB Live!) chips
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* ---- FX8010 ----
|
||||
*/
|
||||
|
||||
#define EMU10K1_CARD_CREATIVE 0x00000000
|
||||
#define EMU10K1_CARD_EMUAPS 0x00000001
|
||||
|
||||
#define EMU10K1_FX8010_PCM_COUNT 8
|
||||
|
||||
/* instruction set */
|
||||
#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
|
||||
#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
|
||||
#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
|
||||
#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
|
||||
#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
|
||||
#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
|
||||
#define iACC3 0x06 /* R = A + X + Y ; saturation */
|
||||
#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
|
||||
#define iANDXOR 0x08 /* R = (A & X) ^ Y */
|
||||
#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
|
||||
#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
|
||||
#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
|
||||
#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
|
||||
#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
|
||||
#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
|
||||
#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
|
||||
|
||||
/* GPRs */
|
||||
#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
|
||||
#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
|
||||
#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f */
|
||||
#define C_00000000 0x40
|
||||
#define C_00000001 0x41
|
||||
#define C_00000002 0x42
|
||||
#define C_00000003 0x43
|
||||
#define C_00000004 0x44
|
||||
#define C_00000008 0x45
|
||||
#define C_00000010 0x46
|
||||
#define C_00000020 0x47
|
||||
#define C_00000100 0x48
|
||||
#define C_00010000 0x49
|
||||
#define C_00080000 0x4a
|
||||
#define C_10000000 0x4b
|
||||
#define C_20000000 0x4c
|
||||
#define C_40000000 0x4d
|
||||
#define C_80000000 0x4e
|
||||
#define C_7fffffff 0x4f
|
||||
#define C_ffffffff 0x50
|
||||
#define C_fffffffe 0x51
|
||||
#define C_c0000000 0x52
|
||||
#define C_4f1bbcdc 0x53
|
||||
#define C_5a7ef9db 0x54
|
||||
#define C_00100000 0x55 /* ?? */
|
||||
#define GPR_ACCU 0x56 /* ACCUM, accumulator */
|
||||
#define GPR_COND 0x57 /* CCR, condition register */
|
||||
#define GPR_NOISE0 0x58 /* noise source */
|
||||
#define GPR_NOISE1 0x59 /* noise source */
|
||||
#define GPR_IRQ 0x5a /* IRQ register */
|
||||
#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
|
||||
#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
|
||||
#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
|
||||
#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
|
||||
#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
|
||||
#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
|
||||
|
||||
#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f? */
|
||||
#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x1f? */
|
||||
#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f? */
|
||||
#define A_GPR(x) (A_FXGPREGBASE + (x))
|
||||
|
||||
/* cc_reg constants */
|
||||
#define CC_REG_NORMALIZED C_00000001
|
||||
#define CC_REG_BORROW C_00000002
|
||||
#define CC_REG_MINUS C_00000004
|
||||
#define CC_REG_ZERO C_00000008
|
||||
#define CC_REG_SATURATE C_00000010
|
||||
#define CC_REG_NONZERO C_00000100
|
||||
|
||||
/* FX buses */
|
||||
#define FXBUS_PCM_LEFT 0x00
|
||||
#define FXBUS_PCM_RIGHT 0x01
|
||||
#define FXBUS_PCM_LEFT_REAR 0x02
|
||||
#define FXBUS_PCM_RIGHT_REAR 0x03
|
||||
#define FXBUS_MIDI_LEFT 0x04
|
||||
#define FXBUS_MIDI_RIGHT 0x05
|
||||
#define FXBUS_PCM_CENTER 0x06
|
||||
#define FXBUS_PCM_LFE 0x07
|
||||
#define FXBUS_PCM_LEFT_FRONT 0x08
|
||||
#define FXBUS_PCM_RIGHT_FRONT 0x09
|
||||
#define FXBUS_MIDI_REVERB 0x0c
|
||||
#define FXBUS_MIDI_CHORUS 0x0d
|
||||
#define FXBUS_PCM_LEFT_SIDE 0x0e
|
||||
#define FXBUS_PCM_RIGHT_SIDE 0x0f
|
||||
#define FXBUS_PT_LEFT 0x14
|
||||
#define FXBUS_PT_RIGHT 0x15
|
||||
|
||||
/* Inputs */
|
||||
#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
|
||||
#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
|
||||
#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
|
||||
#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
|
||||
#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
|
||||
#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
|
||||
#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
|
||||
#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
|
||||
#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
|
||||
#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
|
||||
#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
|
||||
#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
|
||||
#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
|
||||
#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
|
||||
|
||||
/* Outputs */
|
||||
#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
|
||||
#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
|
||||
#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
|
||||
#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
|
||||
#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
|
||||
#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
|
||||
#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
|
||||
#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
|
||||
#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
|
||||
#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
|
||||
#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
|
||||
#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
|
||||
#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
|
||||
#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
|
||||
#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
|
||||
#define EXTOUT_ACENTER 0x11 /* Analog Center */
|
||||
#define EXTOUT_ALFE 0x12 /* Analog LFE */
|
||||
|
||||
/* Audigy Inputs */
|
||||
#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
|
||||
#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
|
||||
#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
|
||||
#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
|
||||
#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
|
||||
#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
|
||||
#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
|
||||
#define A_EXTIN_LINE2_R 0x09 /* right */
|
||||
#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
|
||||
#define A_EXTIN_ADC_R 0x0b /* right */
|
||||
#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
|
||||
#define A_EXTIN_AUX2_R 0x0d /* - right */
|
||||
|
||||
/* Audigiy Outputs */
|
||||
#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
|
||||
#define A_EXTOUT_FRONT_R 0x01 /* right */
|
||||
#define A_EXTOUT_CENTER 0x02 /* digital front center */
|
||||
#define A_EXTOUT_LFE 0x03 /* digital front lfe */
|
||||
#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
|
||||
#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
|
||||
#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
|
||||
#define A_EXTOUT_REAR_R 0x07 /* right */
|
||||
#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
|
||||
#define A_EXTOUT_AFRONT_R 0x09 /* right */
|
||||
#define A_EXTOUT_ACENTER 0x0a /* analog center */
|
||||
#define A_EXTOUT_ALFE 0x0b /* analog LFE */
|
||||
#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
|
||||
#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
|
||||
#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
|
||||
#define A_EXTOUT_AREAR_R 0x0f /* right */
|
||||
#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
|
||||
#define A_EXTOUT_AC97_R 0x11 /* right */
|
||||
#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
|
||||
#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
|
||||
#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
|
||||
|
||||
/* Audigy constants */
|
||||
#define A_C_00000000 0xc0
|
||||
#define A_C_00000001 0xc1
|
||||
#define A_C_00000002 0xc2
|
||||
#define A_C_00000003 0xc3
|
||||
#define A_C_00000004 0xc4
|
||||
#define A_C_00000008 0xc5
|
||||
#define A_C_00000010 0xc6
|
||||
#define A_C_00000020 0xc7
|
||||
#define A_C_00000100 0xc8
|
||||
#define A_C_00010000 0xc9
|
||||
#define A_C_00000800 0xca
|
||||
#define A_C_10000000 0xcb
|
||||
#define A_C_20000000 0xcc
|
||||
#define A_C_40000000 0xcd
|
||||
#define A_C_80000000 0xce
|
||||
#define A_C_7fffffff 0xcf
|
||||
#define A_C_ffffffff 0xd0
|
||||
#define A_C_fffffffe 0xd1
|
||||
#define A_C_c0000000 0xd2
|
||||
#define A_C_4f1bbcdc 0xd3
|
||||
#define A_C_5a7ef9db 0xd4
|
||||
#define A_C_00100000 0xd5
|
||||
#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
|
||||
#define A_GPR_COND 0xd7 /* CCR, condition register */
|
||||
#define A_GPR_NOISE0 0xd8 /* noise source */
|
||||
#define A_GPR_NOISE1 0xd9 /* noise source */
|
||||
#define A_GPR_IRQ 0xda /* IRQ register */
|
||||
#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
|
||||
#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
|
||||
|
||||
/* definitions for debug register */
|
||||
#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
|
||||
#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
|
||||
#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
|
||||
#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
|
||||
#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
|
||||
#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
|
||||
#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
|
||||
|
||||
/* tank memory address line */
|
||||
#ifndef __KERNEL__
|
||||
#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
|
||||
#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
|
||||
#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
|
||||
#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
|
||||
#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned int internal_tram_size; /* in samples */
|
||||
unsigned int external_tram_size; /* in samples */
|
||||
char fxbus_names[16][32]; /* names of FXBUSes */
|
||||
char extin_names[16][32]; /* names of external inputs */
|
||||
char extout_names[32][32]; /* names of external outputs */
|
||||
unsigned int gpr_controls; /* count of GPR controls */
|
||||
} emu10k1_fx8010_info_t;
|
||||
|
||||
#define EMU10K1_GPR_TRANSLATION_NONE 0
|
||||
#define EMU10K1_GPR_TRANSLATION_TABLE100 1
|
||||
#define EMU10K1_GPR_TRANSLATION_BASS 2
|
||||
#define EMU10K1_GPR_TRANSLATION_TREBLE 3
|
||||
#define EMU10K1_GPR_TRANSLATION_ONOFF 4
|
||||
|
||||
enum emu10k1_ctl_elem_iface {
|
||||
EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
|
||||
EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
unsigned int pad; /* don't use */
|
||||
int iface; /* interface identifier */
|
||||
unsigned int device; /* device/client number */
|
||||
unsigned int subdevice; /* subdevice (substream) number */
|
||||
unsigned char name[44]; /* ASCII name of item */
|
||||
unsigned int index; /* index of item */
|
||||
} emu10k1_ctl_elem_id_t;
|
||||
|
||||
typedef struct {
|
||||
emu10k1_ctl_elem_id_t id; /* full control ID definition */
|
||||
unsigned int vcount; /* visible count */
|
||||
unsigned int count; /* count of GPR (1..16) */
|
||||
unsigned short gpr[32]; /* GPR number(s) */
|
||||
unsigned int value[32]; /* initial values */
|
||||
unsigned int min; /* minimum range */
|
||||
unsigned int max; /* maximum range */
|
||||
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
|
||||
unsigned int *tlv;
|
||||
} emu10k1_fx8010_control_gpr_t;
|
||||
|
||||
typedef struct {
|
||||
char name[128];
|
||||
|
||||
unsigned long gpr_valid[0x200/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
|
||||
uint32_t *gpr_map; /* initializers */
|
||||
|
||||
unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
|
||||
emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */
|
||||
|
||||
unsigned int gpr_del_control_count; /* count of GPR controls to remove */
|
||||
emu10k1_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */
|
||||
|
||||
unsigned int gpr_list_control_count; /* count of GPR controls to list */
|
||||
unsigned int gpr_list_control_total; /* total count of GPR controls */
|
||||
emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */
|
||||
|
||||
unsigned long tram_valid[0x100/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
|
||||
uint32_t *tram_data_map; /* data initializers */
|
||||
uint32_t *tram_addr_map; /* map initializers */
|
||||
|
||||
unsigned long code_valid[1024/(sizeof(unsigned long)*8)]; /* bitmask of valid instructions */
|
||||
uint32_t *code; /* one instruction - 64 bits */
|
||||
} emu10k1_fx8010_code_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int address; /* 31.bit == 1 -> external TRAM */
|
||||
unsigned int size; /* size in samples (4 bytes) */
|
||||
unsigned int *samples; /* pointer to samples (20-bit) */
|
||||
/* NULL->clear memory */
|
||||
} emu10k1_fx8010_tram_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int substream; /* substream number */
|
||||
unsigned int res1; /* reserved */
|
||||
unsigned int channels; /* 16-bit channels count, zero = remove this substream */
|
||||
unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
|
||||
unsigned int buffer_size; /* count of buffered samples */
|
||||
unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
|
||||
unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
|
||||
unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
|
||||
unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
|
||||
unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
|
||||
unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
|
||||
unsigned char pad; /* reserved */
|
||||
unsigned char etram[32]; /* external TRAM address & data (one per channel) */
|
||||
unsigned int res2; /* reserved */
|
||||
} emu10k1_fx8010_pcm_t;
|
||||
|
||||
#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
|
||||
#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t)
|
||||
#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
|
||||
#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
|
||||
#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
|
||||
#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
|
||||
#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
|
||||
#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
|
||||
|
||||
#endif /* __SOUND_EMU10K1_H */
|
113
raylib/external/alsa/sound/hdsp.h
vendored
113
raylib/external/alsa/sound/hdsp.h
vendored
|
@ -1,113 +0,0 @@
|
|||
#ifndef __SOUND_HDSP_H
|
||||
#define __SOUND_HDSP_H
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define HDSP_MATRIX_MIXER_SIZE 2048
|
||||
|
||||
typedef enum {
|
||||
Digiface,
|
||||
Multiface,
|
||||
H9652,
|
||||
H9632,
|
||||
RPM,
|
||||
Undefined,
|
||||
} HDSP_IO_Type;
|
||||
|
||||
typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
|
||||
|
||||
struct _snd_hdsp_peak_rms {
|
||||
uint32_t input_peaks[26];
|
||||
uint32_t playback_peaks[26];
|
||||
uint32_t output_peaks[28];
|
||||
uint64_t input_rms[26];
|
||||
uint64_t playback_rms[26];
|
||||
/* These are only used for H96xx cards */
|
||||
uint64_t output_rms[26];
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t)
|
||||
|
||||
typedef struct _snd_hdsp_config_info hdsp_config_info_t;
|
||||
|
||||
struct _snd_hdsp_config_info {
|
||||
unsigned char pref_sync_ref;
|
||||
unsigned char wordclock_sync_check;
|
||||
unsigned char spdif_sync_check;
|
||||
unsigned char adatsync_sync_check;
|
||||
unsigned char adat_sync_check[3];
|
||||
unsigned char spdif_in;
|
||||
unsigned char spdif_out;
|
||||
unsigned char spdif_professional;
|
||||
unsigned char spdif_emphasis;
|
||||
unsigned char spdif_nonaudio;
|
||||
unsigned int spdif_sample_rate;
|
||||
unsigned int system_sample_rate;
|
||||
unsigned int autosync_sample_rate;
|
||||
unsigned char system_clock_mode;
|
||||
unsigned char clock_source;
|
||||
unsigned char autosync_ref;
|
||||
unsigned char line_out;
|
||||
unsigned char passthru;
|
||||
unsigned char da_gain;
|
||||
unsigned char ad_gain;
|
||||
unsigned char phone_gain;
|
||||
unsigned char xlr_breakout_cable;
|
||||
unsigned char analog_extension_board;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t)
|
||||
|
||||
typedef struct _snd_hdsp_firmware hdsp_firmware_t;
|
||||
|
||||
struct _snd_hdsp_firmware {
|
||||
void *firmware_data; /* 24413 x 4 bytes */
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
|
||||
|
||||
typedef struct _snd_hdsp_version hdsp_version_t;
|
||||
|
||||
struct _snd_hdsp_version {
|
||||
HDSP_IO_Type io_type;
|
||||
unsigned short firmware_rev;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t)
|
||||
|
||||
typedef struct _snd_hdsp_mixer hdsp_mixer_t;
|
||||
|
||||
struct _snd_hdsp_mixer {
|
||||
unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t)
|
||||
|
||||
typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t;
|
||||
|
||||
struct _snd_hdsp_9632_aeb {
|
||||
int aebi;
|
||||
int aebo;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t)
|
||||
|
||||
#endif /* __SOUND_HDSP_H */
|
229
raylib/external/alsa/sound/hdspm.h
vendored
229
raylib/external/alsa/sound/hdspm.h
vendored
|
@ -1,229 +0,0 @@
|
|||
#ifndef __SOUND_HDSPM_H
|
||||
#define __SOUND_HDSPM_H
|
||||
/*
|
||||
* Copyright (C) 2003 Winfried Ritsch (IEM)
|
||||
* based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
|
||||
#define HDSPM_MAX_CHANNELS 64
|
||||
|
||||
enum hdspm_io_type {
|
||||
MADI,
|
||||
MADIface,
|
||||
AIO,
|
||||
AES32,
|
||||
RayDAT
|
||||
};
|
||||
|
||||
enum hdspm_speed {
|
||||
ss,
|
||||
ds,
|
||||
qs
|
||||
};
|
||||
|
||||
/* -------------------- IOCTL Peak/RMS Meters -------------------- */
|
||||
|
||||
struct hdspm_peak_rms {
|
||||
uint32_t input_peaks[64];
|
||||
uint32_t playback_peaks[64];
|
||||
uint32_t output_peaks[64];
|
||||
|
||||
uint64_t input_rms[64];
|
||||
uint64_t playback_rms[64];
|
||||
uint64_t output_rms[64];
|
||||
|
||||
uint8_t speed; /* enum {ss, ds, qs} */
|
||||
int status2;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
|
||||
_IOR('H', 0x42, struct hdspm_peak_rms)
|
||||
|
||||
/* ------------ CONFIG block IOCTL ---------------------- */
|
||||
|
||||
struct hdspm_config {
|
||||
unsigned char pref_sync_ref;
|
||||
unsigned char wordclock_sync_check;
|
||||
unsigned char madi_sync_check;
|
||||
unsigned int system_sample_rate;
|
||||
unsigned int autosync_sample_rate;
|
||||
unsigned char system_clock_mode;
|
||||
unsigned char clock_source;
|
||||
unsigned char autosync_ref;
|
||||
unsigned char line_out;
|
||||
unsigned int passthru;
|
||||
unsigned int analog_out;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
|
||||
_IOR('H', 0x41, struct hdspm_config)
|
||||
|
||||
/**
|
||||
* If there's a TCO (TimeCode Option) board installed,
|
||||
* there are further options and status data available.
|
||||
* The hdspm_ltc structure contains the current SMPTE
|
||||
* timecode and some status information and can be
|
||||
* obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
|
||||
* hdspm_status struct.
|
||||
**/
|
||||
|
||||
enum hdspm_ltc_format {
|
||||
format_invalid,
|
||||
fps_24,
|
||||
fps_25,
|
||||
fps_2997,
|
||||
fps_30
|
||||
};
|
||||
|
||||
enum hdspm_ltc_frame {
|
||||
frame_invalid,
|
||||
drop_frame,
|
||||
full_frame
|
||||
};
|
||||
|
||||
enum hdspm_ltc_input_format {
|
||||
ntsc,
|
||||
pal,
|
||||
no_video
|
||||
};
|
||||
|
||||
struct hdspm_ltc {
|
||||
unsigned int ltc;
|
||||
|
||||
enum hdspm_ltc_format format;
|
||||
enum hdspm_ltc_frame frame;
|
||||
enum hdspm_ltc_input_format input_format;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
|
||||
|
||||
/**
|
||||
* The status data reflects the device's current state
|
||||
* as determined by the card's configuration and
|
||||
* connection status.
|
||||
**/
|
||||
|
||||
enum hdspm_sync {
|
||||
hdspm_sync_no_lock = 0,
|
||||
hdspm_sync_lock = 1,
|
||||
hdspm_sync_sync = 2
|
||||
};
|
||||
|
||||
enum hdspm_madi_input {
|
||||
hdspm_input_optical = 0,
|
||||
hdspm_input_coax = 1
|
||||
};
|
||||
|
||||
enum hdspm_madi_channel_format {
|
||||
hdspm_format_ch_64 = 0,
|
||||
hdspm_format_ch_56 = 1
|
||||
};
|
||||
|
||||
enum hdspm_madi_frame_format {
|
||||
hdspm_frame_48 = 0,
|
||||
hdspm_frame_96 = 1
|
||||
};
|
||||
|
||||
enum hdspm_syncsource {
|
||||
syncsource_wc = 0,
|
||||
syncsource_madi = 1,
|
||||
syncsource_tco = 2,
|
||||
syncsource_sync = 3,
|
||||
syncsource_none = 4
|
||||
};
|
||||
|
||||
struct hdspm_status {
|
||||
uint8_t card_type; /* enum hdspm_io_type */
|
||||
enum hdspm_syncsource autosync_source;
|
||||
|
||||
uint64_t card_clock;
|
||||
uint32_t master_period;
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint8_t sync_wc; /* enum hdspm_sync */
|
||||
uint8_t sync_madi; /* enum hdspm_sync */
|
||||
uint8_t sync_tco; /* enum hdspm_sync */
|
||||
uint8_t sync_in; /* enum hdspm_sync */
|
||||
uint8_t madi_input; /* enum hdspm_madi_input */
|
||||
uint8_t channel_format; /* enum hdspm_madi_channel_format */
|
||||
uint8_t frame_format; /* enum hdspm_madi_frame_format */
|
||||
} madi;
|
||||
} card_specific;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSPM_IOCTL_GET_STATUS \
|
||||
_IOR('H', 0x47, struct hdspm_status)
|
||||
|
||||
/**
|
||||
* Get information about the card and its add-ons.
|
||||
**/
|
||||
|
||||
#define HDSPM_ADDON_TCO 1
|
||||
|
||||
struct hdspm_version {
|
||||
uint8_t card_type; /* enum hdspm_io_type */
|
||||
char cardname[20];
|
||||
unsigned int serial;
|
||||
unsigned short firmware_rev;
|
||||
int addons;
|
||||
};
|
||||
|
||||
#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
|
||||
|
||||
/* ------------- get Matrix Mixer IOCTL --------------- */
|
||||
|
||||
/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
|
||||
* 32768 Bytes
|
||||
*/
|
||||
|
||||
/* organisation is 64 channelfader in a continous memory block */
|
||||
/* equivalent to hardware definition, maybe for future feature of mmap of
|
||||
* them
|
||||
*/
|
||||
/* each of 64 outputs has 64 infader and 64 outfader:
|
||||
Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
|
||||
|
||||
#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
|
||||
|
||||
struct hdspm_channelfader {
|
||||
unsigned int in[HDSPM_MIXER_CHANNELS];
|
||||
unsigned int pb[HDSPM_MIXER_CHANNELS];
|
||||
};
|
||||
|
||||
struct hdspm_mixer {
|
||||
struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
|
||||
};
|
||||
|
||||
struct hdspm_mixer_ioctl {
|
||||
struct hdspm_mixer *mixer;
|
||||
};
|
||||
|
||||
/* use indirect access due to the limit of ioctl bit size */
|
||||
#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
|
||||
|
||||
/* typedefs for compatibility to user-space */
|
||||
typedef struct hdspm_peak_rms hdspm_peak_rms_t;
|
||||
typedef struct hdspm_config_info hdspm_config_info_t;
|
||||
typedef struct hdspm_version hdspm_version_t;
|
||||
typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
|
||||
typedef struct hdspm_mixer hdspm_mixer_t;
|
||||
|
||||
|
||||
#endif
|
115
raylib/external/alsa/sound/sb16_csp.h
vendored
115
raylib/external/alsa/sound/sb16_csp.h
vendored
|
@ -1,115 +0,0 @@
|
|||
#ifndef __SOUND_SB16_CSP_H
|
||||
#define __SOUND_SB16_CSP_H
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
|
||||
* Takashi Iwai <tiwai@suse.de>
|
||||
*
|
||||
* SB16ASP/AWE32 CSP control
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/* CSP modes */
|
||||
#define SNDRV_SB_CSP_MODE_NONE 0x00
|
||||
#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
|
||||
#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
|
||||
#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
|
||||
|
||||
/* CSP load flags */
|
||||
#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
|
||||
#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
|
||||
|
||||
/* CSP sample width */
|
||||
#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
|
||||
#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
|
||||
|
||||
/* CSP channels */
|
||||
#define SNDRV_SB_CSP_MONO 0x01
|
||||
#define SNDRV_SB_CSP_STEREO 0x02
|
||||
|
||||
/* CSP rates */
|
||||
#define SNDRV_SB_CSP_RATE_8000 0x01
|
||||
#define SNDRV_SB_CSP_RATE_11025 0x02
|
||||
#define SNDRV_SB_CSP_RATE_22050 0x04
|
||||
#define SNDRV_SB_CSP_RATE_44100 0x08
|
||||
#define SNDRV_SB_CSP_RATE_ALL 0x0f
|
||||
|
||||
/* CSP running state */
|
||||
#define SNDRV_SB_CSP_ST_IDLE 0x00
|
||||
#define SNDRV_SB_CSP_ST_LOADED 0x01
|
||||
#define SNDRV_SB_CSP_ST_RUNNING 0x02
|
||||
#define SNDRV_SB_CSP_ST_PAUSED 0x04
|
||||
#define SNDRV_SB_CSP_ST_AUTO 0x08
|
||||
#define SNDRV_SB_CSP_ST_QSOUND 0x10
|
||||
|
||||
/* maximum QSound value (180 degrees right) */
|
||||
#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
|
||||
|
||||
/* maximum microcode RIFF file size */
|
||||
#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
|
||||
|
||||
/* microcode header */
|
||||
typedef struct snd_sb_csp_mc_header {
|
||||
char codec_name[16]; /* id name of codec */
|
||||
unsigned short func_req; /* requested function */
|
||||
} snd_sb_csp_mc_header_t;
|
||||
|
||||
/* microcode to be loaded */
|
||||
typedef struct snd_sb_csp_microcode {
|
||||
snd_sb_csp_mc_header_t info;
|
||||
unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
|
||||
} snd_sb_csp_microcode_t;
|
||||
|
||||
/* start CSP with sample_width in mono/stereo */
|
||||
typedef struct snd_sb_csp_start {
|
||||
int sample_width; /* sample width, look above */
|
||||
int channels; /* channels, look above */
|
||||
} snd_sb_csp_start_t;
|
||||
|
||||
/* CSP information */
|
||||
typedef struct snd_sb_csp_info {
|
||||
char codec_name[16]; /* id name of codec */
|
||||
unsigned short func_nr; /* function number */
|
||||
unsigned int acc_format; /* accepted PCM formats */
|
||||
unsigned short acc_channels; /* accepted channels */
|
||||
unsigned short acc_width; /* accepted sample width */
|
||||
unsigned short acc_rates; /* accepted sample rates */
|
||||
unsigned short csp_mode; /* CSP mode, see above */
|
||||
unsigned short run_channels; /* current channels */
|
||||
unsigned short run_width; /* current sample width */
|
||||
unsigned short version; /* version id: 0x10 - 0x1f */
|
||||
unsigned short state; /* state bits */
|
||||
} snd_sb_csp_info_t;
|
||||
|
||||
/* HWDEP controls */
|
||||
/* get CSP information */
|
||||
#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t)
|
||||
/* load microcode to CSP */
|
||||
#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t)
|
||||
/* unload microcode from CSP */
|
||||
#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
|
||||
/* start CSP */
|
||||
#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t)
|
||||
/* stop CSP */
|
||||
#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
|
||||
/* pause CSP and DMA transfer */
|
||||
#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
|
||||
/* restart CSP and DMA transfer */
|
||||
#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
|
||||
|
||||
|
||||
#endif /* __SOUND_SB16_CSP */
|
21
raylib/external/alsa/sound/sscape_ioctl.h
vendored
21
raylib/external/alsa/sound/sscape_ioctl.h
vendored
|
@ -1,21 +0,0 @@
|
|||
#ifndef SSCAPE_IOCTL_H
|
||||
#define SSCAPE_IOCTL_H
|
||||
|
||||
|
||||
struct sscape_bootblock
|
||||
{
|
||||
unsigned char code[256];
|
||||
unsigned version;
|
||||
};
|
||||
|
||||
#define SSCAPE_MICROCODE_SIZE 65536
|
||||
|
||||
struct sscape_microcode
|
||||
{
|
||||
unsigned char *code;
|
||||
};
|
||||
|
||||
#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
|
||||
#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
|
||||
|
||||
#endif
|
100
raylib/external/alsa/sound/tlv.h
vendored
100
raylib/external/alsa/sound/tlv.h
vendored
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __UAPI_SOUND_TLV_H
|
||||
#define __UAPI_SOUND_TLV_H
|
||||
|
||||
#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
|
||||
#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
|
||||
#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
|
||||
#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
|
||||
#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
|
||||
#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
|
||||
|
||||
/*
|
||||
* channel-mapping TLV items
|
||||
* TLV length must match with num_channels
|
||||
*/
|
||||
#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
|
||||
#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
|
||||
#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
|
||||
|
||||
/*
|
||||
* TLV structure is right behind the struct snd_ctl_tlv:
|
||||
* unsigned int type - see SNDRV_CTL_TLVT_*
|
||||
* unsigned int length
|
||||
* .... data aligned to sizeof(unsigned int), use
|
||||
* block_length = (length + (sizeof(unsigned int) - 1)) &
|
||||
* ~(sizeof(unsigned int) - 1)) ....
|
||||
*/
|
||||
#define SNDRV_CTL_TLVD_ITEM(type, ...) \
|
||||
(type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
|
||||
#define SNDRV_CTL_TLVD_LENGTH(...) \
|
||||
((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
|
||||
|
||||
#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
|
||||
#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
|
||||
}
|
||||
|
||||
#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff
|
||||
#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000
|
||||
#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
|
||||
(min), \
|
||||
((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
|
||||
((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
|
||||
#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
|
||||
}
|
||||
|
||||
/* dB scale specified with min/max values instead of step */
|
||||
#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
|
||||
#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
|
||||
#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
|
||||
}
|
||||
#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
|
||||
}
|
||||
|
||||
/* linear volume between min_dB and max_dB (.01dB unit) */
|
||||
#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
|
||||
#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
|
||||
}
|
||||
|
||||
/* dB range container:
|
||||
* Items in dB range container must be ordered by their values and by their
|
||||
* dB values. This implies that larger values must correspond with larger
|
||||
* dB values (which is also required for all other mixer controls).
|
||||
*/
|
||||
/* Each item is: <min> <max> <TLV> */
|
||||
#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
|
||||
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
|
||||
#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
|
||||
unsigned int name[] = { \
|
||||
SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
|
||||
}
|
||||
|
||||
#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999
|
||||
|
||||
#endif
|
42
raylib/external/alsa/sound/type_compat.h
vendored
42
raylib/external/alsa/sound/type_compat.h
vendored
|
@ -1,42 +0,0 @@
|
|||
#ifndef __TYPE_COMPAT_H
|
||||
#define __TYPE_COMPAT_H
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
#include <stdint.h>
|
||||
typedef uint8_t __u8;
|
||||
typedef uint16_t __u16;
|
||||
typedef uint32_t __u32;
|
||||
typedef int8_t __s8;
|
||||
typedef int16_t __s16;
|
||||
typedef int32_t __s32;
|
||||
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define __cpu_to_le32(x) (x)
|
||||
#define __cpu_to_be32(x) bswap_32(x)
|
||||
#define __cpu_to_le16(x) (x)
|
||||
#define __cpu_to_be16(x) bswap_16(x)
|
||||
#else
|
||||
#define __cpu_to_le32(x) bswap_32(x)
|
||||
#define __cpu_to_be32(x) (x)
|
||||
#define __cpu_to_le16(x) bswap_16(x)
|
||||
#define __cpu_to_be16(x) (x)
|
||||
#endif
|
||||
|
||||
#define __le32_to_cpu __cpu_to_le32
|
||||
#define __be32_to_cpu __cpu_to_be32
|
||||
#define __le16_to_cpu __cpu_to_le16
|
||||
#define __be16_to_cpu __cpu_to_be16
|
||||
|
||||
#define __le64 __u64
|
||||
#define __le32 __u32
|
||||
#define __le16 __u16
|
||||
#define __le8 __u8
|
||||
#define __be64 __u64
|
||||
#define __be32 __u32
|
||||
#define __be16 __u16
|
||||
#define __be8 __u8
|
||||
#endif /* DOC_HIDDEN */
|
||||
|
||||
#endif /* __TYPE_COMPAT_H */
|
259
raylib/external/alsa/timer.h
vendored
259
raylib/external/alsa/timer.h
vendored
|
@ -1,259 +0,0 @@
|
|||
/**
|
||||
* \file include/timer.h
|
||||
* \brief Application interface library for the ALSA driver
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Takashi Iwai <tiwai@suse.de>
|
||||
* \date 1998-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver
|
||||
*/
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_TIMER_H
|
||||
#define __ALSA_TIMER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup Timer Timer Interface
|
||||
* Timer Interface. See \ref timer page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
|
||||
/** dlsym version for interface entry callback */
|
||||
#define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
|
||||
|
||||
/** timer identification structure */
|
||||
typedef struct _snd_timer_id snd_timer_id_t;
|
||||
/** timer global info structure */
|
||||
typedef struct _snd_timer_ginfo snd_timer_ginfo_t;
|
||||
/** timer global params structure */
|
||||
typedef struct _snd_timer_gparams snd_timer_gparams_t;
|
||||
/** timer global status structure */
|
||||
typedef struct _snd_timer_gstatus snd_timer_gstatus_t;
|
||||
/** timer info structure */
|
||||
typedef struct _snd_timer_info snd_timer_info_t;
|
||||
/** timer params structure */
|
||||
typedef struct _snd_timer_params snd_timer_params_t;
|
||||
/** timer status structure */
|
||||
typedef struct _snd_timer_status snd_timer_status_t;
|
||||
/** timer master class */
|
||||
typedef enum _snd_timer_class {
|
||||
SND_TIMER_CLASS_NONE = -1, /**< invalid */
|
||||
SND_TIMER_CLASS_SLAVE = 0, /**< slave timer */
|
||||
SND_TIMER_CLASS_GLOBAL, /**< global timer */
|
||||
SND_TIMER_CLASS_CARD, /**< card timer */
|
||||
SND_TIMER_CLASS_PCM, /**< PCM timer */
|
||||
SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM /**< last timer */
|
||||
} snd_timer_class_t;
|
||||
|
||||
/** timer slave class */
|
||||
typedef enum _snd_timer_slave_class {
|
||||
SND_TIMER_SCLASS_NONE = 0, /**< none */
|
||||
SND_TIMER_SCLASS_APPLICATION, /**< for internal use */
|
||||
SND_TIMER_SCLASS_SEQUENCER, /**< sequencer timer */
|
||||
SND_TIMER_SCLASS_OSS_SEQUENCER, /**< OSS sequencer timer */
|
||||
SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER /**< last slave timer */
|
||||
} snd_timer_slave_class_t;
|
||||
|
||||
/** timer read event identification */
|
||||
typedef enum _snd_timer_event {
|
||||
SND_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
|
||||
SND_TIMER_EVENT_TICK, /* val = ticks */
|
||||
SND_TIMER_EVENT_START, /* val = resolution in ns */
|
||||
SND_TIMER_EVENT_STOP, /* val = 0 */
|
||||
SND_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
|
||||
SND_TIMER_EVENT_PAUSE, /* val = 0 */
|
||||
SND_TIMER_EVENT_EARLY, /* val = 0 */
|
||||
SND_TIMER_EVENT_SUSPEND, /* val = 0 */
|
||||
SND_TIMER_EVENT_RESUME, /* val = resolution in ns */
|
||||
/* master timer events for slave timer instances */
|
||||
SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
|
||||
SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
|
||||
SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
|
||||
SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
|
||||
SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
|
||||
SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
|
||||
} snd_timer_event_t;
|
||||
|
||||
/** timer read structure */
|
||||
typedef struct _snd_timer_read {
|
||||
unsigned int resolution; /**< tick resolution in nanoseconds */
|
||||
unsigned int ticks; /**< count of happened ticks */
|
||||
} snd_timer_read_t;
|
||||
|
||||
/** timer tstamp + event read structure */
|
||||
typedef struct _snd_timer_tread {
|
||||
snd_timer_event_t event; /**< Timer event */
|
||||
snd_htimestamp_t tstamp; /**< Time stamp of each event */
|
||||
unsigned int val; /**< Event value */
|
||||
} snd_timer_tread_t;
|
||||
|
||||
/** global timer - system */
|
||||
#define SND_TIMER_GLOBAL_SYSTEM 0
|
||||
/** global timer - RTC */
|
||||
#define SND_TIMER_GLOBAL_RTC 1 /* Obsoleted, due to enough legacy. */
|
||||
/** global timer - HPET */
|
||||
#define SND_TIMER_GLOBAL_HPET 2
|
||||
/** global timer - HRTIMER */
|
||||
#define SND_TIMER_GLOBAL_HRTIMER 3
|
||||
|
||||
/** timer open mode flag - non-blocking behaviour */
|
||||
#define SND_TIMER_OPEN_NONBLOCK (1<<0)
|
||||
/** use timestamps and event notification - enhanced read */
|
||||
#define SND_TIMER_OPEN_TREAD (1<<1)
|
||||
|
||||
/** timer handle type */
|
||||
typedef enum _snd_timer_type {
|
||||
/** Kernel level HwDep */
|
||||
SND_TIMER_TYPE_HW = 0,
|
||||
/** Shared memory client timer (not yet implemented) */
|
||||
SND_TIMER_TYPE_SHM,
|
||||
/** INET client timer (not yet implemented) */
|
||||
SND_TIMER_TYPE_INET
|
||||
} snd_timer_type_t;
|
||||
|
||||
/** timer query handle */
|
||||
typedef struct _snd_timer_query snd_timer_query_t;
|
||||
/** timer handle */
|
||||
typedef struct _snd_timer snd_timer_t;
|
||||
|
||||
|
||||
int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode);
|
||||
int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf);
|
||||
int snd_timer_query_close(snd_timer_query_t *handle);
|
||||
int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid);
|
||||
int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info);
|
||||
int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params);
|
||||
int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status);
|
||||
|
||||
int snd_timer_open(snd_timer_t **handle, const char *name, int mode);
|
||||
int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf);
|
||||
int snd_timer_close(snd_timer_t *handle);
|
||||
int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
|
||||
snd_async_callback_t callback, void *private_data);
|
||||
snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler);
|
||||
int snd_timer_poll_descriptors_count(snd_timer_t *handle);
|
||||
int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space);
|
||||
int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
|
||||
int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
|
||||
int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
|
||||
int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
|
||||
int snd_timer_start(snd_timer_t *handle);
|
||||
int snd_timer_stop(snd_timer_t *handle);
|
||||
int snd_timer_continue(snd_timer_t *handle);
|
||||
ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
|
||||
|
||||
size_t snd_timer_id_sizeof(void);
|
||||
/** allocate #snd_timer_id_t container on stack */
|
||||
#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
|
||||
int snd_timer_id_malloc(snd_timer_id_t **ptr);
|
||||
void snd_timer_id_free(snd_timer_id_t *obj);
|
||||
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
|
||||
|
||||
void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class);
|
||||
int snd_timer_id_get_class(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass);
|
||||
int snd_timer_id_get_sclass(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_card(snd_timer_id_t *id, int card);
|
||||
int snd_timer_id_get_card(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_device(snd_timer_id_t *id, int device);
|
||||
int snd_timer_id_get_device(snd_timer_id_t *id);
|
||||
void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
|
||||
int snd_timer_id_get_subdevice(snd_timer_id_t *id);
|
||||
|
||||
size_t snd_timer_ginfo_sizeof(void);
|
||||
/** allocate #snd_timer_ginfo_t container on stack */
|
||||
#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
|
||||
int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
|
||||
void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
|
||||
void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
|
||||
|
||||
int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid);
|
||||
snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj);
|
||||
unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj);
|
||||
int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj);
|
||||
char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj);
|
||||
char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj);
|
||||
unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj);
|
||||
unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj);
|
||||
unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj);
|
||||
unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj);
|
||||
|
||||
size_t snd_timer_info_sizeof(void);
|
||||
/** allocate #snd_timer_info_t container on stack */
|
||||
#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
|
||||
int snd_timer_info_malloc(snd_timer_info_t **ptr);
|
||||
void snd_timer_info_free(snd_timer_info_t *obj);
|
||||
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
|
||||
|
||||
int snd_timer_info_is_slave(snd_timer_info_t * info);
|
||||
int snd_timer_info_get_card(snd_timer_info_t * info);
|
||||
const char *snd_timer_info_get_id(snd_timer_info_t * info);
|
||||
const char *snd_timer_info_get_name(snd_timer_info_t * info);
|
||||
long snd_timer_info_get_resolution(snd_timer_info_t * info);
|
||||
|
||||
size_t snd_timer_params_sizeof(void);
|
||||
/** allocate #snd_timer_params_t container on stack */
|
||||
#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
|
||||
int snd_timer_params_malloc(snd_timer_params_t **ptr);
|
||||
void snd_timer_params_free(snd_timer_params_t *obj);
|
||||
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
|
||||
|
||||
int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
|
||||
int snd_timer_params_get_auto_start(snd_timer_params_t * params);
|
||||
int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive);
|
||||
int snd_timer_params_get_exclusive(snd_timer_params_t * params);
|
||||
int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event);
|
||||
int snd_timer_params_get_early_event(snd_timer_params_t * params);
|
||||
void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
|
||||
long snd_timer_params_get_ticks(snd_timer_params_t * params);
|
||||
void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
|
||||
long snd_timer_params_get_queue_size(snd_timer_params_t * params);
|
||||
void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter);
|
||||
unsigned int snd_timer_params_get_filter(snd_timer_params_t * params);
|
||||
|
||||
size_t snd_timer_status_sizeof(void);
|
||||
/** allocate #snd_timer_status_t container on stack */
|
||||
#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
|
||||
int snd_timer_status_malloc(snd_timer_status_t **ptr);
|
||||
void snd_timer_status_free(snd_timer_status_t *obj);
|
||||
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
|
||||
|
||||
snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_resolution(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_lost(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_overrun(snd_timer_status_t * status);
|
||||
long snd_timer_status_get_queue(snd_timer_status_t * status);
|
||||
|
||||
/* deprecated functions, for compatibility */
|
||||
long snd_timer_info_get_ticks(snd_timer_info_t * info);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** __ALSA_TIMER_H */
|
||||
|
1115
raylib/external/alsa/topology.h
vendored
1115
raylib/external/alsa/topology.h
vendored
File diff suppressed because it is too large
Load diff
433
raylib/external/alsa/use-case.h
vendored
433
raylib/external/alsa/use-case.h
vendored
|
@ -1,433 +0,0 @@
|
|||
/**
|
||||
* \file include/use-case.h
|
||||
* \brief use case interface for the ALSA driver
|
||||
* \author Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
* \author Stefan Schmidt <stefan@slimlogic.co.uk>
|
||||
* \author Jaroslav Kysela <perex@perex.cz>
|
||||
* \author Justin Xu <justinx@slimlogic.co.uk>
|
||||
* \date 2008-2010
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Copyright (C) 2008-2010 SlimLogic Ltd
|
||||
* Copyright (C) 2010 Wolfson Microelectronics PLC
|
||||
* Copyright (C) 2010 Texas Instruments Inc.
|
||||
*
|
||||
* Support for the verb/device/modifier core logic and API,
|
||||
* command line tool and file parser was kindly sponsored by
|
||||
* Texas Instruments Inc.
|
||||
* Support for multiple active modifiers and devices,
|
||||
* transition sequences, multiple client access and user defined use
|
||||
* cases was kindly sponsored by Wolfson Microelectronics PLC.
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_USE_CASE_H
|
||||
#define __ALSA_USE_CASE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup ucm Use Case Interface
|
||||
* The ALSA Use Case manager interface.
|
||||
* See \ref Usecase page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
/*! \page Usecase ALSA Use Case Interface
|
||||
*
|
||||
* The use case manager works by configuring the sound card ALSA kcontrols to
|
||||
* change the hardware digital and analog audio routing to match the requested
|
||||
* device use case. The use case manager kcontrol configurations are stored in
|
||||
* easy to modify text files.
|
||||
*
|
||||
* An audio use case can be defined by a verb and device parameter. The verb
|
||||
* describes the use case action i.e. a phone call, listening to music, recording
|
||||
* a conversation etc. The device describes the physical audio capture and playback
|
||||
* hardware i.e. headphones, phone handset, bluetooth headset, etc.
|
||||
*
|
||||
* It's intended clients will mostly only need to set the use case verb and
|
||||
* device for each system use case change (as the verb and device parameters
|
||||
* cover most audio use cases).
|
||||
*
|
||||
* However there are times when a use case has to be modified at runtime. e.g.
|
||||
*
|
||||
* + Incoming phone call when the device is playing music
|
||||
* + Recording sections of a phone call
|
||||
* + Playing tones during a call.
|
||||
*
|
||||
* In order to allow asynchronous runtime use case adaptations, we have a third
|
||||
* optional modifier parameter that can be used to further configure
|
||||
* the use case during live audio runtime.
|
||||
*
|
||||
* This interface allows clients to :-
|
||||
*
|
||||
* + Query the supported use case verbs, devices and modifiers for the machine.
|
||||
* + Set and Get use case verbs, devices and modifiers for the machine.
|
||||
* + Get the ALSA PCM playback and capture device PCMs for use case verb,
|
||||
* use case device and modifier.
|
||||
* + Get the TQ parameter for each use case verb, use case device and
|
||||
* modifier.
|
||||
* + Get the ALSA master playback and capture volume/switch kcontrols
|
||||
* for each use case.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Use Case Verb.
|
||||
*
|
||||
* The use case verb is the main device audio action. e.g. the "HiFi" use
|
||||
* case verb will configure the audio hardware for HiFi Music playback
|
||||
* and capture.
|
||||
*/
|
||||
#define SND_USE_CASE_VERB_INACTIVE "Inactive" /**< Inactive Verb */
|
||||
#define SND_USE_CASE_VERB_HIFI "HiFi" /**< HiFi Verb */
|
||||
#define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power" /**< HiFi Low Power Verb */
|
||||
#define SND_USE_CASE_VERB_VOICE "Voice" /**< Voice Verb */
|
||||
#define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power" /**< Voice Low Power Verb */
|
||||
#define SND_USE_CASE_VERB_VOICECALL "Voice Call" /**< Voice Call Verb */
|
||||
#define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP" /**< Voice Call IP Verb */
|
||||
#define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio" /**< FM Analog Radio Verb */
|
||||
#define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio" /**< FM Digital Radio Verb */
|
||||
/* add new verbs to end of list */
|
||||
|
||||
|
||||
/*
|
||||
* Use Case Device.
|
||||
*
|
||||
* Physical system devices the render and capture audio. Devices can be OR'ed
|
||||
* together to support audio on simultaneous devices.
|
||||
*/
|
||||
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
||||
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
|
||||
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
|
||||
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
|
||||
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
|
||||
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
|
||||
#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */
|
||||
#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
|
||||
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
|
||||
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */
|
||||
/* add new devices to end of list */
|
||||
|
||||
|
||||
/*
|
||||
* Use Case Modifiers.
|
||||
*
|
||||
* The use case modifier allows runtime configuration changes to deal with
|
||||
* asynchronous events.
|
||||
*
|
||||
* e.g. to record a voice call :-
|
||||
* 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
|
||||
* 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
|
||||
* 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
|
||||
* with captured voice pcm data.
|
||||
*
|
||||
* e.g. to play a ring tone when listenin to MP3 Music :-
|
||||
* 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
|
||||
* 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
|
||||
* 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
|
||||
* ringtone pcm data.
|
||||
*/
|
||||
#define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice" /**< Capture Voice Modifier */
|
||||
#define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music" /**< Capture Music Modifier */
|
||||
#define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music" /**< Play Music Modifier */
|
||||
#define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice" /**< Play Voice Modifier */
|
||||
#define SND_USE_CASE_MOD_PLAY_TONE "Play Tone" /**< Play Tone Modifier */
|
||||
#define SND_USE_CASE_MOD_ECHO_REF "Echo Reference" /**< Echo Reference Modifier */
|
||||
/* add new modifiers to end of list */
|
||||
|
||||
|
||||
/**
|
||||
* TQ - Tone Quality
|
||||
*
|
||||
* The interface allows clients to determine the audio TQ required for each
|
||||
* use case verb and modifier. It's intended as an optional hint to the
|
||||
* audio driver in order to lower power consumption.
|
||||
*
|
||||
*/
|
||||
#define SND_USE_CASE_TQ_MUSIC "Music" /**< Music Tone Quality */
|
||||
#define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice Tone Quality */
|
||||
#define SND_USE_CASE_TQ_TONES "Tones" /**< Tones Tone Quality */
|
||||
|
||||
/** use case container */
|
||||
typedef struct snd_use_case_mgr snd_use_case_mgr_t;
|
||||
|
||||
/**
|
||||
* \brief Create an identifier
|
||||
* \param fmt Format (sprintf like)
|
||||
* \param ... Optional arguments for sprintf like format
|
||||
* \return Allocated string identifier or NULL on error
|
||||
*/
|
||||
char *snd_use_case_identifier(const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Free a string list
|
||||
* \param list The string list to free
|
||||
* \param items Count of strings
|
||||
* \return Zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_use_case_free_list(const char *list[], int items);
|
||||
|
||||
/**
|
||||
* \brief Obtain a list of entries
|
||||
* \param uc_mgr Use case manager (may be NULL - card list)
|
||||
* \param identifier (may be NULL - card list)
|
||||
* \param list Returned allocated list
|
||||
* \return Number of list entries if success, otherwise a negative error code
|
||||
*
|
||||
* Defined identifiers:
|
||||
* - NULL - get card list
|
||||
* (in pair cardname+comment)
|
||||
* - _verbs - get verb list
|
||||
* (in pair verb+comment)
|
||||
* - _devices[/{verb}] - get list of supported devices
|
||||
* (in pair device+comment)
|
||||
* - _modifiers[/{verb}] - get list of supported modifiers
|
||||
* (in pair modifier+comment)
|
||||
* - TQ[/{verb}] - get list of TQ identifiers
|
||||
* - _enadevs - get list of enabled devices
|
||||
* - _enamods - get list of enabled modifiers
|
||||
*
|
||||
* - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices
|
||||
* - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices
|
||||
*
|
||||
* Note that at most one of the supported/conflicting devs lists has
|
||||
* any entries, and when neither is present, all devices are supported.
|
||||
*
|
||||
*/
|
||||
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char **list[]);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get current - string
|
||||
* \param uc_mgr Use case manager
|
||||
* \param identifier
|
||||
* \param value Value pointer
|
||||
* \return Zero if success, otherwise a negative error code
|
||||
*
|
||||
* Note: The returned string is dynamically allocated, use free() to
|
||||
* deallocate this string. (Yes, the value parameter shouldn't be marked as
|
||||
* "const", but it's too late to fix it, sorry about that.)
|
||||
*
|
||||
* Known identifiers:
|
||||
* - NULL - return current card
|
||||
* - _verb - return current verb
|
||||
* - _file - return configuration file loaded for current card
|
||||
*
|
||||
* - [=]{NAME}[/[{modifier}|{/device}][/{verb}]]
|
||||
* - value identifier {NAME}
|
||||
* - Search starts at given modifier or device if any,
|
||||
* else at a verb
|
||||
* - Search starts at given verb if any,
|
||||
* else current verb
|
||||
* - Searches modifier/device, then verb, then defaults
|
||||
* - Specify a leading "=" to search only the exact
|
||||
* device/modifier/verb specified, and not search
|
||||
* through each object in turn.
|
||||
* - Examples:
|
||||
* - "PlaybackPCM/Play Music"
|
||||
* - "CapturePCM/SPDIF"
|
||||
* - From ValueDefaults only:
|
||||
* "=Variable"
|
||||
* - From current active verb:
|
||||
* "=Variable//"
|
||||
* - From verb "Verb":
|
||||
* "=Variable//Verb"
|
||||
* - From "Modifier" in current active verb:
|
||||
* "=Variable/Modifier/"
|
||||
* - From "Modifier" in "Verb":
|
||||
* "=Variable/Modifier/Verb"
|
||||
*
|
||||
* Recommended names for values:
|
||||
* - TQ
|
||||
* - Tone Quality
|
||||
* - PlaybackPCM
|
||||
* - full PCM playback device name
|
||||
* - PlaybackPCMIsDummy
|
||||
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
|
||||
* PlaybackPCM value is a dummy device, meaning that opening it enables
|
||||
* an audio path in the hardware, but writing to the PCM device has no
|
||||
* effect.
|
||||
* - CapturePCM
|
||||
* - full PCM capture device name
|
||||
* - CapturePCMIsDummy
|
||||
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
|
||||
* CapturePCM value is a dummy device, meaning that opening it enables
|
||||
* an audio path in the hardware, but reading from the PCM device has no
|
||||
* effect.
|
||||
* - PlaybackRate
|
||||
* - playback device sample rate
|
||||
* - PlaybackChannels
|
||||
* - playback device channel count
|
||||
* - PlaybackCTL
|
||||
* - playback control device name
|
||||
* - PlaybackVolume
|
||||
* - playback control volume ID string
|
||||
* - PlaybackSwitch
|
||||
* - playback control switch ID string
|
||||
* - CaptureRate
|
||||
* - capture device sample rate
|
||||
* - CaptureChannels
|
||||
* - capture device channel count
|
||||
* - CaptureCTL
|
||||
* - capture control device name
|
||||
* - CaptureVolume
|
||||
* - capture control volume ID string
|
||||
* - CaptureSwitch
|
||||
* - capture control switch ID string
|
||||
* - PlaybackMixer
|
||||
* - name of playback mixer
|
||||
* - PlaybackMixerID
|
||||
* - mixer playback ID
|
||||
* - CaptureMixer
|
||||
* - name of capture mixer
|
||||
* - CaptureMixerID
|
||||
* - mixer capture ID
|
||||
* - JackControl, JackDev, JackHWMute
|
||||
* - Jack information for a device. The jack status can be reported via
|
||||
* a kcontrol and/or via an input device. **JackControl** is the
|
||||
* kcontrol name of the jack, and **JackDev** is the input device id of
|
||||
* the jack (if the full input device path is /dev/input/by-id/foo, the
|
||||
* JackDev value should be "foo"). UCM configuration files should
|
||||
* contain both JackControl and JackDev when possible, because
|
||||
* applications are likely to support only one or the other.
|
||||
*
|
||||
* If **JackHWMute** is set, it indicates that when the jack is plugged
|
||||
* in, the hardware automatically mutes some other device(s). The
|
||||
* JackHWMute value is a space-separated list of device names (this
|
||||
* isn't compatible with device names with spaces in them, so don't use
|
||||
* such device names!). Note that JackHWMute should be used only when
|
||||
* the hardware enforces the automatic muting. If the hardware doesn't
|
||||
* enforce any muting, it may still be tempting to set JackHWMute to
|
||||
* trick upper software layers to e.g. automatically mute speakers when
|
||||
* headphones are plugged in, but that's application policy
|
||||
* configuration that doesn't belong to UCM configuration files.
|
||||
*/
|
||||
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char **value);
|
||||
|
||||
/**
|
||||
* \brief Get current - integer
|
||||
* \param uc_mgr Use case manager
|
||||
* \param identifier
|
||||
* \param value result
|
||||
* \return Zero if success, otherwise a negative error code
|
||||
*
|
||||
* Known identifiers:
|
||||
* - _devstatus/{device} - return status for given device
|
||||
* - _modstatus/{modifier} - return status for given modifier
|
||||
*/
|
||||
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
long *value);
|
||||
|
||||
/**
|
||||
* \brief Set new
|
||||
* \param uc_mgr Use case manager
|
||||
* \param identifier
|
||||
* \param value Value
|
||||
* \return Zero if success, otherwise a negative error code
|
||||
*
|
||||
* Known identifiers:
|
||||
* - _verb - set current verb = value
|
||||
* - _enadev - enable given device = value
|
||||
* - _disdev - disable given device = value
|
||||
* - _swdev/{old_device} - new_device = value
|
||||
* - disable old_device and then enable new_device
|
||||
* - if old_device is not enabled just return
|
||||
* - check transmit sequence firstly
|
||||
* - _enamod - enable given modifier = value
|
||||
* - _dismod - disable given modifier = value
|
||||
* - _swmod/{old_modifier} - new_modifier = value
|
||||
* - disable old_modifier and then enable new_modifier
|
||||
* - if old_modifier is not enabled just return
|
||||
* - check transmit sequence firstly
|
||||
*/
|
||||
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* \brief Open and initialise use case core for sound card
|
||||
* \param uc_mgr Returned use case manager pointer
|
||||
* \param card_name Sound card name.
|
||||
* \return zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Reload and re-parse use case configuration files for sound card.
|
||||
* \param uc_mgr Use case manager
|
||||
* \return zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
|
||||
|
||||
/**
|
||||
* \brief Close use case manager
|
||||
* \param uc_mgr Use case manager
|
||||
* \return zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
|
||||
|
||||
/**
|
||||
* \brief Reset use case manager verb, device, modifier to deafult settings.
|
||||
* \param uc_mgr Use case manager
|
||||
* \return zero if success, otherwise a negative error code
|
||||
*/
|
||||
int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
|
||||
|
||||
/*
|
||||
* helper functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Obtain a list of cards
|
||||
* \param list Returned allocated list
|
||||
* \return Number of list entries if success, otherwise a negative error code
|
||||
*/
|
||||
static __inline__ int snd_use_case_card_list(const char **list[])
|
||||
{
|
||||
return snd_use_case_get_list(NULL, NULL, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Obtain a list of verbs
|
||||
* \param uc_mgr Use case manager
|
||||
* \param list Returned list of verbs
|
||||
* \return Number of list entries if success, otherwise a negative error code
|
||||
*/
|
||||
static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
|
||||
const char **list[])
|
||||
{
|
||||
return snd_use_case_get_list(uc_mgr, "_verbs", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALSA_USE_CASE_H */
|
15
raylib/external/alsa/version.h
vendored
15
raylib/external/alsa/version.h
vendored
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* version.h
|
||||
*/
|
||||
|
||||
#define SND_LIB_MAJOR 1 /**< major number of library version */
|
||||
#define SND_LIB_MINOR 1 /**< minor number of library version */
|
||||
#define SND_LIB_SUBMINOR 5 /**< subminor number of library version */
|
||||
#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
|
||||
/** library version */
|
||||
#define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\
|
||||
(SND_LIB_MINOR<<8)|\
|
||||
SND_LIB_SUBMINOR)
|
||||
/** library version (string) */
|
||||
#define SND_LIB_VERSION_STR "1.1.5"
|
||||
|
2023
raylib/external/cgltf.h
vendored
Normal file
2023
raylib/external/cgltf.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
713
raylib/external/dr_flac.h
vendored
713
raylib/external/dr_flac.h
vendored
File diff suppressed because it is too large
Load diff
71
raylib/external/dr_mp3.h
vendored
71
raylib/external/dr_mp3.h
vendored
|
@ -1,5 +1,5 @@
|
|||
// MP3 audio decoder. Public domain. See "unlicense" statement at the end of this file.
|
||||
// dr_mp3 - v0.2.3 - 2018-04-29
|
||||
// dr_mp3 - v0.2.5 - 2018-06-22
|
||||
//
|
||||
// David Reid - mackron@gmail.com
|
||||
//
|
||||
|
@ -339,7 +339,7 @@ void drmp3_free(void* p);
|
|||
#define DRMP3_HDR_GET_LAYER(h) (((h[1]) >> 1) & 3)
|
||||
#define DRMP3_HDR_GET_BITRATE(h) ((h[2]) >> 4)
|
||||
#define DRMP3_HDR_GET_SAMPLE_RATE(h) (((h[2]) >> 2) & 3)
|
||||
#define DRMP3_HDR_GET_MY_SAMPLE_RATE(h) (DRMP3_HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1))*3)
|
||||
#define DRMP3_HDR_GET_MY_SAMPLE_RATE(h) (DRMP3_HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1))*3)
|
||||
#define DRMP3_HDR_IS_FRAME_576(h) ((h[1] & 14) == 2)
|
||||
#define DRMP3_HDR_IS_LAYER_1(h) ((h[1] & 6) == 6)
|
||||
|
||||
|
@ -412,10 +412,10 @@ static int drmp3_have_simd()
|
|||
#ifdef MINIMP3_TEST
|
||||
static int g_counter;
|
||||
if (g_counter++ > 100)
|
||||
goto test_nosimd;
|
||||
return 0;
|
||||
#endif
|
||||
if (g_have_simd)
|
||||
return g_have_simd - 1;
|
||||
goto end;
|
||||
drmp3_cpuid(CPUInfo, 0);
|
||||
if (CPUInfo[0] > 0)
|
||||
{
|
||||
|
@ -423,11 +423,9 @@ static int drmp3_have_simd()
|
|||
g_have_simd = (CPUInfo[3] & (1 << 26)) + 1; /* SSE2 */
|
||||
return g_have_simd - 1;
|
||||
}
|
||||
#ifdef MINIMP3_TEST
|
||||
test_nosimd:
|
||||
#endif
|
||||
g_have_simd = 1;
|
||||
return 0;
|
||||
|
||||
end:
|
||||
return g_have_simd - 1;
|
||||
#endif
|
||||
}
|
||||
#elif defined(__ARM_NEON) || defined(__aarch64__)
|
||||
|
@ -760,8 +758,7 @@ static void drmp3_L12_apply_scf_384(drmp3_L12_scale_info *sci, const float *scf,
|
|||
|
||||
static int drmp3_L3_read_side_info(drmp3_bs *bs, drmp3_L3_gr_info *gr, const drmp3_uint8 *hdr)
|
||||
{
|
||||
static const drmp3_uint8 g_scf_long[9][23] = {
|
||||
{ 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
|
||||
static const drmp3_uint8 g_scf_long[8][23] = {
|
||||
{ 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
|
||||
{ 12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2,0 },
|
||||
{ 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
|
||||
|
@ -771,8 +768,7 @@ static int drmp3_L3_read_side_info(drmp3_bs *bs, drmp3_L3_gr_info *gr, const drm
|
|||
{ 4,4,4,4,4,4,6,6,6,8,10,12,16,18,22,28,34,40,46,54,54,192,0 },
|
||||
{ 4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102,26,0 }
|
||||
};
|
||||
static const drmp3_uint8 g_scf_short[9][40] = {
|
||||
{ 4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
|
||||
static const drmp3_uint8 g_scf_short[8][40] = {
|
||||
{ 4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
|
||||
{ 8,8,8,8,8,8,8,8,8,12,12,12,16,16,16,20,20,20,24,24,24,28,28,28,36,36,36,2,2,2,2,2,2,2,2,2,26,26,26,0 },
|
||||
{ 4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,8,8,8,10,10,10,14,14,14,18,18,18,26,26,26,32,32,32,42,42,42,18,18,18,0 },
|
||||
|
@ -782,8 +778,7 @@ static int drmp3_L3_read_side_info(drmp3_bs *bs, drmp3_L3_gr_info *gr, const drm
|
|||
{ 4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,10,10,10,12,12,12,14,14,14,16,16,16,20,20,20,26,26,26,66,66,66,0 },
|
||||
{ 4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,12,12,12,16,16,16,20,20,20,26,26,26,34,34,34,42,42,42,12,12,12,0 }
|
||||
};
|
||||
static const drmp3_uint8 g_scf_mixed[9][40] = {
|
||||
{ 6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
|
||||
static const drmp3_uint8 g_scf_mixed[8][40] = {
|
||||
{ 6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
|
||||
{ 12,12,12,4,4,4,8,8,8,12,12,12,16,16,16,20,20,20,24,24,24,28,28,28,36,36,36,2,2,2,2,2,2,2,2,2,26,26,26,0 },
|
||||
{ 6,6,6,6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,14,14,14,18,18,18,26,26,26,32,32,32,42,42,42,18,18,18,0 },
|
||||
|
@ -796,7 +791,7 @@ static int drmp3_L3_read_side_info(drmp3_bs *bs, drmp3_L3_gr_info *gr, const drm
|
|||
|
||||
unsigned tables, scfsi = 0;
|
||||
int main_data_begin, part_23_sum = 0;
|
||||
int sr_idx = DRMP3_HDR_GET_MY_SAMPLE_RATE(hdr);
|
||||
int sr_idx = DRMP3_HDR_GET_MY_SAMPLE_RATE(hdr); sr_idx -= (sr_idx != 0);
|
||||
int gr_count = DRMP3_HDR_IS_MONO(hdr) ? 1 : 2;
|
||||
|
||||
if (DRMP3_HDR_TEST_MPEG1(hdr))
|
||||
|
@ -1020,25 +1015,25 @@ static float drmp3_L3_pow_43(int x)
|
|||
static void drmp3_L3_huffman(float *dst, drmp3_bs *bs, const drmp3_L3_gr_info *gr_info, const float *scf, int layer3gr_limit)
|
||||
{
|
||||
static const float g_pow43_signed[32] = { 0,0,1,-1,2.519842f,-2.519842f,4.326749f,-4.326749f,6.349604f,-6.349604f,8.549880f,-8.549880f,10.902724f,-10.902724f,13.390518f,-13.390518f,16.000000f,-16.000000f,18.720754f,-18.720754f,21.544347f,-21.544347f,24.463781f,-24.463781f,27.473142f,-27.473142f,30.567351f,-30.567351f,33.741992f,-33.741992f,36.993181f,-36.993181f };
|
||||
static const drmp3_int16 tab0[32] = { 0, };
|
||||
static const drmp3_int16 tab1[] = { 785,785,785,785,784,784,784,784,513,513,513,513,513,513,513,513,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256 };
|
||||
static const drmp3_int16 tab2[] = { -255,1313,1298,1282,785,785,785,785,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,290,288 };
|
||||
static const drmp3_int16 tab3[] = { -255,1313,1298,1282,769,769,769,769,529,529,529,529,529,529,529,529,528,528,528,528,528,528,528,528,512,512,512,512,512,512,512,512,290,288 };
|
||||
static const drmp3_int16 tab5[] = { -253,-318,-351,-367,785,785,785,785,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,819,818,547,547,275,275,275,275,561,560,515,546,289,274,288,258 };
|
||||
static const drmp3_int16 tab6[] = { -254,-287,1329,1299,1314,1312,1057,1057,1042,1042,1026,1026,784,784,784,784,529,529,529,529,529,529,529,529,769,769,769,769,768,768,768,768,563,560,306,306,291,259 };
|
||||
static const drmp3_int16 tab7[] = { -252,-413,-477,-542,1298,-575,1041,1041,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-383,-399,1107,1092,1106,1061,849,849,789,789,1104,1091,773,773,1076,1075,341,340,325,309,834,804,577,577,532,532,516,516,832,818,803,816,561,561,531,531,515,546,289,289,288,258 };
|
||||
static const drmp3_int16 tab8[] = { -252,-429,-493,-559,1057,1057,1042,1042,529,529,529,529,529,529,529,529,784,784,784,784,769,769,769,769,512,512,512,512,512,512,512,512,-382,1077,-415,1106,1061,1104,849,849,789,789,1091,1076,1029,1075,834,834,597,581,340,340,339,324,804,833,532,532,832,772,818,803,817,787,816,771,290,290,290,290,288,258 };
|
||||
static const drmp3_int16 tab9[] = { -253,-349,-414,-447,-463,1329,1299,-479,1314,1312,1057,1057,1042,1042,1026,1026,785,785,785,785,784,784,784,784,769,769,769,769,768,768,768,768,-319,851,821,-335,836,850,805,849,341,340,325,336,533,533,579,579,564,564,773,832,578,548,563,516,321,276,306,291,304,259 };
|
||||
static const drmp3_int16 tab10[] = { -251,-572,-733,-830,-863,-879,1041,1041,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-511,-527,-543,1396,1351,1381,1366,1395,1335,1380,-559,1334,1138,1138,1063,1063,1350,1392,1031,1031,1062,1062,1364,1363,1120,1120,1333,1348,881,881,881,881,375,374,359,373,343,358,341,325,791,791,1123,1122,-703,1105,1045,-719,865,865,790,790,774,774,1104,1029,338,293,323,308,-799,-815,833,788,772,818,803,816,322,292,307,320,561,531,515,546,289,274,288,258 };
|
||||
static const drmp3_int16 tab11[] = { -251,-525,-605,-685,-765,-831,-846,1298,1057,1057,1312,1282,785,785,785,785,784,784,784,784,769,769,769,769,512,512,512,512,512,512,512,512,1399,1398,1383,1367,1382,1396,1351,-511,1381,1366,1139,1139,1079,1079,1124,1124,1364,1349,1363,1333,882,882,882,882,807,807,807,807,1094,1094,1136,1136,373,341,535,535,881,775,867,822,774,-591,324,338,-671,849,550,550,866,864,609,609,293,336,534,534,789,835,773,-751,834,804,308,307,833,788,832,772,562,562,547,547,305,275,560,515,290,290 };
|
||||
static const drmp3_int16 tab12[] = { -252,-397,-477,-557,-622,-653,-719,-735,-750,1329,1299,1314,1057,1057,1042,1042,1312,1282,1024,1024,785,785,785,785,784,784,784,784,769,769,769,769,-383,1127,1141,1111,1126,1140,1095,1110,869,869,883,883,1079,1109,882,882,375,374,807,868,838,881,791,-463,867,822,368,263,852,837,836,-543,610,610,550,550,352,336,534,534,865,774,851,821,850,805,593,533,579,564,773,832,578,578,548,548,577,577,307,276,306,291,516,560,259,259 };
|
||||
static const drmp3_int16 tab13[] = { -250,-2107,-2507,-2764,-2909,-2974,-3007,-3023,1041,1041,1040,1040,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-767,-1052,-1213,-1277,-1358,-1405,-1469,-1535,-1550,-1582,-1614,-1647,-1662,-1694,-1726,-1759,-1774,-1807,-1822,-1854,-1886,1565,-1919,-1935,-1951,-1967,1731,1730,1580,1717,-1983,1729,1564,-1999,1548,-2015,-2031,1715,1595,-2047,1714,-2063,1610,-2079,1609,-2095,1323,1323,1457,1457,1307,1307,1712,1547,1641,1700,1699,1594,1685,1625,1442,1442,1322,1322,-780,-973,-910,1279,1278,1277,1262,1276,1261,1275,1215,1260,1229,-959,974,974,989,989,-943,735,478,478,495,463,506,414,-1039,1003,958,1017,927,942,987,957,431,476,1272,1167,1228,-1183,1256,-1199,895,895,941,941,1242,1227,1212,1135,1014,1014,490,489,503,487,910,1013,985,925,863,894,970,955,1012,847,-1343,831,755,755,984,909,428,366,754,559,-1391,752,486,457,924,997,698,698,983,893,740,740,908,877,739,739,667,667,953,938,497,287,271,271,683,606,590,712,726,574,302,302,738,736,481,286,526,725,605,711,636,724,696,651,589,681,666,710,364,467,573,695,466,466,301,465,379,379,709,604,665,679,316,316,634,633,436,436,464,269,424,394,452,332,438,363,347,408,393,448,331,422,362,407,392,421,346,406,391,376,375,359,1441,1306,-2367,1290,-2383,1337,-2399,-2415,1426,1321,-2431,1411,1336,-2447,-2463,-2479,1169,1169,1049,1049,1424,1289,1412,1352,1319,-2495,1154,1154,1064,1064,1153,1153,416,390,360,404,403,389,344,374,373,343,358,372,327,357,342,311,356,326,1395,1394,1137,1137,1047,1047,1365,1392,1287,1379,1334,1364,1349,1378,1318,1363,792,792,792,792,1152,1152,1032,1032,1121,1121,1046,1046,1120,1120,1030,1030,-2895,1106,1061,1104,849,849,789,789,1091,1076,1029,1090,1060,1075,833,833,309,324,532,532,832,772,818,803,561,561,531,560,515,546,289,274,288,258 };
|
||||
static const drmp3_int16 tab15[] = { -250,-1179,-1579,-1836,-1996,-2124,-2253,-2333,-2413,-2477,-2542,-2574,-2607,-2622,-2655,1314,1313,1298,1312,1282,785,785,785,785,1040,1040,1025,1025,768,768,768,768,-766,-798,-830,-862,-895,-911,-927,-943,-959,-975,-991,-1007,-1023,-1039,-1055,-1070,1724,1647,-1103,-1119,1631,1767,1662,1738,1708,1723,-1135,1780,1615,1779,1599,1677,1646,1778,1583,-1151,1777,1567,1737,1692,1765,1722,1707,1630,1751,1661,1764,1614,1736,1676,1763,1750,1645,1598,1721,1691,1762,1706,1582,1761,1566,-1167,1749,1629,767,766,751,765,494,494,735,764,719,749,734,763,447,447,748,718,477,506,431,491,446,476,461,505,415,430,475,445,504,399,460,489,414,503,383,474,429,459,502,502,746,752,488,398,501,473,413,472,486,271,480,270,-1439,-1455,1357,-1471,-1487,-1503,1341,1325,-1519,1489,1463,1403,1309,-1535,1372,1448,1418,1476,1356,1462,1387,-1551,1475,1340,1447,1402,1386,-1567,1068,1068,1474,1461,455,380,468,440,395,425,410,454,364,467,466,464,453,269,409,448,268,432,1371,1473,1432,1417,1308,1460,1355,1446,1459,1431,1083,1083,1401,1416,1458,1445,1067,1067,1370,1457,1051,1051,1291,1430,1385,1444,1354,1415,1400,1443,1082,1082,1173,1113,1186,1066,1185,1050,-1967,1158,1128,1172,1097,1171,1081,-1983,1157,1112,416,266,375,400,1170,1142,1127,1065,793,793,1169,1033,1156,1096,1141,1111,1155,1080,1126,1140,898,898,808,808,897,897,792,792,1095,1152,1032,1125,1110,1139,1079,1124,882,807,838,881,853,791,-2319,867,368,263,822,852,837,866,806,865,-2399,851,352,262,534,534,821,836,594,594,549,549,593,593,533,533,848,773,579,579,564,578,548,563,276,276,577,576,306,291,516,560,305,305,275,259 };
|
||||
static const drmp3_int16 tab16[] = { -251,-892,-2058,-2620,-2828,-2957,-3023,-3039,1041,1041,1040,1040,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-511,-527,-543,-559,1530,-575,-591,1528,1527,1407,1526,1391,1023,1023,1023,1023,1525,1375,1268,1268,1103,1103,1087,1087,1039,1039,1523,-604,815,815,815,815,510,495,509,479,508,463,507,447,431,505,415,399,-734,-782,1262,-815,1259,1244,-831,1258,1228,-847,-863,1196,-879,1253,987,987,748,-767,493,493,462,477,414,414,686,669,478,446,461,445,474,429,487,458,412,471,1266,1264,1009,1009,799,799,-1019,-1276,-1452,-1581,-1677,-1757,-1821,-1886,-1933,-1997,1257,1257,1483,1468,1512,1422,1497,1406,1467,1496,1421,1510,1134,1134,1225,1225,1466,1451,1374,1405,1252,1252,1358,1480,1164,1164,1251,1251,1238,1238,1389,1465,-1407,1054,1101,-1423,1207,-1439,830,830,1248,1038,1237,1117,1223,1148,1236,1208,411,426,395,410,379,269,1193,1222,1132,1235,1221,1116,976,976,1192,1162,1177,1220,1131,1191,963,963,-1647,961,780,-1663,558,558,994,993,437,408,393,407,829,978,813,797,947,-1743,721,721,377,392,844,950,828,890,706,706,812,859,796,960,948,843,934,874,571,571,-1919,690,555,689,421,346,539,539,944,779,918,873,932,842,903,888,570,570,931,917,674,674,-2575,1562,-2591,1609,-2607,1654,1322,1322,1441,1441,1696,1546,1683,1593,1669,1624,1426,1426,1321,1321,1639,1680,1425,1425,1305,1305,1545,1668,1608,1623,1667,1592,1638,1666,1320,1320,1652,1607,1409,1409,1304,1304,1288,1288,1664,1637,1395,1395,1335,1335,1622,1636,1394,1394,1319,1319,1606,1621,1392,1392,1137,1137,1137,1137,345,390,360,375,404,373,1047,-2751,-2767,-2783,1062,1121,1046,-2799,1077,-2815,1106,1061,789,789,1105,1104,263,355,310,340,325,354,352,262,339,324,1091,1076,1029,1090,1060,1075,833,833,788,788,1088,1028,818,818,803,803,561,561,531,531,816,771,546,546,289,274,288,258 };
|
||||
static const drmp3_int16 tab24[] = { -253,-317,-381,-446,-478,-509,1279,1279,-811,-1179,-1451,-1756,-1900,-2028,-2189,-2253,-2333,-2414,-2445,-2511,-2526,1313,1298,-2559,1041,1041,1040,1040,1025,1025,1024,1024,1022,1007,1021,991,1020,975,1019,959,687,687,1018,1017,671,671,655,655,1016,1015,639,639,758,758,623,623,757,607,756,591,755,575,754,559,543,543,1009,783,-575,-621,-685,-749,496,-590,750,749,734,748,974,989,1003,958,988,973,1002,942,987,957,972,1001,926,986,941,971,956,1000,910,985,925,999,894,970,-1071,-1087,-1102,1390,-1135,1436,1509,1451,1374,-1151,1405,1358,1480,1420,-1167,1507,1494,1389,1342,1465,1435,1450,1326,1505,1310,1493,1373,1479,1404,1492,1464,1419,428,443,472,397,736,526,464,464,486,457,442,471,484,482,1357,1449,1434,1478,1388,1491,1341,1490,1325,1489,1463,1403,1309,1477,1372,1448,1418,1433,1476,1356,1462,1387,-1439,1475,1340,1447,1402,1474,1324,1461,1371,1473,269,448,1432,1417,1308,1460,-1711,1459,-1727,1441,1099,1099,1446,1386,1431,1401,-1743,1289,1083,1083,1160,1160,1458,1445,1067,1067,1370,1457,1307,1430,1129,1129,1098,1098,268,432,267,416,266,400,-1887,1144,1187,1082,1173,1113,1186,1066,1050,1158,1128,1143,1172,1097,1171,1081,420,391,1157,1112,1170,1142,1127,1065,1169,1049,1156,1096,1141,1111,1155,1080,1126,1154,1064,1153,1140,1095,1048,-2159,1125,1110,1137,-2175,823,823,1139,1138,807,807,384,264,368,263,868,838,853,791,867,822,852,837,866,806,865,790,-2319,851,821,836,352,262,850,805,849,-2399,533,533,835,820,336,261,578,548,563,577,532,532,832,772,562,562,547,547,305,275,560,515,290,290,288,258 };
|
||||
static const drmp3_int16 tabs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
785,785,785,785,784,784,784,784,513,513,513,513,513,513,513,513,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,
|
||||
-255,1313,1298,1282,785,785,785,785,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,290,288,
|
||||
-255,1313,1298,1282,769,769,769,769,529,529,529,529,529,529,529,529,528,528,528,528,528,528,528,528,512,512,512,512,512,512,512,512,290,288,
|
||||
-253,-318,-351,-367,785,785,785,785,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,819,818,547,547,275,275,275,275,561,560,515,546,289,274,288,258,
|
||||
-254,-287,1329,1299,1314,1312,1057,1057,1042,1042,1026,1026,784,784,784,784,529,529,529,529,529,529,529,529,769,769,769,769,768,768,768,768,563,560,306,306,291,259,
|
||||
-252,-413,-477,-542,1298,-575,1041,1041,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-383,-399,1107,1092,1106,1061,849,849,789,789,1104,1091,773,773,1076,1075,341,340,325,309,834,804,577,577,532,532,516,516,832,818,803,816,561,561,531,531,515,546,289,289,288,258,
|
||||
-252,-429,-493,-559,1057,1057,1042,1042,529,529,529,529,529,529,529,529,784,784,784,784,769,769,769,769,512,512,512,512,512,512,512,512,-382,1077,-415,1106,1061,1104,849,849,789,789,1091,1076,1029,1075,834,834,597,581,340,340,339,324,804,833,532,532,832,772,818,803,817,787,816,771,290,290,290,290,288,258,
|
||||
-253,-349,-414,-447,-463,1329,1299,-479,1314,1312,1057,1057,1042,1042,1026,1026,785,785,785,785,784,784,784,784,769,769,769,769,768,768,768,768,-319,851,821,-335,836,850,805,849,341,340,325,336,533,533,579,579,564,564,773,832,578,548,563,516,321,276,306,291,304,259,
|
||||
-251,-572,-733,-830,-863,-879,1041,1041,784,784,784,784,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-511,-527,-543,1396,1351,1381,1366,1395,1335,1380,-559,1334,1138,1138,1063,1063,1350,1392,1031,1031,1062,1062,1364,1363,1120,1120,1333,1348,881,881,881,881,375,374,359,373,343,358,341,325,791,791,1123,1122,-703,1105,1045,-719,865,865,790,790,774,774,1104,1029,338,293,323,308,-799,-815,833,788,772,818,803,816,322,292,307,320,561,531,515,546,289,274,288,258,
|
||||
-251,-525,-605,-685,-765,-831,-846,1298,1057,1057,1312,1282,785,785,785,785,784,784,784,784,769,769,769,769,512,512,512,512,512,512,512,512,1399,1398,1383,1367,1382,1396,1351,-511,1381,1366,1139,1139,1079,1079,1124,1124,1364,1349,1363,1333,882,882,882,882,807,807,807,807,1094,1094,1136,1136,373,341,535,535,881,775,867,822,774,-591,324,338,-671,849,550,550,866,864,609,609,293,336,534,534,789,835,773,-751,834,804,308,307,833,788,832,772,562,562,547,547,305,275,560,515,290,290,
|
||||
-252,-397,-477,-557,-622,-653,-719,-735,-750,1329,1299,1314,1057,1057,1042,1042,1312,1282,1024,1024,785,785,785,785,784,784,784,784,769,769,769,769,-383,1127,1141,1111,1126,1140,1095,1110,869,869,883,883,1079,1109,882,882,375,374,807,868,838,881,791,-463,867,822,368,263,852,837,836,-543,610,610,550,550,352,336,534,534,865,774,851,821,850,805,593,533,579,564,773,832,578,578,548,548,577,577,307,276,306,291,516,560,259,259,
|
||||
-250,-2107,-2507,-2764,-2909,-2974,-3007,-3023,1041,1041,1040,1040,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-767,-1052,-1213,-1277,-1358,-1405,-1469,-1535,-1550,-1582,-1614,-1647,-1662,-1694,-1726,-1759,-1774,-1807,-1822,-1854,-1886,1565,-1919,-1935,-1951,-1967,1731,1730,1580,1717,-1983,1729,1564,-1999,1548,-2015,-2031,1715,1595,-2047,1714,-2063,1610,-2079,1609,-2095,1323,1323,1457,1457,1307,1307,1712,1547,1641,1700,1699,1594,1685,1625,1442,1442,1322,1322,-780,-973,-910,1279,1278,1277,1262,1276,1261,1275,1215,1260,1229,-959,974,974,989,989,-943,735,478,478,495,463,506,414,-1039,1003,958,1017,927,942,987,957,431,476,1272,1167,1228,-1183,1256,-1199,895,895,941,941,1242,1227,1212,1135,1014,1014,490,489,503,487,910,1013,985,925,863,894,970,955,1012,847,-1343,831,755,755,984,909,428,366,754,559,-1391,752,486,457,924,997,698,698,983,893,740,740,908,877,739,739,667,667,953,938,497,287,271,271,683,606,590,712,726,574,302,302,738,736,481,286,526,725,605,711,636,724,696,651,589,681,666,710,364,467,573,695,466,466,301,465,379,379,709,604,665,679,316,316,634,633,436,436,464,269,424,394,452,332,438,363,347,408,393,448,331,422,362,407,392,421,346,406,391,376,375,359,1441,1306,-2367,1290,-2383,1337,-2399,-2415,1426,1321,-2431,1411,1336,-2447,-2463,-2479,1169,1169,1049,1049,1424,1289,1412,1352,1319,-2495,1154,1154,1064,1064,1153,1153,416,390,360,404,403,389,344,374,373,343,358,372,327,357,342,311,356,326,1395,1394,1137,1137,1047,1047,1365,1392,1287,1379,1334,1364,1349,1378,1318,1363,792,792,792,792,1152,1152,1032,1032,1121,1121,1046,1046,1120,1120,1030,1030,-2895,1106,1061,1104,849,849,789,789,1091,1076,1029,1090,1060,1075,833,833,309,324,532,532,832,772,818,803,561,561,531,560,515,546,289,274,288,258,
|
||||
-250,-1179,-1579,-1836,-1996,-2124,-2253,-2333,-2413,-2477,-2542,-2574,-2607,-2622,-2655,1314,1313,1298,1312,1282,785,785,785,785,1040,1040,1025,1025,768,768,768,768,-766,-798,-830,-862,-895,-911,-927,-943,-959,-975,-991,-1007,-1023,-1039,-1055,-1070,1724,1647,-1103,-1119,1631,1767,1662,1738,1708,1723,-1135,1780,1615,1779,1599,1677,1646,1778,1583,-1151,1777,1567,1737,1692,1765,1722,1707,1630,1751,1661,1764,1614,1736,1676,1763,1750,1645,1598,1721,1691,1762,1706,1582,1761,1566,-1167,1749,1629,767,766,751,765,494,494,735,764,719,749,734,763,447,447,748,718,477,506,431,491,446,476,461,505,415,430,475,445,504,399,460,489,414,503,383,474,429,459,502,502,746,752,488,398,501,473,413,472,486,271,480,270,-1439,-1455,1357,-1471,-1487,-1503,1341,1325,-1519,1489,1463,1403,1309,-1535,1372,1448,1418,1476,1356,1462,1387,-1551,1475,1340,1447,1402,1386,-1567,1068,1068,1474,1461,455,380,468,440,395,425,410,454,364,467,466,464,453,269,409,448,268,432,1371,1473,1432,1417,1308,1460,1355,1446,1459,1431,1083,1083,1401,1416,1458,1445,1067,1067,1370,1457,1051,1051,1291,1430,1385,1444,1354,1415,1400,1443,1082,1082,1173,1113,1186,1066,1185,1050,-1967,1158,1128,1172,1097,1171,1081,-1983,1157,1112,416,266,375,400,1170,1142,1127,1065,793,793,1169,1033,1156,1096,1141,1111,1155,1080,1126,1140,898,898,808,808,897,897,792,792,1095,1152,1032,1125,1110,1139,1079,1124,882,807,838,881,853,791,-2319,867,368,263,822,852,837,866,806,865,-2399,851,352,262,534,534,821,836,594,594,549,549,593,593,533,533,848,773,579,579,564,578,548,563,276,276,577,576,306,291,516,560,305,305,275,259,
|
||||
-251,-892,-2058,-2620,-2828,-2957,-3023,-3039,1041,1041,1040,1040,769,769,769,769,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,-511,-527,-543,-559,1530,-575,-591,1528,1527,1407,1526,1391,1023,1023,1023,1023,1525,1375,1268,1268,1103,1103,1087,1087,1039,1039,1523,-604,815,815,815,815,510,495,509,479,508,463,507,447,431,505,415,399,-734,-782,1262,-815,1259,1244,-831,1258,1228,-847,-863,1196,-879,1253,987,987,748,-767,493,493,462,477,414,414,686,669,478,446,461,445,474,429,487,458,412,471,1266,1264,1009,1009,799,799,-1019,-1276,-1452,-1581,-1677,-1757,-1821,-1886,-1933,-1997,1257,1257,1483,1468,1512,1422,1497,1406,1467,1496,1421,1510,1134,1134,1225,1225,1466,1451,1374,1405,1252,1252,1358,1480,1164,1164,1251,1251,1238,1238,1389,1465,-1407,1054,1101,-1423,1207,-1439,830,830,1248,1038,1237,1117,1223,1148,1236,1208,411,426,395,410,379,269,1193,1222,1132,1235,1221,1116,976,976,1192,1162,1177,1220,1131,1191,963,963,-1647,961,780,-1663,558,558,994,993,437,408,393,407,829,978,813,797,947,-1743,721,721,377,392,844,950,828,890,706,706,812,859,796,960,948,843,934,874,571,571,-1919,690,555,689,421,346,539,539,944,779,918,873,932,842,903,888,570,570,931,917,674,674,-2575,1562,-2591,1609,-2607,1654,1322,1322,1441,1441,1696,1546,1683,1593,1669,1624,1426,1426,1321,1321,1639,1680,1425,1425,1305,1305,1545,1668,1608,1623,1667,1592,1638,1666,1320,1320,1652,1607,1409,1409,1304,1304,1288,1288,1664,1637,1395,1395,1335,1335,1622,1636,1394,1394,1319,1319,1606,1621,1392,1392,1137,1137,1137,1137,345,390,360,375,404,373,1047,-2751,-2767,-2783,1062,1121,1046,-2799,1077,-2815,1106,1061,789,789,1105,1104,263,355,310,340,325,354,352,262,339,324,1091,1076,1029,1090,1060,1075,833,833,788,788,1088,1028,818,818,803,803,561,561,531,531,816,771,546,546,289,274,288,258,
|
||||
-253,-317,-381,-446,-478,-509,1279,1279,-811,-1179,-1451,-1756,-1900,-2028,-2189,-2253,-2333,-2414,-2445,-2511,-2526,1313,1298,-2559,1041,1041,1040,1040,1025,1025,1024,1024,1022,1007,1021,991,1020,975,1019,959,687,687,1018,1017,671,671,655,655,1016,1015,639,639,758,758,623,623,757,607,756,591,755,575,754,559,543,543,1009,783,-575,-621,-685,-749,496,-590,750,749,734,748,974,989,1003,958,988,973,1002,942,987,957,972,1001,926,986,941,971,956,1000,910,985,925,999,894,970,-1071,-1087,-1102,1390,-1135,1436,1509,1451,1374,-1151,1405,1358,1480,1420,-1167,1507,1494,1389,1342,1465,1435,1450,1326,1505,1310,1493,1373,1479,1404,1492,1464,1419,428,443,472,397,736,526,464,464,486,457,442,471,484,482,1357,1449,1434,1478,1388,1491,1341,1490,1325,1489,1463,1403,1309,1477,1372,1448,1418,1433,1476,1356,1462,1387,-1439,1475,1340,1447,1402,1474,1324,1461,1371,1473,269,448,1432,1417,1308,1460,-1711,1459,-1727,1441,1099,1099,1446,1386,1431,1401,-1743,1289,1083,1083,1160,1160,1458,1445,1067,1067,1370,1457,1307,1430,1129,1129,1098,1098,268,432,267,416,266,400,-1887,1144,1187,1082,1173,1113,1186,1066,1050,1158,1128,1143,1172,1097,1171,1081,420,391,1157,1112,1170,1142,1127,1065,1169,1049,1156,1096,1141,1111,1155,1080,1126,1154,1064,1153,1140,1095,1048,-2159,1125,1110,1137,-2175,823,823,1139,1138,807,807,384,264,368,263,868,838,853,791,867,822,852,837,866,806,865,790,-2319,851,821,836,352,262,850,805,849,-2399,533,533,835,820,336,261,578,548,563,577,532,532,832,772,562,562,547,547,305,275,560,515,290,290,288,258 };
|
||||
static const drmp3_uint8 tab32[] = { 130,162,193,209,44,28,76,140,9,9,9,9,9,9,9,9,190,254,222,238,126,94,157,157,109,61,173,205};
|
||||
static const drmp3_uint8 tab33[] = { 252,236,220,204,188,172,156,140,124,108,92,76,60,44,28,12 };
|
||||
static const drmp3_int16 * const tabindex[2*16] = { tab0,tab1,tab2,tab3,tab0,tab5,tab6,tab7,tab8,tab9,tab10,tab11,tab12,tab13,tab0,tab15,tab16,tab16,tab16,tab16,tab16,tab16,tab16,tab16,tab24,tab24,tab24,tab24,tab24,tab24,tab24,tab24 };
|
||||
static const drmp3_int16 tabindex[2*16] = { 0,32,64,98,0,132,180,218,292,364,426,538,648,746,0,1126,1460,1460,1460,1460,1460,1460,1460,1460,1842,1842,1842,1842,1842,1842,1842,1842 };
|
||||
static const drmp3_uint8 g_linbits[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,6,8,10,13,4,5,6,7,8,9,11,13 };
|
||||
|
||||
#define DRMP3_PEEK_BITS(n) (bs_cache >> (32 - n))
|
||||
|
@ -1058,7 +1053,7 @@ static void drmp3_L3_huffman(float *dst, drmp3_bs *bs, const drmp3_L3_gr_info *g
|
|||
{
|
||||
int tab_num = gr_info->table_select[ireg];
|
||||
int sfb_cnt = gr_info->region_count[ireg++];
|
||||
const short *codebook = tabindex[tab_num];
|
||||
const short *codebook = tabs + tabindex[tab_num];
|
||||
int linbits = g_linbits[tab_num];
|
||||
do
|
||||
{
|
||||
|
@ -1227,7 +1222,7 @@ static void drmp3_L3_intensity_stereo(float *left, drmp3_uint8 *ist_pos, const d
|
|||
int prev = itop - max_blocks;
|
||||
ist_pos[itop] = (drmp3_uint8)(max_band[i] >= prev ? default_pos : ist_pos[prev]);
|
||||
}
|
||||
drmp3_L3_stereo_process(left, ist_pos, gr->sfbtab, hdr, max_band, gr[1].scalefac_compress&1);
|
||||
drmp3_L3_stereo_process(left, ist_pos, gr->sfbtab, hdr, max_band, gr[1].scalefac_compress & 1);
|
||||
}
|
||||
|
||||
static void drmp3_L3_reorder(float *grbuf, float *scratch, const drmp3_uint8 *sfb)
|
||||
|
@ -2776,6 +2771,12 @@ void drmp3_free(void* p)
|
|||
// REVISION HISTORY
|
||||
// ===============
|
||||
//
|
||||
// v0.2.5 - 2018-06-22
|
||||
// - Bring up to date with minimp3.
|
||||
//
|
||||
// v0.2.4 - 2018-05-12
|
||||
// - Bring up to date with minimp3.
|
||||
//
|
||||
// v0.2.3 - 2018-04-29
|
||||
// - Fix TCC build.
|
||||
//
|
||||
|
|
803
raylib/external/dr_wav.h
vendored
803
raylib/external/dr_wav.h
vendored
File diff suppressed because it is too large
Load diff
27703
raylib/external/mini_al.h
vendored
27703
raylib/external/mini_al.h
vendored
File diff suppressed because it is too large
Load diff
2
raylib/external/stb_vorbis.c
vendored
2
raylib/external/stb_vorbis.c
vendored
|
@ -193,7 +193,7 @@
|
|||
#undef __forceinline
|
||||
#endif
|
||||
#define __forceinline
|
||||
//#define alloca __builtin_alloca
|
||||
#define alloca __builtin_alloca
|
||||
#elif !defined(_MSC_VER)
|
||||
#if __GNUC__
|
||||
#define __forceinline inline
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
189
raylib/models.c
189
raylib/models.c
|
@ -5,10 +5,10 @@
|
|||
* CONFIGURATION:
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_OBJ
|
||||
* Selected desired fileformats to be supported for loading.
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_MTL
|
||||
* Selected desired fileformats to be supported for loading.
|
||||
* #define SUPPORT_FILEFORMAT_IQM
|
||||
* #define SUPPORT_FILEFORMAT_GLTF
|
||||
* Selected desired fileformats to be supported for model data loading.
|
||||
*
|
||||
* #define SUPPORT_MESH_GENERATION
|
||||
* Support procedural mesh generation functions, uses external par_shapes.h library
|
||||
|
@ -36,9 +36,8 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
#include "config.h" // Defines module configuration flags
|
||||
#include "raylib.h" // Declares module functions
|
||||
|
||||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
|
||||
|
@ -49,8 +48,20 @@
|
|||
|
||||
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
||||
|
||||
#define PAR_SHAPES_IMPLEMENTATION
|
||||
#include "external/par_shapes.h" // Shapes 3d parametric generation
|
||||
#if defined(SUPPORT_FILEFORMAT_IQM)
|
||||
#define RIQM_IMPLEMENTATION
|
||||
#include "external/riqm.h" // IQM file format loading
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_GLTF)
|
||||
#define CGLTF_IMPLEMENTATION
|
||||
#include "external/cgltf.h" // glTF file format loading
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_MESH_GENERATION)
|
||||
#define PAR_SHAPES_IMPLEMENTATION
|
||||
#include "external/par_shapes.h" // Shapes 3d parametric generation
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
|
@ -76,6 +87,12 @@ static Mesh LoadOBJ(const char *fileName); // Load OBJ mesh data
|
|||
#if defined(SUPPORT_FILEFORMAT_MTL)
|
||||
static Material LoadMTL(const char *fileName); // Load MTL material data
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_GLTF)
|
||||
static Mesh LoadIQM(const char *fileName); // Load IQM mesh data
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_GLTF)
|
||||
static Mesh LoadGLTF(const char *fileName); // Load GLTF mesh data
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition
|
||||
|
@ -647,45 +664,54 @@ void UnloadMesh(Mesh *mesh)
|
|||
rlUnloadMesh(mesh);
|
||||
}
|
||||
|
||||
// Export mesh as an OBJ file
|
||||
void ExportMesh(const char *fileName, Mesh mesh)
|
||||
// Export mesh data to file
|
||||
void ExportMesh(Mesh mesh, const char *fileName)
|
||||
{
|
||||
FILE *objFile = fopen(fileName, "wt");
|
||||
bool success = false;
|
||||
|
||||
fprintf(objFile, "# raylib Mesh OBJ exporter v1.0\n\n");
|
||||
fprintf(objFile, "# Mesh exported as triangle faces and not optimized.\n");
|
||||
fprintf(objFile, "# Vertex Count: %i\n", mesh.vertexCount);
|
||||
fprintf(objFile, "# Triangle Count: %i\n\n", mesh.triangleCount);
|
||||
fprintf(objFile, "# LICENSE: zlib/libpng\n");
|
||||
fprintf(objFile, "# Copyright (c) 2018 Ramon Santamaria (@raysan5)\n\n");
|
||||
|
||||
fprintf(objFile, "g mesh\n");
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
|
||||
if (IsFileExtension(fileName, ".obj"))
|
||||
{
|
||||
fprintf(objFile, "v %.2f %.2f %.2f\n", mesh.vertices[v], mesh.vertices[v + 1], mesh.vertices[v + 2]);
|
||||
FILE *objFile = fopen(fileName, "wt");
|
||||
|
||||
fprintf(objFile, "# raylib Mesh OBJ exporter v1.0\n\n");
|
||||
fprintf(objFile, "# Mesh exported as triangle faces and not optimized.\n");
|
||||
fprintf(objFile, "# Vertex Count: %i\n", mesh.vertexCount);
|
||||
fprintf(objFile, "# Triangle Count: %i\n\n", mesh.triangleCount);
|
||||
fprintf(objFile, "# LICENSE: zlib/libpng\n");
|
||||
fprintf(objFile, "# Copyright (c) 2018 Ramon Santamaria (@raysan5)\n\n");
|
||||
|
||||
fprintf(objFile, "g mesh\n");
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
|
||||
{
|
||||
fprintf(objFile, "v %.2f %.2f %.2f\n", mesh.vertices[v], mesh.vertices[v + 1], mesh.vertices[v + 2]);
|
||||
}
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 2)
|
||||
{
|
||||
fprintf(objFile, "vt %.2f %.2f\n", mesh.texcoords[v], mesh.texcoords[v + 1]);
|
||||
}
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
|
||||
{
|
||||
fprintf(objFile, "vn %.2f %.2f %.2f\n", mesh.normals[v], mesh.normals[v + 1], mesh.normals[v + 2]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh.triangleCount; i += 3)
|
||||
{
|
||||
fprintf(objFile, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i, i, i, i + 1, i + 1, i + 1, i + 2, i + 2, i + 2);
|
||||
}
|
||||
|
||||
fprintf(objFile, "\n");
|
||||
|
||||
fclose(objFile);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 2)
|
||||
{
|
||||
fprintf(objFile, "vt %.2f %.2f\n", mesh.texcoords[v], mesh.texcoords[v + 1]);
|
||||
}
|
||||
|
||||
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
|
||||
{
|
||||
fprintf(objFile, "vn %.2f %.2f %.2f\n", mesh.normals[v], mesh.normals[v + 1], mesh.normals[v + 2]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh.triangleCount; i += 3)
|
||||
{
|
||||
fprintf(objFile, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i, i, i, i + 1, i + 1, i + 1, i + 2, i + 2, i + 2);
|
||||
}
|
||||
|
||||
fprintf(objFile, "\n");
|
||||
|
||||
fclose(objFile);
|
||||
else if (IsFileExtension(fileName, ".raw")) { } // TODO: Support additional file formats to export mesh vertex data
|
||||
|
||||
TraceLog(LOG_INFO, "Mesh saved: %s", fileName);
|
||||
if (success) TraceLog(LOG_INFO, "Mesh exported successfully: %s", fileName);
|
||||
else TraceLog(LOG_WARNING, "Mesh could not be exported.");
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_MESH_GENERATION)
|
||||
|
@ -700,7 +726,7 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
resZ++;
|
||||
|
||||
// Vertices definition
|
||||
int vertexCount = resX*resZ*6; // 6 vertex by quad
|
||||
int vertexCount = resX*resZ; // vertices get reused for the faces
|
||||
|
||||
Vector3 *vertices = (Vector3 *)malloc(vertexCount*sizeof(Vector3));
|
||||
for (int z = 0; z < resZ; z++)
|
||||
|
@ -719,7 +745,7 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
Vector3 *normals = (Vector3 *)malloc(vertexCount*sizeof(Vector3));
|
||||
for (int n = 0; n < vertexCount; n++) normals[n] = (Vector3){ 0.0f, 1.0f, 0.0f }; // Vector3.up;
|
||||
|
||||
// TexCoords definition
|
||||
// TexCoords definition
|
||||
Vector2 *texcoords = (Vector2 *)malloc(vertexCount*sizeof(Vector2));
|
||||
for (int v = 0; v < resZ; v++)
|
||||
{
|
||||
|
@ -742,7 +768,7 @@ Mesh GenMeshPlane(float width, float length, int resX, int resZ)
|
|||
triangles[t++] = i + 1;
|
||||
triangles[t++] = i;
|
||||
|
||||
triangles[t++] = i + resX;
|
||||
triangles[t++] = i + resX;
|
||||
triangles[t++] = i + resX + 1;
|
||||
triangles[t++] = i + 1;
|
||||
}
|
||||
|
@ -1772,7 +1798,7 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
|
|||
// Draw a billboard
|
||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint)
|
||||
{
|
||||
Rectangle sourceRec = { 0, 0, texture.width, texture.height };
|
||||
Rectangle sourceRec = { 0.0f, 0.0f, (float)texture.width, (float)texture.height };
|
||||
|
||||
DrawBillboardRec(camera, texture, sourceRec, center, size, tint);
|
||||
}
|
||||
|
@ -1838,9 +1864,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
|
|||
{
|
||||
Vector3 size;
|
||||
|
||||
size.x = fabsf(box.max.x - box.min.x);
|
||||
size.y = fabsf(box.max.y - box.min.y);
|
||||
size.z = fabsf(box.max.z - box.min.z);
|
||||
size.x = (float)fabs(box.max.x - box.min.x);
|
||||
size.y = (float)fabs(box.max.y - box.min.y);
|
||||
size.z = (float)fabs(box.max.z - box.min.z);
|
||||
|
||||
Vector3 center = { box.min.x + size.x/2.0f, box.min.y + size.y/2.0f, box.min.z + size.z/2.0f };
|
||||
|
||||
|
@ -2075,7 +2101,7 @@ RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
|
|||
|
||||
RayHitInfo result = { 0 };
|
||||
|
||||
if (fabsf(ray.direction.y) > EPSILON)
|
||||
if (fabs(ray.direction.y) > EPSILON)
|
||||
{
|
||||
float distance = (ray.position.y - groundHeight)/-ray.direction.y;
|
||||
|
||||
|
@ -2207,9 +2233,8 @@ void MeshBinormals(Mesh *mesh)
|
|||
Vector3 tangent = { mesh->tangents[i*4 + 0], mesh->tangents[i*4 + 1], mesh->tangents[i*4 + 2] };
|
||||
float tangentW = mesh->tangents[i*4 + 3];
|
||||
|
||||
Vector3 binormal = Vector3Multiply(Vector3CrossProduct(normal, tangent), tangentW);
|
||||
|
||||
// TODO: Register computed binormal in mesh->binormal ?
|
||||
// Vector3 binormal = Vector3Multiply(Vector3CrossProduct(normal, tangent), tangentW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2223,7 +2248,7 @@ static Mesh LoadOBJ(const char *fileName)
|
|||
{
|
||||
Mesh mesh = { 0 };
|
||||
|
||||
char dataType;
|
||||
char dataType = 0;
|
||||
char comments[200];
|
||||
|
||||
int vertexCount = 0;
|
||||
|
@ -2246,7 +2271,7 @@ static Mesh LoadOBJ(const char *fileName)
|
|||
// NOTE: faces MUST be defined as TRIANGLES (3 vertex per face)
|
||||
while (!feof(objFile))
|
||||
{
|
||||
dataType = '\0';
|
||||
dataType = 0;
|
||||
fscanf(objFile, "%c", &dataType);
|
||||
|
||||
switch (dataType)
|
||||
|
@ -2632,3 +2657,59 @@ static Material LoadMTL(const char *fileName)
|
|||
return material;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_GLTF)
|
||||
// Load IQM mesh data
|
||||
static Mesh LoadIQM(const char *fileName)
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
|
||||
// TODO: Load IQM file
|
||||
|
||||
return mesh;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_GLTF)
|
||||
// Load GLTF mesh data
|
||||
static Mesh LoadGLTF(const char *fileName)
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
|
||||
// GLTF file loading
|
||||
FILE *gltfFile = fopen(fileName, "rb");
|
||||
|
||||
if (gltfFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] GLTF file could not be opened", fileName);
|
||||
return mesh;
|
||||
}
|
||||
|
||||
fseek(gltfFile, 0, SEEK_END);
|
||||
int size = ftell(gltfFile);
|
||||
fseek(gltfFile, 0, SEEK_SET);
|
||||
|
||||
void *buffer = malloc(size);
|
||||
fread(buffer, size, 1, gltfFile);
|
||||
|
||||
fclose(gltfFile);
|
||||
|
||||
// GLTF data loading
|
||||
cgltf_options options = {0};
|
||||
cgltf_data data;
|
||||
cgltf_result result = cgltf_parse(&options, buffer, size, &data);
|
||||
|
||||
if (result == cgltf_result_success)
|
||||
{
|
||||
printf("Type: %u\n", data.file_type);
|
||||
printf("Version: %d\n", data.version);
|
||||
printf("Meshes: %lu\n", data.meshes_count);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] GLTF data could not be loaded", fileName);
|
||||
|
||||
free(buffer);
|
||||
cgltf_free(&data);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
@ -201,11 +201,11 @@ func UnloadMesh(mesh *Mesh) {
|
|||
}
|
||||
|
||||
// ExportMesh - Export mesh as an OBJ file
|
||||
func ExportMesh(fileName string, mesh Mesh) {
|
||||
func ExportMesh(mesh Mesh, fileName string) {
|
||||
cfileName := C.CString(fileName)
|
||||
defer C.free(unsafe.Pointer(cfileName))
|
||||
cmesh := mesh.cptr()
|
||||
C.ExportMesh(cfileName, *cmesh)
|
||||
C.ExportMesh(*cmesh, cfileName)
|
||||
}
|
||||
|
||||
// GenMeshPlane - Generate plane mesh (with subdivisions)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build android
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !android,arm
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !android,!arm
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -33,7 +33,7 @@ Example:
|
|||
|
||||
|
||||
*/
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
@ -174,8 +174,8 @@ const (
|
|||
FlagFullscreenMode = 2
|
||||
// Set to allow resizable window
|
||||
FlagWindowResizable = 4
|
||||
// Set to show window decoration (frame and buttons)
|
||||
FlagWindowDecorated = 8
|
||||
// Set to disable window decoration (frame and buttons)
|
||||
FlagWindowUndecorated = 8
|
||||
// Set to allow transparent window
|
||||
FlagWindowTransparent = 16
|
||||
// Set to try enabling MSAA 4X
|
||||
|
@ -219,35 +219,35 @@ const (
|
|||
KeyLeftShift = 340
|
||||
KeyLeftControl = 341
|
||||
KeyLeftAlt = 342
|
||||
KeyLeftSuper = 343
|
||||
KeyLeftSuper = 347
|
||||
KeyRightShift = 344
|
||||
KeyRightControl = 345
|
||||
KeyRightAlt = 346
|
||||
KeyRightSuper = 347
|
||||
KeyKBMenu = 348
|
||||
KeyKbMenu = 348
|
||||
KeyLeftBracket = 91
|
||||
KeyBackSlash = 92
|
||||
KeyRightBracket = 93
|
||||
KeyGrave = 96
|
||||
|
||||
// Keyboard Number Pad Keys
|
||||
KeyKPZero = 320
|
||||
KeyKPOne = 321
|
||||
KeyKPTwo = 322
|
||||
KeyKPThree = 323
|
||||
KeyKPFour = 324
|
||||
KeyKPFive = 325
|
||||
KeyKPSix = 326
|
||||
KeyKPSeven = 327
|
||||
KeyKPEight = 328
|
||||
KeyKPNine = 329
|
||||
KeyKPDecimal = 330
|
||||
KeyKPDivide = 331
|
||||
KeyKPMultiply = 332
|
||||
KeyKPSubtract = 333
|
||||
KeyKPAdd = 334
|
||||
KeyKPEnter = 335
|
||||
KeyKPEqual = 336
|
||||
KeyKp0 = 320
|
||||
KeyKp1 = 321
|
||||
KeyKp2 = 322
|
||||
KeyKp3 = 323
|
||||
KeyKp4 = 324
|
||||
KeyKp5 = 325
|
||||
KeyKp6 = 326
|
||||
KeyKp7 = 327
|
||||
KeyKp8 = 328
|
||||
KeyKp9 = 329
|
||||
KeyKpDecimal = 330
|
||||
KeyKpDivide = 331
|
||||
KeyKpMultiply = 332
|
||||
KeyKpSubtract = 333
|
||||
KeyKpAdd = 334
|
||||
KeyKpEnter = 335
|
||||
KeyKpEqual = 336
|
||||
|
||||
// Keyboard Alpha Numeric Keys
|
||||
KeyApostrophe = 39
|
||||
|
@ -358,6 +358,24 @@ const (
|
|||
GamepadXboxButtonLeft = 13
|
||||
GamepadXboxButtonHome = 8
|
||||
|
||||
// Android Gamepad Controller (SNES CLASSIC)
|
||||
GamepadAndroidDpadUp = 19
|
||||
GamepadAndroidDpadDown = 20
|
||||
GamepadAndroidDpadLeft = 21
|
||||
GamepadAndroidDpadRight = 22
|
||||
GamepadAndroidDpadCenter = 23
|
||||
|
||||
GamepadAndroidButtonA = 96
|
||||
GamepadAndroidButtonB = 97
|
||||
GamepadAndroidButtonC = 98
|
||||
GamepadAndroidButtonX = 99
|
||||
GamepadAndroidButtonY = 100
|
||||
GamepadAndroidButtonZ = 101
|
||||
GamepadAndroidButtonL1 = 102
|
||||
GamepadAndroidButtonR1 = 103
|
||||
GamepadAndroidButtonL2 = 104
|
||||
GamepadAndroidButtonR2 = 105
|
||||
|
||||
// Xbox360 USB Controller Axis
|
||||
// [-1..1] (left->right)
|
||||
GamepadXboxAxisLeftX = 0
|
||||
|
@ -871,25 +889,25 @@ const (
|
|||
// VrDeviceInfo - Head-Mounted-Display device parameters
|
||||
type VrDeviceInfo struct {
|
||||
// HMD horizontal resolution in pixels
|
||||
HResolution int
|
||||
hResolution int
|
||||
// HMD vertical resolution in pixels
|
||||
VResolution int
|
||||
vResolution int
|
||||
// HMD horizontal size in meters
|
||||
HScreenSize float32
|
||||
hScreenSize float32
|
||||
// HMD vertical size in meters
|
||||
VScreenSize float32
|
||||
vScreenSize float32
|
||||
// HMD screen center in meters
|
||||
VScreenCenter float32
|
||||
vScreenCenter float32
|
||||
// HMD distance between eye and display in meters
|
||||
EyeToScreenDistance float32
|
||||
eyeToScreenDistance float32
|
||||
// HMD lens separation distance in meters
|
||||
LensSeparationDistance float32
|
||||
lensSeparationDistance float32
|
||||
// HMD IPD (distance between pupils) in meters
|
||||
InterpupillaryDistance float32
|
||||
interpupillaryDistance float32
|
||||
// HMD lens distortion constant parameters
|
||||
LensDistortionValues [4]float32
|
||||
lensDistortionValues [4]float32
|
||||
// HMD chromatic aberration correction parameters
|
||||
ChromaAbCorrection [4]float32
|
||||
chromaAbCorrection [4]float32
|
||||
}
|
||||
|
||||
// NewVrDeviceInfo - Returns new VrDeviceInfo
|
||||
|
|
180
raylib/raylib.h
180
raylib/raylib.h
|
@ -1,8 +1,10 @@
|
|||
/**********************************************************************************************
|
||||
*
|
||||
* raylib - A simple and easy-to-use library to learn videogames programming (www.raylib.com)
|
||||
* raylib - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
*
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
* - Multiple platforms support: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, MacOS, UWP, Android, Raspberry Pi, HTML5.
|
||||
* - Written in plain C code (C99) in PascalCase/camelCase notation
|
||||
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile)
|
||||
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||
|
@ -12,10 +14,8 @@
|
|||
* - Flexible Materials system, supporting classic maps and PBR maps
|
||||
* - Shaders support, including Model shaders and Postprocessing shaders
|
||||
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
|
||||
* - Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
|
||||
* - Multiple platforms support: Windows, Linux, FreeBSD, MacOS, UWP, Android, Raspberry Pi, HTML5.
|
||||
* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
|
||||
* - VR stereo rendering with configurable HMD device parameters
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
* - Complete bindings to LUA (raylib-lua) and Go (raylib-go)
|
||||
*
|
||||
* NOTES:
|
||||
|
@ -33,14 +33,15 @@
|
|||
* stb_image_resize (Sean Barret) for image resizing algorythms [textures]
|
||||
* stb_image_write (Sean Barret) for image writting (PNG) [utils]
|
||||
* stb_truetype (Sean Barret) for ttf fonts loading [text]
|
||||
* stb_rect_pack (Sean Barret) for rectangles packing [text]
|
||||
* stb_vorbis (Sean Barret) for OGG audio loading [audio]
|
||||
* stb_perlin (Sean Barret) for Perlin noise image generation [textures]
|
||||
* par_shapes (Philip Rideout) for parametric 3d shapes generation [models]
|
||||
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
|
||||
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
|
||||
* dr_flac (David Reid) for FLAC audio file loading [audio]
|
||||
* dr_mp3 (David Reid) for MP3 audio file loading [audio]
|
||||
* rgif (Charlie Tangora, Ramon Santamaria) for GIF recording [core]
|
||||
* tinfl for data decompression (DEFLATE algorithm) [rres]
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
|
@ -70,6 +71,8 @@
|
|||
#ifndef RAYLIB_H
|
||||
#define RAYLIB_H
|
||||
|
||||
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
|
||||
|
||||
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
|
||||
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
|
||||
|
@ -92,7 +95,7 @@
|
|||
#define FLAG_SHOW_LOGO 1 // Set to show raylib logo at startup
|
||||
#define FLAG_FULLSCREEN_MODE 2 // Set to run program in fullscreen
|
||||
#define FLAG_WINDOW_RESIZABLE 4 // Set to allow resizable window
|
||||
#define FLAG_WINDOW_DECORATED 8 // Set to show window decoration (frame and buttons)
|
||||
#define FLAG_WINDOW_UNDECORATED 8 // Set to disable window decoration (frame and buttons)
|
||||
#define FLAG_WINDOW_TRANSPARENT 16 // Set to allow transparent window
|
||||
#define FLAG_MSAA_4X_HINT 32 // Set to try enabling MSAA 4X
|
||||
#define FLAG_VSYNC_HINT 64 // Set to try enabling V-Sync on GPU
|
||||
|
@ -270,6 +273,24 @@
|
|||
#define GAMEPAD_XBOX_BUTTON_LEFT 13
|
||||
#define GAMEPAD_XBOX_BUTTON_HOME 8
|
||||
|
||||
// Android Gamepad Controller (SNES CLASSIC)
|
||||
#define GAMEPAD_ANDROID_DPAD_UP 19
|
||||
#define GAMEPAD_ANDROID_DPAD_DOWN 20
|
||||
#define GAMEPAD_ANDROID_DPAD_LEFT 21
|
||||
#define GAMEPAD_ANDROID_DPAD_RIGHT 22
|
||||
#define GAMEPAD_ANDROID_DPAD_CENTER 23
|
||||
|
||||
#define GAMEPAD_ANDROID_BUTTON_A 96
|
||||
#define GAMEPAD_ANDROID_BUTTON_B 97
|
||||
#define GAMEPAD_ANDROID_BUTTON_C 98
|
||||
#define GAMEPAD_ANDROID_BUTTON_X 99
|
||||
#define GAMEPAD_ANDROID_BUTTON_Y 100
|
||||
#define GAMEPAD_ANDROID_BUTTON_Z 101
|
||||
#define GAMEPAD_ANDROID_BUTTON_L1 102
|
||||
#define GAMEPAD_ANDROID_BUTTON_R1 103
|
||||
#define GAMEPAD_ANDROID_BUTTON_L2 104
|
||||
#define GAMEPAD_ANDROID_BUTTON_R2 105
|
||||
|
||||
// Xbox360 USB Controller Axis
|
||||
// NOTE: For Raspberry Pi, axis must be reconfigured
|
||||
#if defined(PLATFORM_RPI)
|
||||
|
@ -333,11 +354,9 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
#ifndef __cplusplus
|
||||
// Boolean type
|
||||
#ifndef bool
|
||||
typedef enum { false, true } bool;
|
||||
#endif
|
||||
#if !defined(__cplusplus) && !defined(bool)
|
||||
typedef enum { false, true } bool;
|
||||
#endif
|
||||
|
||||
// Vector2 type
|
||||
|
@ -361,6 +380,9 @@ typedef struct Vector4 {
|
|||
float w;
|
||||
} Vector4;
|
||||
|
||||
// Quaternion type, same as Vector4
|
||||
typedef Vector4 Quaternion;
|
||||
|
||||
// Matrix type (OpenGL style 4x4 - right handed, column major)
|
||||
typedef struct Matrix {
|
||||
float m0, m4, m8, m12;
|
||||
|
@ -405,6 +427,9 @@ typedef struct Texture2D {
|
|||
int format; // Data format (PixelFormat type)
|
||||
} Texture2D;
|
||||
|
||||
// Texture type, same as Texture2D
|
||||
typedef Texture2D Texture;
|
||||
|
||||
// RenderTexture2D type, for texture rendering
|
||||
typedef struct RenderTexture2D {
|
||||
unsigned int id; // OpenGL Framebuffer Object (FBO) id
|
||||
|
@ -412,6 +437,19 @@ typedef struct RenderTexture2D {
|
|||
Texture2D depth; // Depth buffer attachment texture
|
||||
} RenderTexture2D;
|
||||
|
||||
// RenderTexture type, same as RenderTexture2D
|
||||
typedef RenderTexture2D RenderTexture;
|
||||
|
||||
// N-Patch layout info
|
||||
typedef struct NPatchInfo {
|
||||
Rectangle sourceRec; // Region in the texture
|
||||
int left; // left border offset
|
||||
int top; // top border offset
|
||||
int right; // right border offset
|
||||
int bottom; // bottom border offset
|
||||
int type; // layout of the n-patch: 3x3, 1x3 or 3x1
|
||||
} NPatchInfo;
|
||||
|
||||
// Font character info
|
||||
typedef struct CharInfo {
|
||||
int value; // Character value (Unicode)
|
||||
|
@ -419,6 +457,7 @@ typedef struct CharInfo {
|
|||
int offsetX; // Character offset X when drawing
|
||||
int offsetY; // Character offset Y when drawing
|
||||
int advanceX; // Character advance position X
|
||||
unsigned char *data; // Character pixel data (grayscale)
|
||||
} CharInfo;
|
||||
|
||||
// Font type, includes texture and charSet array data
|
||||
|
@ -429,7 +468,7 @@ typedef struct Font {
|
|||
CharInfo *chars; // Characters info data
|
||||
} Font;
|
||||
|
||||
#define SpriteFont Font // SpriteFont type fallback, defaults to Font
|
||||
#define SpriteFont Font // SpriteFont type fallback, defaults to Font
|
||||
|
||||
// Camera type, defines a camera position/orientation in 3d space
|
||||
typedef struct Camera3D {
|
||||
|
@ -440,7 +479,7 @@ typedef struct Camera3D {
|
|||
int type; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
||||
} Camera3D;
|
||||
|
||||
#define Camera Camera3D // Camera type fallback, defaults to Camera3D
|
||||
#define Camera Camera3D // Camera type fallback, defaults to Camera3D
|
||||
|
||||
// Camera2D type, defines a 2d camera
|
||||
typedef struct Camera2D {
|
||||
|
@ -462,6 +501,7 @@ typedef struct Mesh {
|
|||
int vertexCount; // Number of vertices stored in arrays
|
||||
int triangleCount; // Number of triangles stored (indexed or not)
|
||||
|
||||
// Default vertex data
|
||||
float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
||||
float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
||||
float *texcoords2; // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
|
||||
|
@ -469,9 +509,16 @@ typedef struct Mesh {
|
|||
float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
||||
unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
||||
unsigned short *indices;// Vertex indices (in case vertex data comes indexed)
|
||||
|
||||
// Animation vertex data
|
||||
float *baseVertices; // Vertex base position (required to apply bones transformations)
|
||||
float *baseNormals; // Vertex base normals (required to apply bones transformations)
|
||||
float *weightBias; // Vertex weight bias
|
||||
int *weightId; // Vertex weight id
|
||||
|
||||
// OpenGL identifiers
|
||||
unsigned int vaoId; // OpenGL Vertex Array Object id
|
||||
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
|
||||
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (default vertex data)
|
||||
} Mesh;
|
||||
|
||||
// Shader type (generic)
|
||||
|
@ -569,12 +616,12 @@ typedef struct VrDeviceInfo {
|
|||
// Enumerators Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
// Trace log type
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
LOG_INFO = 1,
|
||||
LOG_WARNING = 2,
|
||||
LOG_ERROR = 4,
|
||||
LOG_DEBUG = 8,
|
||||
LOG_OTHER = 16
|
||||
LOG_WARNING = 2,
|
||||
LOG_ERROR = 4,
|
||||
LOG_DEBUG = 8,
|
||||
LOG_OTHER = 16
|
||||
} LogType;
|
||||
|
||||
// Shader location point type
|
||||
|
@ -666,16 +713,23 @@ typedef enum {
|
|||
} TextureFilterMode;
|
||||
|
||||
// Texture parameters: wrap mode
|
||||
typedef enum {
|
||||
WRAP_REPEAT = 0,
|
||||
WRAP_CLAMP,
|
||||
WRAP_MIRROR
|
||||
typedef enum {
|
||||
WRAP_REPEAT = 0,
|
||||
WRAP_CLAMP,
|
||||
WRAP_MIRROR
|
||||
} TextureWrapMode;
|
||||
|
||||
// Font type, defines generation method
|
||||
typedef enum {
|
||||
FONT_DEFAULT = 0, // Default font generation, anti-aliased
|
||||
FONT_BITMAP, // Bitmap font generation, no anti-aliasing
|
||||
FONT_SDF // SDF font generation, requires external shader
|
||||
} FontType;
|
||||
|
||||
// Color blending modes (pre-defined)
|
||||
typedef enum {
|
||||
BLEND_ALPHA = 0,
|
||||
BLEND_ADDITIVE,
|
||||
typedef enum {
|
||||
BLEND_ALPHA = 0,
|
||||
BLEND_ADDITIVE,
|
||||
BLEND_MULTIPLIED
|
||||
} BlendMode;
|
||||
|
||||
|
@ -720,6 +774,16 @@ typedef enum {
|
|||
HMD_SONY_PSVR
|
||||
} VrDeviceType;
|
||||
|
||||
// Type of n-patch
|
||||
typedef enum {
|
||||
NPT_9PATCH = 0, // 3x3
|
||||
NPT_3PATCH_VERTICAL, // 1x3
|
||||
NPT_3PATCH_HORIZONTAL // 3x1
|
||||
} NPatchType;
|
||||
|
||||
// Callbacks to be implemented by users
|
||||
typedef void (*TraceLogCallback)(int msgType, const char *text, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
|
@ -748,6 +812,13 @@ RLAPI void SetWindowMinSize(int width, int height); // Set window
|
|||
RLAPI void SetWindowSize(int width, int height); // Set window dimensions
|
||||
RLAPI int GetScreenWidth(void); // Get current screen width
|
||||
RLAPI int GetScreenHeight(void); // Get current screen height
|
||||
RLAPI void *GetWindowHandle(void); // Get native window handle
|
||||
RLAPI int GetMonitorCount(void); // Get number of connected monitors
|
||||
RLAPI int GetMonitorWidth(int monitor); // Get primary monitor width
|
||||
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
|
||||
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
|
||||
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
|
||||
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
|
||||
// Cursor-related functions
|
||||
RLAPI void ShowCursor(void); // Shows cursor
|
||||
|
@ -772,7 +843,7 @@ RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a r
|
|||
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
|
||||
RLAPI Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
|
||||
|
||||
// Timming-related functions
|
||||
// timing-related functions
|
||||
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||
RLAPI int GetFPS(void); // Returns current FPS
|
||||
RLAPI float GetFrameTime(void); // Returns time in seconds for last frame drawn
|
||||
|
@ -789,6 +860,7 @@ RLAPI Color Fade(Color color, float alpha); // Color fade-
|
|||
RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags)
|
||||
RLAPI void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS)
|
||||
RLAPI void SetTraceLog(unsigned char types); // Enable trace log message types (bit flags based)
|
||||
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging bypassing raylib's one
|
||||
RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png)
|
||||
RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
||||
|
@ -799,10 +871,12 @@ RLAPI const char *GetExtension(const char *fileName); // Get pointer
|
|||
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
|
||||
RLAPI const char *GetDirectoryPath(const char *fileName); // Get full path for a given fileName (uses static string)
|
||||
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
|
||||
RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
|
||||
RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
|
||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, returns true if success
|
||||
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
RLAPI char **GetDroppedFiles(int *count); // Get dropped files names
|
||||
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer
|
||||
RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed)
|
||||
RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
|
||||
|
||||
// Persistent storage management
|
||||
RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
|
||||
|
@ -921,7 +995,7 @@ RLAPI Image LoadImage(const char *fileName);
|
|||
RLAPI Image LoadImageEx(Color *pixels, int width, int height); // Load image from Color array data (RGBA - 32bit)
|
||||
RLAPI Image LoadImagePro(void *data, int width, int height, int format); // Load image from raw data with parameters
|
||||
RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
|
||||
RLAPI void ExportImage(const char *fileName, Image image); // Export image as a PNG file
|
||||
RLAPI void ExportImage(Image image, const char *fileName); // Export image data to file
|
||||
RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
|
||||
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
||||
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
||||
|
@ -929,6 +1003,7 @@ RLAPI void UnloadImage(Image image);
|
|||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
|
||||
RLAPI Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
||||
RLAPI Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
|
||||
RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture)
|
||||
RLAPI Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
|
||||
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
|
||||
|
@ -942,23 +1017,27 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold);
|
|||
RLAPI void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value
|
||||
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
|
||||
RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
||||
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering)
|
||||
RLAPI void ImageResizeNN(Image *image,int newWidth,int newHeight); // Resize and image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (bilinear filtering)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color color); // Resize canvas and fill with color
|
||||
RLAPI void ImageMipmaps(Image *image); // Generate all mipmap levels for a provided image
|
||||
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
||||
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
|
||||
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
|
||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
|
||||
RLAPI void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color); // Draw rectangle within an image
|
||||
RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
|
||||
RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination)
|
||||
RLAPI void ImageFlipVertical(Image *image); // Flip image vertically
|
||||
RLAPI void ImageFlipHorizontal(Image *image); // Flip image horizontally
|
||||
RLAPI void ImageRotateCW(Image *image); // Rotate image clockwise 90deg
|
||||
RLAPI void ImageRotateCCW(Image *image); // Rotate image counter-clockwise 90deg
|
||||
RLAPI void ImageColorTint(Image *image, Color color); // Modify image color: tint
|
||||
RLAPI void ImageColorInvert(Image *image); // Modify image color: invert
|
||||
RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale
|
||||
RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
|
||||
RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
|
||||
RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color
|
||||
|
||||
// Image generation functions
|
||||
RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color
|
||||
|
@ -981,29 +1060,31 @@ RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint);
|
|||
RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
|
||||
RLAPI void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
|
||||
RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
|
||||
|
||||
RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely.
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Font Loading and Text Drawing Functions (Module: text)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
// Font loading/unloading functions
|
||||
RLAPI Font GetDefaultFont(void); // Get the default Font
|
||||
RLAPI Font LoadFont(const char *fileName); // Load Font from file into GPU memory (VRAM)
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load Font from file with extended parameters
|
||||
RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
|
||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load font from file with extended parameters
|
||||
RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
|
||||
RLAPI Image GenImageFontAtlas(CharInfo *chars, int fontSize, int charsCount, int padding, int packMethod); // Generate image font atlas using chars info
|
||||
RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
|
||||
|
||||
// Text drawing functions
|
||||
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS
|
||||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||
RLAPI void DrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using Font and additional parameters
|
||||
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS
|
||||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||
RLAPI void DrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
||||
|
||||
// Text misc. functions
|
||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
||||
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
||||
RLAPI const char *SubText(const char *text, int position, int length); // Get a piece of a text string
|
||||
RLAPI int GetGlyphIndex(Font font, int character); // Returns index position for a unicode character on sprite font
|
||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
|
||||
RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
||||
RLAPI const char *SubText(const char *text, int position, int length); // Get a piece of a text string
|
||||
RLAPI int GetGlyphIndex(Font font, int character); // Get index position for a unicode character on font
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||
|
@ -1039,11 +1120,11 @@ RLAPI void UnloadModel(Model model);
|
|||
// Mesh loading/unloading functions
|
||||
RLAPI Mesh LoadMesh(const char *fileName); // Load mesh from file
|
||||
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
|
||||
RLAPI void ExportMesh(const char *fileName, Mesh mesh); // Export mesh as an OBJ file
|
||||
RLAPI void ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file
|
||||
|
||||
// Mesh manipulation functions
|
||||
RLAPI BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
|
||||
RLAPI void MeshTangents(Mesh *mesh); // Compute mesh tangents
|
||||
RLAPI void MeshTangents(Mesh *mesh); // Compute mesh tangents
|
||||
RLAPI void MeshBinormals(Mesh *mesh); // Compute mesh binormals
|
||||
|
||||
// Mesh generation functions
|
||||
|
@ -1147,6 +1228,7 @@ RLAPI Sound LoadSoundFromWave(Wave wave); // Load so
|
|||
RLAPI void UpdateSound(Sound sound, const void *data, int samplesCount);// Update sound buffer with new data
|
||||
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||
RLAPI void ExportWave(Wave wave, const char *fileName); // Export wave data to file
|
||||
|
||||
// Wave/Sound management functions
|
||||
RLAPI void PlaySound(Sound sound); // Play a sound
|
||||
|
@ -1189,10 +1271,6 @@ RLAPI void StopAudioStream(AudioStream stream); // Stop au
|
|||
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
|
||||
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
RLAPI struct android_app *GetAndroidApp(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
245
raylib/raymath.h
245
raylib/raymath.h
|
@ -12,9 +12,9 @@
|
|||
* #define RAYMATH_HEADER_ONLY
|
||||
* Define static inline functions code, so #include header suffices for use.
|
||||
* This may use up lots of memory.
|
||||
*
|
||||
*
|
||||
* #define RAYMATH_STANDALONE
|
||||
* Avoid raylib.h header inclusion in this file.
|
||||
* Avoid raylib.h header inclusion in this file.
|
||||
* Vector3 and Matrix data types are defined internally in raymath module.
|
||||
*
|
||||
*
|
||||
|
@ -60,7 +60,13 @@
|
|||
#endif
|
||||
|
||||
#ifdef RAYMATH_IMPLEMENTATION
|
||||
#define RMDEF extern inline // Provide external definition
|
||||
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RMDEF __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll).
|
||||
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
|
||||
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
||||
#else
|
||||
#define RMDEF extern inline // Provide external definition
|
||||
#endif
|
||||
#elif defined RAYMATH_HEADER_ONLY
|
||||
#define RMDEF static inline // Functions may be inlined, no external out-of-line definition
|
||||
#else
|
||||
|
@ -94,7 +100,7 @@
|
|||
|
||||
// Return float vector for Vector3
|
||||
#ifndef Vector3ToFloat
|
||||
#define Vector3ToFloat(vec) (Vector3ToFloatV(vec).v)
|
||||
#define Vector3ToFloat(vec) (Vector3ToFloatV(vec).v)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -114,6 +120,14 @@
|
|||
float y;
|
||||
float z;
|
||||
} Vector3;
|
||||
|
||||
// Quaternion type
|
||||
typedef struct Quaternion {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} Quaternion;
|
||||
|
||||
// Matrix type (OpenGL style 4x4 - right handed, column major)
|
||||
typedef struct Matrix {
|
||||
|
@ -128,14 +142,6 @@
|
|||
typedef struct float3 { float v[3]; } float3;
|
||||
typedef struct float16 { float v[16]; } float16;
|
||||
|
||||
// Quaternion type
|
||||
typedef struct Quaternion {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} Quaternion;
|
||||
|
||||
#include <math.h> // Required for: sinf(), cosf(), tan(), fabs()
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -143,26 +149,32 @@ typedef struct Quaternion {
|
|||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Clamp float value
|
||||
RMDEF float Clamp(float value, float min, float max)
|
||||
RMDEF float Clamp(float value, float min, float max)
|
||||
{
|
||||
const float res = value < min ? min : value;
|
||||
return res > max ? max : res;
|
||||
}
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
RMDEF float Lerp(float start, float end, float amount)
|
||||
{
|
||||
return start + amount*(end - start);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector2 math
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Vector with components value 0.0f
|
||||
RMDEF Vector2 Vector2Zero(void)
|
||||
{
|
||||
RMDEF Vector2 Vector2Zero(void)
|
||||
{
|
||||
Vector2 result = { 0.0f, 0.0f };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Vector with components value 1.0f
|
||||
RMDEF Vector2 Vector2One(void)
|
||||
{
|
||||
RMDEF Vector2 Vector2One(void)
|
||||
{
|
||||
Vector2 result = { 1.0f, 1.0f };
|
||||
return result;
|
||||
}
|
||||
|
@ -217,6 +229,13 @@ RMDEF Vector2 Vector2Scale(Vector2 v, float scale)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Multiply vector by vector
|
||||
RMDEF Vector2 Vector2MultiplyV(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
Vector2 result = { v1.x*v2.x, v1.y*v2.y };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Negate vector
|
||||
RMDEF Vector2 Vector2Negate(Vector2 v)
|
||||
{
|
||||
|
@ -231,6 +250,13 @@ RMDEF Vector2 Vector2Divide(Vector2 v, float div)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Divide vector by vector
|
||||
RMDEF Vector2 Vector2DivideV(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
Vector2 result = { v1.x/v2.x, v1.y/v2.y };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Normalize provided vector
|
||||
RMDEF Vector2 Vector2Normalize(Vector2 v)
|
||||
{
|
||||
|
@ -238,36 +264,47 @@ RMDEF Vector2 Vector2Normalize(Vector2 v)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
RMDEF Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount)
|
||||
{
|
||||
Vector2 result = { 0 };
|
||||
|
||||
result.x = v1.x + amount*(v2.x - v1.x);
|
||||
result.y = v1.y + amount*(v2.y - v1.y);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vector3 math
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Vector with components value 0.0f
|
||||
RMDEF Vector3 Vector3Zero(void)
|
||||
{
|
||||
RMDEF Vector3 Vector3Zero(void)
|
||||
{
|
||||
Vector3 result = { 0.0f, 0.0f, 0.0f };
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Vector with components value 1.0f
|
||||
RMDEF Vector3 Vector3One(void)
|
||||
{
|
||||
RMDEF Vector3 Vector3One(void)
|
||||
{
|
||||
Vector3 result = { 1.0f, 1.0f, 1.0f };
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Add two vectors
|
||||
RMDEF Vector3 Vector3Add(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { v1.x + v2.x, v1.y + v2.y, v1.z + v2.z };
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Substract two vectors
|
||||
RMDEF Vector3 Vector3Subtract(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { v1.x - v2.x, v1.y - v2.y, v1.z - v2.z };
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Multiply vector by scalar
|
||||
|
@ -279,7 +316,7 @@ RMDEF Vector3 Vector3Multiply(Vector3 v, float scalar)
|
|||
|
||||
// Multiply vector by vector
|
||||
RMDEF Vector3 Vector3MultiplyV(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
{
|
||||
Vector3 result = { v1.x*v2.x, v1.y*v2.y, v1.z*v2.z };
|
||||
return result;
|
||||
}
|
||||
|
@ -296,17 +333,17 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
|
|||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
float min = fabsf(v.x);
|
||||
float min = (float) fabs(v.x);
|
||||
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
|
||||
|
||||
if (fabsf(v.y) < min)
|
||||
if (fabs(v.y) < min)
|
||||
{
|
||||
min = fabsf(v.y);
|
||||
min = (float) fabs(v.y);
|
||||
Vector3 tmp = {0.0f, 1.0f, 0.0f};
|
||||
cardinalAxis = tmp;
|
||||
}
|
||||
|
||||
if (fabsf(v.z) < min)
|
||||
if (fabs(v.z) < min)
|
||||
{
|
||||
Vector3 tmp = {0.0f, 0.0f, 1.0f};
|
||||
cardinalAxis = tmp;
|
||||
|
@ -355,11 +392,25 @@ RMDEF Vector3 Vector3Negate(Vector3 v)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Divide vector by a float value
|
||||
RMDEF Vector3 Vector3Divide(Vector3 v, float div)
|
||||
{
|
||||
Vector3 result = { v.x / div, v.y / div, v.z / div };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Divide vector by vector
|
||||
RMDEF Vector3 Vector3DivideV(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { v1.x/v2.x, v1.y/v2.y, v1.z/v2.z };
|
||||
return result;
|
||||
}
|
||||
|
||||
// Normalize provided vector
|
||||
RMDEF Vector3 Vector3Normalize(Vector3 v)
|
||||
{
|
||||
Vector3 result = v;
|
||||
|
||||
|
||||
float length, ilength;
|
||||
length = Vector3Length(v);
|
||||
if (length == 0.0f) length = 1.0f;
|
||||
|
@ -394,10 +445,22 @@ RMDEF Vector3 Vector3Transform(Vector3 v, Matrix mat)
|
|||
result.x = mat.m0*x + mat.m4*y + mat.m8*z + mat.m12;
|
||||
result.y = mat.m1*x + mat.m5*y + mat.m9*z + mat.m13;
|
||||
result.z = mat.m2*x + mat.m6*y + mat.m10*z + mat.m14;
|
||||
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// Transform a vector by quaternion rotation
|
||||
RMDEF Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
result.x = v.x*(q.x*q.x + q.w*q.w - q.y*q.y - q.z*q.z) + v.y*(2*q.x*q.y - 2*q.w*q.z) + v.z*(2*q.x*q.z + 2*q.w*q.y);
|
||||
result.y = v.x*(2*q.w*q.z + 2*q.x*q.y) + v.y*(q.w*q.w - q.x*q.x + q.y*q.y - q.z*q.z) + v.z*(-2*q.w*q.x + 2*q.y*q.z);
|
||||
result.z = v.x*(-2*q.w*q.y + 2*q.x*q.z) + v.y*(2*q.w*q.x + 2*q.y*q.z)+ v.z*(q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
RMDEF Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount)
|
||||
{
|
||||
|
@ -432,11 +495,11 @@ RMDEF Vector3 Vector3Reflect(Vector3 v, Vector3 normal)
|
|||
RMDEF Vector3 Vector3Min(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
|
||||
result.x = fminf(v1.x, v2.x);
|
||||
result.y = fminf(v1.y, v2.y);
|
||||
result.z = fminf(v1.z, v2.z);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -444,11 +507,11 @@ RMDEF Vector3 Vector3Min(Vector3 v1, Vector3 v2)
|
|||
RMDEF Vector3 Vector3Max(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
|
||||
result.x = fmaxf(v1.x, v2.x);
|
||||
result.y = fmaxf(v1.y, v2.y);
|
||||
result.z = fmaxf(v1.z, v2.z);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -457,7 +520,7 @@ RMDEF Vector3 Vector3Max(Vector3 v1, Vector3 v2)
|
|||
RMDEF Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c)
|
||||
{
|
||||
//Vector v0 = b - a, v1 = c - a, v2 = p - a;
|
||||
|
||||
|
||||
Vector3 v0 = Vector3Subtract(b, a);
|
||||
Vector3 v1 = Vector3Subtract(c, a);
|
||||
Vector3 v2 = Vector3Subtract(p, a);
|
||||
|
@ -466,15 +529,15 @@ RMDEF Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c)
|
|||
float d11 = Vector3DotProduct(v1, v1);
|
||||
float d20 = Vector3DotProduct(v2, v0);
|
||||
float d21 = Vector3DotProduct(v2, v1);
|
||||
|
||||
|
||||
float denom = d00*d11 - d01*d01;
|
||||
|
||||
|
||||
Vector3 result = { 0 };
|
||||
|
||||
|
||||
result.y = (d11*d20 - d01*d21)/denom;
|
||||
result.z = (d00*d21 - d01*d20)/denom;
|
||||
result.x = 1.0f - (result.z + result.y);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -598,7 +661,7 @@ RMDEF Matrix MatrixInvert(Matrix mat)
|
|||
RMDEF Matrix MatrixNormalize(Matrix mat)
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
|
||||
float det = MatrixDeterminant(mat);
|
||||
|
||||
result.m0 = mat.m0/det;
|
||||
|
@ -617,15 +680,15 @@ RMDEF Matrix MatrixNormalize(Matrix mat)
|
|||
result.m13 = mat.m13/det;
|
||||
result.m14 = mat.m14/det;
|
||||
result.m15 = mat.m15/det;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns identity matrix
|
||||
RMDEF Matrix MatrixIdentity(void)
|
||||
{
|
||||
Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
Matrix result = { 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
|
@ -685,9 +748,9 @@ RMDEF Matrix MatrixSubstract(Matrix left, Matrix right)
|
|||
// Returns translation matrix
|
||||
RMDEF Matrix MatrixTranslate(float x, float y, float z)
|
||||
{
|
||||
Matrix result = { 1.0f, 0.0f, 0.0f, x,
|
||||
0.0f, 1.0f, 0.0f, y,
|
||||
0.0f, 0.0f, 1.0f, z,
|
||||
Matrix result = { 1.0f, 0.0f, 0.0f, x,
|
||||
0.0f, 1.0f, 0.0f, y,
|
||||
0.0f, 0.0f, 1.0f, z,
|
||||
0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
return result;
|
||||
|
@ -724,12 +787,12 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle)
|
|||
result.m5 = y*y*t + cosres;
|
||||
result.m6 = z*y*t + x*sinres;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
|
||||
result.m8 = x*z*t + y*sinres;
|
||||
result.m9 = y*z*t - x*sinres;
|
||||
result.m10 = z*z*t + cosres;
|
||||
result.m11 = 0.0f;
|
||||
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = 0.0f;
|
||||
|
@ -789,9 +852,9 @@ RMDEF Matrix MatrixRotateZ(float angle)
|
|||
// Returns scaling matrix
|
||||
RMDEF Matrix MatrixScale(float x, float y, float z)
|
||||
{
|
||||
Matrix result = { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, y, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, z, 0.0f,
|
||||
Matrix result = { x, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, y, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, z, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
return result;
|
||||
|
@ -828,28 +891,28 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
|
|||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (right - left);
|
||||
float tb = (top - bottom);
|
||||
float fn = (far - near);
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(far - near);
|
||||
|
||||
result.m0 = (near*2.0f)/rl;
|
||||
result.m0 = ((float) near*2.0f)/rl;
|
||||
result.m1 = 0.0f;
|
||||
result.m2 = 0.0f;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = 0.0f;
|
||||
result.m5 = (near*2.0f)/tb;
|
||||
result.m5 = ((float) near*2.0f)/tb;
|
||||
result.m6 = 0.0f;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = (right + left)/rl;
|
||||
result.m9 = (top + bottom)/tb;
|
||||
result.m10 = -(far + near)/fn;
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)far + (float)near)/fn;
|
||||
result.m11 = -1.0f;
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = -(far*near*2.0f)/fn;
|
||||
result.m14 = -((float)far*(float)near*2.0f)/fn;
|
||||
result.m15 = 0.0f;
|
||||
|
||||
return result;
|
||||
|
@ -859,11 +922,11 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
|
|||
// NOTE: Angle should be provided in radians
|
||||
RMDEF Matrix MatrixPerspective(double fovy, double aspect, double near, double far)
|
||||
{
|
||||
double top = near*tan(fovy*0.5);
|
||||
double top = near*tan(fovy*0.5);
|
||||
double right = top*aspect;
|
||||
Matrix result = MatrixFrustum(-right, right, -top, top, near, far);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns orthographic projection matrix
|
||||
|
@ -871,9 +934,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
|
|||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (right - left);
|
||||
float tb = (top - bottom);
|
||||
float fn = (far - near);
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(far - near);
|
||||
|
||||
result.m0 = 2.0f/rl;
|
||||
result.m1 = 0.0f;
|
||||
|
@ -887,9 +950,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
|
|||
result.m9 = 0.0f;
|
||||
result.m10 = -2.0f/fn;
|
||||
result.m11 = 0.0f;
|
||||
result.m12 = -(left + right)/rl;
|
||||
result.m13 = -(top + bottom)/tb;
|
||||
result.m14 = -(far + near)/fn;
|
||||
result.m12 = -((float)left + (float)right)/rl;
|
||||
result.m13 = -((float)top + (float)bottom)/tb;
|
||||
result.m14 = -((float)far + (float)near)/fn;
|
||||
result.m15 = 1.0f;
|
||||
|
||||
return result;
|
||||
|
@ -906,7 +969,7 @@ RMDEF Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up)
|
|||
x = Vector3Normalize(x);
|
||||
Vector3 y = Vector3CrossProduct(z, x);
|
||||
y = Vector3Normalize(y);
|
||||
|
||||
|
||||
result.m0 = x.x;
|
||||
result.m1 = x.y;
|
||||
result.m2 = x.z;
|
||||
|
@ -968,7 +1031,7 @@ RMDEF Quaternion QuaternionIdentity(void)
|
|||
// Computes the length of a quaternion
|
||||
RMDEF float QuaternionLength(Quaternion q)
|
||||
{
|
||||
float result = sqrt(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w);
|
||||
float result = (float)sqrt(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -976,7 +1039,7 @@ RMDEF float QuaternionLength(Quaternion q)
|
|||
RMDEF Quaternion QuaternionNormalize(Quaternion q)
|
||||
{
|
||||
Quaternion result = { 0 };
|
||||
|
||||
|
||||
float length, ilength;
|
||||
length = QuaternionLength(q);
|
||||
if (length == 0.0f) length = 1.0f;
|
||||
|
@ -986,7 +1049,7 @@ RMDEF Quaternion QuaternionNormalize(Quaternion q)
|
|||
result.y = q.y*ilength;
|
||||
result.z = q.z*ilength;
|
||||
result.w = q.w*ilength;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -996,17 +1059,17 @@ RMDEF Quaternion QuaternionInvert(Quaternion q)
|
|||
Quaternion result = q;
|
||||
float length = QuaternionLength(q);
|
||||
float lengthSq = length*length;
|
||||
|
||||
|
||||
if (lengthSq != 0.0)
|
||||
{
|
||||
float i = 1.0f/lengthSq;
|
||||
|
||||
|
||||
result.x *= -i;
|
||||
result.y *= -i;
|
||||
result.z *= -i;
|
||||
result.w *= i;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1107,7 @@ RMDEF Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount)
|
|||
{
|
||||
Quaternion result = QuaternionLerp(q1, q2, amount);
|
||||
result = QuaternionNormalize(result);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1059,8 +1122,8 @@ RMDEF Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
|
|||
else if (cosHalfTheta > 0.95f) result = QuaternionNlerp(q1, q2, amount);
|
||||
else
|
||||
{
|
||||
float halfTheta = acos(cosHalfTheta);
|
||||
float sinHalfTheta = sqrt(1.0f - cosHalfTheta*cosHalfTheta);
|
||||
float halfTheta = (float) acos(cosHalfTheta);
|
||||
float sinHalfTheta = (float) sqrt(1.0f - cosHalfTheta*cosHalfTheta);
|
||||
|
||||
if (fabs(sinHalfTheta) < 0.001f)
|
||||
{
|
||||
|
@ -1096,13 +1159,13 @@ RMDEF Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to)
|
|||
result.y = cross.y;
|
||||
result.z = cross.y;
|
||||
result.w = 1.0f + cos2Theta; // NOTE: Added QuaternioIdentity()
|
||||
|
||||
|
||||
// Normalize to essentially nlerp the original and identity to 0.5
|
||||
result = QuaternionNormalize(result);
|
||||
|
||||
result = QuaternionNormalize(result);
|
||||
|
||||
// Above lines are equivalent to:
|
||||
//Quaternion result = QuaternionNlerp(q, QuaternionIdentity(), 0.5f);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1235,7 @@ RMDEF Matrix QuaternionToMatrix(Quaternion q)
|
|||
float x2 = x + x;
|
||||
float y2 = y + y;
|
||||
float z2 = z + z;
|
||||
|
||||
|
||||
float length = QuaternionLength(q);
|
||||
float lengthSquared = length*length;
|
||||
|
||||
|
@ -1204,7 +1267,7 @@ RMDEF Matrix QuaternionToMatrix(Quaternion q)
|
|||
result.m13 = 0.0f;
|
||||
result.m14 = 0.0f;
|
||||
result.m15 = 1.0f;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1282,7 @@ RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
|
|||
angle *= 0.5f;
|
||||
|
||||
axis = Vector3Normalize(axis);
|
||||
|
||||
|
||||
float sinres = sinf(angle);
|
||||
float cosres = cosf(angle);
|
||||
|
||||
|
@ -1277,7 +1340,7 @@ RMDEF Quaternion QuaternionFromEuler(float roll, float pitch, float yaw)
|
|||
q.y = x0*y1*z0 + x1*y0*z1;
|
||||
q.z = x0*y0*z1 - x1*y1*z0;
|
||||
q.w = x0*y0*z0 + x1*y1*z1;
|
||||
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
@ -1300,9 +1363,9 @@ RMDEF Vector3 QuaternionToEuler(Quaternion q)
|
|||
|
||||
// yaw (z-axis rotation)
|
||||
float z0 = 2.0f*(q.w*q.z + q.x*q.y);
|
||||
float z1 = 1.0f - 2.0f*(q.y*q.y + q.z*q.z);
|
||||
float z1 = 1.0f - 2.0f*(q.y*q.y + q.z*q.z);
|
||||
result.z = atan2f(z0, z1)*RAD2DEG;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1378,7 @@ RMDEF Quaternion QuaternionTransform(Quaternion q, Matrix mat)
|
|||
result.y = mat.m1*q.x + mat.m5*q.y + mat.m9*q.z + mat.m13*q.w;
|
||||
result.z = mat.m2*q.x + mat.m6*q.y + mat.m10*q.z + mat.m14*q.w;
|
||||
result.w = mat.m3*q.x + mat.m7*q.y + mat.m11*q.z + mat.m15*q.w;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
4456
raylib/rlgl.h
4456
raylib/rlgl.h
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
102
raylib/shapes.c
102
raylib/shapes.c
|
@ -153,9 +153,9 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
|
|||
for (int i = 1; i <= LINE_DIVISIONS; i++)
|
||||
{
|
||||
// Cubic easing in-out
|
||||
// NOTE: Easing is calcutated only for y position value
|
||||
current.y = EaseCubicInOut(i, startPos.y, endPos.y - startPos.y, LINE_DIVISIONS);
|
||||
current.x = previous.x + (endPos.x - startPos.x)/LINE_DIVISIONS;
|
||||
// NOTE: Easing is calculated only for y position value
|
||||
current.y = EaseCubicInOut((float)i, startPos.y, endPos.y - startPos.y, (float)LINE_DIVISIONS);
|
||||
current.x = previous.x + (endPos.x - startPos.x)/ (float)LINE_DIVISIONS;
|
||||
|
||||
DrawLineEx(previous, current, thick, color);
|
||||
|
||||
|
@ -173,6 +173,8 @@ void DrawCircle(int centerX, int centerY, float radius, Color color)
|
|||
// NOTE: Gradient goes from center (color1) to border (color2)
|
||||
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2)
|
||||
{
|
||||
if (rlCheckBufferLimit(RL_TRIANGLES, 3*36)) rlglDraw();
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
for (int i = 0; i < 360; i += 10)
|
||||
{
|
||||
|
@ -189,8 +191,10 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co
|
|||
// Draw a color-filled circle (Vector version)
|
||||
// NOTE: On OpenGL 3.3 and ES2 we use QUADS to avoid drawing order issues (view rlglDraw)
|
||||
void DrawCircleV(Vector2 center, float radius, Color color)
|
||||
{
|
||||
{
|
||||
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||
if (rlCheckBufferLimit(RL_QUADS, 4*(36/2))) rlglDraw();
|
||||
|
||||
rlEnableTexture(GetTextureDefault().id); // Default white texture
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
|
@ -207,6 +211,8 @@ void DrawCircleV(Vector2 center, float radius, Color color)
|
|||
|
||||
rlDisableTexture();
|
||||
#else
|
||||
if (rlCheckBufferLimit(RL_TRIANGLES, 3*(36/2))) rlglDraw();
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
for (int i = 0; i < 360; i += 10)
|
||||
{
|
||||
|
@ -223,6 +229,8 @@ void DrawCircleV(Vector2 center, float radius, Color color)
|
|||
// Draw circle outline
|
||||
void DrawCircleLines(int centerX, int centerY, float radius, Color color)
|
||||
{
|
||||
if (rlCheckBufferLimit(RL_LINES, 2*36)) rlglDraw();
|
||||
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
|
@ -251,27 +259,27 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|||
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||
#if defined(SUPPORT_FONT_TEXTURE)
|
||||
// Draw rectangle using font texture white character
|
||||
rlEnableTexture(GetDefaultFont().texture.id);
|
||||
rlEnableTexture(GetFontDefault().texture.id);
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
||||
|
||||
// NOTE: Default raylib font character 95 is a white square
|
||||
rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
|
||||
(float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((float)GetFontDefault().chars[95].rec.x/GetFontDefault().texture.width,
|
||||
(float)GetFontDefault().chars[95].rec.y/GetFontDefault().texture.height);
|
||||
rlVertex2f(position.x, position.y);
|
||||
|
||||
rlTexCoord2f((float)GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
|
||||
(float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((float)GetFontDefault().chars[95].rec.x/GetFontDefault().texture.width,
|
||||
(float)(GetFontDefault().chars[95].rec.y + GetFontDefault().chars[95].rec.height)/GetFontDefault().texture.height);
|
||||
rlVertex2f(position.x, position.y + size.y);
|
||||
|
||||
rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
|
||||
(float)(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((float)(GetFontDefault().chars[95].rec.x + GetFontDefault().chars[95].rec.width)/GetFontDefault().texture.width,
|
||||
(float)(GetFontDefault().chars[95].rec.y + GetFontDefault().chars[95].rec.height)/GetFontDefault().texture.height);
|
||||
rlVertex2f(position.x + size.x, position.y + size.y);
|
||||
|
||||
rlTexCoord2f((float)(GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
|
||||
(float)GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((float)(GetFontDefault().chars[95].rec.x + GetFontDefault().chars[95].rec.width)/GetFontDefault().texture.width,
|
||||
(float)GetFontDefault().chars[95].rec.y/GetFontDefault().texture.height);
|
||||
rlVertex2f(position.x + size.x, position.y);
|
||||
rlEnd();
|
||||
|
||||
|
@ -316,7 +324,7 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
|||
// Draw a color-filled rectangle
|
||||
void DrawRectangleRec(Rectangle rec, Color color)
|
||||
{
|
||||
DrawRectangle(rec.x, rec.y, rec.width, rec.height, color);
|
||||
DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color);
|
||||
}
|
||||
|
||||
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
|
||||
|
@ -346,14 +354,14 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
|
|||
// NOTE: Gradient goes from bottom (color1) to top (color2)
|
||||
void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2)
|
||||
{
|
||||
DrawRectangleGradientEx((Rectangle){ posX, posY, width, height }, color1, color2, color2, color1);
|
||||
DrawRectangleGradientEx((Rectangle){ (float)posX, (float)posY, (float)width, (float)height }, color1, color2, color2, color1);
|
||||
}
|
||||
|
||||
// Draw a horizontal-gradient-filled rectangle
|
||||
// NOTE: Gradient goes from bottom (color1) to top (color2)
|
||||
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2)
|
||||
{
|
||||
DrawRectangleGradientEx((Rectangle){ posX, posY, width, height }, color1, color1, color2, color2);
|
||||
DrawRectangleGradientEx((Rectangle){ (float)posX, (float)posY, (float)width, (float)height }, color1, color1, color2, color2);
|
||||
}
|
||||
|
||||
// Draw a gradient-filled rectangle
|
||||
|
@ -362,30 +370,30 @@ void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3,
|
|||
{
|
||||
#if defined(SUPPORT_FONT_TEXTURE)
|
||||
// Draw rectangle using font texture white character
|
||||
rlEnableTexture(GetDefaultFont().texture.id);
|
||||
rlEnableTexture(GetFontDefault().texture.id);
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
||||
|
||||
// NOTE: Default raylib font character 95 is a white square
|
||||
rlColor4ub(col1.r, col1.g, col1.b, col1.a);
|
||||
rlTexCoord2f(GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
|
||||
GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f(GetFontDefault().chars[95].rec.x/GetFontDefault().texture.width,
|
||||
GetFontDefault().chars[95].rec.y/GetFontDefault().texture.height);
|
||||
rlVertex2f(rec.x, rec.y);
|
||||
|
||||
rlColor4ub(col2.r, col2.g, col2.b, col2.a);
|
||||
rlTexCoord2f(GetDefaultFont().chars[95].rec.x/GetDefaultFont().texture.width,
|
||||
(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f(GetFontDefault().chars[95].rec.x/GetFontDefault().texture.width,
|
||||
(GetFontDefault().chars[95].rec.y + GetFontDefault().chars[95].rec.height)/GetFontDefault().texture.height);
|
||||
rlVertex2f(rec.x, rec.y + rec.height);
|
||||
|
||||
rlColor4ub(col3.r, col3.g, col3.b, col3.a);
|
||||
rlTexCoord2f((GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
|
||||
(GetDefaultFont().chars[95].rec.y + GetDefaultFont().chars[95].rec.height)/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((GetFontDefault().chars[95].rec.x + GetFontDefault().chars[95].rec.width)/GetFontDefault().texture.width,
|
||||
(GetFontDefault().chars[95].rec.y + GetFontDefault().chars[95].rec.height)/GetFontDefault().texture.height);
|
||||
rlVertex2f(rec.x + rec.width, rec.y + rec.height);
|
||||
|
||||
rlColor4ub(col4.r, col4.g, col4.b, col4.a);
|
||||
rlTexCoord2f((GetDefaultFont().chars[95].rec.x + GetDefaultFont().chars[95].rec.width)/GetDefaultFont().texture.width,
|
||||
GetDefaultFont().chars[95].rec.y/GetDefaultFont().texture.height);
|
||||
rlTexCoord2f((GetFontDefault().chars[95].rec.x + GetFontDefault().chars[95].rec.width)/GetFontDefault().texture.width,
|
||||
GetFontDefault().chars[95].rec.y/GetFontDefault().texture.height);
|
||||
rlVertex2f(rec.x + rec.width, rec.y);
|
||||
rlEnd();
|
||||
|
||||
|
@ -449,14 +457,14 @@ void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color)
|
|||
{
|
||||
if (lineThick > rec.width || lineThick > rec.height)
|
||||
{
|
||||
if(rec.width > rec.height) lineThick = rec.height/2;
|
||||
else if (rec.width < rec.height) lineThick = rec.width/2;
|
||||
if(rec.width > rec.height) lineThick = (int)rec.height/2;
|
||||
else if (rec.width < rec.height) lineThick = (int)rec.width/2;
|
||||
}
|
||||
|
||||
DrawRectangle(rec.x, rec.y, rec.width, lineThick, color);
|
||||
DrawRectangle(rec.x - lineThick + rec.width, rec.y + lineThick, lineThick, rec.height - lineThick*2, color);
|
||||
DrawRectangle(rec.x, rec.y + rec.height - lineThick, rec.width, lineThick, color);
|
||||
DrawRectangle(rec.x, rec.y + lineThick, lineThick, rec.height - lineThick*2, color);
|
||||
DrawRectangle( (int)rec.x, (int)rec.y, (int)rec.width, lineThick, color);
|
||||
DrawRectangle( (int)(rec.x - lineThick + rec.width), (int)(rec.y + lineThick), lineThick, (int)(rec.height - lineThick*2.0f), color);
|
||||
DrawRectangle( (int)rec.x, (int)(rec.y + rec.height - lineThick), (int)rec.width, lineThick, color);
|
||||
DrawRectangle( (int)rec.x, (int)(rec.y + lineThick), lineThick, (int)(rec.height - lineThick*2), color);
|
||||
}
|
||||
|
||||
// Draw a triangle
|
||||
|
@ -504,6 +512,8 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
|||
void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color)
|
||||
{
|
||||
if (sides < 3) sides = 3;
|
||||
|
||||
if (rlCheckBufferLimit(RL_QUADS, 4*(360/sides))) rlglDraw();
|
||||
|
||||
rlPushMatrix();
|
||||
rlTranslatef(center.x, center.y, 0.0);
|
||||
|
@ -544,6 +554,8 @@ void DrawPolyEx(Vector2 *points, int pointsCount, Color color)
|
|||
{
|
||||
if (pointsCount >= 3)
|
||||
{
|
||||
if (rlCheckBufferLimit(RL_QUADS, pointsCount)) rlglDraw();
|
||||
|
||||
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||
rlEnableTexture(GetTextureDefault().id); // Default white texture
|
||||
|
||||
|
@ -579,6 +591,8 @@ void DrawPolyExLines(Vector2 *points, int pointsCount, Color color)
|
|||
{
|
||||
if (pointsCount >= 2)
|
||||
{
|
||||
if (rlCheckBufferLimit(RL_LINES, pointsCount)) rlglDraw();
|
||||
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
|
@ -633,11 +647,9 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
|
|||
bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
|
||||
{
|
||||
bool collision = false;
|
||||
|
||||
int dx = abs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
|
||||
int dy = abs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
|
||||
|
||||
if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true;
|
||||
|
||||
if ((rec1.x <= (rec2.x + rec2.width) && (rec1.x + rec1.width) >= rec2.x) &&
|
||||
(rec1.y <= (rec2.y + rec2.height) && (rec1.y + rec1.height) >= rec2.y)) collision = true;
|
||||
|
||||
return collision;
|
||||
}
|
||||
|
@ -661,11 +673,11 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
|
|||
// NOTE: Reviewed version to take into account corner limit case
|
||||
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
|
||||
{
|
||||
int recCenterX = rec.x + rec.width/2;
|
||||
int recCenterY = rec.y + rec.height/2;
|
||||
int recCenterX = (int)(rec.x + rec.width/2.0f);
|
||||
int recCenterY = (int)(rec.y + rec.height/2.0f);
|
||||
|
||||
float dx = fabsf(center.x - recCenterX);
|
||||
float dy = fabsf(center.y - recCenterY);
|
||||
float dx = (float)fabs(center.x - recCenterX);
|
||||
float dy = (float)fabs(center.y - recCenterY);
|
||||
|
||||
if (dx > (rec.width/2.0f + radius)) { return false; }
|
||||
if (dy > (rec.height/2.0f + radius)) { return false; }
|
||||
|
@ -686,8 +698,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
|
|||
|
||||
if (CheckCollisionRecs(rec1, rec2))
|
||||
{
|
||||
int dxx = abs(rec1.x - rec2.x);
|
||||
int dyy = abs(rec1.y - rec2.y);
|
||||
float dxx = (float)fabs(rec1.x - rec2.x);
|
||||
float dyy = (float)fabs(rec1.y - rec2.y);
|
||||
|
||||
if (rec1.x <= rec2.x)
|
||||
{
|
||||
|
@ -754,8 +766,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
|
|||
// NOTE: Required for DrawLineBezier()
|
||||
static float EaseCubicInOut(float t, float b, float c, float d)
|
||||
{
|
||||
if ((t /= 0.5*d) < 1)
|
||||
return 0.5*c*t*t*t + b;
|
||||
if ((t /= 0.5f*d) < 1)
|
||||
return 0.5f*c*t*t*t + b;
|
||||
t -= 2;
|
||||
return 0.5*c*(t*t*t + 2) + b;
|
||||
return 0.5f*c*(t*t*t + 2.0f) + b;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
454
raylib/text.c
454
raylib/text.c
|
@ -36,9 +36,8 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "raylib.h"
|
||||
#include "config.h" // Defines module configuration flags
|
||||
#include "raylib.h" // Declares module functions
|
||||
|
||||
#include <stdlib.h> // Required for: malloc(), free()
|
||||
#include <string.h> // Required for: strlen()
|
||||
|
@ -48,15 +47,13 @@
|
|||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
// Following libs are used on LoadTTF()
|
||||
#define STBTT_STATIC // Define stb_truetype functions static to this module
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include "external/stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
|
||||
#endif
|
||||
#define STB_RECT_PACK_IMPLEMENTATION
|
||||
#include "external/stb_rect_pack.h" // Required for: ttf font rectangles packaging
|
||||
|
||||
// Rectangle packing functions (not used at the moment)
|
||||
//#define STB_RECT_PACK_IMPLEMENTATION
|
||||
//#include "stb_rect_pack.h"
|
||||
#define STBTT_STATIC
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include "external/stb_truetype.h" // Required for: ttf font data reading
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
|
@ -89,9 +86,6 @@ static Font LoadImageFont(Image image, Color key, int firstChar); // Load a Imag
|
|||
#if defined(SUPPORT_FILEFORMAT_FNT)
|
||||
static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file)
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
static Font LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load spritefont from TTF data
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_DEFAULT_FONT)
|
||||
extern void LoadDefaultFont(void);
|
||||
|
@ -223,12 +217,12 @@ extern void LoadDefaultFont(void)
|
|||
{
|
||||
defaultFont.chars[i].value = 32 + i; // First char is 32
|
||||
|
||||
defaultFont.chars[i].rec.x = currentPosX;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.width = charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = charsHeight;
|
||||
defaultFont.chars[i].rec.x = (float)currentPosX;
|
||||
defaultFont.chars[i].rec.y = (float)(charsDivisor + currentLine*(charsHeight + charsDivisor));
|
||||
defaultFont.chars[i].rec.width = (float)charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = (float)charsHeight;
|
||||
|
||||
testPosX += (defaultFont.chars[i].rec.width + charsDivisor);
|
||||
testPosX += (int)(defaultFont.chars[i].rec.width + (float)charsDivisor);
|
||||
|
||||
if (testPosX >= defaultFont.texture.width)
|
||||
{
|
||||
|
@ -236,8 +230,8 @@ extern void LoadDefaultFont(void)
|
|||
currentPosX = 2*charsDivisor + charsWidth[i];
|
||||
testPosX = currentPosX;
|
||||
|
||||
defaultFont.chars[i].rec.x = charsDivisor;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.x = (float)charsDivisor;
|
||||
defaultFont.chars[i].rec.y = (float)(charsDivisor + currentLine*(charsHeight + charsDivisor));
|
||||
}
|
||||
else currentPosX = testPosX;
|
||||
|
||||
|
@ -247,7 +241,7 @@ extern void LoadDefaultFont(void)
|
|||
defaultFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
defaultFont.baseSize = defaultFont.chars[0].rec.height;
|
||||
defaultFont.baseSize = (int)defaultFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
|
||||
}
|
||||
|
@ -261,7 +255,7 @@ extern void UnloadDefaultFont(void)
|
|||
#endif // SUPPORT_DEFAULT_FONT
|
||||
|
||||
// Get the default font, useful to be used with extended parameters
|
||||
Font GetDefaultFont()
|
||||
Font GetFontDefault()
|
||||
{
|
||||
#if defined(SUPPORT_DEFAULT_FONT)
|
||||
return defaultFont;
|
||||
|
@ -277,32 +271,40 @@ Font LoadFont(const char *fileName)
|
|||
// Default hardcoded values for ttf file loading
|
||||
#define DEFAULT_TTF_FONTSIZE 32 // Font first character (32 - space)
|
||||
#define DEFAULT_TTF_NUMCHARS 95 // ASCII 32..126 is 95 glyphs
|
||||
#define DEFAULT_FIRST_CHAR 32 // Expected first char for image spritefont
|
||||
#define DEFAULT_FIRST_CHAR 32 // Expected first char for image sprite font
|
||||
|
||||
Font spriteFont = { 0 };
|
||||
Font font = { 0 };
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL);
|
||||
if (IsFileExtension(fileName, ".ttf"))
|
||||
{
|
||||
font.baseSize = DEFAULT_TTF_FONTSIZE;
|
||||
font.charsCount = DEFAULT_TTF_NUMCHARS;
|
||||
font.chars = LoadFontData(fileName, font.baseSize, NULL, font.charsCount, FONT_DEFAULT);
|
||||
Image atlas = GenImageFontAtlas(font.chars, font.charsCount, font.baseSize, 4, 0);
|
||||
font.texture = LoadTextureFromImage(atlas);
|
||||
UnloadImage(atlas);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FNT)
|
||||
if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName);
|
||||
if (IsFileExtension(fileName, ".fnt")) font = LoadBMFont(fileName);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Image image = LoadImage(fileName);
|
||||
if (image.data != NULL) spriteFont = LoadImageFont(image, MAGENTA, DEFAULT_FIRST_CHAR);
|
||||
if (image.data != NULL) font = LoadImageFont(image, MAGENTA, DEFAULT_FIRST_CHAR);
|
||||
UnloadImage(image);
|
||||
}
|
||||
|
||||
if (spriteFont.texture.id == 0)
|
||||
if (font.texture.id == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Font could not be loaded, using default font", fileName);
|
||||
spriteFont = GetDefaultFont();
|
||||
font = GetFontDefault();
|
||||
}
|
||||
else SetTextureFilter(spriteFont.texture, FILTER_POINT); // By default we set point filter (best performance)
|
||||
else SetTextureFilter(font.texture, FILTER_POINT); // By default we set point filter (best performance)
|
||||
|
||||
return spriteFont;
|
||||
return font;
|
||||
}
|
||||
|
||||
// Load Font from TTF font file with generation parameters
|
||||
|
@ -310,38 +312,249 @@ Font LoadFont(const char *fileName)
|
|||
// if array is NULL, default char set is selected 32..126
|
||||
Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars)
|
||||
{
|
||||
Font spriteFont = { 0 };
|
||||
int totalChars = 95; // Default charset [32..126]
|
||||
Font font = { 0 };
|
||||
|
||||
font.baseSize = fontSize;
|
||||
font.charsCount = (charsCount > 0) ? charsCount : 95;
|
||||
font.chars = LoadFontData(fileName, font.baseSize, fontChars, font.charsCount, FONT_DEFAULT);
|
||||
Image atlas = GenImageFontAtlas(font.chars, font.charsCount, font.baseSize, 2, 0);
|
||||
font.texture = LoadTextureFromImage(atlas);
|
||||
UnloadImage(atlas);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
if (IsFileExtension(fileName, ".ttf"))
|
||||
// Load font data for further use
|
||||
// NOTE: Requires TTF font and can generate SDF data
|
||||
CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type)
|
||||
{
|
||||
// NOTE: Using some SDF generation default values,
|
||||
// trades off precision with ability to handle *smaller* sizes
|
||||
#define SDF_CHAR_PADDING 4
|
||||
#define SDF_ON_EDGE_VALUE 128
|
||||
#define SDF_PIXEL_DIST_SCALE 64.0f
|
||||
|
||||
#define BITMAP_ALPHA_THRESHOLD 80
|
||||
|
||||
// In case no chars count provided, default to 95
|
||||
charsCount = (charsCount > 0) ? charsCount : 95;
|
||||
|
||||
CharInfo *chars = (CharInfo *)malloc(charsCount*sizeof(CharInfo));
|
||||
|
||||
// Load font data (including pixel data) from TTF file
|
||||
// NOTE: Loaded information should be enough to generate font image atlas,
|
||||
// using any packaging method
|
||||
FILE *fontFile = fopen(fileName, "rb"); // Load font file
|
||||
|
||||
fseek(fontFile, 0, SEEK_END);
|
||||
long size = ftell(fontFile); // Get file size
|
||||
fseek(fontFile, 0, SEEK_SET); // Reset file pointer
|
||||
|
||||
unsigned char *fontBuffer = (unsigned char *)malloc(size);
|
||||
|
||||
fread(fontBuffer, size, 1, fontFile);
|
||||
fclose(fontFile);
|
||||
|
||||
// Init font for data reading
|
||||
stbtt_fontinfo fontInfo;
|
||||
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
|
||||
|
||||
// Calculate font scale factor
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float)fontSize);
|
||||
|
||||
// Calculate font basic metrics
|
||||
// NOTE: ascent is equivalent to font baseline
|
||||
int ascent, descent, lineGap;
|
||||
stbtt_GetFontVMetrics(&fontInfo, &ascent, &descent, &lineGap);
|
||||
|
||||
// Fill fontChars in case not provided externally
|
||||
// NOTE: By default we fill charsCount consecutevely, starting at 32 (Space)
|
||||
int genFontChars = false;
|
||||
if (fontChars == NULL) genFontChars = true;
|
||||
if (genFontChars)
|
||||
{
|
||||
if (charsCount != 0) totalChars = charsCount;
|
||||
fontChars = (int *)malloc(charsCount*sizeof(int));
|
||||
for (int i = 0; i < charsCount; i++) fontChars[i] = i + 32;
|
||||
}
|
||||
|
||||
// NOTE: Using simple packaging, one char after another
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
int chw = 0, chh = 0; // Character width and height (on generation)
|
||||
int ch = fontChars[i]; // Character value to get info for
|
||||
chars[i].value = ch;
|
||||
|
||||
if (fontChars == NULL)
|
||||
// Render a unicode codepoint to a bitmap
|
||||
// stbtt_GetCodepointBitmap() -- allocates and returns a bitmap
|
||||
// stbtt_GetCodepointBitmapBox() -- how big the bitmap must be
|
||||
// stbtt_MakeCodepointBitmap() -- renders into bitmap you provide
|
||||
|
||||
if (type != FONT_SDF) chars[i].data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, ch, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY);
|
||||
else if (ch != 32) chars[i].data = stbtt_GetCodepointSDF(&fontInfo, scaleFactor, ch, SDF_CHAR_PADDING, SDF_ON_EDGE_VALUE, SDF_PIXEL_DIST_SCALE, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY);
|
||||
|
||||
if (type == FONT_BITMAP)
|
||||
{
|
||||
fontChars = (int *)malloc(totalChars*sizeof(int));
|
||||
for (int i = 0; i < totalChars; i++) fontChars[i] = i + 32; // Default first character: SPACE[32]
|
||||
// Aliased bitmap (black & white) font generation, avoiding anti-aliasing
|
||||
// NOTE: For optimum results, bitmap font should be generated at base pixel size
|
||||
for (int p = 0; p < chw*chh; p++)
|
||||
{
|
||||
if (chars[i].data[p] < BITMAP_ALPHA_THRESHOLD) chars[i].data[p] = 0;
|
||||
else chars[i].data[p] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
spriteFont = LoadTTF(fileName, fontSize, totalChars, fontChars);
|
||||
}
|
||||
#endif
|
||||
chars[i].rec.width = (float)chw;
|
||||
chars[i].rec.height = (float)chh;
|
||||
chars[i].offsetY += (int)((float)ascent*scaleFactor);
|
||||
|
||||
// Get bounding box for character (may be offset to account for chars that dip above or below the line)
|
||||
int chX1, chY1, chX2, chY2;
|
||||
stbtt_GetCodepointBitmapBox(&fontInfo, ch, scaleFactor, scaleFactor, &chX1, &chY1, &chX2, &chY2);
|
||||
|
||||
TraceLog(LOG_DEBUG, "Character box measures: %i, %i, %i, %i", chX1, chY1, chX2 - chX1, chY2 - chY1);
|
||||
TraceLog(LOG_DEBUG, "Character offsetY: %i", (int)((float)ascent*scaleFactor) + chY1);
|
||||
|
||||
if (spriteFont.texture.id == 0)
|
||||
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
|
||||
chars[i].advanceX *= scaleFactor;
|
||||
}
|
||||
|
||||
free(fontBuffer);
|
||||
if (genFontChars) free(fontChars);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
// Generate image font atlas using chars info
|
||||
// NOTE: Packing method: 0-Default, 1-Skyline
|
||||
Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int padding, int packMethod)
|
||||
{
|
||||
Image atlas = { 0 };
|
||||
|
||||
// In case no chars count provided we suppose default of 95
|
||||
charsCount = (charsCount > 0) ? charsCount : 95;
|
||||
|
||||
// Calculate image size based on required pixel area
|
||||
// NOTE 1: Image is forced to be squared and POT... very conservative!
|
||||
// NOTE 2: SDF font characters already contain an internal padding,
|
||||
// so image size would result bigger than default font type
|
||||
float requiredArea = 0;
|
||||
for (int i = 0; i < charsCount; i++) requiredArea += ((chars[i].rec.width + 2*padding)*(chars[i].rec.height + 2*padding));
|
||||
float guessSize = sqrtf(requiredArea)*1.25f;
|
||||
int imageSize = (int)powf(2, ceilf(logf((float)guessSize)/logf(2))); // Calculate next POT
|
||||
|
||||
atlas.width = imageSize; // Atlas bitmap width
|
||||
atlas.height = imageSize; // Atlas bitmap height
|
||||
atlas.data = (unsigned char *)calloc(1, atlas.width*atlas.height); // Create a bitmap to store characters (8 bpp)
|
||||
atlas.format = UNCOMPRESSED_GRAYSCALE;
|
||||
atlas.mipmaps = 1;
|
||||
|
||||
// DEBUG: We can see padding in the generated image setting a gray background...
|
||||
//for (int i = 0; i < atlas.width*atlas.height; i++) ((unsigned char *)atlas.data)[i] = 100;
|
||||
|
||||
if (packMethod == 0) // Use basic packing algorythm
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Font could not be generated, using default font", fileName);
|
||||
spriteFont = GetDefaultFont();
|
||||
int offsetX = padding;
|
||||
int offsetY = padding;
|
||||
|
||||
// NOTE: Using simple packaging, one char after another
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
// Copy pixel data from fc.data to atlas
|
||||
for (int y = 0; y < (int)chars[i].rec.height; y++)
|
||||
{
|
||||
for (int x = 0; x < (int)chars[i].rec.width; x++)
|
||||
{
|
||||
((unsigned char *)atlas.data)[(offsetY + y)*atlas.width + (offsetX + x)] = chars[i].data[y*(int)chars[i].rec.width + x];
|
||||
}
|
||||
}
|
||||
|
||||
chars[i].rec.x = (float)offsetX;
|
||||
chars[i].rec.y = (float)offsetY;
|
||||
|
||||
// Move atlas position X for next character drawing
|
||||
offsetX += ((int)chars[i].rec.width + 2*padding);
|
||||
|
||||
if (offsetX >= (atlas.width - (int)chars[i].rec.width - padding))
|
||||
{
|
||||
offsetX = padding;
|
||||
|
||||
// NOTE: Be careful on offsetY for SDF fonts, by default SDF
|
||||
// use an internal padding of 4 pixels, it means char rectangle
|
||||
// height is bigger than fontSize, it could be up to (fontSize + 8)
|
||||
offsetY += (fontSize + 2*padding);
|
||||
|
||||
if (offsetY > (atlas.height - fontSize - padding)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packMethod == 1) // Use Skyline rect packing algorythm (stb_pack_rect)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Using Skyline packing algorythm!");
|
||||
|
||||
stbrp_context *context = (stbrp_context *)malloc(sizeof(*context));
|
||||
stbrp_node *nodes = (stbrp_node *)malloc(charsCount*sizeof(*nodes));
|
||||
|
||||
stbrp_init_target(context, atlas.width, atlas.height, nodes, charsCount);
|
||||
stbrp_rect *rects = (stbrp_rect *)malloc(charsCount*sizeof(stbrp_rect));
|
||||
|
||||
// Fill rectangles for packaging
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
rects[i].id = i;
|
||||
rects[i].w = (int)chars[i].rec.width + 2*padding;
|
||||
rects[i].h = (int)chars[i].rec.height + 2*padding;
|
||||
}
|
||||
|
||||
// Package rectangles into atlas
|
||||
stbrp_pack_rects(context, rects, charsCount);
|
||||
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
chars[i].rec.x = rects[i].x + (float)padding;
|
||||
chars[i].rec.y = rects[i].y + (float)padding;
|
||||
|
||||
if (rects[i].was_packed)
|
||||
{
|
||||
// Copy pixel data from fc.data to atlas
|
||||
for (int y = 0; y < (int)chars[i].rec.height; y++)
|
||||
{
|
||||
for (int x = 0; x < (int)chars[i].rec.width; x++)
|
||||
{
|
||||
((unsigned char *)atlas.data)[(rects[i].y + padding + y)*atlas.width + (rects[i].x + padding + x)] = chars[i].data[y*(int)chars[i].rec.width + x];
|
||||
}
|
||||
}
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Character could not be packed: %i", i);
|
||||
}
|
||||
|
||||
free(nodes);
|
||||
free(context);
|
||||
}
|
||||
|
||||
// TODO: Crop image if required for smaller size
|
||||
|
||||
// Convert image data from GRAYSCALE to GRAY_ALPHA
|
||||
// WARNING: ImageAlphaMask(&atlas, atlas) does not work in this case, requires manual operation
|
||||
unsigned char *dataGrayAlpha = (unsigned char *)malloc(imageSize*imageSize*sizeof(unsigned char)*2); // Two channels
|
||||
|
||||
for (int i = 0, k = 0; i < atlas.width*atlas.height; i++, k += 2)
|
||||
{
|
||||
dataGrayAlpha[k] = 255;
|
||||
dataGrayAlpha[k + 1] = ((unsigned char *)atlas.data)[i];
|
||||
}
|
||||
|
||||
return spriteFont;
|
||||
free(atlas.data);
|
||||
atlas.data = dataGrayAlpha;
|
||||
atlas.format = UNCOMPRESSED_GRAY_ALPHA;
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
// Unload Font from GPU memory (VRAM)
|
||||
void UnloadFont(Font font)
|
||||
{
|
||||
// NOTE: Make sure spriteFont is not default font (fallback)
|
||||
if (font.texture.id != GetDefaultFont().texture.id)
|
||||
if (font.texture.id != GetFontDefault().texture.id)
|
||||
{
|
||||
UnloadTexture(font.texture);
|
||||
free(font.chars);
|
||||
|
@ -356,7 +569,7 @@ void UnloadFont(Font font)
|
|||
void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
|
||||
{
|
||||
// Check if default font has been loaded
|
||||
if (GetDefaultFont().texture.id != 0)
|
||||
if (GetFontDefault().texture.id != 0)
|
||||
{
|
||||
Vector2 position = { (float)posX, (float)posY };
|
||||
|
||||
|
@ -364,7 +577,7 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
|
|||
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
|
||||
int spacing = fontSize/defaultFontSize;
|
||||
|
||||
DrawTextEx(GetDefaultFont(), text, position, (float)fontSize, (float)spacing, color);
|
||||
DrawTextEx(GetFontDefault(), text, position, (float)fontSize, (float)spacing, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,11 +668,11 @@ const char *SubText(const char *text, int position, int length)
|
|||
|
||||
for (int c = 0 ; c < length ; c++)
|
||||
{
|
||||
*(buffer+c) = *(text+position);
|
||||
*(buffer + c) = *(text + position);
|
||||
text++;
|
||||
}
|
||||
|
||||
*(buffer+length) = '\0';
|
||||
*(buffer + length) = '\0';
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -470,13 +683,13 @@ int MeasureText(const char *text, int fontSize)
|
|||
Vector2 vec = { 0.0f, 0.0f };
|
||||
|
||||
// Check if default font has been loaded
|
||||
if (GetDefaultFont().texture.id != 0)
|
||||
if (GetFontDefault().texture.id != 0)
|
||||
{
|
||||
int defaultFontSize = 10; // Default Font chars height in pixel
|
||||
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
|
||||
int spacing = fontSize/defaultFontSize;
|
||||
|
||||
vec = MeasureTextEx(GetDefaultFont(), text, (float)fontSize, (float)spacing);
|
||||
vec = MeasureTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing);
|
||||
}
|
||||
|
||||
return (int)vec.x;
|
||||
|
@ -629,15 +842,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
|||
{
|
||||
tempCharValues[index] = firstChar + index;
|
||||
|
||||
tempCharRecs[index].x = xPosToRead;
|
||||
tempCharRecs[index].y = lineSpacing + lineToRead*(charHeight + lineSpacing);
|
||||
tempCharRecs[index].height = charHeight;
|
||||
tempCharRecs[index].x = (float)xPosToRead;
|
||||
tempCharRecs[index].y = (float)(lineSpacing + lineToRead*(charHeight + lineSpacing));
|
||||
tempCharRecs[index].height = (float)charHeight;
|
||||
|
||||
int charWidth = 0;
|
||||
|
||||
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
|
||||
|
||||
tempCharRecs[index].width = charWidth;
|
||||
tempCharRecs[index].width = (float)charWidth;
|
||||
|
||||
index++;
|
||||
|
||||
|
@ -682,7 +895,7 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
|||
spriteFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
spriteFont.baseSize = spriteFont.chars[0].rec.height;
|
||||
spriteFont.baseSize = (int)spriteFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "Image file loaded correctly as Font");
|
||||
|
||||
|
@ -764,22 +977,23 @@ static Font LoadBMFont(const char *fileName)
|
|||
{
|
||||
Image imCopy = ImageCopy(imFont);
|
||||
|
||||
for (int i = 0; i < imCopy.width*imCopy.height; i++) ((unsigned char *)imCopy.data)[i] = 0xff; // WHITE pixel
|
||||
for (int i = 0; i < imCopy.width*imCopy.height; i++) ((unsigned char *)imCopy.data)[i] = 0xff;
|
||||
|
||||
ImageAlphaMask(&imCopy, imFont);
|
||||
font.texture = LoadTextureFromImage(imCopy);
|
||||
UnloadImage(imCopy);
|
||||
}
|
||||
else font.texture = LoadTextureFromImage(imFont);
|
||||
|
||||
UnloadImage(imFont);
|
||||
free(texPath);
|
||||
|
||||
|
||||
// Fill font characters info data
|
||||
font.baseSize = fontSize;
|
||||
font.charsCount = charsCount;
|
||||
font.chars = (CharInfo *)malloc(charsCount*sizeof(CharInfo));
|
||||
|
||||
UnloadImage(imFont);
|
||||
|
||||
free(texPath);
|
||||
|
||||
int charId, charX, charY, charWidth, charHeight, charOffsetX, charOffsetY, charAdvanceX;
|
||||
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
|
@ -790,7 +1004,7 @@ static Font LoadBMFont(const char *fileName)
|
|||
|
||||
// Save data properly in sprite font
|
||||
font.chars[i].value = charId;
|
||||
font.chars[i].rec = (Rectangle){ charX, charY, charWidth, charHeight };
|
||||
font.chars[i].rec = (Rectangle){ (float)charX, (float)charY, (float)charWidth, (float)charHeight };
|
||||
font.chars[i].offsetX = charOffsetX;
|
||||
font.chars[i].offsetY = charOffsetY;
|
||||
font.chars[i].advanceX = charAdvanceX;
|
||||
|
@ -801,116 +1015,10 @@ static Font LoadBMFont(const char *fileName)
|
|||
if (font.texture.id == 0)
|
||||
{
|
||||
UnloadFont(font);
|
||||
font = GetDefaultFont();
|
||||
font = GetFontDefault();
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[%s] Font loaded successfully", fileName);
|
||||
|
||||
return font;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
// Generate a sprite font from TTF file data (font size required)
|
||||
// TODO: Review texture packing method and generation (use oversampling)
|
||||
static Font LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars)
|
||||
{
|
||||
#define MAX_TTF_SIZE 16 // Maximum ttf file size in MB
|
||||
|
||||
// NOTE: Font texture size is predicted (being as much conservative as possible)
|
||||
// Predictive method consist of supposing same number of chars by line-column (sqrtf)
|
||||
// and a maximum character width of 3/4 of fontSize... it worked ok with all my tests...
|
||||
|
||||
// Calculate next power-of-two value
|
||||
float guessSize = ceilf((float)fontSize*3/4)*ceilf(sqrtf((float)charsCount));
|
||||
int textureSize = (int)powf(2, ceilf(logf((float)guessSize)/logf(2))); // Calculate next POT
|
||||
|
||||
TraceLog(LOG_INFO, "TTF spritefont loading: Predicted texture size: %ix%i", textureSize, textureSize);
|
||||
|
||||
unsigned char *ttfBuffer = (unsigned char *)malloc(MAX_TTF_SIZE*1024*1024);
|
||||
unsigned char *dataBitmap = (unsigned char *)malloc(textureSize*textureSize*sizeof(unsigned char)); // One channel bitmap returned!
|
||||
stbtt_bakedchar *charData = (stbtt_bakedchar *)malloc(sizeof(stbtt_bakedchar)*charsCount);
|
||||
|
||||
Font font = { 0 };
|
||||
|
||||
FILE *ttfFile = fopen(fileName, "rb");
|
||||
|
||||
if (ttfFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] TTF file could not be opened", fileName);
|
||||
return font;
|
||||
}
|
||||
|
||||
// NOTE: We try reading up to 16 MB of elements of 1 byte
|
||||
fread(ttfBuffer, 1, MAX_TTF_SIZE*1024*1024, ttfFile);
|
||||
|
||||
// Find font baseline (vertical origin of the font)
|
||||
// NOTE: This value is required because y-offset depends on it!
|
||||
stbtt_fontinfo fontInfo;
|
||||
int ascent, baseline;
|
||||
float scale;
|
||||
|
||||
stbtt_InitFont(&fontInfo, ttfBuffer, 0);
|
||||
scale = stbtt_ScaleForPixelHeight(&fontInfo, fontSize);
|
||||
stbtt_GetFontVMetrics(&fontInfo, &ascent, 0, 0);
|
||||
baseline = (int)(ascent*scale);
|
||||
|
||||
if (fontChars[0] != 32) TraceLog(LOG_WARNING, "TTF spritefont loading: first character is not SPACE(32) character");
|
||||
|
||||
// NOTE: Using stb_truetype crappy packing method, no guarantee the font fits the image...
|
||||
// TODO: Replace this function by a proper packing method and support random chars order,
|
||||
// we already receive a list (fontChars) with the ordered expected characters
|
||||
int result = stbtt_BakeFontBitmap(ttfBuffer, 0, fontSize, dataBitmap, textureSize, textureSize, fontChars[0], charsCount, charData);
|
||||
|
||||
//if (result > 0) TraceLog(LOG_INFO, "TTF spritefont loading: first unused row of generated bitmap: %i", result);
|
||||
if (result < 0) TraceLog(LOG_WARNING, "TTF spritefont loading: Not all the characters fit in the font");
|
||||
|
||||
free(ttfBuffer);
|
||||
|
||||
// Convert image data from grayscale to to UNCOMPRESSED_GRAY_ALPHA
|
||||
unsigned char *dataGrayAlpha = (unsigned char *)malloc(textureSize*textureSize*sizeof(unsigned char)*2); // Two channels
|
||||
|
||||
for (int i = 0, k = 0; i < textureSize*textureSize; i++, k += 2)
|
||||
{
|
||||
dataGrayAlpha[k] = 255;
|
||||
dataGrayAlpha[k + 1] = dataBitmap[i];
|
||||
}
|
||||
|
||||
free(dataBitmap);
|
||||
|
||||
// Sprite font generation from TTF extracted data
|
||||
Image image;
|
||||
image.width = textureSize;
|
||||
image.height = textureSize;
|
||||
image.mipmaps = 1;
|
||||
image.format = UNCOMPRESSED_GRAY_ALPHA;
|
||||
image.data = dataGrayAlpha;
|
||||
|
||||
font.texture = LoadTextureFromImage(image);
|
||||
|
||||
//SavePNG("generated_ttf_image.png", (unsigned char *)image.data, image.width, image.height, 2);
|
||||
|
||||
UnloadImage(image); // Unloads dataGrayAlpha
|
||||
|
||||
font.baseSize = fontSize;
|
||||
font.charsCount = charsCount;
|
||||
font.chars = (CharInfo *)malloc(font.charsCount*sizeof(CharInfo));
|
||||
|
||||
for (int i = 0; i < font.charsCount; i++)
|
||||
{
|
||||
font.chars[i].value = fontChars[i];
|
||||
|
||||
font.chars[i].rec.x = (int)charData[i].x0;
|
||||
font.chars[i].rec.y = (int)charData[i].y0;
|
||||
font.chars[i].rec.width = (int)charData[i].x1 - (int)charData[i].x0;
|
||||
font.chars[i].rec.height = (int)charData[i].y1 - (int)charData[i].y0;
|
||||
|
||||
font.chars[i].offsetX = charData[i].xoff;
|
||||
font.chars[i].offsetY = baseline + charData[i].yoff;
|
||||
font.chars[i].advanceX = (int)charData[i].xadvance;
|
||||
}
|
||||
|
||||
free(charData);
|
||||
|
||||
return font;
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
@ -17,9 +17,9 @@ func (s *Font) cptr() *C.Font {
|
|||
return (*C.Font)(unsafe.Pointer(s))
|
||||
}
|
||||
|
||||
// GetDefaultFont - Get the default Font
|
||||
func GetDefaultFont() Font {
|
||||
ret := C.GetDefaultFont()
|
||||
// GetFontDefault - Get the default Font
|
||||
func GetFontDefault() Font {
|
||||
ret := C.GetFontDefault()
|
||||
v := newFontFromPointer(unsafe.Pointer(&ret))
|
||||
return v
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
@ -127,13 +127,20 @@ func UnloadRenderTexture(target RenderTexture2D) {
|
|||
C.UnloadRenderTexture(*ctarget)
|
||||
}
|
||||
|
||||
// GetImageData - Get pixel data from image
|
||||
// GetImageData - Get pixel data from image as a Color slice
|
||||
func GetImageData(img *Image) []Color {
|
||||
cimg := img.cptr()
|
||||
ret := C.GetImageData(*cimg)
|
||||
return (*[1 << 24]Color)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
||||
}
|
||||
|
||||
// GetImageDataNormalized - Get pixel data from image as Vector4 slice (float normalized)
|
||||
func GetImageDataNormalized(img *Image) []Vector4 {
|
||||
cimg := img.cptr()
|
||||
ret := C.GetImageDataNormalized(*cimg)
|
||||
return (*[1 << 24]Vector4)(unsafe.Pointer(ret))[0 : img.Width*img.Height]
|
||||
}
|
||||
|
||||
// GetPixelDataSize - Get pixel data size in bytes (image or texture)
|
||||
func GetPixelDataSize(width, height, format int32) int32 {
|
||||
cwidth := (C.int)(width)
|
||||
|
@ -159,12 +166,12 @@ func UpdateTexture(texture Texture2D, pixels []Color) {
|
|||
}
|
||||
|
||||
// ExportImage - Export image as a PNG file
|
||||
func ExportImage(name string, image Image) {
|
||||
func ExportImage(image Image, name string) {
|
||||
cname := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
cimage := image.cptr()
|
||||
|
||||
C.ExportImage(cname, *cimage)
|
||||
C.ExportImage(*cimage, cname)
|
||||
}
|
||||
|
||||
// ImageToPOT - Convert image to POT (power-of-two)
|
||||
|
@ -250,6 +257,17 @@ func ImageResizeNN(image *Image, newWidth, newHeight int32) {
|
|||
C.ImageResizeNN(cimage, cnewWidth, cnewHeight)
|
||||
}
|
||||
|
||||
// ImageResizeCanvas - Resize canvas and fill with color
|
||||
func ImageResizeCanvas(image *Image, newWidth, newHeight, offsetX, offsetY int32, color Color) {
|
||||
cimage := image.cptr()
|
||||
cnewWidth := (C.int)(newWidth)
|
||||
cnewHeight := (C.int)(newHeight)
|
||||
coffsetX := (C.int)(offsetX)
|
||||
coffsetY := (C.int)(offsetY)
|
||||
ccolor := color.cptr()
|
||||
C.ImageResizeCanvas(cimage, cnewWidth, cnewHeight, coffsetX, coffsetY, *ccolor)
|
||||
}
|
||||
|
||||
// ImageMipmaps - Generate all mipmap levels for a provided image
|
||||
func ImageMipmaps(image *Image) {
|
||||
cimage := image.cptr()
|
||||
|
@ -334,6 +352,18 @@ func ImageFlipHorizontal(image *Image) {
|
|||
C.ImageFlipHorizontal(cimage)
|
||||
}
|
||||
|
||||
// ImageRotateCW - Rotate image clockwise 90deg
|
||||
func ImageRotateCW(image *Image) {
|
||||
cimage := image.cptr()
|
||||
C.ImageRotateCW(cimage)
|
||||
}
|
||||
|
||||
// ImageRotateCCW - Rotate image counter-clockwise 90deg
|
||||
func ImageRotateCCW(image *Image) {
|
||||
cimage := image.cptr()
|
||||
C.ImageRotateCCW(cimage)
|
||||
}
|
||||
|
||||
// ImageColorTint - Modify image color: tint
|
||||
func ImageColorTint(image *Image, color Color) {
|
||||
cimage := image.cptr()
|
||||
|
@ -367,6 +397,14 @@ func ImageColorBrightness(image *Image, brightness int32) {
|
|||
C.ImageColorBrightness(cimage, cbrightness)
|
||||
}
|
||||
|
||||
// ImageColorReplace - Modify image color: replace color
|
||||
func ImageColorReplace(image *Image, color, replace Color) {
|
||||
cimage := image.cptr()
|
||||
ccolor := color.cptr()
|
||||
creplace := replace.cptr()
|
||||
C.ImageColorReplace(cimage, *ccolor, *creplace)
|
||||
}
|
||||
|
||||
// GenImageColor - Generate image: plain color
|
||||
func GenImageColor(width, height int, color Color) *Image {
|
||||
cwidth := (C.int)(width)
|
||||
|
|
|
@ -4,21 +4,10 @@
|
|||
*
|
||||
* CONFIGURATION:
|
||||
*
|
||||
* #define SUPPORT_SAVE_PNG (defined by default)
|
||||
* Support saving image data as PNG fileformat
|
||||
* NOTE: Requires stb_image_write library
|
||||
*
|
||||
* #define SUPPORT_SAVE_BMP
|
||||
* Support saving image data as BMP fileformat
|
||||
* NOTE: Requires stb_image_write library
|
||||
*
|
||||
* #define SUPPORT_TRACELOG
|
||||
* Show TraceLog() output messages
|
||||
* NOTE: By default LOG_DEBUG traces not shown
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* stb_image_write - BMP/PNG writting functions
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
|
@ -57,10 +46,10 @@
|
|||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
||||
#include <string.h> // Required for: strlen(), strrchr(), strcmp()
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png()
|
||||
#endif
|
||||
/* This should be in <stdio.h>, but Travis doesn't find it... */
|
||||
FILE *funopen(const void *cookie, int (*readfn)(void *, char *, int),
|
||||
int (*writefn)(void *, const char *, int),
|
||||
fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *));
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
|
@ -68,6 +57,7 @@
|
|||
|
||||
// Log types messages supported flags (bit based)
|
||||
static unsigned char logTypeFlags = LOG_INFO | LOG_WARNING | LOG_ERROR;
|
||||
static TraceLogCallback logCallback = NULL;
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
AAssetManager *assetManager;
|
||||
|
@ -93,11 +83,26 @@ void SetTraceLog(unsigned char types)
|
|||
logTypeFlags = types;
|
||||
}
|
||||
|
||||
// Set a trace log callback to enable custom logging bypassing raylib's one
|
||||
void SetTraceLogCallback(TraceLogCallback callback)
|
||||
{
|
||||
logCallback = callback;
|
||||
}
|
||||
|
||||
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
void TraceLog(int msgType, const char *text, ...)
|
||||
{
|
||||
#if defined(SUPPORT_TRACELOG)
|
||||
static char buffer[128];
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
||||
if (logCallback)
|
||||
{
|
||||
logCallback(msgType, text, args);
|
||||
va_end(args);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(msgType)
|
||||
{
|
||||
|
@ -111,9 +116,6 @@ void TraceLog(int msgType, const char *text, ...)
|
|||
strcat(buffer, text);
|
||||
strcat(buffer, "\n");
|
||||
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
switch(msgType)
|
||||
{
|
||||
|
@ -137,32 +139,10 @@ void TraceLog(int msgType, const char *text, ...)
|
|||
va_end(args);
|
||||
|
||||
if (msgType == LOG_ERROR) exit(1); // If LOG_ERROR message, exit program
|
||||
|
||||
|
||||
#endif // SUPPORT_TRACELOG
|
||||
}
|
||||
|
||||
#if defined(SUPPORT_SAVE_BMP)
|
||||
// Creates a BMP image file from an array of pixel data
|
||||
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||
stbi_write_bmp(fileName, width, height, compSize, imgData);
|
||||
TraceLog(LOG_INFO, "BMP Image saved: %s", fileName);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORT_SAVE_PNG)
|
||||
// Creates a PNG image file from an array of pixel data
|
||||
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||
stbi_write_png(fileName, width, height, compSize, imgData, width*compSize);
|
||||
TraceLog(LOG_INFO, "PNG Image saved: %s", fileName);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Keep track of memory allocated
|
||||
// NOTE: mallocType defines the type of data allocated
|
||||
/*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !android,!windows
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
#include <android/asset_manager.h> // Required for: AAssetManager
|
||||
#endif
|
||||
|
||||
#ifndef SUPPORT_SAVE_PNG
|
||||
#define SUPPORT_SAVE_PNG 1
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Some basic Defines
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -58,15 +54,6 @@ extern "C" { // Prevents name mangling of functions
|
|||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
//#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
|
||||
#if defined(SUPPORT_SAVE_BMP)
|
||||
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
|
||||
#endif
|
||||
#if defined(SUPPORT_SAVE_PNG)
|
||||
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
void InitAssetManager(AAssetManager *manager); // Initialize asset manager from android app
|
||||
FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build android
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build windows
|
||||
|
||||
package raylib
|
||||
package rl
|
||||
|
||||
/*
|
||||
#include "raylib.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue