Mercurial > repos > simple16
diff src/system.h @ 24:4c9dbfa30a66
Implemented audio
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 31 Mar 2016 00:07:37 -0700 |
parents | ae58e7c3c328 |
children |
line wrap: on
line diff
--- a/src/system.h Wed Mar 30 20:31:04 2016 -0700 +++ b/src/system.h Thu Mar 31 00:07:37 2016 -0700 @@ -1,9 +1,23 @@ #ifndef SYSTEM_H_ #define SYSTEM_H_ -int system_init(int width, int height); +//initializes audio and video output with the given parameters +int system_init(int width, int height, int desired_sample_rate); +//Should be called once per frame to get a pointer to the output buffer at the start of rendering uint16_t *system_get_framebuffer(int *pitch); +//Should be called once per frame at the competion of rendering +//The pointer returned by system_get_framebuffer should be discarded after calling this function void system_framebuffer_updated(); +//Pumps the event queue and processes events void system_poll_events(); +//Presents an audio buffer to the system for playback +//Will block until the system is ready for more samples +//The buffer passed to this function should not be used again +//by the caller until the next call to system_present_audio +void system_present_audio(int16_t *buffer); +//Returns the audio sample rate, which may be different than what was requested +int system_sample_rate(); +//Returns the number of samples that should be provided in a call to system_present_audio +int system_buffer_size(); #endif //SYSTEM_H_