Просмотр исходного кода

Rename audio callback

pull/2419/head
Ray 2 лет назад
Родитель
Сommit
8e28872fe1
3 измененных файлов: 7 добавлений и 6 удалений
  1. +3
    -2
      examples/audio/audio_raw_stream.c
  2. +2
    -2
      src/raudio.c
  3. +2
    -2
      src/raylib.h

+ 3
- 2
examples/audio/audio_raw_stream.c Просмотреть файл

@ -32,7 +32,8 @@ float oldFrequency = 1.0f;
// Index for audio rendering
float sineIdx = 0.0f;
void AudioCallback(void *buffer, unsigned int frames)
// Audio input processing callback
void AudioInputCallback(void *buffer, unsigned int frames)
{
audioFrequency = frequency + (audioFrequency - frequency)*0.95f;
audioFrequency += 1.0f;
@ -65,7 +66,7 @@ int main(void)
// Init raw audio stream (sample rate: 44100, sample size: 16bit-short, channels: 1-mono)
AudioStream stream = LoadAudioStream(44100, 16, 1);
SetAudioStreamCallback(stream, o">&AudioCallback);
SetAudioStreamCallback(stream, AudioInputCallback);
// Buffer for the single cycle waveform we are synthesizing
short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES);

+ 2
- 2
src/raudio.c Просмотреть файл

@ -315,7 +315,7 @@ typedef enum {
struct rAudioBuffer {
ma_data_converter converter; // Audio data converter
AudioStreamCallback callback; // Audio buffer callback for buffer filling on audio threads
AudioCallback callback; // Audio buffer callback for buffer filling on audio threads
float volume; // Audio buffer volume
float pitch; // Audio buffer pitch
@ -2034,7 +2034,7 @@ void SetAudioStreamBufferSizeDefault(int size)
}
// Audio thread callback to request new data
void SetAudioStreamCallback(AudioStream stream, AudioStreamCallback callback)
void SetAudioStreamCallback(AudioStream stream, AudioCallback callback)
{
if (stream.buffer != NULL) stream.buffer->callback = callback;
}

+ 2
- 2
src/raylib.h Просмотреть файл

@ -1474,7 +1474,7 @@ RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3
//------------------------------------------------------------------------------------
// Audio Loading and Playing Functions (Module: audio)
//------------------------------------------------------------------------------------
typedef void (*AudioStreamCallback)(void *bufferData, unsigned int frames);
typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
// Audio device management functions
RLAPI void InitAudioDevice(void); // Initialize audio device and context
@ -1542,7 +1542,7 @@ RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set vol
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioStreamCallback callback); // Audio thread callback to request new data
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
#if defined(__cplusplus)
}

Загрузка…
Отмена
Сохранить