r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / menuaeffects.C
blob4f976222fa2f3a2a356842deca667fd90dff46b0
1 #include "asset.h"
2 #include "apluginarray.h"
3 #include "bchash.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "file.h"
7 #include "mainmenu.h"
8 #include "mainsession.h"
9 #include "mwindow.h"
10 #include "mwindowgui.h"
11 #include "menuaeffects.h"
12 #include "patchbay.h"
13 #include "tracks.h"
15 // ============================================= audio effects
17 MenuAEffects::MenuAEffects(MWindow *mwindow)
18  : MenuEffects(mwindow)
20         thread = new MenuAEffectThread(mwindow);
23 MenuAEffects::~MenuAEffects()
25         delete thread;
28 MenuAEffectThread::MenuAEffectThread(MWindow *mwindow)
29  : MenuEffectThread(mwindow)
33 MenuAEffectThread::~MenuAEffectThread()
37 int MenuAEffectThread::get_recordable_tracks(Asset *asset)
39         asset->channels = mwindow->edl->tracks->recordable_audio_tracks();
40         return asset->channels;
44 int MenuAEffectThread::get_derived_attributes(Asset *asset, BC_Hash *defaults)
46         asset->load_defaults(defaults, 
47                 "AEFFECT_",
48                 1, 
49                 1,
50                 1,
51                 0,
52                 1);
55 // Fix asset for audio only
56         if(!File::supports_audio(asset->format)) asset->format = FILE_WAV;
57         asset->audio_data = 1;
58         asset->video_data = 0;
60         return 0;
63 int MenuAEffectThread::save_derived_attributes(Asset *asset, BC_Hash *defaults)
65         asset->save_defaults(defaults, 
66                 "AEFFECT_",
67                 1, 
68                 1,
69                 1,
70                 0,
71                 1);
73         return 0;
77 PluginArray* MenuAEffectThread::create_plugin_array()
79         return new APluginArray();
82 int64_t MenuAEffectThread::to_units(double position, int round)
84         if(round)
85                 return Units::round(position * mwindow->edl->session->sample_rate);
86         else
87                 return (int64_t)(position * mwindow->edl->session->sample_rate);
88                 
89         return 0;
92 int MenuAEffectThread::fix_menu(char *title)
94         mwindow->gui->mainmenu->add_aeffect(title); 
99 MenuAEffectItem::MenuAEffectItem(MenuAEffects *menueffect, char *string)
100  : MenuEffectItem(menueffect, string)