HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: foosion on 2006-03-24 11:51:48

Title: Developer Tutorials
Post by: foosion on 2006-03-24 11:51:48
The following is a list of the known tutorials for componet developers for foobar2000 0.9.

SDK readme
Not a real tutorial, but nevertheless a required read.

Included in the SDK.


General Component Tutorial
This tutorial explains how to use some of the commonly used features with an emphasis on general purpose features. The tutorial does not show how to create an input, output or DSP component.

Download (http://foosion.foobar2000.org/0.9/tutorials/#general)


DSP Component Tutorial
This tutorial explains how to implement a DSP service - either with presets or without.Download (http://foosion.foobar2000.org/0.9/tutorials/#dsp)
Title: Developer Tutorials
Post by: Synthetic Soul on 2006-03-24 12:33:01
Good work again foosion.

The comments are superb.

Is it dumb of me to point out that, once you have closed the window, it won't come back again?
Title: Developer Tutorials
Post by: foosion on 2006-03-24 12:41:04
No, I think you have found I bug there. I'll try to confirm (and fix) this later.
Title: Developer Tutorials
Post by: foosion on 2006-03-24 14:12:06
Title: Developer Tutorials
Post by: Eric on 2006-03-26 15:27:52
Hi,
I am new on this part of the forum. Since I am using Foobar for 2 years, I would like to have a look of a development process.

But what are the requirements ?

I have downloaded and installed
- Visual C++ 2005 Express edition
- Foobar2000 SDK
- and now, these tutorials.

I have seen that foo_tutorial1 solution need to have the projects of the SDK of the same directory level (meaning extracting the foo_ in "foobar2000" directory created by the SDK), each foobar2000_*  is now loaded, but some projects are still missing: "components", "librairies" and "sdk".

Do I need the .NET SDK for that?

Other topic: is the database model documented? What kind of DB it is?
Title: Developer Tutorials
Post by: foosion on 2006-03-26 17:54:41
Quote
I have downloaded and installed
- Visual C++ 2005 Express edition
- Foobar2000 SDK
- and now, these tutorials.
You also need the Windows Platform SDK.

Quote
I have seen that foo_tutorial1 solution need to have the projects of the SDK of the same directory level (meaning extracting the foo_ in "foobar2000" directory created by the SDK), each foobar2000_*  is now loaded, but some projects are still missing: "components", "librairies" and "sdk".
Those are not projects, but "solution folders"; in other words, they are merely a means to organize projects in a VS solution.
Title: Developer Tutorials
Post by: TrNSZ on 2006-03-31 03:49:00
[deleted]
Title: Developer Tutorials
Post by: mixcherry on 2006-03-31 22:30:54
What is preventing Peter from releasing source code for such plugins as Autoplaylist Manager or Playback Statistics?... That would help me a lot on my way to become The Plugin Developer  And, as far as I remember, there were a lot more sample plugins included in 0.8.3 SDK. Where have they gone?...
Title: Developer Tutorials
Post by: the_LefthAND on 2006-04-01 00:00:19
Hi,

i'm a newbie in developing foobar plugin, and always I find people that use only Visual C++ to develop and compile foobar2000 plugin. What about using Mingw-32? Do somebody use it to compile foobar2000 plugins?

Bye,
the_lefThAND.
Title: Developer Tutorials
Post by: TrNSZ on 2006-04-01 03:57:57
[deleted]
Title: Developer Tutorials
Post by: foosion on 2006-04-01 10:56:53
Quote
GCC is not currently capable of compiling the source code due to bugs and missing C++ features.  Hopefully this situation will change one day.[a href="index.php?act=findpost&pid=377703"][{POST_SNAPBACK}][/a]
You will also need C++ ABI compatibility with Microsoft's compilers, not only for the vtable but also for C++ exceptions.

Quote
However, you should be aware that Microsoft Visual Studio Express and the required Platform SDK are both free downloads from Microsoft, for now.[a href="index.php?act=findpost&pid=377703"][{POST_SNAPBACK}][/a]
The Platform SDK has been free for quite some time; it contains the toolchain (including an optimizing compiler) and all the header files and stuff you need to produce Windows binaries.
Note that ATL or MFC are only available with the non-Express versions of Visual Studio; (some) resource editors are also missing in the Expresss version, in particular the dialog editor. Nonetheless, the resource compiler is included with the Platform SDK.
Title: Developer Tutorials
Post by: the_LefthAND on 2006-04-01 12:47:07
Thanks!

I didn't know these limits of gcc, so i will try to use visual c++ express.
Title: Developer Tutorials
Post by: andrei5008 on 2006-06-09 14:02:29
Hi,

is there any way to have the projects for Visual Studio 2003? Unfortuanatelly, VS2003 and VS 2005 can coexist peacefully on the same OS, and I really need 2003.

I tried to do build the projects manually, but unfortunatelly the tutorial give some compile error that doesn;t appear on 2005.
Title: Developer Tutorials
Post by: Florian on 2006-06-09 14:23:39
is there any way to have the projects for Visual Studio 2003? Unfortuanatelly, VS2003 and VS 2005 can coexist peacefully on the same OS, and I really need 2003.

The foobar2000 0.9 SDK is only available for Visual Studio 2005. There is also a freely available Express edition.
Title: Developer Tutorials
Post by: Moitah on 2006-07-17 06:55:16
Any idea why the DSP tutorial won't compile for me?  I'm using the 2006-06-22 SDK and get this error:

Code: [Select]
c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(321) : error C2259: 'service_impl_t<T>' : cannot instantiate abstract class
        with
        [
            T=dsp_tutorial_nopreset
        ]
        due to following members:
        'void dsp_impl_base_t<t_baseclass>::on_endoftrack(foobar2000_io::abort_callback &)' : is abstract
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(121) : see declaration of 'dsp_impl_base_t<t_baseclass>::on_endoftrack'
        with
        [
            t_baseclass=dsp_v2
        ]
        'void dsp_impl_base_t<t_baseclass>::on_endofplayback(foobar2000_io::abort_callback &)' : is abstract
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(127) : see declaration of 'dsp_impl_base_t<t_baseclass>::on_endofplayback'
        with
        [
            t_baseclass=dsp_v2
        ]
        'bool dsp_impl_base_t<t_baseclass>::on_chunk(audio_chunk *,foobar2000_io::abort_callback &)' : is abstract
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(133) : see declaration of 'dsp_impl_base_t<t_baseclass>::on_chunk'
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(318) : while compiling class template member function 'bool dsp_entry_impl_nopreset_t<T>::instantiate(service_ptr_t<dsp> &,const dsp_preset &)'
        with
        [
            T=dsp_tutorial_nopreset
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\service.h(406) : see reference to class template instantiation 'dsp_entry_impl_nopreset_t<T>' being compiled
        with
        [
            T=dsp_tutorial_nopreset
        ]
        c:\stuff\code\foobar2000 sdk 0.9.2\foobar2000\sdk\dsp.h(372) : see reference to class template instantiation 'service_factory_single_t<T>' being compiled
        with
        [
            T=dsp_entry_impl_nopreset_t<dsp_tutorial_nopreset>
        ]
        .\foo_dsp_tutorial.cpp(133) : see reference to class template instantiation 'dsp_factory_nopreset_t<T>' being compiled
        with
        [
            T=dsp_tutorial_nopreset
        ]
If I comment out these lines in the tutorial:

Code: [Select]
static dsp_factory_nopreset_t<dsp_tutorial_nopreset> foo_dsp_tutorial_nopreset;
..
static dsp_factory_t<dsp_tutorial> foo_dsp_tutorial;
Everything compiles fine.  But I kind of need those 2 lines .
Title: Developer Tutorials
Post by: Moitah on 2006-07-17 22:03:33
Nevermind, I got it (a few things need to be changed in the tutorial to make it compatible with the latest SDK).
Title: Developer Tutorials
Post by: andrei5008 on 2006-08-09 16:07:12
What about some documentation of the API? There are a lot of classes and functions, but except the these tutorials, there's no other inspiration source.
At least some DOXYGEN generated API summary.
Thanks.
Title: Developer Tutorials
Post by: Zastai on 2006-10-23 15:21:39
Hi,

is there any way to have the projects for Visual Studio 2003? Unfortuanatelly, VS2003 and VS 2005 can coexist peacefully on the same OS, and I really need 2003.

I tried to do build the projects manually, but unfortunatelly the tutorial give some compile error that doesn;t appear on 2005.


2003 & 2005 can work on same machine just fine - 2005 sets up explorer so that it opens solutions/projects with the same version that was used to create them.  Just be sure to install 2003 first.
Title: Developer Tutorials
Post by: AndyCar on 2006-11-16 18:23:00
Nevermind, I got it (a few things need to be changed in the tutorial to make it compatible with the latest SDK).


Moitah, could you please explain what did you do to the DSP tutorial to make it compile fine with the latest SDK?

Thanks
Title: Developer Tutorials
Post by: Spirit_of_the_ocean on 2006-11-27 16:10:34
I have one question: I want to modify the window in step 2 to see if  I understand at least a bit of what is in this tutorial.
I have Visual C++ Express 2005 Edition: How can I create a dll?
I am shure I read it in this somewhere in devellopers section but I can't find it anymore.
Title: Developer Tutorials
Post by: kanex on 2006-12-28 16:27:37

Nevermind, I got it (a few things need to be changed in the tutorial to make it compatible with the latest SDK).


Moitah, could you please explain what did you do to the DSP tutorial to make it compile fine with the latest SDK?

Thanks
Title: Developer Tutorials
Post by: Moitah on 2007-01-01 22:57:19
Sorry for taking so long to respond, I didn't see this until now.  I think I just had to add an extra parameter to some functions:

virtual bool on_chunk(audio_chunk * chunk) {
becomes
virtual bool on_chunk(audio_chunk * chunk, abort_callback &) {

virtual void on_endofplayback() {
becomes
virtual void on_endofplayback(abort_callback &) {

Also I see this function in my code which isn't in the tutorial, I'm not sure if it was required to make it work or not:

virtual void on_endoftrack(abort_callback &) {
Title: Developer Tutorials
Post by: Hancoque on 2007-04-28 15:38:40
@Moitah: I added the abort_callback parameter to the two functions but I still get a compile error. It seems that the implementation of the on_endoftrack function is required as you assumed. Can you (or anyone else) tell me how this function has to be implemented in foo_dsp_tutorial.cpp? I tried but didn't get it to work.

This is the exact compile error description:
Code: [Select]
c:\foobar2000\foobar2000\sdk\dsp.h(321) : error C2259: 'service_impl_t<T>' : cannot instantiate abstract class
        with
        [
            T=dsp_tutorial_nopreset
        ]
        due to following members:
        'void dsp_impl_base_t<t_baseclass>::on_endoftrack(foobar2000_io::abort_callback &)' : is abstract
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\foobar2000\foobar2000\sdk\dsp.h(121) : see declaration of 'dsp_impl_base_t<t_baseclass>::on_endoftrack'
        with
        [
            t_baseclass=dsp_v2
        ]
        c:\foobar2000\foobar2000\sdk\dsp.h(318) : while compiling class template member function 'bool dsp_entry_impl_nopreset_t<T>::instantiate(service_ptr_t<dsp> &,const dsp_preset &)'
        with
        [
            T=dsp_tutorial_nopreset
        ]
        c:\foobar2000\foobar2000\sdk\service.h(413) : see reference to class template instantiation 'dsp_entry_impl_nopreset_t<T>' being compiled
        with
        [
            T=dsp_tutorial_nopreset
        ]
        c:\foobar2000\foobar2000\sdk\dsp.h(372) : see reference to class template instantiation 'service_factory_single_t<T>' being compiled
        with
        [
            T=dsp_entry_impl_nopreset_t<dsp_tutorial_nopreset>
        ]
        c:\foobar2000\foobar2000\foo_dsp_tutorial\foo_dsp_tutorial.cpp(133) : see reference to class template instantiation 'dsp_factory_nopreset_t<T>' being compiled
        with
        [
            T=dsp_tutorial_nopreset
        ]
Title: Developer Tutorials
Post by: Hancoque on 2007-04-29 01:00:37
It's working now. I didn't notice that I had to implement the function two times (for each class). I thought the error was still there when it was in fact a new error coming from the second class. But right after that I got new compile errors. For now I have removed the second class (with presets). The class without presets compiles without any new errors. So I finally have *something* to start with.
Title: Developer Tutorials
Post by: foosion on 2007-07-03 12:37:15
Update to foo_tutorial1. The component now queries and uses the global setting for showing keyboard shortcuts in menus. Only the on_contextmenu method in steps 3 and 4 is affected.

Before:
Code: [Select]
        // Create a menu_manager that will build the context menu.
        service_ptr_t<contextmenu_manager> cmm;
        contextmenu_manager::g_create(cmm);
        // Set up flags for contextmenu_manager::init_context.
        // Initialize menu_manager for using a context menu.
        cmm->init_context(items, contextmenu_manager::FLAG_SHOW_SHORTCUTS);


After:
Code: [Select]
        // Create a menu_manager that will build the context menu.
        service_ptr_t<contextmenu_manager> cmm;
        contextmenu_manager::g_create(cmm);
        // Query setting for showing keyboard shortcuts.
        const bool show_shortcuts = config_object::g_get_data_bool_simple(standard_config_objects::bool_show_keyboard_shortcuts_in_menus, false);
        // Set up flags for contextmenu_manager::init_context.
        unsigned flags = show_shortcuts ? contextmenu_manager::FLAG_SHOW_SHORTCUTS : 0;
        // Initialize menu_manager for using a context menu.
        cmm->init_context(items, flags);
Title: Developer Tutorials
Post by: Tuzz on 2007-10-14 08:43:12
I managed to compile SDK, and SDK helpers, but i have errors compiling step1:
Code: [Select]
step1.obj : error LNK2019: symbole externe non résolu __imp__RegisterClassW@4 référencé dans la fonction "public: struct HWND__ * __thiscall window_tutorial1::create(struct HWND__ *)" (?create@window_tutorial1@@QAEPAUHWND__@@PAU2@@Z)
step1.obj : error LNK2019: symbole externe non résolu __imp__LoadCursorW@8 référencé dans la fonction "public: struct HWND__ * __thiscall window_tutorial1::create(struct HWND__ *)" (?create@window_tutorial1@@QAEPAUHWND__@@PAU2@@Z)

...

foobar2000_sdk_helpers.lib(window_placement_helper.obj) : error LNK2001: symbole externe non résolu __imp__IsWindow@4
foobar2000_sdk_helpers.lib(window_placement_helper.obj) : error LNK2019: symbole externe non résolu __imp__GetWindowPlacement@8 référencé dans la fonction "public: bool __thiscall cfg_window_placement::read_from_window(struct HWND__ *)" (?read_from_window@cfg_window_placement@@QAE_NPAUHWND__@@@Z)
Title: Developer Tutorials
Post by: foosion on 2007-10-14 10:05:55
The missing functions are from the Win32 API. Do you use Visual C++ 2005 Express? If so, you should check that the Windows SDK (previously called Microsoft Platform SDK) is installed correctly, specifically that the library directory is set up correctly in the IDE.
Title: Developer Tutorials
Post by: Tuzz on 2007-10-14 17:57:19
you're right, i've forget to modify a file
Title: Developer Tutorials
Post by: foosion on 2008-09-04 22:48:54
I've updated the DSP tutorial. It now compiles with the latest foobar2000 SDK. There is still a warning message about a deprecated dialog helper class from the SDK, I plan to get rid of that in the next version.
Title: Developer Tutorials
Post by: mccarver on 2009-06-08 19:38:42
Nevermind. Found what I was looking for 
Title: Developer Tutorials
Post by: grodriguez on 2009-06-26 02:52:45
Hey guys,

Maybe this is a really newbie question but here it goes.

I compiled and tested the tutorial component but is there an easier way of making modifications to it other than:

1. Modify
2. Compile
3. Close foobar
4. Copy .dll to components folder
5. Open foobar
6. Try

?

Cheers

G
Title: Developer Tutorials
Post by: Yirkha on 2009-06-26 10:53:45
Set output target directory to ...\foobar2000\components directly, or add a post-build step to copy it there, and set ...\foobar2000\foobar2000.exe as debugged process in project properties. Just hit F5 (Run) to do everything automagically each time after that.
Title: Developer Tutorials
Post by: grodriguez on 2009-07-07 01:33:30
Set output target directory to ...\foobar2000\components directly, or add a post-build step to copy it there, and set ...\foobar2000\foobar2000.exe as debugged process in project properties. Just hit F5 (Run) to do everything automagically each time after that.


Thanks Yirkha, I'll try that ...

G
Title: Developer Tutorials
Post by: foosion on 2009-10-23 20:12:49
I've updated the DSP tutorial. There was an old bug in the dsp_tutorial_nopreset::flush() method.
Title: Developer Tutorials
Post by: sunshine_fen on 2010-02-02 06:51:46
I'm a new on this part. Recently, I want to have a look of the development process.
I have download and installed,
-VC 2005
-Windows platform SDK

And get SDK-2010-01-19.zip. But when I unzip it, I can not find the "SDK-test" solution file.
Is there anything wrong?
Title: Developer Tutorials
Post by: Yirkha on 2010-02-14 15:50:56
No, the .sln file is just not bundled with this version. Create a solution yourself and add all the projects (search for *.vcproj).
Title: Developer Tutorials
Post by: sunshine_fen on 2010-02-25 04:07:00
Thanks Yirkha!
I have another problem,
Is there any method to debug the project?
How can I see the value/state of a parameter?
Title: Developer Tutorials
Post by: Yirkha on 2010-03-01 14:04:34
Yes, see this (http://yirkha.fud.cz/tmp/496351ef.tutorial-draft.html) (but note it's old, it might fairly outdated in some other regards).
Title: Developer Tutorials
Post by: Blood HaZaRd on 2010-04-11 20:56:17
Hi Foobares  . As i'm new here and really addicted to contribute into the devolepment of foobar, i was wandering if one momber of the commity could tell me what EDI we should install (microsoft visual 6, 2003, 2005 or later ) and others related staff !!

Thank you 
Title: Developer Tutorials
Post by: Blood HaZaRd on 2010-04-12 00:21:16
well, i downloaded MVS C++ Express edition 2008. and i tried to compile the foobar project but when compiling it told me to specify the name of the exec to use. COuld some one tell me or give a tuto or a little help to surpass this nooby handicap.
Title: Developer Tutorials
Post by: Girid on 2010-09-16 00:13:22
I have been developing a plugin that I finally got to a point where I would like to share it but when I switch the configuration over from debug to release in visual studio 2010, I get numerous errors for my project along the lines of "error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL':".  All of the separate components for the SDK compile fine in release mode, it is only when I try to make a component dll that I get these errors.  I have tried doing the same for the sample projects mentioned here and I get the same errors.  Has anyone seen this before or have any ideas about how I should go about fixing this?
Title: Developer Tutorials
Post by: Yirkha on 2010-09-16 00:20:17
You have part of the projects build with debug and part with release configurations. Make sure your Release configuration reference Release .libs of other components, that you don't force /D_DEBUG options for compiler even in Release configuration etc.
Title: Developer Tutorials
Post by: Girid on 2010-09-16 18:45:03
Thanks Yirkha.  For some reason when I was switching over to release, some of the projects were switching over to the Multi-Thread libraries and some to the Multi-Thread DLL libraries.  Just switched them all to the Multi-Thread and it worked fine.
Title: Developer Tutorials
Post by: popatr on 2011-01-13 16:54:30
I have seemingly successfully compiled the general component tutorial, and loaded it into foobar:
but when I start foobar (v1.1.1) I can't see the component's main menu item.  The component is visible in the components list and can display it's simple about form.
Title: Developer Tutorials
Post by: popatr on 2011-01-25 14:56:45
Nevermind my last post, I was incorrectly looking for a preferences dialog, not a link under the view menu where I should have been looking.
Title: Developer Tutorials
Post by: Ditchbuster on 2011-07-05 22:26:46
the link seems to be broken to download the General Component Tutorial.
Title: Developer Tutorials
Post by: foosion on 2011-07-06 06:14:40
the link seems to be broken to download the General Component Tutorial.
Fixed. Thanks for noticing.
Title: Developer Tutorials
Post by: Ditchbuster on 2011-07-06 16:42:30
the link seems to be broken to download the General Component Tutorial.
Fixed. Thanks for noticing.

Thanks for fixing!
Title: Re: Developer Tutorials
Post by: tipar on 2016-09-05 01:06:27
So, If I read all of this documentation I will be able to do a component from the scratch? If not, where can I look for that?
Title: Re: Developer Tutorials
Post by: aidivn on 2016-10-18 07:25:53
I want to read REM DISCNUMBER of cue file
Title: Re: Developer Tutorials
Post by: icepopo on 2016-12-30 19:41:34
I am having a problem with atl. I've installed the wtl and successfully compiled(and run) foo_sample. But I'm not able to make it work in a solution made from scratch. I added all the files from foo_sample to the solution, next set up the linker and added all the projects from sdk. It compiles fine, but when running in foobar I'm getting 'Internel error - one or more of the installed components have been damaged. How can I make it work?
Title: Re: Developer Tutorials
Post by: foosion on 2016-12-30 20:12:52
Have you added the required references under "Frameworks and references"? Right click the project "Solution explorer" and choose "References...". You'll need to add at least pfc, foobar2000_component_client and foobar2000_SDK. Most projects will additionally need foobar2000_sdk_helpers and foobar2000_ATL_helpers.

I'm not entirely sure what the error message means but it sounds like the DLL might lack the proper entrypoint function. This in turn would indicate that foobar2000_component_client is not linked into the DLL.
Title: Re: Developer Tutorials
Post by: kode54 on 2016-12-30 20:36:59
Perhaps it is a mismatched name to the component filename verification service, versus installing the component to the Application\components folder instead of Configuration\user-components\foo_component_name?

Also, that service is always a good idea if you ever care about receiving crash reports, as it can be bothersome loading minidumps where the DLLs have been renamed from your original build filenames.
Title: Re: Developer Tutorials
Post by: icepopo on 2016-12-30 20:47:30
Perhaps it is a mismatched name to the component filename verification service, versus installing the component to the Application\components folder instead of Configuration\user-components\foo_component_name?

Also, that service is always a good idea if you ever care about receiving crash reports, as it can be bothersome loading minidumps where the DLLs have been renamed from your original build filenames.
I wouldn't think that that service exists! Thanks for the help.
Title: Re: Developer Tutorials
Post by: kode54 on 2016-12-30 21:24:56
VALIDATE_COMPONENT_FILENAME is the macro, it declares an implementation of the component validation service, styled to check your filename on disk. It can be expanded through more complex means to perform more thorough verification, although filename is usually all you need to care about for minidump concerns.
Title: Re: Developer Tutorials
Post by: magicgoose on 2018-10-23 09:34:58
Is there something similar for Android version of foobar2000?
Title: Re: Developer Tutorials
Post by: Case on 2018-10-23 11:00:56
No. Mobile versions don't support third party components. I'm pretty sure it's not even allowed, certainly not allowed for Apple Store.
Title: Re: Developer Tutorials
Post by: magicgoose on 2018-10-24 15:16:02
There's a lot of things that Apple doesn't allow but fortunately this doesn't affect Android.
On Google Play & Android it's possible to add extra modules as separate APK files if they are published and signed by the same person. So the foobar2000 author will need to upload them in the end, but they can be developed by someone else.
Deadbeef player (Android version) used this mechanism to offer extra decoder pack as a separate APK.
Title: Re: Developer Tutorials
Post by: lvqcl on 2018-10-24 17:30:17
On Google Play & Android it's possible to add extra modules as separate APK files if they are published and signed by the same person. So the foobar2000 author will need to upload them in the end, but they can be developed by someone else.
So, foobar2000 author will be responsible for those 3rd party plugins made by unknown authors? Sounds like a bad idea.
Title: Re: Developer Tutorials
Post by: AndreaT on 2020-03-25 13:56:04
Hi All, ... sorry for disturbing you but... I am new attempting to getting started in developing a plug-in (4ch Cross-Over with Phase Arbitrator).

Unfortunately it is since 1997 I don't write code in C/C++, but this is not the biggest issue I want to talk about now.
My today post is regarding Visual Studio 2019 set-up and the Foobar tutorial.

I see your Tutorial is quite dated, back to 2010 or so, and there is no reference to the new 2019 SDK or API for the last Foobar 1.5.x: is it still current? Have to start from there?

Would you be so kind to address me on how to correctly install the 2019 SDK along with VS 2019 Community Ed and how to start learning in the best way about the actual Foobar SDK 2019/API 1.5?
I already installed VS 2019 Community Edition adding only the Windows C/C++ Desktop Application Dev Env and I have also downloaded the Foobar SDK but not yet copied anywhere to avoid mistakes.

Many thanks and kind regards, Andrea
Title: Re: Developer Tutorials
Post by: Tam Lin on 2020-03-27 23:10:28
@AndreaT, I just endured the pain of migrating from VS2008 with foobar SDK 2010 to VS2019 with the latest foobar SDK. I wouln't bother with the old tutorial, but rely on the sample code that is included in the SDK. The foobar transition involving a single DSP plugin was rather painless. The VS transition was difficult because I don't know much C++ and my C programming style dates back to K&R, which VS didn't like at all.

Regarding the 2019 install, I think all you need in addition to the Desktop C++ support is ATL and MFC for v142 and v141 build tools. At least, that seems to work for me.
Title: Re: Developer Tutorials
Post by: AndreaT on 2020-03-28 13:16:51
@AndreaT, I just endured the pain of migrating from VS2008 with foobar SDK 2010 to VS2019 with the latest foobar SDK. I wouln't bother with the old tutorial, but rely on the sample code that is included in the SDK. The foobar transition involving a single DSP plugin was rather painless. The VS transition was difficult because I don't know much C++ and my C programming style dates back to K&R, which VS didn't like at all.

Regarding the 2019 install, I think all you need in addition to the Desktop C++ support is ATL and MFC for v142 and v141 build tools. At least, that seems to work for me.


Hello @Tam Lin, thanks for your info and tips.
Kind regards, Andrea
Title: Re: Developer Tutorials
Post by: AndreaT on 2020-03-31 09:50:51
Hello @Tam Lin , as per your tips, I installed also MSVC v141 package and, because I got also the stable Win 10 SDK 10.0.1.17763.0.
The ATL C++ package was already installed by default.

However, even so, I am getting strange errors as reported in the screenshots herein attached.
Very strange also the error about the missing Windows SDK ver 10, because I installed 2 Windows SDK, the last stable and the current preview.
Please, would you be so kind to share with me your VS 2019 setup/configuration?
Or can you help me fixing these problems?
Kind regards, Andrea
Title: Re: Developer Tutorials
Post by: Case on 2020-03-31 13:38:48
You can install the XP compatible toolset or change Platform Toolset under project properties to something you actually have installed. Change the Windows SDK to a version you have while you're there.
Title: Re: Developer Tutorials
Post by: AndreaT on 2020-04-01 17:40:17
You can install the XP compatible toolset or change Platform Toolset under project properties to something you actually have installed. Change the Windows SDK to a version you have while you're there.

Hello @Case , thanks for your tips.
Unfortunately, within the VS2019 options, I cannot find any XP target platform. It may it is not so labelled.
Can you see it among the options I listed in the "VS 2019 installed packages.jpg" screenshot I provided?

I also tried to retarget the entire project following the "instruction" given in the error message.
However, doing so, the compiler tells me that I shall have to retarget also the entire Foobar SDK and I don't know if it is good to do.
Also for this matter, if you have any suggestion, please tell me.

Thanks and regards, Andrea
Title: Re: Developer Tutorials
Post by: marc2k3 on 2020-04-01 18:43:10
Use this slightly modified copy of the SDK. It's pre-configured for VS2019 and should just work(tm)....

https://github.com/marc2k3/foobar2000-sdk

If you're not familiar with git, just use the green button to download the zip.

Title: Re: Developer Tutorials
Post by: AndreaT on 2020-04-02 15:32:31
Use this slightly modified copy of the SDK. It's pre-configured for VS2019 and should just work(tm)....
https://github.com/marc2k3/foobar2000-sdk
If you're not familiar with git, just use the green button to download the zip.

Hello @snotlicker , thanks for your help!
Regards, Andrea
Title: Re: Developer Tutorials
Post by: Tam Lin on 2020-04-02 16:07:14
Unfortunately, within the VS2019 options, I cannot find any XP target platform. It may it is not so labelled.
Can you see it among the options I listed in the "VS 2019 installed packages.jpg" screenshot I provided?
 
 As I explained, you have to install MFC, ATL, and the v141 (VS2017) tool set. All that is done in the initial VS2019 installation dialog, e.g. when you selected the C++ desktop components. In other words, run Visual Studio Installer again and select modify. The v141 checkbox is near the end of the list of options.
Title: Re: Developer Tutorials
Post by: AndreaT on 2020-04-03 09:30:47
Unfortunately, within the VS2019 options, I cannot find any XP target platform. It may it is not so labelled.
Can you see it among the options I listed in the "VS 2019 installed packages.jpg" screenshot I provided?

 As I explained, you have to install MFC, ATL, and the v141 (VS2017) tool set. All that is done in the initial VS2019 installation dialog, e.g. when you selected the C++ desktop components. In other words, run Visual Studio Installer again and select modify. The v141 checkbox is near the end of the list of options.

Hello @Tam Lin, thanks but as I replied to you in post #62, I already installed all the packages you suggested to install as I had care to show in the screenshot i posted as "VS 2019 - Installed packages.jpg".
So, I have to suppose you did also something else in order to get all running smooth.
Regards, Andrea
Title: Re: Developer Tutorials
Post by: Tam Lin on 2020-04-03 13:51:22
AndreaT,
My VS2019 install includes:
Windows 10 SDK (10.0.18362.0)
Just-In-Time debugger
C++ profiling tools
C++ CMake tools for Windows
C++ ATL for latest v142 build tools (x86 & x64)
C++ MFC for latest v142 build tools (x86 & x64)
MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)

I am using foobar SDK 2019-06-30
Title: Re: Developer Tutorials
Post by: Tam Lin on 2020-04-20 19:22:25
What I didn't realize is the most important difference between AndreaT's VS2019 configuration and mine is I also have VS2017 installed.

When I upgraded from VS2008, and foobar SDK 2010, I first installed VS2017 because the latest foobar SDK is a 2017 solution and should offer the fewest compatibility problems. That was true except I didn't like VS2017. I then tried VS2019. I liked it better than VS2017 and I continued to use it without problems.

A couple days ago I did a system cleanup and deleted unused files and apps, including VS2017. After that I couldn't compile my foobar plugin. Apparently, when VS2019 is installed it 'borrows' the VS2017 tool chain that includes XP support. I had to reinstall both VS2017 and VS2019 to get everything working again.
Title: Re: Developer Tutorials
Post by: kode54 on 2020-04-21 01:38:06
You can install the v141_xp SDK with Visual Studio 2019's installer.
Title: Re: Developer Tutorials
Post by: Tam Lin on 2020-04-21 17:24:53
Yes, I selected v141 when I installed VS2019 but it does not include XP support. Although all VS2017 installs include v141, XP support is a separate selection item for VS2017 installs and that item is not available for VS2019.
Title: Re: Developer Tutorials
Post by: marc2k3 on 2020-04-21 17:50:59
It is there for VS2019 but nobody I don't think anyone should be installing it this late in the game.

(https://i.imgur.com/CtOLbwv.png)

If you've been maintaining components since XP was a "thing" then it's probably not much effort but for anyone starting out, just install the v142 toolset, update the SDK projects and be done with it.

Random comment/tip: to avoid installing MFC, you can update any .rc files by including windows.h instead of afxres.h
Title: Re: Developer Tutorials
Post by: Forfit on 2020-04-21 20:28:39
Do it is difficult the source code to run a context menu item programmatically?
Title: Re: Developer Tutorials
Post by: dchester@charter.net on 2020-05-14 01:10:40
I mostly just wanted to say thanks to people, as using info from the recent posts, I have been able to get Visual Studio 2019 to compile foo_sample in the  SDK, and it appears to work with Foobar.  Now for the hard part, figuring out how to learn enough to code my planned component. 
Basically, I have the desire to capture the title, artist, & genre from both the prior and next songs of the current playlist,  Then create Title Formatting fields to put them into, so that I can display them, via the foo_osd On-Screen Display component, (along with the current song info, that I already display). 
Any suggestions are welcome.  Wish me luck.
Thanks again.
Title: Re: Developer Tutorials
Post by: hudson4351 on 2022-03-25 20:49:06
Are there any updated foobar2000 component developer tutorials available? The link in the top post (https://foosion.foobar2000.org/0.9/tutorials/#general) doesn't seem to actually contain any tutorials. Searching google is only returning links that describe how to setup foobar2000, not how to develop components.