raylib_audio.c 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Audio device management functions
  2. void InitAudioDevice(void); // Initialize audio device and context
  3. void CloseAudioDevice(void); // Close the audio device and context (and music stream)
  4. bool IsAudioDeviceReady(void); // Check if audio device is ready
  5. void SetMasterVolume(float volume); // Set master volume (listener)
  6. // Wave/Sound loading/unloading functions
  7. Wave LoadWave(const char *fileName); // Load wave data from file into RAM
  8. Wave LoadWaveEx(float *data, int sampleCount, int sampleRate,
  9. int sampleSize, int channels); // Load wave data from float array data (32bit)
  10. Sound LoadSound(const char *fileName); // Load sound to memory
  11. Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
  12. void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
  13. void UnloadWave(Wave wave); // Unload wave data
  14. void UnloadSound(Sound sound); // Unload sound
  15. // Wave/Sound management functions
  16. void PlaySound(Sound sound); // Play a sound
  17. void PauseSound(Sound sound); // Pause a sound
  18. void ResumeSound(Sound sound); // Resume a paused sound
  19. void StopSound(Sound sound); // Stop playing a sound
  20. bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
  21. void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
  22. void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
  23. void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
  24. Wave WaveCopy(Wave wave); // Copy a wave to a new wave
  25. void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
  26. float *GetWaveData(Wave wave); // Get samples data from wave as a floats array
  27. // Music management functions
  28. Music LoadMusicStream(const char *fileName); // Load music stream from file
  29. void UnloadMusicStream(Music music); // Unload music stream
  30. void PlayMusicStream(Music music); // Start music playing
  31. void UpdateMusicStream(Music music); // Updates buffers for music streaming
  32. void StopMusicStream(Music music); // Stop music playing
  33. void PauseMusicStream(Music music); // Pause music playing
  34. void ResumeMusicStream(Music music); // Resume playing paused music
  35. bool IsMusicPlaying(Music music); // Check if music is playing
  36. void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
  37. void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
  38. void SetMusicLoopCount(Music music, float count); // Set music loop count (loop repeats)
  39. float GetMusicTimeLength(Music music); // Get music time length (in seconds)
  40. float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
  41. // AudioStream management functions
  42. AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize,
  43. unsigned int channels); // Init audio stream (to stream raw audio pcm data)
  44. void UpdateAudioStream(AudioStream stream, void *data, int numSamples); // Update audio stream buffers with data
  45. void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
  46. bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
  47. void PlayAudioStream(AudioStream stream); // Play audio stream
  48. void PauseAudioStream(AudioStream stream); // Pause audio stream
  49. void ResumeAudioStream(AudioStream stream); // Resume audio stream
  50. void StopAudioStream(AudioStream stream); // Stop audio stream