2017-03-05 14:47:28 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_audio_buses.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2017-03-05 14:47:28 +00:00
|
|
|
/*************************************************************************/
|
2018-01-01 13:40:08 +00:00
|
|
|
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
|
2017-03-05 14:47:28 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2017-01-21 22:00:25 +00:00
|
|
|
#ifndef EDITORAUDIOBUSES_H
|
|
|
|
#define EDITORAUDIOBUSES_H
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "editor/editor_file_dialog.h"
|
|
|
|
#include "editor_plugin.h"
|
2017-01-21 22:00:25 +00:00
|
|
|
#include "scene/gui/box_container.h"
|
|
|
|
#include "scene/gui/button.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/gui/line_edit.h"
|
2017-08-10 23:07:24 +00:00
|
|
|
#include "scene/gui/menu_button.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/gui/option_button.h"
|
|
|
|
#include "scene/gui/panel.h"
|
2017-01-21 22:00:25 +00:00
|
|
|
#include "scene/gui/panel_container.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/gui/scroll_container.h"
|
2017-01-21 22:00:25 +00:00
|
|
|
#include "scene/gui/slider.h"
|
|
|
|
#include "scene/gui/texture_progress.h"
|
|
|
|
#include "scene/gui/texture_rect.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/gui/tool_button.h"
|
2017-01-21 22:00:25 +00:00
|
|
|
#include "scene/gui/tree.h"
|
|
|
|
|
|
|
|
class EditorAudioBuses;
|
|
|
|
|
|
|
|
class EditorAudioBus : public PanelContainer {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(EditorAudioBus, PanelContainer)
|
2017-01-21 22:00:25 +00:00
|
|
|
|
|
|
|
Ref<Texture> disabled_vu;
|
|
|
|
LineEdit *track_name;
|
2017-08-10 23:07:24 +00:00
|
|
|
MenuButton *bus_options;
|
2017-01-21 22:00:25 +00:00
|
|
|
VSlider *slider;
|
2017-08-22 21:27:17 +00:00
|
|
|
|
|
|
|
int cc;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
bool prev_active;
|
|
|
|
|
|
|
|
float peak_l;
|
|
|
|
float peak_r;
|
|
|
|
|
|
|
|
TextureProgress *vu_l;
|
|
|
|
TextureProgress *vu_r;
|
|
|
|
} channel[4];
|
|
|
|
|
2017-01-21 22:00:25 +00:00
|
|
|
TextureRect *scale;
|
|
|
|
OptionButton *send;
|
|
|
|
|
|
|
|
PopupMenu *effect_options;
|
2017-08-26 14:42:28 +00:00
|
|
|
PopupMenu *bus_popup;
|
2017-01-24 23:11:13 +00:00
|
|
|
PopupMenu *delete_effect_popup;
|
2017-01-21 22:00:25 +00:00
|
|
|
|
|
|
|
Button *solo;
|
|
|
|
Button *mute;
|
|
|
|
Button *bypass;
|
|
|
|
|
|
|
|
Tree *effects;
|
|
|
|
|
|
|
|
bool updating_bus;
|
|
|
|
|
2017-09-25 06:12:18 +00:00
|
|
|
bool is_master;
|
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
void _gui_input(const Ref<InputEvent> &p_event);
|
2017-08-26 14:42:28 +00:00
|
|
|
void _bus_popup_pressed(int p_option);
|
2017-01-24 02:12:08 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _name_changed(const String &p_new_name);
|
2017-01-21 22:00:25 +00:00
|
|
|
void _name_focus_exit() { _name_changed(track_name->get_text()); }
|
|
|
|
void _volume_db_changed(float p_db);
|
|
|
|
void _solo_toggled();
|
|
|
|
void _mute_toggled();
|
|
|
|
void _bypass_toggled();
|
|
|
|
void _send_selected(int p_which);
|
|
|
|
void _effect_edited();
|
|
|
|
void _effect_add(int p_which);
|
|
|
|
void _effect_selected();
|
2017-01-24 23:11:13 +00:00
|
|
|
void _delete_effect_pressed(int p_option);
|
2017-03-05 15:44:50 +00:00
|
|
|
void _effect_rmb(const Vector2 &p_pos);
|
2017-01-24 02:12:08 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual Variant get_drag_data(const Point2 &p_point);
|
|
|
|
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
|
|
|
|
virtual void drop_data(const Point2 &p_point, const Variant &p_data);
|
2017-01-24 02:12:08 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
|
|
|
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
|
|
|
|
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
2017-01-24 03:19:31 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
friend class EditorAudioBuses;
|
2017-01-21 22:00:25 +00:00
|
|
|
|
|
|
|
EditorAudioBuses *buses;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
2017-01-21 22:00:25 +00:00
|
|
|
void update_bus();
|
|
|
|
void update_send();
|
|
|
|
|
2017-09-25 06:12:18 +00:00
|
|
|
EditorAudioBus(EditorAudioBuses *p_buses = NULL, bool p_is_master = false);
|
2017-01-21 22:00:25 +00:00
|
|
|
};
|
|
|
|
|
2017-01-24 02:12:08 +00:00
|
|
|
class EditorAudioBusDrop : public Panel {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(EditorAudioBusDrop, Panel);
|
2017-01-24 02:12:08 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
|
|
|
|
virtual void drop_data(const Point2 &p_point, const Variant &p_data);
|
2017-01-24 02:12:08 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
protected:
|
2017-01-24 02:12:08 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
2017-01-24 02:12:08 +00:00
|
|
|
EditorAudioBusDrop();
|
|
|
|
};
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
class EditorAudioBuses : public VBoxContainer {
|
2017-01-21 22:00:25 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(EditorAudioBuses, VBoxContainer)
|
2017-01-21 22:00:25 +00:00
|
|
|
|
|
|
|
HBoxContainer *top_hb;
|
|
|
|
|
|
|
|
Button *add;
|
|
|
|
ScrollContainer *bus_scroll;
|
|
|
|
HBoxContainer *bus_hb;
|
|
|
|
|
2017-01-24 02:12:08 +00:00
|
|
|
EditorAudioBusDrop *drop_end;
|
|
|
|
|
2017-01-25 17:30:40 +00:00
|
|
|
Button *file;
|
|
|
|
Button *load;
|
|
|
|
Button *save_as;
|
|
|
|
Button *_default;
|
|
|
|
Button *_new;
|
|
|
|
|
|
|
|
Timer *save_timer;
|
|
|
|
String edited_path;
|
|
|
|
|
2017-01-21 22:00:25 +00:00
|
|
|
void _add_bus();
|
|
|
|
void _update_buses();
|
|
|
|
void _update_bus(int p_index);
|
|
|
|
void _update_sends();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _delete_bus(Object *p_which);
|
2017-01-25 17:30:40 +00:00
|
|
|
void _duplicate_bus(int p_which);
|
2017-09-07 00:11:31 +00:00
|
|
|
void _reset_bus_volume(Object *p_which);
|
2017-01-25 17:30:40 +00:00
|
|
|
|
2017-01-24 02:12:08 +00:00
|
|
|
void _request_drop_end();
|
2017-03-05 15:44:50 +00:00
|
|
|
void _drop_at_index(int p_bus, int p_index);
|
2017-01-21 22:00:25 +00:00
|
|
|
|
2017-01-25 17:30:40 +00:00
|
|
|
void _server_save();
|
|
|
|
|
|
|
|
void _select_layout();
|
|
|
|
void _load_layout();
|
|
|
|
void _save_as_layout();
|
|
|
|
void _load_default_layout();
|
|
|
|
void _new_layout();
|
|
|
|
|
|
|
|
EditorFileDialog *file_dialog;
|
|
|
|
bool new_layout;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _file_dialog_callback(const String &p_string);
|
2017-01-25 17:30:40 +00:00
|
|
|
|
2017-01-21 22:00:25 +00:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
|
|
|
void open_layout(const String &p_path);
|
2017-01-21 22:00:25 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
static EditorAudioBuses *register_editor();
|
2017-01-21 22:00:25 +00:00
|
|
|
|
|
|
|
EditorAudioBuses();
|
|
|
|
};
|
|
|
|
|
2017-01-25 17:30:40 +00:00
|
|
|
class AudioBusesEditorPlugin : public EditorPlugin {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(AudioBusesEditorPlugin, EditorPlugin);
|
2017-01-25 17:30:40 +00:00
|
|
|
|
|
|
|
EditorAudioBuses *audio_bus_editor;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
2017-01-25 17:30:40 +00:00
|
|
|
virtual String get_name() const { return "SampleLibrary"; }
|
|
|
|
bool has_main_screen() const { return false; }
|
|
|
|
virtual void edit(Object *p_node);
|
|
|
|
virtual bool handles(Object *p_node) const;
|
|
|
|
virtual void make_visible(bool p_visible);
|
|
|
|
|
|
|
|
AudioBusesEditorPlugin(EditorAudioBuses *p_node);
|
|
|
|
~AudioBusesEditorPlugin();
|
|
|
|
};
|
|
|
|
|
2017-01-21 22:00:25 +00:00
|
|
|
#endif // EDITORAUDIOBUSES_H
|