Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (41 loc) · 1.93 KB
/
Copy pathmain.cpp
File metadata and controls
50 lines (41 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "main_dialog.h"
// Регистрация метаданных плагина
DECLARE_COMPONENT_VERSION(
"BPM & Key Detector",
"2.0",
"Automatic BPM and musical key analysis for foobar2000.\n"
"\n"
"BPM detection algorithm based on foo_bpm by Michael Balzer.\n"
"Uses KissFFT for FFT processing and libkeyfinder for key detection.\n"
"\n"
"(c) 2026 Vadim Levo\n"
);
VALIDATE_COMPONENT_FILENAME("foo_bpmkey.dll");
// Класс для контекстного меню
class context_bpm_key : public contextmenu_item_simple {
public:
// 1. Исправили группу на root
GUID get_parent() override { return contextmenu_groups::root; }
unsigned get_num_items() override { return 1; }
void get_item_name(unsigned p_index, pfc::string_base& p_out) override {
p_out = "Detect BPM & Key";
}
GUID get_item_guid(unsigned p_index) override {
static const GUID guid = { 0xc6a8276f, 0x145a, 0x4f12, { 0x81, 0x9b, 0x2e, 0x3d, 0x4c, 0x5b, 0x6a, 0x79 } };
return guid;
}
// 2. Добавили обязательный метод описания (исправляет ошибку абстрактного класса)
bool get_item_description(unsigned p_index, pfc::string_base& p_out) override {
p_out = "Calculates BPM and Key for selected tracks.";
return true;
}
void context_command(unsigned p_index, metadb_handle_list_cref p_data, const GUID& p_caller) override {
if (p_data.get_count() == 0) return;
// Создаем немодальное окно, передавая ему выделенные треки
CBpmKeyDialog* dlg = new CBpmKeyDialog(p_data);
dlg->Create(core_api::get_main_window());
dlg->ShowWindow(SW_SHOW);
}
};
// Фабрика для регистрации меню в ядре foobar2000
static contextmenu_item_factory_t<context_bpm_key> g_context_bpm_key_factory;