summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_wasapi.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_wasapi.c b/src/lib/ecore_audio/ecore_audio_obj_out_wasapi.c
index 772a826..c016be9 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_wasapi.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_wasapi.c
@@ -57,6 +57,7 @@ struct _Ecore_Audio_Out_Wasapi_Data
57 IAudioRenderClient *render; 57 IAudioRenderClient *render;
58 IAudioStreamVolume *volume; 58 IAudioStreamVolume *volume;
59 WAVEFORMATEXTENSIBLE *wave_format; 59 WAVEFORMATEXTENSIBLE *wave_format;
60 Ecore_Win32_Handler *handler;
60 HANDLE event; 61 HANDLE event;
61 UINT32 NumBufferFrames; 62 UINT32 NumBufferFrames;
62 Eina_Bool spec_format; 63 Eina_Bool spec_format;
@@ -97,20 +98,25 @@ _ecore_audio_out_wasapi_ecore_audio_volume_set(Eo *eo_obj EINA_UNUSED, Ecore_Aud
97 } 98 }
98} 99}
99 100
101static void
102_clear(Ecore_Audio_Out_Wasapi_Data *_pd)
103{
104 if (_pd->event) CloseHandle(_pd->event);
105 if (_pd->handler) ecore_main_win32_handler_del(_pd->handler);
106 if (_pd->render) _pd->render->lpVtbl->Release(_pd->render);
107 if (_pd->client) _pd->client->lpVtbl->Release(_pd->client);
108
109 _pd->event = NULL;
110 _pd->handler = NULL;
111 _pd->render = NULL;
112 _pd->client = NULL;
113 _pd->play = EINA_FALSE;
114}
100 115
101static void 116static void
102_close_cb(void *data, const Efl_Event *event EINA_UNUSED) 117_close_cb(void *data, const Efl_Event *event EINA_UNUSED)
103{ 118{
104 Ecore_Audio_Out_Wasapi_Data *_pd = data; 119 _clear(data);
105
106 if (_pd->event) CloseHandle(_pd->event);
107 if (_pd->render) _pd->render->lpVtbl->Release(_pd->render);
108 if (_pd->client) _pd->client->lpVtbl->Release(_pd->client);
109
110 _pd->event = NULL;
111 _pd->render = NULL;
112 _pd->client = NULL;
113 _pd->play = EINA_FALSE;
114} 120}
115 121
116static void 122static void
@@ -224,7 +230,9 @@ _write_cb(void *data, Ecore_Win32_Handler *wh EINA_UNUSED)
224 230
225 if (_pd->client) _pd->client->lpVtbl->Stop(_pd->client); 231 if (_pd->client) _pd->client->lpVtbl->Stop(_pd->client);
226 232
227 ecore_main_win32_handler_del(_pd->event); 233 if (_pd->handler) ecore_main_win32_handler_del(_pd->handler);
234 _pd->handler = NULL;
235
228 efl_event_callback_call(_pd->out, ECORE_AUDIO_OUT_WASAPI_EVENT_STOP, NULL); 236 efl_event_callback_call(_pd->out, ECORE_AUDIO_OUT_WASAPI_EVENT_STOP, NULL);
229 237
230 _pd->play = EINA_FALSE; 238 _pd->play = EINA_FALSE;
@@ -589,8 +597,9 @@ _ecore_audio_out_wasapi_efl_object_constructor(Eo *eo_obj, Ecore_Audio_Out_Wasap
589} 597}
590 598
591EOLIAN static void 599EOLIAN static void
592_ecore_audio_out_wasapi_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Out_Wasapi_Data *_pd EINA_UNUSED) 600_ecore_audio_out_wasapi_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Out_Wasapi_Data *_pd)
593{ 601{
602 _clear(_pd);
594 client_connect_count--; 603 client_connect_count--;
595 efl_destructor(efl_super(eo_obj, MY_CLASS)); 604 efl_destructor(efl_super(eo_obj, MY_CLASS));
596 605