mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-03 03:26:45 +02:00
show info box for audio calls
This commit is contained in:
@ -61,7 +61,7 @@ typedef struct _Call {
|
||||
} Call;
|
||||
|
||||
|
||||
void set_call(Call* call, _Bool start)
|
||||
void set_call(ToxWindow *self, Call* call, _Bool start)
|
||||
{
|
||||
call->in_idx = -1;
|
||||
call->out_idx = -1;
|
||||
@ -76,7 +76,7 @@ void set_call(Call* call, _Bool start)
|
||||
}
|
||||
}
|
||||
|
||||
struct _ASettings {
|
||||
struct _ASettins {
|
||||
AudioError errors;
|
||||
|
||||
ToxAv *av;
|
||||
@ -98,7 +98,6 @@ void callback_call_ended ( int32_t call_index, void *arg );
|
||||
void callback_requ_timeout ( int32_t call_index, void *arg );
|
||||
void callback_peer_timeout ( int32_t call_index, void *arg );
|
||||
|
||||
|
||||
static void print_err (ToxWindow *self, uint8_t *error_str)
|
||||
{
|
||||
line_info_add(self, NULL, NULL, NULL, error_str, SYS_MSG, 0, 0);
|
||||
@ -230,7 +229,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(this_call, _False);
|
||||
set_call(self, this_call, _False);
|
||||
|
||||
_cbend;
|
||||
}
|
||||
@ -248,12 +247,12 @@ int start_transmission(ToxWindow *self)
|
||||
!toxav_capability_supported(ASettins.av, self->call_idx, AudioEncoding) )
|
||||
return -1;
|
||||
|
||||
set_call(&ASettins.calls[self->call_idx], _True);
|
||||
set_call(self, &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) ) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int stop_transmission(int call_index)
|
||||
@ -695,9 +694,15 @@ void cmd_mute(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv)[
|
||||
if ( self->call_idx > -1) {
|
||||
Call* this_call = &ASettins.calls[self->call_idx];
|
||||
|
||||
pthread_mutex_lock(&this_call->mutex);
|
||||
device_mute(type, type == input ? this_call->in_idx : this_call->out_idx);
|
||||
pthread_mutex_unlock(&this_call->mutex);
|
||||
pthread_mutex_lock(&this_call->mutex);
|
||||
if (type == input) {
|
||||
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);
|
||||
}
|
||||
pthread_mutex_unlock(&this_call->mutex);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -727,10 +732,16 @@ void cmd_sense(WINDOW * window, ToxWindow * self, Tox *m, int argc, char (*argv)
|
||||
}
|
||||
|
||||
/* Call must be active */
|
||||
if ( self->call_idx > -1) device_set_VAD_treshold(ASettins.calls[self->call_idx].in_idx, value);
|
||||
if ( self->call_idx > -1) {
|
||||
device_set_VAD_treshold(ASettins.calls[self->call_idx].in_idx, value);
|
||||
self->chatwin->infobox.vad_lvl = value;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
on_error:
|
||||
print_err (self, error_str);
|
||||
}
|
||||
/*
|
||||
* end of commands
|
||||
*/
|
||||
|
Reference in New Issue
Block a user