tuxanci2-engine
Game engine for tuxanci2
Log | Files | Refs | README | LICENSE

audio.h (1045B)


      1 #ifndef TA_AUDIO_H
      2 #define TA_AUDIO_H
      3 
      4 #include <stdint.h>
      5 #include <stdbool.h>
      6 
      7 #define TA_AUDIO_BUFFERS 16
      8 #define TA_AUDIO_RATE 44100
      9 
     10 #ifndef TA_AUDIO_BUFFER_SIZE
     11 #define TA_AUDIO_BUFFER_SIZE 2048
     12 #endif
     13 
     14 #define TA_AUDIO_VOLUME_MAX 255
     15 #define TA_AUDIO_PAN_LEFT 0
     16 #define TA_AUDIO_PAN_CENTER 128
     17 #define TA_AUDIO_PAN_RIGHT 255
     18 
     19 typedef void (*ta_audio_source)(void *user);
     20 
     21 int ta_audio_lock(ta_audio_source source, void *user);
     22 void ta_audio_unlock(int buffer);
     23 bool ta_audio_is_locked(int buffer);
     24 void ta_audio_set_volume(int buffer, uint8_t volume);
     25 void ta_audio_set_pan(int buffer, uint8_t pan);
     26 uint8_t ta_audio_get_volume(int buffer);
     27 uint8_t ta_audio_get_pan(int buffer);
     28 uint32_t ta_audio_free(int buffer);
     29 uint32_t ta_audio_write(int buffer, const int8_t *samples, uint32_t count);
     30 uint32_t ta_audio_available(int buffer);
     31 uint32_t ta_audio_read(int buffer, int8_t *samples, uint32_t count);
     32 void ta_audio_clear(int buffer);
     33 void ta_audio_update(void);
     34 uint32_t ta_audio_mix(int16_t *out, uint32_t frames);
     35 
     36 #endif // TA_AUDIO_H