Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Developer Tutorials (Read 140354 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Developer Tutorials

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


DSP Component Tutorial
This tutorial explains how to implement a DSP service - either with presets or without.
  • Tutorial DSP without presets
    This DSP does not alter the signal, but mangles with chunks for the sake of it.
  • Tutorial DSP with presets
    The focus here is on how to support presets in a DSP. Adapted from foo_dsp_delta's "Noise sharpening" DSP with kind permission from Marc Heubeck.
Download

Developer Tutorials

Reply #1
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?
I'm on a horse.

Developer Tutorials

Reply #2
No, I think you have found I bug there. I'll try to confirm (and fix) this later.

Developer Tutorials

Reply #3
  • Fixed foo_tutorial1
  • Added precompiled binaries for foo_tutorial1
  • Added DSP tutorial

Developer Tutorials

Reply #4
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?

Developer Tutorials

Reply #5
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.

Developer Tutorials

Reply #6
[deleted]

Developer Tutorials

Reply #7
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?...

Developer Tutorials

Reply #8
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.

Developer Tutorials

Reply #9
[deleted]

Developer Tutorials

Reply #10
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.

Developer Tutorials

Reply #11
Thanks!

I didn't know these limits of gcc, so i will try to use visual c++ express.

 

Developer Tutorials

Reply #12
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.

Developer Tutorials

Reply #13
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.

Developer Tutorials

Reply #14
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 .

Developer Tutorials

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

Developer Tutorials

Reply #16
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.

Developer Tutorials

Reply #17
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.

Developer Tutorials

Reply #18
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

Developer Tutorials

Reply #19
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.


Developer Tutorials

Reply #21
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 &) {

Developer Tutorials

Reply #22
@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
        ]

Developer Tutorials

Reply #23
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.

Developer Tutorials

Reply #24
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);