Help - Search - Members - Calendar
Full Version: What's the prerequisite(in terms of knowledge) to code a foobar200
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
Valeron
Hi, I'm going to write a DSP plugin for foobar2000. I wonder what programming knowledge I must know.
I know there's SDK readme and tutorial sticked in
I've just learned win32 API. Is familiar with DirectShow required? I haven't read that yet. Or there's other required knowledge?
Thanks.
Canar
You must be comfortable with templates. For anything that involves any UI coding, including preferences pages, you must be comfortable with Win32 API.
Valeron
Thank you for your info. I'll review the C++ logic.
Since I'm going to work on a DSP, don't I have to know something about DirectShow? Or if I just have to read foobar2000's API?
Canar
QUOTE (Valeron @ Apr 4 2009, 19:23) *
Since I'm going to work on a DSP, don't I have to know something about DirectShow? Or if I just have to read foobar2000's API?
You don't need to know anything about DirectShow. foobar2000 uses its own, proprietary DSP format.
Valeron
Thanks again smile.gif . I know how to go on now.
Yirkha
Maybe you know but I'll mention it anyway for completeness of the topic - don't miss foosion's DSP Tutorial Component, provided with plenty of insightful comments.
Canar
Yirkha, do you still have that patch that makes the tutorial component use WTL?
Yirkha
You sure remember a lot smile.gif Yes, I found it.

WTLized dialog class:
CODE
// Our configuration dialog is implemented as a WTL modal dialog.
class dialog_dsp_tutorial : public CDialogImpl<dialog_dsp_tutorial>
{
public:
enum {
IDD = IDD_CONFIG
};

BEGIN_MSG_MAP_EX(dialog_dsp_tutorial)
MSG_WM_INITDIALOG(OnInitDialog)
MSG_WM_HSCROLL(OnHScroll)
MSG_WM_COMMAND(OnCommand)
END_MSG_MAP()

public:
dialog_dsp_tutorial(const dsp_preset & p_data, dsp_preset_edit_callback & p_callback)
: m_old_data(p_data), m_callback(p_callback), m_dirty(false)
{
m_params.set_data(m_old_data);
}

protected:
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
CTrackBarCtrl slider(GetDlgItem(IDC_SLIDER));
slider.SetRange(-50, 200);
slider.SetPos(m_params.m_percent);
slider.SetTicFreq(25);
update_display();
return FALSE;
}

void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
{
m_dirty = true;
update_display();
}

void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
{
switch(nID) {
case IDOK:
EndDialog(1);
break;

case IDCANCEL:
m_callback.on_preset_changed(m_old_data);
EndDialog(0);
break;
}
}

//---

void update_display()
{
CTrackBarCtrl slider(GetDlgItem(IDC_SLIDER));
m_params.m_percent = slider.GetPos();

if (m_dirty) {
dsp_preset_impl data;
m_params.get_data(data);
m_callback.on_preset_changed(data);
m_dirty = false;
}

uSetDlgItemText(m_hWnd, IDC_STATIC_DISPLAY, pfc::string_formatter() << pfc::format_int(m_params.m_percent) << "%");
}

protected:
bool m_dirty;
const dsp_preset & m_old_data;
t_dsp_tutorial_params m_params;
dsp_preset_edit_callback & m_callback;
};
Then in the main class below:
CODE
        static void g_show_config_popup(const dsp_preset & p_data, HWND p_parent, dsp_preset_edit_callback & p_callback) {
                t_dsp_tutorial_params params;
                if (params.set_data(p_data)) {
                        dialog_dsp_tutorial dlg(p_data, p_callback);
                        dlg.DoModal(p_parent); // <== CHANGED
                }
        }
mudlord
QUOTE ("Canar")
You must be comfortable with templates.


Not to mention derived classes.

QUOTE
Or if I just have to read foobar2000's API?


You just need to read the SDK.
Of course, signal processing knowledge will help a lot.
Found that extremely useful for my private reverb component for 0.9
foosion
QUOTE (mudlord @ Apr 6 2009, 04:00) *
QUOTE ("Canar")
You must be comfortable with templates.


Not to mention derived classes.
Obviously, but inheritance is a much easier concept than templates. wink.gif
Valeron
Thanks for all your help. I'm on the way now...
Hopefully I can get it to work in the near future.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.