1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 13:27:46 +02:00

some fixups

This commit is contained in:
Jfreegman 2014-06-23 19:00:11 -04:00
parent f3ee120c48
commit f324d2d34b
4 changed files with 9 additions and 14 deletions

View File

@ -61,7 +61,7 @@ typedef struct _Call {
} Call;
void set_call(ToxWindow *self, Call* call, _Bool start)
void set_call(Call* call, _Bool start)
{
call->in_idx = -1;
call->out_idx = -1;
@ -76,7 +76,7 @@ void set_call(ToxWindow *self, Call* call, _Bool start)
}
}
struct _ASettins {
struct _ASettings {
AudioError errors;
ToxAv *av;
@ -234,7 +234,7 @@ cleanup:
if ( this_call->out_idx != -1 ) if ( close_device(output, this_call->out_idx) != de_None )
line_info_add(self, NULL, NULL, NULL, "Failed to close output device!", SYS_MSG, 0, 0);
set_call(self, this_call, _False);
set_call(this_call, _False);
_cbend;
}
@ -252,7 +252,7 @@ int start_transmission(ToxWindow *self)
!toxav_capability_supported(ASettins.av, self->call_idx, AudioEncoding) )
return -1;
set_call(self, &ASettins.calls[self->call_idx], _True);
set_call(&ASettins.calls[self->call_idx], _True);
if ( 0 != pthread_create(&ASettins.calls[self->call_idx].ttid, NULL, transmission, self ) &&
0 != pthread_detach(ASettins.calls[self->call_idx].ttid) ) {
@ -514,6 +514,7 @@ void cmd_cancel(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
if ( error != ErrorNone ) {
if ( error == ErrorNoCall ) error_str = "No call!";
else if ( error == ErrorInvalidState ) error_str = "Cannot cancel in invalid state!";
else error_str = "Internal error!";
goto on_error;
@ -712,8 +713,8 @@ void cmd_mute(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv)[
device_mute(type, this_call->in_idx);
self->chatwin->infobox.in_is_muted ^= 1;
} else {
self->chatwin->infobox.out_is_muted ^= 1;
device_mute(type, this_call->out_idx);
self->chatwin->infobox.out_is_muted ^= 1;
}
pthread_mutex_unlock(&this_call->mutex);
}
@ -755,6 +756,3 @@ void cmd_sense(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv)
on_error:
print_err (self, error_str);
}
/*
* end of commands
*/

View File

@ -26,7 +26,6 @@
#include <tox/toxav.h>
#include "device.h"
#include "windows.h"
#define VAD_THRESHOLD_DEFAULT 40.0

View File

@ -40,7 +40,6 @@
#include "log.h"
#include "line_info.h"
#include "settings.h"
#include "chat.h"
#ifdef _SUPPORT_AUDIO
#include "audio_call.h"
@ -498,7 +497,6 @@ void chat_onCancel (ToxWindow *self, ToxAv *av, int call_index)
if ( self->call_idx != call_index || self->num != toxav_get_peer_id(av, call_index, 0))
return;
kill_infobox(self);
self->call_idx = -1;
line_info_add(self, NULL, NULL, NULL, "Call canceled!", SYS_MSG, 0, 0);
}
@ -585,12 +583,12 @@ static void draw_infobox(ToxWindow *self)
uint64_t curtime = get_unix_time();
/* update elapsed time string once per second */
if (curtime > infobox.deltatime) {
if (curtime > infobox.lastupdate) {
infobox.calltime = curtime - infobox.calltime;
get_elapsed_time_str(infobox.timestr, sizeof(infobox.timestr), infobox.calltime);
}
infobox.deltatime = curtime;
infobox.lastupdate = curtime;
const char *in_is_muted = infobox.in_is_muted ? "yes" : "no";
const char *out_is_muted = infobox.out_is_muted ? "yes" : "no";

View File

@ -154,7 +154,7 @@ struct infobox {
bool active;
uint64_t calltime;
uint64_t deltatime;
uint64_t lastupdate;
char timestr[TIME_STR_SIZE];
WINDOW *win;