Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
51
Src/Wasabi/api/core/api_core.cpp
Normal file
51
Src/Wasabi/api/core/api_core.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <precomp.h>
|
||||
#include "api_core.h"
|
||||
|
||||
#ifdef CBCLASS
|
||||
#undef CBCLASS
|
||||
#endif
|
||||
#define CBCLASS api_coreI
|
||||
START_DISPATCH;
|
||||
CB(API_CORE_GETSUPPORTEDEXTENSIONS, core_getSupportedExtensions);
|
||||
CB(API_CORE_GETEXTSUPPORTEDEXTENSIONS, core_getExtSupportedExtensions);
|
||||
CB(API_CORE_CREATE, core_create);
|
||||
CB(API_CORE_FREE, core_free);
|
||||
CB(API_CORE_SETNEXTFILE, core_setNextFile);
|
||||
CB(API_CORE_GETSTATUS, core_getStatus);
|
||||
CB(API_CORE_GETCURRENT, core_getCurrent);
|
||||
CB(API_CORE_GETCURPLAYBACKNUMBER, core_getCurPlaybackNumber);
|
||||
CB(API_CORE_GETPOSITION, core_getPosition);
|
||||
CB(API_CORE_GETWRITEPOSITION, core_getWritePosition);
|
||||
CB(API_CORE_SETPOSITION, core_setPosition);
|
||||
CB(API_CORE_GETLENGTH, core_getLength);
|
||||
CB(API_CORE_GETPLUGINDATA, core_getPluginData);
|
||||
CB(API_CORE_GETVOLUME, core_getVolume);
|
||||
VCB(API_CORE_SETVOLUME, core_setVolume);
|
||||
CB(API_CORE_GETPAN, core_getPan);
|
||||
VCB(API_CORE_SETPAN, core_setPan);
|
||||
VCB(API_CORE_ADDCALLBACK, core_addCallback);
|
||||
VCB(API_CORE_DELCALLBACK, core_delCallback);
|
||||
CB(API_CORE_GETVISDATA, core_getVisData);
|
||||
CB(API_CORE_GETLEFTVUMETER, core_getLeftVuMeter);
|
||||
CB(API_CORE_GETRIGHTVUMETER, core_getRightVuMeter);
|
||||
CB(API_CORE_REGISTERSEQUENCER, core_registerSequencer);
|
||||
CB(API_CORE_DEREGISTERSEQUENCER, core_deregisterSequencer);
|
||||
VCB(API_CORE_USERBUTTON, core_userButton);
|
||||
CB(API_CORE_GETEQSTATUS, core_getEqStatus);
|
||||
VCB(API_CORE_SETEQSTATUS, core_setEqStatus);
|
||||
CB(API_CORE_GETEQPREAMP, core_getEqPreamp);
|
||||
VCB(API_CORE_SETEQPREAMP, core_setEqPreamp);
|
||||
CB(API_CORE_GETEQBAND, core_getEqBand);
|
||||
VCB(API_CORE_SETEQBAND, core_setEqBand);
|
||||
CB(API_CORE_GETEQAUTO, core_getEqAuto);
|
||||
VCB(API_CORE_SETEQAUTO, core_setEqAuto);
|
||||
VCB(API_CORE_SETCUSTOMMSG, core_setCustomMsg);
|
||||
VCB(API_CORE_REGISTEREXTENSION, core_registerExtension);
|
||||
CB(API_CORE_GETEXTENSIONFAMILY, core_getExtensionFamily);
|
||||
VCB(API_CORE_UNREGISTEREXTENSION, core_unregisterExtension);
|
||||
CB(API_CORE_GETTITLE, core_getTitle);
|
||||
CB(API_CORE_GETRATING, core_getRating);
|
||||
VCB(API_CORE_SETRATING, core_setRating);
|
||||
CB(API_CORE_GETDECODERNAME, core_getDecoderName);
|
||||
VCB(API_CORE_SETTITLE, core_setTitle);
|
||||
END_DISPATCH;
|
371
Src/Wasabi/api/core/api_core.h
Normal file
371
Src/Wasabi/api/core/api_core.h
Normal file
|
@ -0,0 +1,371 @@
|
|||
#ifndef __API_CORE_H
|
||||
#define __API_CORE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
typedef unsigned int CoreToken;
|
||||
class CoreCallback;
|
||||
class ItemSequencer;
|
||||
|
||||
class NOVTABLE api_core : public Dispatchable
|
||||
{
|
||||
public:
|
||||
const wchar_t *core_getSupportedExtensions();
|
||||
const wchar_t *core_getExtSupportedExtensions();
|
||||
CoreToken core_create();
|
||||
int core_free(CoreToken core);
|
||||
int core_setNextFile(CoreToken core, const wchar_t *playstring);
|
||||
int core_getStatus(CoreToken core);
|
||||
const wchar_t *core_getCurrent(CoreToken core);
|
||||
int core_getCurPlaybackNumber(CoreToken core);
|
||||
int core_getPosition(CoreToken core);
|
||||
int core_getWritePosition(CoreToken core);
|
||||
int core_setPosition(CoreToken core, int ms);
|
||||
int core_getLength(CoreToken core);
|
||||
int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0);
|
||||
unsigned int core_getVolume(CoreToken core);
|
||||
void core_setVolume(CoreToken core, unsigned int vol);
|
||||
int core_getPan(CoreToken core);
|
||||
void core_setPan(CoreToken core, int val);
|
||||
void core_addCallback(CoreToken core, CoreCallback *cb);
|
||||
void core_delCallback(CoreToken core, CoreCallback *cb);
|
||||
int core_getVisData(CoreToken core, void *dataptr, int sizedataptr);
|
||||
int core_getLeftVuMeter(CoreToken core);
|
||||
int core_getRightVuMeter(CoreToken core);
|
||||
int core_registerSequencer(CoreToken core, ItemSequencer *seq);
|
||||
int core_deregisterSequencer(CoreToken core, ItemSequencer *seq);
|
||||
void core_userButton(CoreToken core, int button);
|
||||
int core_getEqStatus(CoreToken core);
|
||||
void core_setEqStatus(CoreToken core, int enable);
|
||||
int core_getEqPreamp(CoreToken core);
|
||||
void core_setEqPreamp(CoreToken core, int pre);
|
||||
int core_getEqBand(CoreToken core, int band);
|
||||
void core_setEqBand(CoreToken core, int band, int val);
|
||||
int core_getEqAuto(CoreToken core);
|
||||
void core_setEqAuto(CoreToken core, int enable);
|
||||
void core_setCustomMsg(CoreToken core, const wchar_t *text);
|
||||
void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL);
|
||||
const wchar_t *core_getExtensionFamily(const wchar_t *extension);
|
||||
void core_unregisterExtension(const wchar_t *extensions);
|
||||
const wchar_t *core_getTitle(CoreToken core);
|
||||
void core_setTitle(const wchar_t *new_title);
|
||||
const wchar_t *core_getDecoderName(const wchar_t *filename);
|
||||
// these don't necessarily belong here, but api_core is already over-bloated :)
|
||||
int core_getRating();
|
||||
void core_setRating(int newRating);
|
||||
|
||||
enum
|
||||
{
|
||||
API_CORE_GETSUPPORTEDEXTENSIONS = 0,
|
||||
API_CORE_GETEXTSUPPORTEDEXTENSIONS = 10,
|
||||
API_CORE_CREATE = 20,
|
||||
API_CORE_FREE = 30,
|
||||
API_CORE_SETNEXTFILE = 40,
|
||||
API_CORE_GETSTATUS = 50,
|
||||
API_CORE_GETCURRENT = 60,
|
||||
API_CORE_GETCURPLAYBACKNUMBER = 70,
|
||||
API_CORE_GETPOSITION = 80,
|
||||
API_CORE_GETWRITEPOSITION = 90,
|
||||
API_CORE_SETPOSITION = 100,
|
||||
API_CORE_GETLENGTH = 110,
|
||||
API_CORE_GETPLUGINDATA = 120,
|
||||
API_CORE_GETVOLUME = 130,
|
||||
API_CORE_SETVOLUME = 140,
|
||||
API_CORE_GETPAN = 150,
|
||||
API_CORE_SETPAN = 160,
|
||||
API_CORE_ADDCALLBACK = 170,
|
||||
API_CORE_DELCALLBACK = 180,
|
||||
API_CORE_GETVISDATA = 190,
|
||||
API_CORE_GETLEFTVUMETER = 200,
|
||||
API_CORE_GETRIGHTVUMETER = 210,
|
||||
API_CORE_REGISTERSEQUENCER = 220,
|
||||
API_CORE_DEREGISTERSEQUENCER = 230,
|
||||
API_CORE_USERBUTTON = 240,
|
||||
API_CORE_GETEQSTATUS = 250,
|
||||
API_CORE_SETEQSTATUS = 260,
|
||||
API_CORE_GETEQPREAMP = 270,
|
||||
API_CORE_SETEQPREAMP = 280,
|
||||
API_CORE_GETEQBAND = 290,
|
||||
API_CORE_SETEQBAND = 300,
|
||||
API_CORE_GETEQAUTO = 310,
|
||||
API_CORE_SETEQAUTO = 320,
|
||||
API_CORE_SETCUSTOMMSG = 330,
|
||||
API_CORE_REGISTEREXTENSION = 340,
|
||||
API_CORE_GETEXTENSIONFAMILY = 350,
|
||||
API_CORE_UNREGISTEREXTENSION = 360,
|
||||
API_CORE_GETTITLE = 370,
|
||||
API_CORE_GETRATING = 380,
|
||||
API_CORE_SETRATING = 390,
|
||||
API_CORE_GETDECODERNAME = 400,
|
||||
API_CORE_SETTITLE = 410,
|
||||
};
|
||||
};
|
||||
|
||||
inline const wchar_t *api_core::core_getSupportedExtensions()
|
||||
{
|
||||
return _call(API_CORE_GETSUPPORTEDEXTENSIONS, (const wchar_t *)0);
|
||||
}
|
||||
|
||||
inline const wchar_t *api_core::core_getExtSupportedExtensions()
|
||||
{
|
||||
return _call(API_CORE_GETEXTSUPPORTEDEXTENSIONS, (const wchar_t *)0);
|
||||
}
|
||||
|
||||
inline CoreToken api_core::core_create()
|
||||
{
|
||||
return _call(API_CORE_CREATE, (CoreToken)NULL);
|
||||
}
|
||||
|
||||
inline int api_core::core_free(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_FREE, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_setNextFile(CoreToken core, const wchar_t *playstring)
|
||||
{
|
||||
return _call(API_CORE_SETNEXTFILE, (int)0, core, playstring);
|
||||
}
|
||||
|
||||
inline int api_core::core_getStatus(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETSTATUS, (int)0, core);
|
||||
}
|
||||
|
||||
inline const wchar_t *api_core::core_getCurrent(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETCURRENT, (const wchar_t *)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_getCurPlaybackNumber(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETCURPLAYBACKNUMBER, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_getPosition(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETPOSITION, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_getWritePosition(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETWRITEPOSITION, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_setPosition(CoreToken core, int ms)
|
||||
{
|
||||
return _call(API_CORE_SETPOSITION, (int)0, core, ms);
|
||||
}
|
||||
|
||||
inline int api_core::core_getLength(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETLENGTH, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type)
|
||||
{
|
||||
return _call(API_CORE_GETPLUGINDATA, (int)0, playstring, name, data, data_len, data_type);
|
||||
}
|
||||
|
||||
inline unsigned int api_core::core_getVolume(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETVOLUME, (unsigned int)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setVolume(CoreToken core, unsigned int vol)
|
||||
{
|
||||
_voidcall(API_CORE_SETVOLUME, core, vol);
|
||||
}
|
||||
|
||||
inline int api_core::core_getPan(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETPAN, (int)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setPan(CoreToken core, int val)
|
||||
{
|
||||
_voidcall(API_CORE_SETPAN, core, val);
|
||||
}
|
||||
|
||||
inline void api_core::core_addCallback(CoreToken core, CoreCallback *cb)
|
||||
{
|
||||
_voidcall(API_CORE_ADDCALLBACK, core, cb);
|
||||
}
|
||||
|
||||
inline void api_core::core_delCallback(CoreToken core, CoreCallback *cb)
|
||||
{
|
||||
_voidcall(API_CORE_DELCALLBACK, core, cb);
|
||||
}
|
||||
|
||||
inline int api_core::core_getVisData(CoreToken core, void *dataptr, int sizedataptr)
|
||||
{
|
||||
return _call(API_CORE_GETVISDATA, (int)0, core, dataptr, sizedataptr);
|
||||
}
|
||||
|
||||
inline int api_core::core_getLeftVuMeter(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETLEFTVUMETER, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_getRightVuMeter(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETRIGHTVUMETER, (int)0, core);
|
||||
}
|
||||
|
||||
inline int api_core::core_registerSequencer(CoreToken core, ItemSequencer *seq)
|
||||
{
|
||||
return _call(API_CORE_REGISTERSEQUENCER, (int)0, core, seq);
|
||||
}
|
||||
|
||||
inline int api_core::core_deregisterSequencer(CoreToken core, ItemSequencer *seq)
|
||||
{
|
||||
return _call(API_CORE_DEREGISTERSEQUENCER, (int)0, core, seq);
|
||||
}
|
||||
|
||||
inline void api_core::core_userButton(CoreToken core, int button)
|
||||
{
|
||||
_voidcall(API_CORE_USERBUTTON, core, button);
|
||||
}
|
||||
|
||||
inline int api_core::core_getEqStatus(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETEQSTATUS, (int)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setEqStatus(CoreToken core, int enable)
|
||||
{
|
||||
_voidcall(API_CORE_SETEQSTATUS, core, enable);
|
||||
}
|
||||
|
||||
inline int api_core::core_getEqPreamp(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETEQPREAMP, (int)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setEqPreamp(CoreToken core, int pre)
|
||||
{
|
||||
_voidcall(API_CORE_SETEQPREAMP, core, pre);
|
||||
}
|
||||
|
||||
inline int api_core::core_getEqBand(CoreToken core, int band)
|
||||
{
|
||||
return _call(API_CORE_GETEQBAND, (int)0, core, band);
|
||||
}
|
||||
|
||||
inline void api_core::core_setEqBand(CoreToken core, int band, int val)
|
||||
{
|
||||
_voidcall(API_CORE_SETEQBAND, core, band, val);
|
||||
}
|
||||
|
||||
inline int api_core::core_getEqAuto(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETEQAUTO, (int)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setEqAuto(CoreToken core, int enable)
|
||||
{
|
||||
_voidcall(API_CORE_SETEQAUTO, core, enable);
|
||||
}
|
||||
|
||||
inline void api_core::core_setCustomMsg(CoreToken core, const wchar_t *text)
|
||||
{
|
||||
_voidcall(API_CORE_SETCUSTOMMSG, core, text);
|
||||
}
|
||||
|
||||
inline void api_core::core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family)
|
||||
{
|
||||
_voidcall(API_CORE_REGISTEREXTENSION, extensions, extension_name, family);
|
||||
}
|
||||
|
||||
inline const wchar_t *api_core::core_getExtensionFamily(const wchar_t *extension)
|
||||
{
|
||||
return _call(API_CORE_GETEXTENSIONFAMILY, (const wchar_t *)0, extension);
|
||||
}
|
||||
|
||||
inline void api_core::core_unregisterExtension(const wchar_t *extensions)
|
||||
{
|
||||
_voidcall(API_CORE_UNREGISTEREXTENSION, extensions);
|
||||
}
|
||||
|
||||
inline const wchar_t *api_core::core_getTitle(CoreToken core)
|
||||
{
|
||||
return _call(API_CORE_GETTITLE, (const wchar_t *)0, core);
|
||||
}
|
||||
|
||||
inline void api_core::core_setTitle(const wchar_t *new_title)
|
||||
{
|
||||
_voidcall(API_CORE_SETTITLE, new_title);
|
||||
}
|
||||
|
||||
inline int api_core::core_getRating()
|
||||
{
|
||||
return _call(API_CORE_GETRATING, (int)0);
|
||||
}
|
||||
|
||||
inline void api_core::core_setRating(int newRating)
|
||||
{
|
||||
_voidcall(API_CORE_SETRATING, newRating);
|
||||
}
|
||||
|
||||
inline const wchar_t *api_core::core_getDecoderName(const wchar_t *filename)
|
||||
{
|
||||
return _call(API_CORE_GETDECODERNAME, (const wchar_t *)0, filename);
|
||||
}
|
||||
|
||||
class api_coreI : public api_core
|
||||
{
|
||||
public:
|
||||
virtual const wchar_t *core_getSupportedExtensions() = 0;
|
||||
virtual const wchar_t *core_getExtSupportedExtensions() = 0;
|
||||
virtual CoreToken core_create() = 0;
|
||||
virtual int core_free(CoreToken core) = 0;
|
||||
virtual int core_setNextFile(CoreToken core, const wchar_t *playstring) = 0;
|
||||
virtual int core_getStatus(CoreToken core) = 0;
|
||||
virtual const wchar_t *core_getCurrent(CoreToken core) = 0;
|
||||
virtual int core_getCurPlaybackNumber(CoreToken core) = 0;
|
||||
virtual int core_getPosition(CoreToken core) = 0;
|
||||
virtual int core_getWritePosition(CoreToken core) = 0;
|
||||
virtual int core_setPosition(CoreToken core, int ms) = 0;
|
||||
virtual int core_getLength(CoreToken core) = 0;
|
||||
virtual int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0) = 0;
|
||||
virtual unsigned int core_getVolume(CoreToken core) = 0;
|
||||
virtual void core_setVolume(CoreToken core, unsigned int vol) = 0;
|
||||
virtual int core_getPan(CoreToken core) = 0;
|
||||
virtual void core_setPan(CoreToken core, int val) = 0;
|
||||
virtual void core_addCallback(CoreToken core, CoreCallback *cb) = 0;
|
||||
virtual void core_delCallback(CoreToken core, CoreCallback *cb) = 0;
|
||||
virtual int core_getVisData(CoreToken core, void *dataptr, int sizedataptr) = 0;
|
||||
virtual int core_getLeftVuMeter(CoreToken core) = 0;
|
||||
virtual int core_getRightVuMeter(CoreToken core) = 0;
|
||||
virtual int core_registerSequencer(CoreToken core, ItemSequencer *seq) = 0;
|
||||
virtual int core_deregisterSequencer(CoreToken core, ItemSequencer *seq) = 0;
|
||||
virtual void core_userButton(CoreToken core, int button) = 0;
|
||||
virtual int core_getEqStatus(CoreToken core) = 0;
|
||||
virtual void core_setEqStatus(CoreToken core, int enable) = 0;
|
||||
virtual int core_getEqPreamp(CoreToken core) = 0;
|
||||
virtual void core_setEqPreamp(CoreToken core, int pre) = 0;
|
||||
virtual int core_getEqBand(CoreToken core, int band) = 0;
|
||||
virtual void core_setEqBand(CoreToken core, int band, int val) = 0;
|
||||
virtual int core_getEqAuto(CoreToken core) = 0;
|
||||
virtual void core_setEqAuto(CoreToken core, int enable) = 0;
|
||||
virtual void core_setCustomMsg(CoreToken core, const wchar_t *text) = 0;
|
||||
virtual void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL) = 0;
|
||||
virtual const wchar_t *core_getExtensionFamily(const wchar_t *extension) = 0;
|
||||
virtual void core_unregisterExtension(const wchar_t *extensions) = 0;
|
||||
virtual const wchar_t *core_getTitle(CoreToken core) = 0;
|
||||
virtual void core_setTitle(const wchar_t *new_title) = 0;
|
||||
virtual int core_getRating()=0;
|
||||
virtual void core_setRating(int newRating)=0;
|
||||
virtual const wchar_t *core_getDecoderName(const wchar_t *filename)=0;
|
||||
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
// {966E3DA1-C2C5-43a9-A931-EB5F8B040A4F}
|
||||
static const GUID coreApiServiceGuid =
|
||||
{ 0x966e3da1, 0xc2c5, 0x43a9, { 0xa9, 0x31, 0xeb, 0x5f, 0x8b, 0x4, 0xa, 0x4f } };
|
||||
|
||||
extern api_core *coreApi;
|
||||
|
||||
#endif
|
18
Src/Wasabi/api/core/buttons.h
Normal file
18
Src/Wasabi/api/core/buttons.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef _BUTTONS_H
|
||||
#define _BUTTONS_H
|
||||
|
||||
// codes for
|
||||
|
||||
namespace UserButton {
|
||||
enum {
|
||||
PREV=0,
|
||||
PLAY,
|
||||
PAUSE,
|
||||
STOP,
|
||||
NEXT,
|
||||
};
|
||||
const int first = PREV;
|
||||
const int last = NEXT;
|
||||
};
|
||||
|
||||
#endif
|
181
Src/Wasabi/api/core/coreactions.cpp
Normal file
181
Src/Wasabi/api/core/coreactions.cpp
Normal file
|
@ -0,0 +1,181 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "coreactions.h"
|
||||
|
||||
#include <api/config/items/cfgitem.h>
|
||||
#include <api/core/buttons.h>
|
||||
#include <api/api.h>
|
||||
#include <api/core/corehandle.h>
|
||||
#include <api/service/svcs/svc_player.h>
|
||||
#include <api/locales/xlatstr.h>
|
||||
|
||||
CoreActions::CoreActions() {
|
||||
registerAction("prev", ACTION_PREV);
|
||||
registerAction("play", ACTION_PLAY);
|
||||
registerAction("pause", ACTION_PAUSE);
|
||||
registerAction("stop", ACTION_STOP);
|
||||
registerAction("next", ACTION_NEXT);
|
||||
registerAction("eject", ACTION_EJECT);
|
||||
registerAction("eject_url", ACTION_EJECTURL);
|
||||
registerAction("eject_dir", ACTION_EJECTDIR);
|
||||
registerAction("seek", ACTION_SEEK);
|
||||
registerAction("volume", ACTION_VOLUME);
|
||||
registerAction("pan", ACTION_PAN);
|
||||
registerAction("volume_up", ACTION_VOLUME_UP);
|
||||
registerAction("volume_down", ACTION_VOLUME_DOWN);
|
||||
registerAction("rewind_5s", ACTION_REWIND_5S);
|
||||
registerAction("ffwd_5s", ACTION_FFWD_5S);
|
||||
registerAction("toggle_repeat", ACTION_TOGGLE_REPEAT);
|
||||
registerAction("toggle_shuffle", ACTION_TOGGLE_SHUFFLE);
|
||||
registerAction("toggle_crossfader", ACTION_TOGGLE_CROSSFADER);
|
||||
registerAction("mute", ACTION_MUTE);
|
||||
registerAction("eq_preamp", ACTION_EQ_PREAMP);
|
||||
registerAction("eq_band", ACTION_EQ_BAND);
|
||||
registerAction("eq_auto", ACTION_EQ_AUTO);
|
||||
registerAction("eq_reset", ACTION_EQ_RESET);
|
||||
registerAction("toggle_repeat", ACTION_TOGGLE_REPEAT);
|
||||
registerAction("toggle_shuffle", ACTION_TOGGLE_SHUFFLE);
|
||||
registerAction("toggle_crossfader", ACTION_TOGGLE_CROSSFADER);
|
||||
registerAction("eq_toggle", ACTION_EQ_TOGGLE);
|
||||
for (int i=0;i<4;i++)
|
||||
registerAction(StringPrintf("play_cd%d", i+1), ACTION_PLAY_CD+i);
|
||||
}
|
||||
|
||||
CoreActions::~CoreActions() {
|
||||
}
|
||||
|
||||
int CoreActions::onActionId(int pvtid, const char *action, const char *param/* =NULL */, int p1/* =0 */, int p2/* =0 */, void *data/* =NULL */, int datalen/* =0 */, api_window *source/* =NULL */) {
|
||||
int d = ATOI(param);
|
||||
CoreHandle ch("main");
|
||||
switch(pvtid) {
|
||||
case ACTION_PREV: { if (d==0) ch.prev(); } break;
|
||||
case ACTION_PLAY: { if (d==0) ch.play(); } break;
|
||||
case ACTION_PAUSE: { if (d==0) ch.pause(); } break;
|
||||
case ACTION_STOP: { if (d==0) ch.stop(); } break;
|
||||
case ACTION_NEXT: { if (d==0) ch.next(); } break;
|
||||
|
||||
case ACTION_EJECT: {
|
||||
svc_player *sp = SvcEnumByGuid<svc_player>();
|
||||
if (d == 0) {
|
||||
if (sp) sp->openFiles(source, "files");
|
||||
} else {
|
||||
if (sp) sp->openFiles(source);
|
||||
}
|
||||
WASABI_API_SVC->service_release(sp);
|
||||
}
|
||||
break;
|
||||
case ACTION_EJECTURL: if (d==0) {
|
||||
svc_player *sp = SvcEnumByGuid<svc_player>();
|
||||
if (sp) sp->openFiles(source, "location");
|
||||
api->service_release(sp);
|
||||
}
|
||||
break;
|
||||
case ACTION_EJECTDIR: if (d==0) {
|
||||
svc_player *sp = SvcEnumByGuid<svc_player>();
|
||||
if (sp) sp->openFiles(source, "directory");
|
||||
api->service_release(sp);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_VOLUME_UP: if (d==0) {
|
||||
int v=ch.getVolume();
|
||||
ch.setVolume(MIN(255,(v+5)));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_VOLUME_DOWN: if (d==0) {
|
||||
int v=ch.getVolume();
|
||||
ch.setVolume(MAX(0,(v-5)));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_REWIND_5S: if (d==0) {
|
||||
int p=ch.getPosition();
|
||||
ch.setPosition(MAX(0,(p-5000)));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_FFWD_5S: if (d==0) {
|
||||
int p=ch.getPosition();
|
||||
int mp=ch.getLength();
|
||||
ch.setPosition(MIN(mp,(p+5000)));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_EQ_AUTO:
|
||||
if (d==0) ch.setEqAuto(!ch.getEqAuto());
|
||||
break;
|
||||
|
||||
case ACTION_EQ_RESET: {
|
||||
if (d==0) for(int i=0;i<10;i++) ch.setEqBand(i,0);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_EQ_TOGGLE: if (d==0) ch.setEqStatus(!ch.getEqStatus()); break;
|
||||
|
||||
case ACTION_MUTE: if (d==0) {
|
||||
ch.setMute(!ch.getMute());;
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_TOGGLE_REPEAT:
|
||||
case ACTION_TOGGLE_SHUFFLE: if (d==0) {
|
||||
// {45F3F7C1-A6F3-4ee6-A15E-125E92FC3F8D}
|
||||
const GUID pledit_guid =
|
||||
{ 0x45f3f7c1, 0xa6f3, 0x4ee6, { 0xa1, 0x5e, 0x12, 0x5e, 0x92, 0xfc, 0x3f, 0x8d } };
|
||||
CfgItem *pli=WASABI_API_CONFIG->config_getCfgItemByGuid(pledit_guid);
|
||||
if(pli) {
|
||||
if(pvtid==ACTION_TOGGLE_REPEAT) pli->setDataAsInt("Repeat",!pli->getDataAsInt("Repeat"));
|
||||
if(pvtid==ACTION_TOGGLE_SHUFFLE) pli->setDataAsInt("Shuffle",!pli->getDataAsInt("Shuffle"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_TOGGLE_CROSSFADER: if (d==0) {
|
||||
// {FC3EAF78-C66E-4ED2-A0AA-1494DFCC13FF}
|
||||
const GUID xfade_guid =
|
||||
{ 0xFC3EAF78, 0xC66E, 0x4ED2, { 0xA0, 0xAA, 0x14, 0x94, 0xDF, 0xCC, 0x13, 0xFF } };
|
||||
CfgItem *pli=WASABI_API_CONFIG->config_getCfgItemByGuid(xfade_guid);
|
||||
if(pli) pli->setDataAsInt("Enable crossfading",!pli->getDataAsInt("Enable crossfading"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pvtid >= ACTION_PLAY_CD && pvtid < ACTION_PLAY_CD+16) if (d==0) {
|
||||
const GUID cdda_guid =
|
||||
{ 0x86b40069, 0x126f, 0x4e11, { 0xa8, 0x7f, 0x55, 0x8f, 0xfa, 0x3d, 0xff, 0xa8 } };
|
||||
#if 0//BU: need some api to send messages like this
|
||||
ComponentManager::sendNotify(cdda_guid, 12345, pvtid-ACTION_PLAY_CD);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *CoreActions::getHelp(int action) {
|
||||
static String name;
|
||||
switch (action) {
|
||||
case ACTION_PREV: name = _("Previous track"); break;
|
||||
case ACTION_PAUSE: name = _("Pause/Resume playback"); break;
|
||||
case ACTION_STOP: name = _("Stop playback"); break;
|
||||
case ACTION_NEXT: name = _("Next track"); break;
|
||||
case ACTION_EJECT: name = _("Load file"); break;
|
||||
case ACTION_EJECTURL: name = _("Load URL"); break;
|
||||
case ACTION_EJECTDIR: name = _("Load directory"); break;
|
||||
case ACTION_SEEK: name = _("Seek"); break;
|
||||
case ACTION_VOLUME: name = _("Volume"); break;
|
||||
case ACTION_PAN: name = _("Panning"); break;
|
||||
case ACTION_EQ_TOGGLE: name = _("Toggle equalizer"); break;
|
||||
case ACTION_EQ_PREAMP: name = _("Toggle preamplifier"); break;
|
||||
case ACTION_EQ_BAND: name = _("Change equalizer band"); break;
|
||||
case ACTION_EQ_AUTO: name = _("Auto equalizer"); break;
|
||||
case ACTION_EQ_RESET: name = _("Reset equalizer"); break;
|
||||
case ACTION_VOLUME_UP: name = _("Volume up"); break;
|
||||
case ACTION_VOLUME_DOWN: name = _("Volume down"); break;
|
||||
case ACTION_REWIND_5S: name = _("Rewind 5 seconds"); break;
|
||||
case ACTION_FFWD_5S: name = _("Fast forward 5 seconds"); break;
|
||||
case ACTION_MUTE: name = _("Mute/Unmute sound"); break;
|
||||
case ACTION_TOGGLE_REPEAT: name = _("Toggle repeat"); break;
|
||||
case ACTION_TOGGLE_SHUFFLE: name = _("Toggle shuffle"); break;
|
||||
case ACTION_TOGGLE_CROSSFADER: name = _("Toggle crossfader"); break;
|
||||
}
|
||||
return name;
|
||||
}
|
47
Src/Wasabi/api/core/coreactions.h
Normal file
47
Src/Wasabi/api/core/coreactions.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef __COREACTIONS_H
|
||||
#define __COREACTIONS_H
|
||||
|
||||
#include <api/service/svcs/svc_action.h>
|
||||
|
||||
class CoreActions : public svc_actionI {
|
||||
public :
|
||||
CoreActions();
|
||||
virtual ~CoreActions();
|
||||
|
||||
static const char *getServiceName() { return "Core Actions"; }
|
||||
virtual int onActionId(int pvtid, const wchar_t *action, const wchar_t *param=NULL, int p1=0, int p2=0, void *data=NULL, int datalen=0, ifc_window *source=NULL);
|
||||
virtual const wchar_t *getHelp(int action);
|
||||
|
||||
private:
|
||||
|
||||
enum {
|
||||
ACTION_PREV = 0,
|
||||
ACTION_PLAY,
|
||||
ACTION_PAUSE,
|
||||
ACTION_STOP,
|
||||
ACTION_NEXT,
|
||||
ACTION_EJECT,
|
||||
ACTION_EJECTURL,
|
||||
ACTION_EJECTDIR,
|
||||
ACTION_SEEK,
|
||||
ACTION_VOLUME,
|
||||
ACTION_EQ_TOGGLE,
|
||||
ACTION_EQ_PREAMP,
|
||||
ACTION_EQ_BAND,
|
||||
ACTION_VOLUME_UP,
|
||||
ACTION_VOLUME_DOWN,
|
||||
ACTION_REWIND_5S,
|
||||
ACTION_FFWD_5S,
|
||||
ACTION_PLAY_CD,
|
||||
ACTION_EQ_AUTO = ACTION_PLAY_CD+16,
|
||||
ACTION_EQ_RESET,
|
||||
ACTION_PAN,
|
||||
ACTION_MUTE,
|
||||
ACTION_TOGGLE_REPEAT,
|
||||
ACTION_TOGGLE_SHUFFLE,
|
||||
ACTION_TOGGLE_CROSSFADER,
|
||||
ACTION_PREFS,
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
304
Src/Wasabi/api/core/corehandle.cpp
Normal file
304
Src/Wasabi/api/core/corehandle.cpp
Normal file
|
@ -0,0 +1,304 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "corehandle.h"
|
||||
|
||||
#include <api/api.h>
|
||||
#include <api/core/buttons.h>
|
||||
#include <api/service/svcs/svc_coreadmin.h>
|
||||
#include <api/service/svc_enum.h> // for castService
|
||||
|
||||
using namespace UserButton;
|
||||
|
||||
static svc_coreAdmin *da_coreadmin=NULL;
|
||||
static int instancecount=0;
|
||||
|
||||
static void initDaCoreAdmin() {
|
||||
if(!da_coreadmin) {
|
||||
if (WASABI_API_SVC != NULL) {
|
||||
waServiceFactory *s=WASABI_API_SVC->service_enumService(WaSvc::COREADMIN,0);
|
||||
if (s != NULL) {
|
||||
//CUT ASSERTPR(s,"Core Admin non present!");
|
||||
da_coreadmin=castService<svc_coreAdmin>(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreHandle::CoreHandle(CoreToken tok) {
|
||||
initDaCoreAdmin();
|
||||
instancecount++;
|
||||
createdcore=0;
|
||||
token = NO_CORE_TOKEN;
|
||||
if (da_coreadmin) {
|
||||
if(da_coreadmin->verifyToken(tok)) token=tok;
|
||||
else {
|
||||
token=da_coreadmin->createCore();
|
||||
createdcore=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreHandle::CoreHandle(const char *name) {
|
||||
initDaCoreAdmin();
|
||||
instancecount++;
|
||||
createdcore=0;
|
||||
token = NO_CORE_TOKEN;
|
||||
if (da_coreadmin) {
|
||||
token=da_coreadmin->nameToToken(name);
|
||||
if(token==-1) {
|
||||
token=da_coreadmin->createCore(name);
|
||||
createdcore=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CoreHandle::~CoreHandle() {
|
||||
instancecount--;
|
||||
if (da_coreadmin) {
|
||||
if(createdcore) da_coreadmin->freeCoreByToken(token);
|
||||
if(!instancecount) {
|
||||
WASABI_API_SVC->service_release(da_coreadmin);
|
||||
da_coreadmin=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CoreHandle::isCoreLoaded() {
|
||||
if (!da_coreadmin) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CoreHandle::setNextFile(const char *playstring, const char *destination) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->setNextFile(token, playstring, destination);
|
||||
}
|
||||
|
||||
void CoreHandle::prev() {
|
||||
userButton(PREV);
|
||||
}
|
||||
|
||||
void CoreHandle::play() {
|
||||
userButton(PLAY);
|
||||
}
|
||||
|
||||
void CoreHandle::pause() {
|
||||
userButton(PAUSE);
|
||||
}
|
||||
|
||||
void CoreHandle::stop() {
|
||||
userButton(STOP);
|
||||
}
|
||||
|
||||
void CoreHandle::next() {
|
||||
userButton(NEXT);
|
||||
}
|
||||
|
||||
void CoreHandle::userButton(int button) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->userButton(token, button);
|
||||
}
|
||||
|
||||
const char *CoreHandle::getSupportedExtensions() {
|
||||
if (da_coreadmin == NULL) return "";
|
||||
return da_coreadmin->getSupportedExtensions();
|
||||
}
|
||||
|
||||
const char *CoreHandle::getExtSupportedExtensions() {
|
||||
if (da_coreadmin == NULL) return "";
|
||||
return da_coreadmin->getExtSupportedExtensions();
|
||||
}
|
||||
|
||||
const char *CoreHandle::getExtensionFamily(const char *extension) {
|
||||
if (da_coreadmin == NULL) return "";
|
||||
return da_coreadmin->getExtensionFamily(extension);
|
||||
}
|
||||
|
||||
void CoreHandle::registerExtension(const char *extensions, const char *extension_name) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->registerExtension(extensions, extension_name);
|
||||
}
|
||||
|
||||
void CoreHandle::unregisterExtension(const char *extensions) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->unregisterExtension(extensions);
|
||||
}
|
||||
|
||||
String CoreHandle::getTitle() {
|
||||
if (da_coreadmin == NULL) return String("");
|
||||
return String(da_coreadmin->getTitle(token));
|
||||
}
|
||||
|
||||
int CoreHandle::getStatus() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getStatus(token);
|
||||
}
|
||||
|
||||
const char *CoreHandle::getCurrent() {
|
||||
if (da_coreadmin == NULL) return "";
|
||||
return da_coreadmin->getCurrent(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getNumTracks() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getNumTracks(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getCurPlaybackNumber() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getCurPlaybackNumber(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getPosition() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getPosition(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getWritePosition() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getWritePosition(token);
|
||||
}
|
||||
|
||||
int CoreHandle::setPosition(int ms) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->setPosition(token,ms);
|
||||
}
|
||||
|
||||
int CoreHandle::getLength() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getLength(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getPluginData(const char *playstring, const char *name, char *data, int data_len, int data_type) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getPluginData(playstring, name, data, data_len, data_type);
|
||||
}
|
||||
|
||||
unsigned int CoreHandle::getVolume() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getVolume(token);
|
||||
}
|
||||
|
||||
void CoreHandle::setVolume(unsigned int vol) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setVolume(token, vol);
|
||||
}
|
||||
|
||||
int CoreHandle::getPan() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getPan(token);
|
||||
}
|
||||
|
||||
void CoreHandle::setPan(int bal) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setPan(token, bal);
|
||||
}
|
||||
|
||||
void CoreHandle::setMute(int mute) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setMute(token, mute);
|
||||
}
|
||||
|
||||
int CoreHandle::getMute() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getMute(token);
|
||||
}
|
||||
|
||||
void CoreHandle::addCallback(CoreCallback *cb) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->addCallback(token, cb);
|
||||
}
|
||||
|
||||
void CoreHandle::delCallback(CoreCallback *cb) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->delCallback(token, cb);
|
||||
}
|
||||
|
||||
int CoreHandle::getVisData(void *dataptr, int sizedataptr) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getVisData(token, dataptr, sizedataptr);
|
||||
}
|
||||
|
||||
int CoreHandle::getLeftVuMeter() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getLeftVuMeter(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getRightVuMeter() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getRightVuMeter(token);
|
||||
}
|
||||
|
||||
int CoreHandle::registerSequencer(ItemSequencer *seq) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->registerSequencer(token, seq);
|
||||
}
|
||||
|
||||
int CoreHandle::deregisterSequencer(ItemSequencer *seq) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->deregisterSequencer(token, seq);
|
||||
}
|
||||
|
||||
ItemSequencer *CoreHandle::getSequencer() {
|
||||
if (da_coreadmin == NULL) return NULL;
|
||||
return da_coreadmin->getSequencer(token);
|
||||
}
|
||||
|
||||
int CoreHandle::getEqStatus() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getEqStatus(token);
|
||||
}
|
||||
|
||||
void CoreHandle::setEqStatus(int enable) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setEqStatus(token, enable);
|
||||
}
|
||||
|
||||
int CoreHandle::getEqPreamp() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getEqPreamp(token);
|
||||
}
|
||||
|
||||
void CoreHandle::setEqPreamp(int pre) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setEqPreamp(token, pre);
|
||||
}
|
||||
|
||||
int CoreHandle::getEqBand(int band) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getEqBand(token, band);
|
||||
}
|
||||
|
||||
void CoreHandle::setEqBand(int band, int val) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setEqBand(token, band, val);
|
||||
}
|
||||
|
||||
int CoreHandle::getEqAuto() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getEqAuto(token);
|
||||
}
|
||||
|
||||
void CoreHandle::setEqAuto(int enable) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setEqAuto(token, enable);
|
||||
}
|
||||
|
||||
void CoreHandle::setPriority(int priority) {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->setPriority(token, priority);
|
||||
}
|
||||
|
||||
int CoreHandle::getPriority() {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->getPriority(token);
|
||||
}
|
||||
|
||||
void CoreHandle::rebuildConvertersChain() {
|
||||
if (da_coreadmin == NULL) return;
|
||||
da_coreadmin->rebuildConvertersChain(token);
|
||||
}
|
||||
|
||||
int CoreHandle::sendConvertersMsg(const char *msg, const char *value) {
|
||||
if (da_coreadmin == NULL) return 0;
|
||||
return da_coreadmin->sendConvertersMsg(token, msg, value);
|
||||
}
|
560
Src/Wasabi/api/core/corehandle.h
Normal file
560
Src/Wasabi/api/core/corehandle.h
Normal file
|
@ -0,0 +1,560 @@
|
|||
#ifndef _COREHANDLE_H
|
||||
#define _COREHANDLE_H
|
||||
|
||||
#include <api/syscb/callbacks/corecb.h>
|
||||
|
||||
// a helper class to access the playback cores within an object for you
|
||||
|
||||
typedef unsigned int CoreToken;
|
||||
#define NO_CORE_TOKEN (CoreToken)(0xffffffff)
|
||||
|
||||
// Fwd References
|
||||
class CfgItem;
|
||||
class ItemSequencer;
|
||||
|
||||
/**
|
||||
Helper class to access the currently instantiated
|
||||
playback cores.
|
||||
|
||||
To create a corehandle on the main playback core
|
||||
use the core token value from the enum ("maincore_token") or
|
||||
the core name "main".
|
||||
|
||||
Here is an example:
|
||||
CoreHandle * ch = new CoreHandle("main");
|
||||
|
||||
@short Access playback cores.
|
||||
@author Nullsoft
|
||||
@ver 1.0
|
||||
@see Core
|
||||
*/
|
||||
class CoreHandle {
|
||||
public:
|
||||
enum { maincore_token=0 };
|
||||
|
||||
/**
|
||||
Create a new CoreHandle while optionally
|
||||
setting the core token to be used.
|
||||
|
||||
Core tokens are handles to cores
|
||||
currently instantiated.
|
||||
|
||||
@see CoreHandle(const char *name)
|
||||
@param token Core token of the core to attach to.
|
||||
*/
|
||||
CoreHandle(CoreToken token=maincore_token);
|
||||
|
||||
/**
|
||||
Create a new CoreHandle for a core
|
||||
using it's name.
|
||||
|
||||
The main core name is "main".
|
||||
|
||||
@see CoreHandle(CoreToken toke=maincore_token)
|
||||
@param name Name of the core to attach to.
|
||||
*/
|
||||
CoreHandle(const wchar_t *name);
|
||||
|
||||
/**
|
||||
Detaches the CoreHandle from the Core.
|
||||
*/
|
||||
virtual ~CoreHandle();
|
||||
|
||||
int isCoreLoaded(); // are we attached to a core?
|
||||
|
||||
/**
|
||||
Get the list of supported extensions
|
||||
from the core. This is a zero delimited list
|
||||
with double zero termination.
|
||||
|
||||
@see getExtSupportedExtensions()
|
||||
@see getExtensionFamily()
|
||||
@ret List of supported extensions.
|
||||
*/
|
||||
const char *getSupportedExtensions(); //just the *.mp3 or whatever
|
||||
|
||||
/**
|
||||
Get the extended list of supported extensions
|
||||
from the core. This will include the proper
|
||||
names of the extensions, for example:
|
||||
"MP3 Files (*.mp3)".
|
||||
|
||||
This is returned as a zero delimited list with double
|
||||
zero termination.
|
||||
|
||||
@see getSupportedExtensions()
|
||||
@see getExtensionFamily()
|
||||
@ret Extended list of supported extensions.
|
||||
*/
|
||||
const char *getExtSupportedExtensions(); // including names
|
||||
|
||||
/**
|
||||
Get the family name to which the extension
|
||||
is associated with (Families are "Audio", "Video", etc.)
|
||||
|
||||
@see getExtSupportedExtensions()
|
||||
@see getSupportedExtensions()
|
||||
@ret Family name of the extension.
|
||||
@param extension Extension to get family name of.
|
||||
*/
|
||||
const wchar_t *getExtensionFamily(const wchar_t *extension);
|
||||
|
||||
/**
|
||||
Register an extension with the core.
|
||||
|
||||
@see unregisterExtension()
|
||||
@see getExtSupportedExtensions()
|
||||
@see getSupportedExtensions()
|
||||
@see getExtensionFamily()
|
||||
@param extensions Extension to register.
|
||||
@param extension_name Name of the extension.
|
||||
*/
|
||||
void registerExtension(const char *extensions, const char *extension_name);
|
||||
|
||||
/**
|
||||
Unregister an extension with the core.
|
||||
|
||||
@see registerExtension()
|
||||
@see getExtSupportedExtensions()
|
||||
@see getSupportedExtensions()
|
||||
@see getExtensionFamily()
|
||||
@param extensions Extension to unregister.
|
||||
*/
|
||||
void unregisterExtension(const char *extensions);
|
||||
|
||||
String getTitle();
|
||||
|
||||
/**
|
||||
Set the next file to be played by the core.
|
||||
|
||||
You can manually select the output of this
|
||||
file. Either "WAVEOUT" or "DIRECTSOUND". If
|
||||
you do not specify one, it will be automatically
|
||||
selected for you.
|
||||
|
||||
@ret 1, success; 0, failure;
|
||||
@param playstring Playstring of the next file to be played.
|
||||
@param destination Output to be used for the next file.
|
||||
*/
|
||||
int setNextFile(const char *playstring, const char *destination=NULL);
|
||||
|
||||
/**
|
||||
Get the playback status of the core.
|
||||
|
||||
@see pause()
|
||||
@see play()
|
||||
@see stop()
|
||||
@ret -1, Paused; 0, Stopped; 1, Playing;
|
||||
*/
|
||||
int getStatus(); // returns -1 if paused, 0 if stopped and 1 if playing
|
||||
|
||||
/**
|
||||
Get the playstring of the currently playing
|
||||
item.
|
||||
|
||||
@ret Playstring of the currently playing item.
|
||||
*/
|
||||
const char *getCurrent();
|
||||
|
||||
/**
|
||||
Get the number of items (tracks) present
|
||||
in the currently registered sequencer.
|
||||
|
||||
@see getCurPlaybackNumber()
|
||||
@ret Number of items present in the sequencer.
|
||||
*/
|
||||
int getNumTracks();
|
||||
|
||||
/**
|
||||
Get the index number of the currently
|
||||
playing item of the currently registered
|
||||
sequencer.
|
||||
|
||||
@see getNumTracks()
|
||||
@ret Index number (in the sequencer) of the item playing.
|
||||
*/
|
||||
int getCurPlaybackNumber();
|
||||
|
||||
/**
|
||||
Get the playback position of the currently
|
||||
playing file.
|
||||
|
||||
@see getWritePosition()
|
||||
@see getLength()
|
||||
@see setPosition()
|
||||
@ret Position in the file (in milliseconds).
|
||||
*/
|
||||
int getPosition();
|
||||
|
||||
/**
|
||||
Help?
|
||||
|
||||
@see getPosition()
|
||||
@see getLength()
|
||||
@see setPosition()
|
||||
@ret Current write position (in milliseconds).
|
||||
*/
|
||||
int getWritePosition();
|
||||
|
||||
/**
|
||||
Seek to a specific position in the
|
||||
currently playing item.
|
||||
|
||||
@see getPosition()
|
||||
@see getLength()
|
||||
@see getWritePosition()
|
||||
@ret 1, Success; 0, Failure;
|
||||
@param ms Position in the file (in milliseconds, 0 being the beginning).
|
||||
*/
|
||||
int setPosition(int ms);
|
||||
|
||||
/**
|
||||
Get the length of the currently
|
||||
playing item.
|
||||
|
||||
@see getPosition()
|
||||
@see setPosition()
|
||||
@see getWritePosition()
|
||||
@ret Length of the item (in milliseconds).
|
||||
*/
|
||||
int getLength();
|
||||
|
||||
// this method queries the core plugins directly, bypassing the db
|
||||
/**
|
||||
*/
|
||||
int getPluginData(const char *playstring, const char *name,
|
||||
char *data, int data_len, int data_type=0); // returns size of data
|
||||
|
||||
/**
|
||||
Get the volume of the core.
|
||||
|
||||
@see setVolume()
|
||||
@see getMute()
|
||||
@see setMute()
|
||||
@ret Volume (0 to 255).
|
||||
*/
|
||||
unsigned int getVolume(); // 0..255
|
||||
|
||||
/**
|
||||
Set the volume of the core.
|
||||
|
||||
@see getVolume()
|
||||
@see getMute()
|
||||
@see setMute()
|
||||
@param vol Volume (0 to 255).
|
||||
*/
|
||||
void setVolume(unsigned int vol); // 0..255
|
||||
|
||||
/**
|
||||
Get the panning value of the core.
|
||||
|
||||
@see setPan()
|
||||
@ret Panning value (-127 [left] to 127 [right]).
|
||||
*/
|
||||
int getPan(); // -127..127
|
||||
|
||||
/**
|
||||
Set the panning value of the core.
|
||||
|
||||
@see getPan()
|
||||
@param bal Panning value (-127 [left] to 127 [right])
|
||||
*/
|
||||
void setPan(int bal); // -127..127
|
||||
|
||||
/**
|
||||
Mute the output.
|
||||
|
||||
@see getVolume()
|
||||
@see setVolume()
|
||||
@see getMute()
|
||||
@param mute 0, No muting; 1, Mute;
|
||||
*/
|
||||
void setMute(int mute);
|
||||
|
||||
/**
|
||||
Get the mute state of the output.
|
||||
@see getVolume()
|
||||
@see setVolume()
|
||||
@see setMute()
|
||||
@ret 0, Not muted; 1, Muted;
|
||||
*/
|
||||
int getMute();
|
||||
|
||||
// register here for general callbacks in core status.
|
||||
/**
|
||||
Register a callback with the core to
|
||||
receive core status callbacks.
|
||||
|
||||
@see delCallback()
|
||||
@param cb Core Callback to register.
|
||||
*/
|
||||
void addCallback(CoreCallback *cb);
|
||||
|
||||
/**
|
||||
Unregister a callback with the core.
|
||||
|
||||
@see addCallback()
|
||||
@param cb Core Callback to unregister.
|
||||
*/
|
||||
void delCallback(CoreCallback *cb);
|
||||
|
||||
// get visualization data, returns 0 if you should blank out
|
||||
/**
|
||||
Get visualization data for the currently
|
||||
playing item.
|
||||
|
||||
We suggest using a struct like this to read the vis
|
||||
data:
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
LEFT = 0,
|
||||
RIGHT = 1
|
||||
};
|
||||
unsigned char spectrumData[2][576];
|
||||
char waveformData[2][576];
|
||||
} VisData;
|
||||
|
||||
A call using this struct would like so:
|
||||
|
||||
getVisData(&myVisData, sizeof(VisData));
|
||||
|
||||
@see getLeftVuMeter()
|
||||
@see getRightVuMeter()
|
||||
@ret 0, If there is no VIS data; > 0, VIS data available;
|
||||
@param dataptr Buffer to receive VIS data.
|
||||
@param sizedataptr Size of the buffer.
|
||||
*/
|
||||
int getVisData(void *dataptr, int sizedataptr);
|
||||
|
||||
/**
|
||||
Get the value of the left VU meter.
|
||||
|
||||
@see getVisData()
|
||||
@see getRightVuMeter()
|
||||
@ret Value of the left VU meter (0 to 255).
|
||||
*/
|
||||
int getLeftVuMeter();
|
||||
|
||||
/**
|
||||
Get the value of the left VU meter.
|
||||
|
||||
@see getVisData()
|
||||
@see getLeftVuMeter()
|
||||
@ret Value of the right VU meter (0 to 255).
|
||||
*/
|
||||
int getRightVuMeter();
|
||||
|
||||
/**
|
||||
Register an item sequencer with the core.
|
||||
The item sequencer feeds the playstrings
|
||||
of the next item to be played to the core.
|
||||
|
||||
@see deregisterSequencer()
|
||||
@ret 1, Success; 0, Failure;
|
||||
@param seq Sequencer to register.
|
||||
*/
|
||||
int registerSequencer(ItemSequencer *seq);
|
||||
|
||||
/**
|
||||
Unregister a sequencer with the core.
|
||||
|
||||
@see registerSequencer()
|
||||
@ret 1, Success; 0, Failure;
|
||||
@param seq Sequencer to unregister.
|
||||
*/
|
||||
int deregisterSequencer(ItemSequencer *seq);
|
||||
|
||||
ItemSequencer *getSequencer();
|
||||
|
||||
/**
|
||||
Get the EQ status.
|
||||
|
||||
@see setEqStatus()
|
||||
@see getEqPreamp()
|
||||
@see setEqPreamp()
|
||||
@see getEqBand()
|
||||
@see setEqBand()
|
||||
@ret 1, On; 0, Off;
|
||||
*/
|
||||
int getEqStatus(); // returns 1 if on, 0 if off
|
||||
|
||||
/**
|
||||
Set the EQ state.
|
||||
|
||||
@see getEqStatus()
|
||||
@see getEqPreamp()
|
||||
@see setEqPreamp()
|
||||
@see getEqBand()
|
||||
@see setEqBand()
|
||||
@param enable 1, On; 0, Off;
|
||||
*/
|
||||
void setEqStatus(int enable);
|
||||
|
||||
/**
|
||||
Get the pre-amp value of the EQ.
|
||||
|
||||
@see setEqStatus()
|
||||
@see getEqStatus()
|
||||
@see setEqPreamp()
|
||||
@see getEqBand()
|
||||
@see setEqBand()
|
||||
@ret Pre-amp value (-127 [-20dB] to 127 [+20dB]).
|
||||
*/
|
||||
int getEqPreamp(); // -127 to 127 (-20db to +20db)
|
||||
|
||||
/**
|
||||
Set the pre-amp value of the EQ.
|
||||
|
||||
@see setEqStatus()
|
||||
@see getEqStatus()
|
||||
@see getEqPreamp()
|
||||
@see getEqBand()
|
||||
@see setEqBand()
|
||||
@param pre Pre-amp value (-127 [-20dB] to 127 [+20dB]).
|
||||
*/
|
||||
void setEqPreamp(int pre);
|
||||
|
||||
/**
|
||||
Get the value of an EQ band. There
|
||||
are 10 bands available.
|
||||
|
||||
Here is the list:
|
||||
|
||||
0 - 60 Hz 1 - 170 Hz
|
||||
2 - 310 Hz 3 - 600 Hz
|
||||
4 - 1 kHz 5 - 3 kHz
|
||||
6 - 6 kHz 7 - 12 kHz
|
||||
8 - 14 kHz 9 - 16 kHz
|
||||
|
||||
@see setEqStatus()
|
||||
@see getEqStatus()
|
||||
@see getEqPreamp()
|
||||
@see setEqBand()
|
||||
@ret EQ band value (-127 [-20dB] to 127 [+20dB]).
|
||||
@param band EQ band to read (0 to 9).
|
||||
*/
|
||||
int getEqBand(int band); // band=0-9
|
||||
|
||||
/**
|
||||
Set the value of an EQ band. There
|
||||
are 10 bands available.
|
||||
|
||||
Here is the list:
|
||||
|
||||
0 - 60 Hz 1 - 170 Hz
|
||||
2 - 310 Hz 3 - 600 Hz
|
||||
4 - 1 kHz 5 - 3 kHz
|
||||
6 - 6 kHz 7 - 12 kHz
|
||||
8 - 14 kHz 9 - 16 kHz
|
||||
|
||||
@see setEqStatus()
|
||||
@see getEqStatus()
|
||||
@see getEqPreamp()
|
||||
@see setEqBand()
|
||||
@param band EQ band to set (0 to 9)
|
||||
@param val EQ band value (-127 [-20dB] to 127 [+20dB]).
|
||||
*/
|
||||
void setEqBand(int band, int val);
|
||||
|
||||
/**
|
||||
Get the automatic EQ preset loading state.
|
||||
|
||||
@see setEqAuto()
|
||||
@ret 1, On; 0, Off;
|
||||
*/
|
||||
int getEqAuto(); // returns 1 if on, 0 if off
|
||||
|
||||
/**
|
||||
Set the automatic EQ preset loading.
|
||||
|
||||
@see getEqAuto()
|
||||
@param enable 1, On; 0, Off;
|
||||
*/
|
||||
void setEqAuto(int enable);
|
||||
|
||||
/**
|
||||
Trigger the previous event.
|
||||
|
||||
@see next()
|
||||
@see play()
|
||||
@see stop()
|
||||
@see pause()
|
||||
*/
|
||||
void prev();
|
||||
|
||||
/**
|
||||
Trigger the play event.
|
||||
|
||||
@see prev()
|
||||
@see next()
|
||||
@see stop()
|
||||
@see pause()
|
||||
*/
|
||||
void play();
|
||||
|
||||
/**
|
||||
Trigger the pause event.
|
||||
|
||||
@see prev()
|
||||
@see next()
|
||||
@see stop()
|
||||
@see play()
|
||||
*/
|
||||
void pause();
|
||||
|
||||
/**
|
||||
Trigger the stop event.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
Trigger the next event.
|
||||
|
||||
@see prev()
|
||||
@see stop()
|
||||
@see play()
|
||||
@see pause()
|
||||
*/
|
||||
void next();
|
||||
|
||||
/**
|
||||
Set the thread priority of the core.
|
||||
|
||||
@see getPriority()
|
||||
@param priority Thread priority.
|
||||
*/
|
||||
void setPriority(int priority);
|
||||
|
||||
/**
|
||||
Get the thread priority of the core.
|
||||
|
||||
@see setPriority()
|
||||
@ret Thread priority level.
|
||||
*/
|
||||
int getPriority();
|
||||
|
||||
/**
|
||||
As the function name implies, rebuilds the converters chain (no shit?)
|
||||
*/
|
||||
void rebuildConvertersChain();
|
||||
|
||||
/**
|
||||
Send a message to all converters in the current
|
||||
playback chain of a core.
|
||||
|
||||
It's possible to pass any pointer using this messanging
|
||||
system, as long as the pointer is valid across dll boundries.
|
||||
|
||||
@param msg Message.
|
||||
@param value Message value.
|
||||
*/
|
||||
int sendConvertersMsg(const char *msg, const char *value);
|
||||
|
||||
private:
|
||||
void userButton(int button);
|
||||
CoreToken token;
|
||||
int createdcore;
|
||||
};
|
||||
|
||||
#endif
|
92
Src/Wasabi/api/core/sequence.cpp
Normal file
92
Src/Wasabi/api/core/sequence.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "precomp.h"
|
||||
|
||||
#include "sequence.h"
|
||||
|
||||
#define CBCLASS ItemSequencerI
|
||||
START_DISPATCH;
|
||||
CB(GETDEPENDENCYPTR, getDependencyPtr);
|
||||
CB(GETNEXTPLAYITEM, getNextPlayItem);
|
||||
CB(GETCURRENTPLAYBACKNUMBER, getCurrentPlaybackNumber);
|
||||
CB(GETNUMITEMS, getNumItems);
|
||||
CB(REWIND, rewind);
|
||||
CB(FORWARD, forward);
|
||||
CB(ONNOTIFY, onNotify);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
int ItemSequencerI::onNotify(int msg, int param1, int param2) {
|
||||
switch (msg) {
|
||||
case SEQNOTIFY_ONREGISTER: return onRegister();
|
||||
case SEQNOTIFY_ONDEREGISTER: return onDeregister();
|
||||
case SEQNOTIFY_ONNEXTFILE: return onNextFile();
|
||||
case SEQNOTIFY_ONTITLECHANGE: return onTitleChange();
|
||||
case SEQNOTIFY_ONSTARTED: return onStarted();
|
||||
case SEQNOTIFY_ONSTOPPED: return onStopped();
|
||||
case SEQNOTIFY_ONPAUSED: return onPaused();
|
||||
case SEQNOTIFY_ONUNPAUSED: return onUnpaused();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *ListSequencer::getNextPlayItem() {
|
||||
int pos;
|
||||
const char *ret;
|
||||
|
||||
pos = getCurrent();
|
||||
|
||||
if (pos < 0) return NULL;
|
||||
|
||||
ret = enumItem(pos);
|
||||
|
||||
setCurrent(pos);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ListSequencer::rewind() {
|
||||
|
||||
int pos;
|
||||
|
||||
pos = getCurrent();
|
||||
|
||||
if (pos < 0) return 0;
|
||||
|
||||
pos--;
|
||||
|
||||
if (pos < 0) {
|
||||
if (loop()) {
|
||||
pos = getNumEntries()-1;
|
||||
} else {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
setCurrent(pos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ListSequencer::forward() {
|
||||
|
||||
int pos;
|
||||
|
||||
pos = getCurrent();
|
||||
|
||||
if (pos < 0) return 0;
|
||||
|
||||
pos++;
|
||||
|
||||
if (pos >= getNumEntries()) {
|
||||
if (loop()) {
|
||||
pos = 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
setCurrent(pos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ListSequencer::getNumItems() {
|
||||
return getNumEntries();
|
||||
}
|
123
Src/Wasabi/api/core/sequence.h
Normal file
123
Src/Wasabi/api/core/sequence.h
Normal file
|
@ -0,0 +1,123 @@
|
|||
//PORTABLE
|
||||
#ifndef _SEQUENCE_H
|
||||
#define _SEQUENCE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/depend.h>
|
||||
|
||||
// abstracted version of a playback order
|
||||
class ItemSequencer : public Dispatchable {
|
||||
public:
|
||||
api_dependent *getDependencyPtr();
|
||||
|
||||
const char *getNextPlayItem();
|
||||
int getCurrentPlaybackNumber(); // 0-based, -1 if you don't know
|
||||
int getNumItems(); // -1 if you don't know
|
||||
int rewind();
|
||||
int forward();
|
||||
|
||||
int onNotify(int msg, int param1=0, int param2=0);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
GETNEXTPLAYITEM=100,
|
||||
GETCURRENTPLAYBACKNUMBER=101,
|
||||
GETNUMITEMS=102,
|
||||
REWIND=200,
|
||||
FORWARD=210,
|
||||
ONNOTIFY=300,
|
||||
GETDEPENDENCYPTR=400,
|
||||
};
|
||||
};
|
||||
|
||||
inline api_dependent *ItemSequencer::getDependencyPtr() {
|
||||
return _call(GETDEPENDENCYPTR, (api_dependent*)NULL);
|
||||
}
|
||||
|
||||
inline const char *ItemSequencer::getNextPlayItem() {
|
||||
return _call(GETNEXTPLAYITEM, (const char *)NULL);
|
||||
}
|
||||
|
||||
inline
|
||||
int ItemSequencer::getCurrentPlaybackNumber() {
|
||||
return _call(GETCURRENTPLAYBACKNUMBER, -1);
|
||||
}
|
||||
|
||||
inline
|
||||
int ItemSequencer::getNumItems() {
|
||||
return _call(GETNUMITEMS, -1);
|
||||
}
|
||||
|
||||
inline int ItemSequencer::rewind() {
|
||||
return _call(REWIND, 0);
|
||||
}
|
||||
|
||||
inline int ItemSequencer::forward() {
|
||||
return _call(FORWARD, 0);
|
||||
}
|
||||
|
||||
inline int ItemSequencer::onNotify(int msg, int param1, int param2) {
|
||||
return _call(ONNOTIFY, 0, msg, param1, param2);
|
||||
}
|
||||
|
||||
#define SEQNOTIFY_ONREGISTER 10
|
||||
#define SEQNOTIFY_ONDEREGISTER 20
|
||||
#define SEQNOTIFY_ONNEXTFILE 30
|
||||
#define SEQNOTIFY_ONTITLECHANGE 40
|
||||
#define SEQNOTIFY_ONSTARTED 50
|
||||
#define SEQNOTIFY_ONSTOPPED 60
|
||||
#define SEQNOTIFY_ONPAUSED 70
|
||||
#define SEQNOTIFY_ONUNPAUSED 80
|
||||
|
||||
// override this one
|
||||
class ItemSequencerI : public ItemSequencer, public DependentI {
|
||||
public:
|
||||
api_dependent *getDependencyPtr() { return this; }
|
||||
|
||||
virtual int rewind()=0;
|
||||
virtual int forward()=0;
|
||||
virtual const char *getNextPlayItem()=0;
|
||||
virtual int getCurrentPlaybackNumber() { return -1; }
|
||||
virtual int getNumItems() { return -1; }
|
||||
|
||||
// these are optional callbacks
|
||||
virtual int onRegister() { return 0; };
|
||||
virtual int onDeregister() { return 0; };
|
||||
virtual int onNextFile() { return 0; }// on transition
|
||||
virtual int onTitleChange() { return 0; }
|
||||
virtual int onStarted() { return 0; }
|
||||
virtual int onStopped() { return 0; }
|
||||
virtual int onPaused() { return 0; }
|
||||
virtual int onUnpaused() { return 0; }
|
||||
|
||||
protected:
|
||||
// default implementation calls above callback methods based on msg
|
||||
virtual int onNotify(int msg, int param1, int param2);
|
||||
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
// also somewhat abstract, but implements playing through some arbitrary
|
||||
// list. just override the protected stuff
|
||||
class ListSequencer : public ItemSequencerI {
|
||||
public:
|
||||
virtual const char *getNextPlayItem();
|
||||
virtual int rewind();
|
||||
virtual int forward();
|
||||
|
||||
protected:
|
||||
// override these 4 only
|
||||
virtual int getNumEntries()=0;
|
||||
virtual const char *enumItem(int pos)=0;
|
||||
virtual int getCurrent()=0;
|
||||
virtual int setCurrent(int cur)=0;
|
||||
|
||||
protected:
|
||||
virtual int loop() { return 0; } // override as necessary
|
||||
|
||||
private:
|
||||
virtual int getNumItems(); // calls getNumEntries()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue