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: Can't for the life of me figure out how to set up the SDK with vis (Read 5799 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Can't for the life of me figure out how to set up the SDK with vis

Can someone give me a step by step guide to setting up the foobar SDK with visual studio 2010? The tutorials I found are either completely out of date, or just say "to do, write tutorial".

I have no experience with setting up SDKs and I can't seem to figure it out. All I'm trying to figure out is how to set up the SDK and compile a plugin that says "it works" when its installed.

Can't for the life of me figure out how to set up the SDK with vis

Reply #1
77 views and no replies? Can anyone help me out? I wish SDKs weren't setup for only extremely experienced programmers. I'm pretty sure I can write the plugin I want to make, but I cant figure out how to set up the SDK.

Can't for the life of me figure out how to set up the SDK with vis

Reply #2
Since the SDK did not provide all the VS2008 project files necessary, I had to do a little bit of legwork to get the sample component working.  You should be able to convert my project file to a VS2010 project pretty easily.  Here is what I did; it is a bit unorthodox, but it cut out all the guesswork as to whether I should include helpers, ATLHelpers, etc. and saves me from managing several projects.  I set up the following file structure (my solution contains other project files, hence the extra directory layer):

<basedir>\foobar2k.vcproj -- .vcxproj for VS2010 and up
<basedir>\foobar2k\
<basedir>\foobar2k\sdk\  -- unzip the SDK into this directory in its entirety
<basedir>\foobar2k\src\
<basedir>\foobar2k\src\Main.cpp
<basedir>\foobar2k\src\Resources.h
<basedir>\foobar2k\src\Resources.rc
<basedir>\foobar2k\src\StdAfx.cpp
<basedir>\foobar2k\src\StdAfx.h

foobar2k.vcproj looks like the following for me.  You could easily add the sample sources and build the sample component instead.
Code: [Select]
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="foobar2k"
ProjectGUID="{85FBFD09-0099-4FE9-9DB6-78DB6F60F817}"
RootNamespace="foobar2k"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ProjectName)\out"
IntermediateDirectory="$(ProjectName)\obj"
ConfigurationType="2"
CharacterSet="1"
DeleteExtensionsOnClean=""
ExcludeBuckets="5;6;8;10;13;14;15;16;18"
>
<Tool
Name="VCPreBuildEventTool"
Description="Deleting $(TargetFileName) from player directory..."
CommandLine="ERASE /F /Q &quot;C:\Program Files\foobar2000\components\$(TargetFileName)&quot;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="$(ProjectName)\sdk"
PreprocessorDefinitions="NOMINMAX;WIN32;_WIN32_WINNT=0x501"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4652"
ErrorReporting="0"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="shared.lib shell32.lib user32.lib $(NOINHERIT)"
OutputFile="$(OutDir)\foo_sample.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="$(ProjectName)\sdk\foobar2000\shared"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
ErrorReporting="0"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying $(TargetFileName) to player directory..."
CommandLine="COPY /B /Y &quot;$(TargetPath)&quot; &quot;C:\Program Files\foobar2000\components\&quot;"
/>
</Configuration>
</Configurations>
<Files>
<File
RelativePath=".\foobar2k\src\Main.cpp"
>
</File>
<File
RelativePath=".\foobar2k\src\Resources.h"
>
</File>
<File
RelativePath=".\foobar2k\src\Resources.rc"
>
</File>
<File
RelativePath=".\foobar2k\src\StdAfx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
WarningLevel="3"
DisableSpecificWarnings="4995;4996"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\foobar2k\src\StdAfx.h"
>
</File>
</Files>
</VisualStudioProject>
Main.cpp is where the component is defined and initquit lives.  It starts out like this:
Code: [Select]
#include "StdAfx.h"

#include <foobar2000/foobar2000_component_client/component_client.cpp>

DECLARE_COMPONENT_VERSION(...);

class Main : public initquit
{
public:
void on_init();
void on_quit();
};

static const initquit_factory_t<Main> initquit_factory_g;
...

Resources.h and Resources.rc are standard resource files for version, dialog, etc.

StdAfx.h is the precompiled header.  It pulls in all the foobar2000 SDK headers like so:
Code: [Select]
#include <foobar2000/ATLHelpers/ATLHelpers.h> // includes all foobar2000 headers

StdAfx.cpp is marked as the file for generating the precompiled headers and also imports all foobar2000 SDK sources like so:
Code: [Select]
#include "StdAfx.h"

#include <foobar2000/SDK/abort_callback.cpp>
#include <foobar2000/SDK/advconfig.cpp>
#include <foobar2000/SDK/album_art.cpp>
#include <foobar2000/SDK/app_close_blocker.cpp>
#include <foobar2000/SDK/audio_chunk.cpp>
#include <foobar2000/SDK/audio_chunk_channel_config.cpp>
#include <foobar2000/SDK/cfg_var.cpp>
#include <foobar2000/SDK/chapterizer.cpp>
#include <foobar2000/SDK/commandline.cpp>
#include <foobar2000/SDK/completion_notify.cpp>
#include <foobar2000/SDK/config_object.cpp>
#include <foobar2000/SDK/console.cpp>
#include <foobar2000/SDK/dsp.cpp>
#include <foobar2000/SDK/dsp_manager.cpp>
#include <foobar2000/SDK/file_info.cpp>
#include <foobar2000/SDK/file_info_impl.cpp>
#include <foobar2000/SDK/file_info_merge.cpp>
#include <foobar2000/SDK/file_operation_callback.cpp>
#include <foobar2000/SDK/filesystem.cpp>
#include <foobar2000/SDK/filesystem_helper.cpp>
#include <foobar2000/SDK/guids.cpp>
#include <foobar2000/SDK/hasher_md5.cpp>
#include <foobar2000/SDK/input.cpp>
#include <foobar2000/SDK/input_file_type.cpp>
#include <foobar2000/SDK/link_resolver.cpp>
#include <foobar2000/SDK/mainmenu.cpp>
#include <foobar2000/SDK/mem_block_container.cpp>
#include <foobar2000/SDK/menu_helpers.cpp>
#include <foobar2000/SDK/menu_item.cpp>
#include <foobar2000/SDK/menu_manager.cpp>
#include <foobar2000/SDK/metadb.cpp>
#include <foobar2000/SDK/metadb_handle.cpp>
#include <foobar2000/SDK/metadb_handle_list.cpp>
#include <foobar2000/SDK/packet_decoder.cpp>
#include <foobar2000/SDK/playable_location.cpp>
#include <foobar2000/SDK/playback_control.cpp>
#include <foobar2000/SDK/playlist.cpp>
#include <foobar2000/SDK/playlist_loader.cpp>
#include <foobar2000/SDK/popup_message.cpp>
#include <foobar2000/SDK/preferences_page.cpp>
#include <foobar2000/SDK/replaygain.cpp>
#include <foobar2000/SDK/replaygain_info.cpp>
#include <foobar2000/SDK/service.cpp>
#include <foobar2000/SDK/tag_processor.cpp>
#include <foobar2000/SDK/tag_processor_id3v2.cpp>
#include <foobar2000/SDK/threaded_process.cpp>
#include <foobar2000/SDK/titleformat.cpp>
#include <foobar2000/SDK/ui.cpp>
#include <foobar2000/SDK/ui_element.cpp>

#include <foobar2000/helpers/clipboard.cpp>
#include <foobar2000/helpers/create_directory_helper.cpp>
#include <foobar2000/helpers/cue_creator.cpp>
#include <foobar2000/helpers/cue_parser.cpp>
#include <foobar2000/helpers/cue_parser_embedding.cpp>
#include <foobar2000/helpers/cuesheet_index_list.cpp>
#include <foobar2000/helpers/dialog_resize_helper.cpp>
#include <foobar2000/helpers/dropdown_helper.cpp>
#include <foobar2000/helpers/dynamic_bitrate_helper.cpp>
#include <foobar2000/helpers/file_info_const_impl.cpp>
#include <foobar2000/helpers/file_list_helper.cpp>
#include <foobar2000/helpers/file_move_helper.cpp>
#include <foobar2000/helpers/file_wrapper_simple.cpp>
//#include <foobar2000/helpers/filetimetools.cpp>
#include <foobar2000/helpers/IDataObjectUtils.cpp>
#include <foobar2000/helpers/input_helpers.cpp>
#include <foobar2000/helpers/listview_helper.cpp>
#include <foobar2000/helpers/metadb_io_hintlist.cpp>
#include <foobar2000/helpers/mp3_utils.cpp>
#include <foobar2000/helpers/seekabilizer.cpp>
#include <foobar2000/helpers/stream_buffer_helper.cpp>
#include <foobar2000/helpers/text_file_loader.cpp>
#include <foobar2000/helpers/VisUtils.cpp>
#include <foobar2000/helpers/wildcard.cpp>
#include <foobar2000/helpers/win32_dialog.cpp>
#include <foobar2000/helpers/win32_misc.cpp>
#include <foobar2000/helpers/window_placement_helper.cpp>

#include <foobar2000/ATLHelpers/AutoComplete.cpp>
#include <foobar2000/ATLHelpers/CDialogResizeHelper.cpp>
#include <foobar2000/ATLHelpers/inplace_edit.cpp>
#include <foobar2000/ATLHelpers/inplace_edit_v2.cpp>
#include <foobar2000/ATLHelpers/misc.cpp>

#include <pfc/base64.cpp>
#include <pfc/bsearch.cpp>
#include <pfc/guid.cpp>
#include <pfc/other.cpp>
#include <pfc/pathUtils.cpp>
#include <pfc/printf.cpp>
#include <pfc/profiler.cpp>
#include <pfc/selftest.cpp>
#include <pfc/sort.cpp>
#include <pfc/string.cpp>
#include <pfc/string_conv.cpp>
#include <pfc/stringNew.cpp>
#include <pfc/threads.cpp>
#include <pfc/utf8.cpp>
There was a conflict between one of the cue file sources and filetimetools, so I had to comment one of the two out.  A simple edit to either would alleviate the problem, but I wanted to be able to take the SDK in with zero edits.

Cry foul if you like, but it builds my component DLL successfully and I don't need to fuss with any of the SDK project files.

Can't for the life of me figure out how to set up the SDK with vis

Reply #3
Thank you for taking the time to help me, I really appreciate it. I did all the above and the compile error I am getting is
"Error   1   error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source file   c:\users\paul\documents\visual studio 2010\foobar2k\sdk\pfc\avltree.h   98"
Googleing that shows that its caused by the program not being set up to work with precompiled headers, and the suggestion is to go to the properties of StdAfx.cpp, and in precompiled header, select "Create (/Yc)". But it is already set to that. Any idea on how to fix this problem?

Also, just so I understand, all the code for the component should be written in the Main.cpp? What would that main.cpp code you showed me do?

Can't for the life of me figure out how to set up the SDK with vis

Reply #4
When using pre-compiled headers, Visual Studio tries to enforce that each source code file (usually .cpp) has '#include "StdAfx.h"' at the beginning.  I believe this is what the error is about.  The project example I gave is already setup for pre-compiled headers.  If you have added any extra source files to the project, make sure to include the PCH at the top.

You could add all your code to Main.cpp if you'd like.  I would not recommend it, but it is possible.  My Main.cpp file only contains an initquit implementation.  I have other cpp files in my project, but removed all the excess to give you the simplest example possible.

Are you compiling in Visual Studio 2010?  It might be worth zipping up what you have and sending it my way so I can see if there were any typos made or if VS2010 is not happy with this use of pre-compiled headers and source file inclusion.

Can't for the life of me figure out how to set up the SDK with vis

Reply #5
When using pre-compiled headers, Visual Studio tries to enforce that each source code file (usually .cpp) has '#include "StdAfx.h"' at the beginning.  I believe this is what the error is about.  The project example I gave is already setup for pre-compiled headers.  If you have added any extra source files to the project, make sure to include the PCH at the top.

You could add all your code to Main.cpp if you'd like.  I would not recommend it, but it is possible.  My Main.cpp file only contains an initquit implementation.  I have other cpp files in my project, but removed all the excess to give you the simplest example possible.

Are you compiling in Visual Studio 2010?  It might be worth zipping up what you have and sending it my way so I can see if there were any typos made or if VS2010 is not happy with this use of pre-compiled headers and source file inclusion.


Sorry I didn't update the post, I figured out I was missing a #include "StdAfx.h and it compiles now. I really appreciate you helping me getting this set up, but at this point I've realized writing a plugin for foobar is way over my skill level. I can think of the logic behind the plugin I want to make, but I don't know where to even start writing the code for foobar. I'm really disappointed in the documentation for the SDK, it seems the only way of learning how to write for foobar is to look through all the cpp files in the SDK and trying to figure out how to do what you want to do from those. I really wish I could find the code for how the shuffle and random play modes work, because that would help me a lot, but at least from what I can tell, that code isn't released.

Can't for the life of me figure out how to set up the SDK with vis

Reply #6
Everything you want to know about the visualization subsystem is in SDK/vis.h. The visualization service activates any time a component queries it for sample and optionally FFT data. As a component, you implement a GUI of some sort, which would involve writing something related to ui_element.h services.

For a silly example of a visualizer that doesn't use the visualization subsystem, you can check vis_spc.cpp of my own foo_gep component, which implements a UI Element based on a rip-off of the Super Jukebox SPC-700 status display. It triggers updates entirely on the SPC input firing off dynamic metadata, and renders a GDI window, which may either exist as a UI Element, or as a pop-up visualization window similar to the core's Spectrogram/Oscilloscope/etc visualizations. It doesn't support a fullscreen mode, though.

It could easily be followed for designing the GUI portions of a visualization element, and modified to use WM_TIMER or some other mechanism to perform timed updates. That squares rendering a window and displaying something. All you really need from there is to poll the visualization subsystem on those timed intervals for sample and optionally FFT data. It supports polling for whatever latency position you want, relative to what the user is currently hearing. The visualization subsystem takes care of buffering sample data and polling the output and DSP chain for latency for you. If you have a zero latency display, you can ask it for zero latency sample/fft data. Or, you can ask it for data a few milliseconds ahead of the output, if you need processing or rendering overhead before the data you request is actually displayed.

Can't for the life of me figure out how to set up the SDK with vis

Reply #7
Everything you want to know about the visualization subsystem is in SDK/vis.h. The visualization service activates any time a component queries it for sample and optionally FFT data. As a component, you implement a GUI of some sort, which would involve writing something related to ui_element.h services.

For a silly example of a visualizer that doesn't use the visualization subsystem, you can check vis_spc.cpp of my own foo_gep component, which implements a UI Element based on a rip-off of the Super Jukebox SPC-700 status display. It triggers updates entirely on the SPC input firing off dynamic metadata, and renders a GDI window, which may either exist as a UI Element, or as a pop-up visualization window similar to the core's Spectrogram/Oscilloscope/etc visualizations. It doesn't support a fullscreen mode, though.

It could easily be followed for designing the GUI portions of a visualization element, and modified to use WM_TIMER or some other mechanism to perform timed updates. That squares rendering a window and displaying something. All you really need from there is to poll the visualization subsystem on those timed intervals for sample and optionally FFT data. It supports polling for whatever latency position you want, relative to what the user is currently hearing. The visualization subsystem takes care of buffering sample data and polling the output and DSP chain for latency for you. If you have a zero latency display, you can ask it for zero latency sample/fft data. Or, you can ask it for data a few milliseconds ahead of the output, if you need processing or rendering overhead before the data you request is actually displayed.


I'm not trying to do anything gui based, or with the visualization system, I'm trying to improve how shuffle works.

Can't for the life of me figure out how to set up the SDK with vis

Reply #8
Oh crap, I misread your truncated Visual Studio as visualizations.

Yeah but, no but, yeah but, no but.... No, you can't actually implement a modified shuffle with the public SDK. You could suggest design ideas or rules for the only shuffle that exists, which is built into the core of the player.

Can't for the life of me figure out how to set up the SDK with vis

Reply #9
Oh crap, I misread your truncated Visual Studio as visualizations.

Yeah but, no but, yeah but, no but.... No, you can't actually implement a modified shuffle with the public SDK. You could suggest design ideas or rules for the only shuffle that exists, which is built into the core of the player.


Well, if I was a good enough programmer, couldn't I make the plugin make a new playback, which would be shuffle just with the changes I want to do to it? That would bypass the native shuffle completely.