1 #include "apluginarray.h"
5 #include "edlsession.h"
8 #include "mainsession.h"
10 #include "mwindowgui.h"
11 #include "menuaeffects.h"
15 // ============================================= audio effects
17 MenuAEffects::MenuAEffects(MWindow *mwindow)
18 : MenuEffects(mwindow)
20 thread = new MenuAEffectThread(mwindow);
23 MenuAEffects::~MenuAEffects()
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, Defaults *defaults)
48 defaults->get("AEFFECTPATH", asset->path);
49 sprintf(string, "WAV");
50 defaults->get("AEFFECTFORMAT", string);
51 if(!file.supports_audio(mwindow->plugindb, string)) sprintf(string, WAV_NAME);
52 asset->format = file.strtoformat(mwindow->plugindb, string);
53 //printf("MenuAEffectThread::get_derived_attributes %s\n", string);
54 asset->sample_rate = mwindow->edl->session->sample_rate;
55 asset->bits = defaults->get("AEFFECTBITS", 16);
56 dither = defaults->get("AEFFECTDITHER", 0);
57 asset->signed_ = defaults->get("AEFFECTSIGNED", 1);
58 asset->byte_order = defaults->get("AEFFECTBYTEORDER", 1);
59 asset->audio_data = 1;
65 asset->load_defaults(defaults);
66 defaults->get("EFFECT_AUDIO_CODEC", asset->acodec);
70 int MenuAEffectThread::save_derived_attributes(Asset *asset, Defaults *defaults)
73 defaults->update("AEFFECTPATH", asset->path);
74 defaults->update("AEFFECTFORMAT", file.formattostr(mwindow->plugindb, asset->format));
75 //printf("MenuAEffectThread::save_derived_attributes %s\n", file.formattostr(mwindow->plugindb, asset->format));
76 defaults->update("AEFFECTBITS", asset->bits);
77 defaults->update("AEFFECTDITHER", dither);
78 defaults->update("AEFFECTSIGNED", asset->signed_);
79 defaults->update("AEFFECTBYTEORDER", asset->byte_order);
81 asset->save_defaults(defaults);
82 defaults->update("EFFECT_AUDIO_CODEC", asset->acodec);
87 PluginArray* MenuAEffectThread::create_plugin_array()
89 return new APluginArray();
92 int64_t MenuAEffectThread::to_units(double position, int round)
95 return Units::round(position * mwindow->edl->session->sample_rate);
97 return (int64_t)(position * mwindow->edl->session->sample_rate);
102 int MenuAEffectThread::fix_menu(char *title)
104 mwindow->gui->mainmenu->add_aeffect(title);
109 MenuAEffectItem::MenuAEffectItem(MenuAEffects *menueffect, char *string)
110 : MenuEffectItem(menueffect, string)