|
1
|
1 #include "stdafx.h"
|
|
|
2
|
|
|
3 #include "playback_stream_capture.h"
|
|
|
4
|
|
|
5 // I am foo_sample and these are *my* GUIDs
|
|
|
6 // Make your own when reusing code or else
|
|
|
7 static const GUID guid_mainmenu_group_id = { 0x44963e7a, 0x4b2a, 0x4588, { 0xb0, 0x17, 0xa8, 0x69, 0x18, 0xcb, 0x8a, 0xa5 } };
|
|
|
8 static const GUID guid_test = { 0x7c4726df, 0x3b2d, 0x4c7c,{ 0xad, 0xe8, 0x43, 0xd8, 0x46, 0xbe, 0xce, 0xa8 } };
|
|
|
9 static const GUID guid_playbackstate = { 0xbd880c51, 0xf0cc, 0x473f,{ 0x9d, 0x14, 0xa6, 0x6e, 0x8c, 0xed, 0x25, 0xae } };
|
|
|
10 static const GUID guid_io = { 0xd380c333, 0xa72c, 0x4e1e,{ 0x97, 0xca, 0xed, 0x14, 0xeb, 0x93, 0x76, 0x23 } };
|
|
|
11 static const GUID guid_listcontrol_advanced = { 0x27e29db0, 0x3079, 0x4ce0, { 0x8b, 0x4a, 0xa0, 0x78, 0xeb, 0x6, 0x56, 0x86 } };
|
|
|
12 static const GUID guid_listcontrol_simple = { 0x34664996, 0x54cd, 0x48eb, { 0xa8, 0x20, 0x8f, 0x45, 0x7d, 0xcc, 0xff, 0xbb } };
|
|
|
13 static const GUID guid_listcontrol_ownerdata = { 0xc6d23696, 0x4be5, 0x4daa, { 0xaf, 0xb2, 0x35, 0x14, 0xa, 0x47, 0xd2, 0xf9 } };
|
|
|
14 static const GUID guid_playback_stream_capture = { 0x3d0f0f1a, 0x6b5f, 0x42e3, { 0xa4, 0x6d, 0x49, 0x1, 0x3, 0xf0, 0x54, 0xb2 } };
|
|
|
15
|
|
|
16
|
|
|
17 static mainmenu_group_popup_factory g_mainmenu_group(guid_mainmenu_group_id, mainmenu_groups::file, mainmenu_commands::sort_priority_dontcare, "Sample component");
|
|
|
18
|
|
|
19 void RunPlaybackStateDemo(); //playback_state.cpp
|
|
|
20 void RunIOTest(); // IO.cpp
|
|
|
21 void RunListControlSimpleDemo(); // listcontrol-simple.cpp
|
|
|
22 void RunListControlOwnerDataDemo(); // listcontrol-ownerdata.cpp
|
|
|
23 void RunListControlAdvancedDemo(); // listcontrol-advanced.cpp
|
|
|
24
|
|
|
25 class mainmenu_commands_sample : public mainmenu_commands {
|
|
|
26 public:
|
|
|
27 enum {
|
|
|
28 cmd_test = 0,
|
|
|
29 cmd_playbackstate,
|
|
|
30 cmd_io,
|
|
|
31 cmd_listcontrol_simple,
|
|
|
32 cmd_listcontrol_ownerdata,
|
|
|
33 cmd_listcontrol_advanced,
|
|
|
34 cmd_playback_stream_capture,
|
|
|
35 cmd_total
|
|
|
36 };
|
|
|
37 t_uint32 get_command_count() override {
|
|
|
38 return cmd_total;
|
|
|
39 }
|
|
|
40 GUID get_command(t_uint32 p_index) override {
|
|
|
41
|
|
|
42 switch(p_index) {
|
|
|
43 case cmd_test: return guid_test;
|
|
|
44 case cmd_playbackstate: return guid_playbackstate;
|
|
|
45 case cmd_io: return guid_io;
|
|
|
46 case cmd_listcontrol_simple: return guid_listcontrol_simple;
|
|
|
47 case cmd_listcontrol_ownerdata: return guid_listcontrol_ownerdata;
|
|
|
48 case cmd_listcontrol_advanced: return guid_listcontrol_advanced;
|
|
|
49 case cmd_playback_stream_capture: return guid_playback_stream_capture;
|
|
|
50 default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
|
|
|
51 }
|
|
|
52 }
|
|
|
53 void get_name(t_uint32 p_index,pfc::string_base & p_out) override {
|
|
|
54 switch(p_index) {
|
|
|
55 case cmd_test: p_out = "Test command"; break;
|
|
|
56 case cmd_playbackstate: p_out = "Playback state demo"; break;
|
|
|
57 case cmd_io: p_out = "I/O test"; break;
|
|
|
58 case cmd_listcontrol_simple: p_out = "Simple CListControl demo"; break;
|
|
|
59 case cmd_listcontrol_ownerdata: p_out = "Owner-data CListControl demo"; break;
|
|
|
60 case cmd_listcontrol_advanced: p_out = "Advanced CListControl demo"; break;
|
|
|
61 case cmd_playback_stream_capture: p_out = "Playback stream capture demo"; break;
|
|
|
62 default: uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
|
|
|
63 }
|
|
|
64 }
|
|
|
65 bool get_description(t_uint32 p_index,pfc::string_base & p_out) override {
|
|
|
66 switch(p_index) {
|
|
|
67 case cmd_test: p_out = "This is a sample menu command."; return true;
|
|
|
68 case cmd_playbackstate: p_out = "Opens the playback state demo dialog."; return true;
|
|
|
69 case cmd_io: p_out = "Runs I/O test."; return true;
|
|
|
70 case cmd_listcontrol_simple: p_out = "Runs Simple CListControl demo."; return true;
|
|
|
71 case cmd_listcontrol_ownerdata: p_out = "Runs Owner Data CListControl demo."; return true;
|
|
|
72 case cmd_listcontrol_advanced: p_out = "Runs Advanced CListControl demo."; return true;
|
|
|
73 case cmd_playback_stream_capture: p_out = "Toggles playback stream capture operation."; return true;
|
|
|
74 default: return false;
|
|
|
75 }
|
|
|
76 }
|
|
|
77 GUID get_parent() override {
|
|
|
78 return guid_mainmenu_group_id;
|
|
|
79 }
|
|
|
80 void execute(t_uint32 p_index,service_ptr_t<service_base> p_callback) override {
|
|
|
81 switch(p_index) {
|
|
|
82 case cmd_test:
|
|
|
83 popup_message::g_show("This is a sample menu command.", "Blah");
|
|
|
84 break;
|
|
|
85 case cmd_playbackstate:
|
|
|
86 RunPlaybackStateDemo();
|
|
|
87 break;
|
|
|
88 case cmd_io:
|
|
|
89 RunIOTest();
|
|
|
90 break;
|
|
|
91 case cmd_listcontrol_simple:
|
|
|
92 RunListControlSimpleDemo();
|
|
|
93 break;
|
|
|
94 case cmd_listcontrol_ownerdata:
|
|
|
95 RunListControlOwnerDataDemo();
|
|
|
96 break;
|
|
|
97 case cmd_listcontrol_advanced:
|
|
|
98 RunListControlAdvancedDemo();
|
|
|
99 break;
|
|
|
100 case cmd_playback_stream_capture:
|
|
|
101 ToggleCapture();
|
|
|
102 break;
|
|
|
103 default:
|
|
|
104 uBugCheck(); // should never happen unless somebody called us with invalid parameters - bail
|
|
|
105 }
|
|
|
106 }
|
|
|
107 bool get_display(t_uint32 p_index,pfc::string_base & p_text,t_uint32 & p_flags) override {
|
|
|
108 // OPTIONAL method
|
|
|
109 bool rv = mainmenu_commands::get_display(p_index, p_text, p_flags);
|
|
|
110 if (rv) switch(p_index) {
|
|
|
111 case cmd_playback_stream_capture:
|
|
|
112 // Add checkmark if capture is in progress
|
|
|
113 if ( IsCaptureRunning() ) p_flags |= flag_checked;
|
|
|
114 break;
|
|
|
115 }
|
|
|
116 return rv;
|
|
|
117 }
|
|
|
118 };
|
|
|
119
|
|
|
120 static mainmenu_commands_factory_t<mainmenu_commands_sample> g_mainmenu_commands_sample_factory;
|