Add new DSP plugin API, events.

This commit is contained in:
Themaister 2011-08-13 04:09:08 +02:00
parent bc23b421e1
commit b16ff3024c
2 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@ extern "C" {
#define SSNES_TRUE 1
#endif
#define SSNES_DSP_API_VERSION 2
#define SSNES_DSP_API_VERSION 3
typedef struct ssnes_dsp_info
{
@ -94,7 +94,7 @@ typedef struct ssnes_dsp_plugin
void (*process)(void *data, ssnes_dsp_output_t *output,
const ssnes_dsp_input_t *input);
// Frees the handle.
// Frees the handle.
void (*free)(void *data);
// API version used to compile the plugin.
@ -110,6 +110,11 @@ typedef struct ssnes_dsp_plugin
// Human readable identification string.
const char *ident;
// Called every frame, allows creating a GUI main loop in the main thread.
// GUI events can be processed here in a non-blocking fashion.
// Can be set to NULL to ignore it.
void (*events)(void *data);
} ssnes_dsp_plugin_t;
// Called by SSNES at startup to get the callback struct.

View File

@ -1573,6 +1573,10 @@ int main(int argc, char *argv[])
// Main loop
for(;;)
{
// DSP plugin GUI events.
if (g_extern.audio_data.dsp_handle && g_extern.audio_data.dsp_plugin->events)
g_extern.audio_data.dsp_plugin->events(g_extern.audio_data.dsp_handle);
// Time to drop?
if (driver.input->key_pressed(driver.input_data, SSNES_QUIT_KEY) ||
!driver.video->alive(driver.video_data) || g_extern.bsv_movie_end)