Skip to content

Commit

Permalink
UI: Remove hotkeys for mon and sends buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
pkviet committed Sep 4, 2018
1 parent 9ed0ec9 commit d61facf
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 213 deletions.
4 changes: 0 additions & 4 deletions UI/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,6 @@ Basic.AdvAudio.Volume="Volume (%)"
Basic.AdvAudio.Mono="Downmix to Mono"
Basic.AdvAudio.Panning="Panning"
Basic.AdvAudio.SyncOffset="Sync Offset (ms)"
Basic.AdvAudio.Monitoring="Audio Monitoring"
Basic.AdvAudio.Monitoring.None="Monitor Off"
Basic.AdvAudio.Monitoring.MonitorOnly="Monitor Only (mute output)"
Basic.AdvAudio.Monitoring.Both="Monitor and Output"
Basic.AdvAudio.AudioTracks="Tracks"

# basic mode 'hotkeys' settings
Expand Down
41 changes: 0 additions & 41 deletions UI/volume-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,6 @@ void VolControl::OBSVolumeMuted(void *data, calldata_t *calldata)
Q_ARG(bool, muted));
}


void VolControl::MonitoringEnabled(bool checked)
{
if (mon->isChecked() != checked)
mon->setChecked(checked);
SetMon(checked);
}

void VolControl::OBSMonitoringEnabled(void *data, calldata_t *calldata)
{
VolControl *volControl = static_cast<VolControl*>(data);
bool monitoring = calldata_bool(calldata, "monitor");

QMetaObject::invokeMethod(volControl, "MonitoringEnabled",
Q_ARG(bool, monitoring));
}

void VolControl::SendEnabled(bool checked) {
if (send->isChecked() != checked)
send->setChecked(checked);
SetSends(checked);
}

void VolControl::OBSSend(void *data, calldata_t *calldata) {
VolControl *volControl = static_cast<VolControl*>(data);
bool send = calldata_bool(calldata, "send");

QMetaObject::invokeMethod(volControl, "SendEnabled",
Q_ARG(bool, send));
}

void VolControl::VolumeChanged()
{
slider->blockSignals(true);
Expand Down Expand Up @@ -473,9 +442,6 @@ VolControl::VolControl(OBSSource source_, bool *mutePtr, bool showConfig, bool v
SetMon(monON);
mon->setAccessibleName(QTStr("VolControl.Mon"));
mon->setToolTip(QTStr("VolControl.Mon.Tooltip"));
if (source != nullptr)
signal_handler_connect(obs_source_get_signal_handler(source), "monitor",
OBSMonitoringEnabled, this);

QWidget::connect(mon, SIGNAL(clicked(bool)), this, SLOT(SetMon(bool)));
/* The send button toggles the sends of the source to output tracks.
Expand All @@ -501,9 +467,6 @@ VolControl::VolControl(OBSSource source_, bool *mutePtr, bool showConfig, bool v

send->setAccessibleName(QTStr("VolControl.Sends"));
send->setToolTip(QTStr("VolControl.Sends.Tooltip"));
if (source != nullptr)
signal_handler_connect(obs_source_get_signal_handler(source),
"send", OBSSend, this);
QWidget::connect(send, SIGNAL(clicked(bool)), this,
SLOT(SetSends(bool)));
}
Expand Down Expand Up @@ -568,10 +531,6 @@ VolControl::~VolControl()
if (source != nullptr) {
signal_handler_disconnect(obs_source_get_signal_handler(source),
"mute", OBSVolumeMuted, this);
signal_handler_disconnect(obs_source_get_signal_handler(source),
"monitor", OBSMonitoringEnabled, this);
signal_handler_disconnect(obs_source_get_signal_handler(source),
"sends", OBSSend, this);
}
obs_fader_destroy(obs_fader);
obs_volmeter_destroy(obs_volmeter);
Expand Down
4 changes: 0 additions & 4 deletions UI/volume-control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,11 @@ class VolControl : public QWidget {
const float peak[MAX_AUDIO_CHANNELS],
const float inputPeak[MAX_AUDIO_CHANNELS]);
static void OBSVolumeMuted(void *data, calldata_t *calldata);
static void OBSMonitoringEnabled(void *data, calldata_t *calldata);
static void OBSSend(void *data, calldata_t *calldata);

void EmitConfigClicked();

private slots:
void VolumeMuted(bool muted);
void MonitoringEnabled(bool checked);
void SendEnabled(bool checked);
void SetMuted(bool checked);
void SetStream(bool checked);
void SetRec(bool checked);
Expand Down
2 changes: 0 additions & 2 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,8 +1924,6 @@ void OBSBasic::InitHotkeys()
obs_hotkeys_set_translations(&t);

obs_hotkeys_set_audio_hotkeys_translations(Str("Mute"), Str("Unmute"),
Str("Monitor"), Str("Unmonitor"),
Str("Send"), Str("Unsend"),
Str("Push-to-mute"), Str("Push-to-talk"));

obs_hotkeys_set_sceneitem_hotkeys_translations(
Expand Down
6 changes: 0 additions & 6 deletions libobs/obs-hotkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,17 +1591,11 @@ void obs_hotkey_update_atomic(obs_hotkey_atomic_update_func func, void *data)

void obs_hotkeys_set_audio_hotkeys_translations(
const char *mute, const char *unmute,
const char *monitor, const char *unmonitor,
const char *send, const char *unsend,
const char *push_to_mute, const char *push_to_talk)
{
#define SET_T(n) bfree(obs->hotkeys.n); obs->hotkeys.n = bstrdup(n)
SET_T(mute);
SET_T(unmute);
SET_T(monitor);
SET_T(unmonitor);
SET_T(send);
SET_T(unsend);
SET_T(push_to_mute);
SET_T(push_to_talk);
#undef SET_T
Expand Down
2 changes: 0 additions & 2 deletions libobs/obs-hotkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ EXPORT void obs_hotkeys_set_translations_s(

EXPORT void obs_hotkeys_set_audio_hotkeys_translations(
const char *mute, const char *unmute,
const char *monitor, const char *unmonitor,
const char *send, const char *unsend,
const char *push_to_mute, const char *push_to_talk);

EXPORT void obs_hotkeys_set_sceneitem_hotkeys_translations(
Expand Down
8 changes: 0 additions & 8 deletions libobs/obs-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@ struct obs_core_hotkeys {
char *push_to_talk;
char *sceneitem_show;
char *sceneitem_hide;
char *monitor;
char *unmonitor;
char *send;
char *unsend;
};

struct obs_core {
Expand Down Expand Up @@ -535,8 +531,6 @@ enum audio_action_type {
AUDIO_ACTION_MUTE,
AUDIO_ACTION_PTT,
AUDIO_ACTION_PTM,
AUDIO_ACTION_MON,
AUDIO_ACTION_SEND,
};

struct audio_action {
Expand Down Expand Up @@ -681,7 +675,6 @@ struct obs_source {

/* sources specific hotkeys */
obs_hotkey_pair_id mute_unmute_key;
obs_hotkey_pair_id monitor_unmonitor_key;
obs_hotkey_id push_to_mute_key;
obs_hotkey_id push_to_talk_key;
bool push_to_mute_enabled;
Expand Down Expand Up @@ -728,7 +721,6 @@ struct obs_source {
*/
bool monitoring;
bool sends;
obs_hotkey_pair_id send_unsend_key;
};

extern struct obs_source_info *get_source_info(const char *id);
Expand Down
138 changes: 0 additions & 138 deletions libobs/obs-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ static const char *source_signals[] = {
"void show(ptr source)",
"void hide(ptr source)",
"void mute(ptr source, bool muted)",
"void monitor(ptr source, bool monitoring)",
"void send(ptr source, bool send)",
"void push_to_mute_changed(ptr source, bool enabled)",
"void push_to_mute_delay(ptr source, int delay)",
"void push_to_talk_changed(ptr source, bool enabled)",
Expand Down Expand Up @@ -233,71 +231,6 @@ static bool obs_source_hotkey_unmute(void *data,
return true;
}

static bool obs_source_hotkey_monitor(void *data,
obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed)
{
UNUSED_PARAMETER(id);
UNUSED_PARAMETER(key);
bool monON;
struct obs_source *source = data;

enum obs_monitoring_type type = obs_source_get_monitoring_type(source);
monON = type == OBS_MONITORING_TYPE_NONE ? false : true;
if (!pressed || monON)
return false;

source->monitoring = true;
obs_source_set_monitoring(source, true);

return true;
}

static bool obs_source_hotkey_unmonitor(void *data,
obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed)
{
UNUSED_PARAMETER(id);
UNUSED_PARAMETER(key);
bool monOFF;
struct obs_source *source = data;

enum obs_monitoring_type type = obs_source_get_monitoring_type(source);
monOFF = type == OBS_MONITORING_TYPE_NONE ? true : false;
if (!pressed || monOFF)
return false;

source->monitoring = false;
obs_source_set_monitoring(source, false);
return true;
}

static bool obs_source_hotkey_send(void *data,
obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed)
{
UNUSED_PARAMETER(id);
UNUSED_PARAMETER(key);
struct obs_source *source = data;

if (!pressed || source->sends)
return false;

obs_source_set_send_hotkey(source, true);
return true;
}

static bool obs_source_hotkey_unsend(void *data,
obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed)
{
UNUSED_PARAMETER(id);
UNUSED_PARAMETER(key);
struct obs_source *source = data;

if (!pressed || !source->sends)
return false;

obs_source_set_send_hotkey(source, false);
return true;
}

static void obs_source_hotkey_push_to_mute(void *data,
obs_hotkey_id id, obs_hotkey_t *key, bool pressed)
{
Expand Down Expand Up @@ -345,8 +278,6 @@ static void obs_source_init_audio_hotkeys(struct obs_source *source)
if (!(source->info.output_flags & OBS_SOURCE_AUDIO) ||
source->info.type != OBS_SOURCE_TYPE_INPUT) {
source->mute_unmute_key = OBS_INVALID_HOTKEY_ID;
source->monitor_unmonitor_key = OBS_INVALID_HOTKEY_PAIR_ID;
source->send_unsend_key = OBS_INVALID_HOTKEY_PAIR_ID;
source->push_to_talk_key = OBS_INVALID_HOTKEY_ID;
return;
}
Expand All @@ -357,19 +288,7 @@ static void obs_source_init_audio_hotkeys(struct obs_source *source)
obs_source_hotkey_mute, obs_source_hotkey_unmute,
source, source);

source->monitor_unmonitor_key = obs_hotkey_pair_register_source(source,
"libobs.monitor", obs->hotkeys.monitor,
"libobs.unmonitor", obs->hotkeys.unmonitor,
obs_source_hotkey_monitor, obs_source_hotkey_unmonitor,
source, source);

if (!(source->info.output_flags & OBS_SOURCE_TRACK)) {
source->send_unsend_key = obs_hotkey_pair_register_source(source,
"libobs.send", obs->hotkeys.send,
"libobs.unsend", obs->hotkeys.unsend,
obs_source_hotkey_send, obs_source_hotkey_unsend,
source, source);

source->push_to_mute_key = obs_hotkey_register_source(source,
"libobs.push-to-mute", obs->hotkeys.push_to_mute,
obs_source_hotkey_push_to_mute, source);
Expand Down Expand Up @@ -404,8 +323,6 @@ static obs_source_t *obs_source_create_internal(const char *id,
}

source->mute_unmute_key = OBS_INVALID_HOTKEY_PAIR_ID;
source->monitor_unmonitor_key = OBS_INVALID_HOTKEY_PAIR_ID;
source->send_unsend_key = OBS_INVALID_HOTKEY_PAIR_ID;
source->push_to_mute_key = OBS_INVALID_HOTKEY_ID;
source->push_to_talk_key = OBS_INVALID_HOTKEY_ID;

Expand Down Expand Up @@ -654,8 +571,6 @@ void obs_source_destroy(struct obs_source *source)
obs_hotkey_unregister(source->push_to_talk_key);
obs_hotkey_unregister(source->push_to_mute_key);
obs_hotkey_pair_unregister(source->mute_unmute_key);
obs_hotkey_pair_unregister(source->monitor_unmonitor_key);
obs_hotkey_pair_unregister(source->send_unsend_key);

for (i = 0; i < source->async_cache.num; i++)
obs_source_frame_decref(source->async_cache.array[i].frame);
Expand Down Expand Up @@ -3718,55 +3633,6 @@ void obs_source_set_muted(obs_source_t *source, bool muted)
pthread_mutex_unlock(&source->audio_actions_mutex);
}

void obs_source_set_monitoring(obs_source_t *source, bool monitoring) {
struct calldata data;
uint8_t stack[128];
struct audio_action action = {
.timestamp = os_gettime_ns(),
.type = AUDIO_ACTION_MON,
.set = monitoring
};

if (!obs_source_valid(source, "obs_source_set_monitoring"))
return;

source->monitoring = monitoring;

calldata_init_fixed(&data, stack, sizeof(stack));
calldata_set_ptr(&data, "source", source);
calldata_set_bool(&data, "monitor", monitoring);

signal_handler_signal(source->context.signals, "monitor", &data);

pthread_mutex_lock(&source->audio_actions_mutex);
da_push_back(source->audio_actions, &action);
pthread_mutex_unlock(&source->audio_actions_mutex);
}

void obs_source_set_send_hotkey(obs_source_t *source, bool send)
{
struct calldata data;
uint8_t stack[128];
struct audio_action action = {
.timestamp = os_gettime_ns(),
.type = AUDIO_ACTION_SEND,
.set = send
};

if (!obs_source_valid(source, "obs_source_set_send_hotkey"))
return;

calldata_init_fixed(&data, stack, sizeof(stack));
calldata_set_ptr(&data, "source", source);
calldata_set_bool(&data, "send", send);

signal_handler_signal(source->context.signals, "send", &data);

pthread_mutex_lock(&source->audio_actions_mutex);
da_push_back(source->audio_actions, &action);
pthread_mutex_unlock(&source->audio_actions_mutex);
}

static void source_signal_push_to_changed(obs_source_t *source,
const char *signal, bool enabled)
{
Expand Down Expand Up @@ -3973,14 +3839,10 @@ static inline void apply_audio_action(obs_source_t *source,
source->volume = action->vol; break;
case AUDIO_ACTION_MUTE:
source->muted = action->set; break;
case AUDIO_ACTION_MON:
source->monitoring = action->set; break;
case AUDIO_ACTION_PTT:
source->push_to_talk_pressed = action->set; break;
case AUDIO_ACTION_PTM:
source->push_to_mute_pressed = action->set; break;
case AUDIO_ACTION_SEND:
source->sends = action->set; break;
}
}

Expand Down
8 changes: 0 additions & 8 deletions libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,10 +689,6 @@ static inline bool obs_init_hotkeys(void)
hotkeys->name_map_init_token = obs_pthread_once_init_token;
hotkeys->mute = bstrdup("Mute");
hotkeys->unmute = bstrdup("Unmute");
hotkeys->monitor = bstrdup("Monitor");
hotkeys->unmonitor= bstrdup("Unmonitor");
hotkeys->send = bstrdup("Send");
hotkeys->unsend = bstrdup("Unsend");
hotkeys->push_to_mute = bstrdup("Push-to-mute");
hotkeys->push_to_talk = bstrdup("Push-to-talk");
hotkeys->sceneitem_show = bstrdup("Show '%1'");
Expand Down Expand Up @@ -744,10 +740,6 @@ static inline void obs_free_hotkeys(void)

bfree(hotkeys->mute);
bfree(hotkeys->unmute);
bfree(hotkeys->monitor);
bfree(hotkeys->unmonitor);
bfree(hotkeys->send);
bfree(hotkeys->unsend);
bfree(hotkeys->push_to_mute);
bfree(hotkeys->push_to_talk);
bfree(hotkeys->sceneitem_show);
Expand Down

0 comments on commit d61facf

Please sign in to comment.