edit group selection and cut/copy/paste/del shortcuts, interview mode tweaks
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / menuaeffects.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "asset.h"
23 #include "apluginarray.h"
24 #include "bchash.h"
25 #include "edl.h"
26 #include "edlsession.h"
27 #include "file.h"
28 #include "mainmenu.h"
29 #include "mainsession.h"
30 #include "mwindow.h"
31 #include "mwindowgui.h"
32 #include "menuaeffects.h"
33 #include "patchbay.h"
34 #include "tracks.h"
35
36 // ============================================= audio effects
37
38 MenuAEffects::MenuAEffects(MWindow *mwindow)
39  : MenuEffects(mwindow)
40 {
41         thread = new MenuAEffectThread(mwindow, this);
42 }
43
44 MenuAEffects::~MenuAEffects()
45 {
46         delete thread;
47 }
48
49 MenuAEffectThread::MenuAEffectThread(MWindow *mwindow, MenuAEffects *menu_item)
50  : MenuEffectThread(mwindow, menu_item)
51 {
52 }
53
54 MenuAEffectThread::~MenuAEffectThread()
55 {
56 }
57
58 int MenuAEffectThread::get_recordable_tracks(Asset *asset)
59 {
60         asset->channels = mwindow->edl->tracks->recordable_audio_tracks();
61         return asset->channels;
62 }
63
64
65 int MenuAEffectThread::get_derived_attributes(Asset *asset, BC_Hash *defaults)
66 {
67         asset->load_defaults(defaults,
68                 "AEFFECT_",
69                 1,
70                 1,
71                 1,
72                 0,
73                 1);
74
75
76 // Fix asset for audio only
77         if(!File::renders_audio(asset)) asset->format = FILE_WAV;
78         asset->audio_data = 1;
79         asset->video_data = 0;
80
81         return 0;
82 }
83
84 int MenuAEffectThread::save_derived_attributes(Asset *asset, BC_Hash *defaults)
85 {
86         asset->save_defaults(defaults,
87                 "AEFFECT_",
88                 1,
89                 1,
90                 1,
91                 0,
92                 1);
93
94         return 0;
95 }
96
97
98 PluginArray* MenuAEffectThread::create_plugin_array()
99 {
100         return new APluginArray();
101 }
102
103 int64_t MenuAEffectThread::to_units(double position, int round)
104 {
105         if(round)
106                 return Units::round(position * mwindow->edl->session->sample_rate);
107         else
108                 return (int64_t)(position * mwindow->edl->session->sample_rate);
109
110         return 0;
111 }
112
113 int MenuAEffectThread::fix_menu(char *title)
114 {
115         mwindow->gui->mainmenu->add_aeffect(title);
116         return 0;
117 }
118
119
120
121 MenuAEffectItem::MenuAEffectItem(MenuAEffects *menueffect, const char *string)
122  : MenuEffectItem(menueffect, string)
123 {
124 }