Mercurial > repos > simple16
comparison 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 |
comparison
equal
deleted
inserted
replaced
23:a085f17b79e9 | 24:4c9dbfa30a66 |
---|---|
1 #ifndef SYSTEM_H_ | 1 #ifndef SYSTEM_H_ |
2 #define SYSTEM_H_ | 2 #define SYSTEM_H_ |
3 | 3 |
4 int system_init(int width, int height); | 4 //initializes audio and video output with the given parameters |
5 int system_init(int width, int height, int desired_sample_rate); | |
6 //Should be called once per frame to get a pointer to the output buffer at the start of rendering | |
5 uint16_t *system_get_framebuffer(int *pitch); | 7 uint16_t *system_get_framebuffer(int *pitch); |
8 //Should be called once per frame at the competion of rendering | |
9 //The pointer returned by system_get_framebuffer should be discarded after calling this function | |
6 void system_framebuffer_updated(); | 10 void system_framebuffer_updated(); |
11 //Pumps the event queue and processes events | |
7 void system_poll_events(); | 12 void system_poll_events(); |
13 //Presents an audio buffer to the system for playback | |
14 //Will block until the system is ready for more samples | |
15 //The buffer passed to this function should not be used again | |
16 //by the caller until the next call to system_present_audio | |
17 void system_present_audio(int16_t *buffer); | |
18 //Returns the audio sample rate, which may be different than what was requested | |
19 int system_sample_rate(); | |
20 //Returns the number of samples that should be provided in a call to system_present_audio | |
21 int system_buffer_size(); | |
8 | 22 |
9 #endif //SYSTEM_H_ | 23 #endif //SYSTEM_H_ |