1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 14:53:26 +01:00

possibly fix sound notification bug

This commit is contained in:
Jfreegman 2014-10-12 01:49:56 -04:00
parent be264528d2
commit f7d46f1100
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -209,7 +209,8 @@ void graceful_clear()
} }
#endif #endif
*actives[i].id_indicator = -1; /* reset indicator value */ if(actives[i].id_indicator)
*actives[i].id_indicator = -1; /* reset indicator value */
if ( actives[i].looping ) { if ( actives[i].looping ) {
stop_sound(i); stop_sound(i);
@ -251,6 +252,9 @@ void* do_playing(void* _p)
&& !actives[i].box && !actives[i].box
#endif #endif
) { ) {
if(actives[i].id_indicator)
*actives[i].id_indicator = -1; /* reset indicator value */
if (!is_playing(actives[i].source)) { if (!is_playing(actives[i].source)) {
/* Close */ /* Close */
alSourceStop(actives[i].source); alSourceStop(actives[i].source);
@ -265,13 +269,14 @@ void* do_playing(void* _p)
GError* ignore; GError* ignore;
notify_notification_close(actives[i].box, &ignore); notify_notification_close(actives[i].box, &ignore);
actives[i].box = NULL; actives[i].box = NULL;
*actives[i].id_indicator = -1; /* reset indicator value */ if(actives[i].id_indicator)
*actives[i].id_indicator = -1; /* reset indicator value */
if (!actives[i].looping && !is_playing(actives[i].source)) { if (!actives[i].looping && !is_playing(actives[i].source)) {
/* stop source if not looping or playing, just terminate box */ /* stop source if not looping or playing, just terminate box */
alSourceStop(actives[i].source); alSourceStop(actives[i].source);
alDeleteSources(1, &actives[i].source); alDeleteSources(1, &actives[i].source);
alDeleteBuffers(1,&actives[i].buffer); alDeleteBuffers(1, &actives[i].buffer);
memset(&actives[i], 0, sizeof(struct _ActiveNotifications)); memset(&actives[i], 0, sizeof(struct _ActiveNotifications));
} }
} }
@ -322,7 +327,9 @@ void* do_playing(void* _p)
GError* ignore; GError* ignore;
notify_notification_close(actives[i].box, &ignore); notify_notification_close(actives[i].box, &ignore);
actives[i].box = NULL; actives[i].box = NULL;
*actives[i].id_indicator = -1; /* reset indicator value */ if(actives[i].id_indicator)
*actives[i].id_indicator = -1; /* reset indicator value */
memset(&actives[i], 0, sizeof(struct _ActiveNotifications)); memset(&actives[i], 0, sizeof(struct _ActiveNotifications));
} }
} }
@ -344,7 +351,9 @@ void graceful_clear()
actives[i].box = NULL; actives[i].box = NULL;
} }
*actives[i].id_indicator = -1; /* reset indicator value */ if (actives[i].id_indicator)
*actives[i].id_indicator = -1; /* reset indicator value */
memset(&actives[i], 0, sizeof(struct _ActiveNotifications)); memset(&actives[i], 0, sizeof(struct _ActiveNotifications));
} }
@ -377,6 +386,7 @@ int init_notify(int login_cooldown, int notification_timeout)
pthread_mutex_destroy(Control.poll_mutex); pthread_mutex_destroy(Control.poll_mutex);
return -1; return -1;
} }
Control.poll_active = 1; Control.poll_active = 1;
#endif #endif
@ -388,7 +398,7 @@ int init_notify(int login_cooldown, int notification_timeout)
#ifdef BOX_NOTIFY #ifdef BOX_NOTIFY
notify_init("toxic"); notify_init("Toxic");
#endif #endif
Control.notif_timeout = notification_timeout; Control.notif_timeout = notification_timeout;
return 1; return 1;
@ -478,7 +488,8 @@ void stop_sound(int id)
notify_notification_close(actives[id].box, &ignore); notify_notification_close(actives[id].box, &ignore);
} }
#endif #endif
*actives[id].id_indicator = -1; if (actives[id].id_indicator)
*actives[id].id_indicator = -1;
// alSourcei(actives[id].source, AL_LOOPING, false); // alSourcei(actives[id].source, AL_LOOPING, false);
alSourceStop(actives[id].source); alSourceStop(actives[id].source);
alDeleteSources(1, &actives[id].source); alDeleteSources(1, &actives[id].source);