Skip to content

Commit

Permalink
Update the foobar2000 SDK to version 20230913
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesh committed Jul 14, 2024
1 parent ecc0b42 commit a9f147d
Show file tree
Hide file tree
Showing 282 changed files with 14,646 additions and 1,970 deletions.
32 changes: 18 additions & 14 deletions 3rdparty/foo_SDK/foobar2000/SDK/abort_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,56 +50,59 @@ class NOVTABLE abort_callback
void waitForEvent(pfc::eventHandle_t evtHandle);
//! Waits for an event. Returns once the event became signaled; throw exception_aborted if abort occurred first.
void waitForEvent(pfc::event& evt);

abort_callback( const abort_callback & ) = delete;
void operator=( const abort_callback & ) = delete;
protected:
abort_callback() {}
~abort_callback() {}
};



//! Implementation of abort_callback interface.
//! Standard implementation of abort_callback interface.
class abort_callback_impl : public abort_callback {
public:
abort_callback_impl() : m_aborting(false) {}
abort_callback_impl() {}
inline void abort() {set_state(true);}
inline void set() {set_state(true);}
inline void reset() {set_state(false);}

void set_state(bool p_state) {m_aborting = p_state; m_event.set_state(p_state);}

bool is_aborting() const {return m_aborting;}
bool is_aborting() const override {return m_aborting;}

abort_callback_event get_abort_event() const {return m_event.get_handle();}
abort_callback_event get_abort_event() const override {return m_event.get_handle();}

private:
abort_callback_impl(const abort_callback_impl &) = delete;
const abort_callback_impl & operator=(const abort_callback_impl&) = delete;

volatile bool m_aborting;
volatile bool m_aborting = false;
pfc::event m_event;
};


//! Alternate abort_callback implementation, supply your own event handle to signal abort. \n
//! Slightly less efficient (is_aborting() polls the event instead of reading a bool variable).
class abort_callback_usehandle : public abort_callback {
public:
abort_callback_usehandle( abort_callback_event handle ) : m_handle(handle) {}

bool is_aborting() const;
abort_callback_event get_abort_event() const { return m_handle; }
bool is_aborting() const override;
abort_callback_event get_abort_event() const override { return m_handle; }
private:
const abort_callback_event m_handle;
};

//! Dummy abort_callback that never gets aborted. \n
//! Slightly more efficient than the regular one especially when you need to regularly create temporary instances of it.
//! Note that there's no need to create instances of it, use shared fb2k::noAbort object instead.
class abort_callback_dummy : public abort_callback {
public:
abort_callback_dummy() : m_event(GetInfiniteWaitEvent()) {}
bool is_aborting() const { return false; }
bool is_aborting() const override { return false; }

abort_callback_event get_abort_event() const { return m_event;}
abort_callback_event get_abort_event() const override { return m_event;}
private:
const abort_callback_event m_event;
const abort_callback_event m_event = GetInfiniteWaitEvent();
};

}
Expand All @@ -117,6 +120,7 @@ using namespace foobar2000_io;


namespace fb2k {
// A shared abort_callback_dummy instance
//! A shared abort_callback_dummy instance. \n
//! Use when some function requires an abort_callback& and you don't have one: somefunc(fb2k::noAbort);
extern abort_callback_dummy noAbort;
}
4 changes: 0 additions & 4 deletions 3rdparty/foo_SDK/foobar2000/SDK/advconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ void advconfig_entry_checkbox_impl::set_data_raw(stream_reader* p_stream, t_size
}
#endif

pfc::string8 fb2k::advconfig_autoName(const GUID& id) {
return pfc::format("advconfig.unnamed.", pfc::print_guid(id));
}

void advconfig_entry_string_impl::reset() {
fb2k::configStore::get()->deleteConfigString(m_varName);
}
Expand Down
24 changes: 7 additions & 17 deletions 3rdparty/foo_SDK/foobar2000/SDK/advconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ class NOVTABLE advconfig_entry : public service_base {

static const GUID guid_root;
static const GUID guid_branch_tagging,guid_branch_decoding,guid_branch_tools,guid_branch_playback,guid_branch_display,guid_branch_debug, guid_branch_tagging_general, guid_branch_converter;


// \since 2.0
static const GUID guid_branch_vis;
static const GUID guid_branch_vis, guid_branch_general;

FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(advconfig_entry);
};

//! Creates a new branch in Advanced Preferences. \n
//! Declares a new branch in Advanced Preferences. \n
//! Implementation: see advconfig_branch_impl / advconfig_branch_factory.
class NOVTABLE advconfig_branch : public advconfig_entry {
public:
FB2K_MAKE_SERVICE_INTERFACE(advconfig_branch,advconfig_entry);
};

//! Creates a checkbox/radiocheckbox entry in Advanced Preferences. \n
//! Declares a checkbox/radiocheckbox entry in Advanced Preferences. \n
//! The difference between checkboxes and radiocheckboxes is different icon (obviously) and that checking a radiocheckbox unchecks all other radiocheckboxes in the same branch. \n
//! Implementation: see advconfig_entry_checkbox_impl / advconfig_checkbox_factory_t.
class NOVTABLE advconfig_entry_checkbox : public advconfig_entry {
Expand All @@ -52,14 +53,15 @@ class NOVTABLE advconfig_entry_checkbox : public advconfig_entry {
FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox,advconfig_entry);
};

//! Extension to advconfig_entry_checkbox, adds default state and preferences flags.
class NOVTABLE advconfig_entry_checkbox_v2 : public advconfig_entry_checkbox {
FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox_v2, advconfig_entry_checkbox)
public:
virtual bool get_default_state() = 0;
virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
};

//! Creates a string/integer editbox entry in Advanced Preferences.\n
//! Declares a string/integer editbox entry in Advanced Preferences.\n
//! Implementation: see advconfig_entry_string_impl / advconfig_string_factory.
class NOVTABLE advconfig_entry_string : public advconfig_entry {
public:
Expand All @@ -77,23 +79,11 @@ class NOVTABLE advconfig_entry_string : public advconfig_entry {
FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string,advconfig_entry);
};

//! Extension to advconfig_entry_string, adds default state, validation and preferences flags.
class NOVTABLE advconfig_entry_string_v2 : public advconfig_entry_string {
FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string_v2, advconfig_entry_string)
public:
virtual void get_default_state(pfc::string_base & out) = 0;
virtual void validate(pfc::string_base & val) {}
virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
};


//! Not currently used, reserved for future use.
class NOVTABLE advconfig_entry_enum : public advconfig_entry {
public:
virtual t_size get_value_count() = 0;
virtual void enum_value(pfc::string_base & p_out,t_size p_index) = 0;
virtual t_size get_state() = 0;
virtual void set_state(t_size p_value) = 0;

FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_enum,advconfig_entry);
};

3 changes: 3 additions & 0 deletions 3rdparty/foo_SDK/foobar2000/SDK/advconfig_impl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

// advconfig_impl.h : mainline (foobar2000 v2.0) implementation of advconfig objects

#include "advconfig.h"

//! Standard implementation of advconfig_branch. \n
Expand Down Expand Up @@ -138,6 +140,7 @@ class advconfig_string_factory : public service_factory_single_t<advconfig_entry
advconfig_string_factory(const char* p_name, const GUID& p_guid, const GUID& p_parent, double p_priority, const char* p_initialstate, t_uint32 p_prefFlags = 0) : service_factory_single_t<advconfig_entry_string_impl>(p_name, fb2k::advconfig_autoName(p_guid), p_guid, p_parent, p_priority, p_initialstate, p_prefFlags) {}

void get(pfc::string_base& out) { get_static_instance().get_state(out); }
pfc::string8 get() { pfc::string8 temp; get(temp); return temp; }
void set(const char* in) { get_static_instance().set_state(in); }
};

Expand Down
Loading

0 comments on commit a9f147d

Please sign in to comment.