Skip to main content
Topic: Read foobar preferences? (Read 333 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Read foobar preferences?

Hi,

I wanted to ask if it's possible to read foobar2000 preferences within my component. More specific, I want to find out the name of the current output device. How can I achieve this?

Best,
Mario

 

Re: Read foobar preferences?

Reply #1
If you just care about querying the current output in foobar2000 1.3.5 and above, something like the following should do it.
If you require updates as the output changes, output_manager_v2 of foobar2000 1.4 lets you register a change callback.

Code: [Select]
        static_api_ptr_t<output_manager> om;
        outputCoreConfig_t cfg;
        om->getCoreConfig(cfg);
        auto op = output_entry::g_find(cfg.m_output);
        std::string output_name = op->get_name();
        std::string device_name = op->get_device_name(cfg.m_device);
        console::formatter() << "Output: " << pfc::print_guid(cfg.m_output)
                             << " - \"" << output_name.c_str() << "\"\n"
                             << "Device: " << pfc::print_guid(cfg.m_device)
                             << " - \"" << device_name.c_str() << "\"\n";
Zao shang yong zao nong zao rang zao ren zao.
To, early in the morning, use a chisel to build a bathtub makes impatient people hot-tempered.

Re: Read foobar preferences?

Reply #2
Thanks! Works flawless.

Good to know that there will be a callback in the future, this will probably make the code a little bit cleaner. But for now, your example is sufficient for me. Thanks again!

 
SimplePortal 1.0.0 RC1 © 2008-2018