svc_coreadmin.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #ifndef _SVC_COREADMIN_H
  2. #define _SVC_COREADMIN_H
  3. #include <bfc/dispatch.h>
  4. #include <api/core/corehandle.h>
  5. #include <api/core/sequence.h>
  6. #include <api/service/services.h>
  7. // There is only ONE INSTANCE of the coreadmin running in the application
  8. class NOVTABLE svc_coreAdmin : public Dispatchable {
  9. public:
  10. static FOURCC getServiceType() { return WaSvc::COREADMIN; }
  11. // create a new playback core
  12. CoreToken createCore(const char *name=NULL) { return _call(CREATECORE,0,name); }
  13. // (CoreToken)0 is the maincore
  14. // "main" is the maincore
  15. CoreToken nameToToken(const char *name) { return _call(NAMETOTOKEN,0,name); }
  16. int freeCoreByToken(CoreToken core) { return _call(FREECOREBYTOKEN,0,core); }
  17. int freeCoreByName(const char *name) { return _call(FREECOREBYNAME,0,name); }
  18. // returns 1 if present, 0 if non existent
  19. int verifyToken(CoreToken token) { return _call(VERIFYTOKEN,0,token); }
  20. //just the *.mp3 or whatever
  21. const char *getSupportedExtensions() { return _call(GETSUPPORTEDEXTENSIONS,(const char *)0); }
  22. // including names
  23. const char *getExtSupportedExtensions() { return _call(GETEXTSUPPORTEDEXTENSIONS,(const char *)0); }
  24. void registerExtension(const char *extensions, const char *extension_name, const char *family=NULL) { _voidcall(REGISTEREXTENSION,extensions,extension_name,family); }
  25. const char *getExtensionFamily(const char *extension) {
  26. return _call(GETEXTENSIONFAMILY, (const char *)0, extension);
  27. }
  28. void unregisterExtension(const char *extensions) { _voidcall(UNREGISTEREXTENSION,extensions); }
  29. int setNextFile(CoreToken core, const char *playstring, const char *destination=NULL) { return _call(SETNEXTFILE,0,core,playstring,destination); }
  30. // returns -1 if paused, 0 if stopped and 1 if playing
  31. int getStatus(CoreToken core) { return _call(GETSTATUS,0,core); }
  32. const char *getCurrent(CoreToken core) { return _call(GETCURRENT,(const char *)0,core); }
  33. int getCurPlaybackNumber(CoreToken core) { return _call(GETCURPLAYBACKNUMBER,-1,core); }
  34. int getNumTracks(CoreToken core) { return _call(GETNUMTRACKS, -1, core); }
  35. int getPosition(CoreToken core) { return _call(GETPOSITION,0,core); }
  36. int getWritePosition(CoreToken core) { return _call(GETWRITEPOSITION,0,core); }
  37. int setPosition(CoreToken core, int ms) { return _call(SETPOSITION,0,core,ms); }
  38. int getLength(CoreToken core) { return _call(GETLENGTH,-1,core); }
  39. // this method queries the core plugins directly, bypassing the db
  40. // returns size of data
  41. int getPluginData(const char *playstring, const char *name,
  42. char *data, int data_len, int data_type=0) { return _call(GETPLUGINDATA,0,playstring,name,data,data_len,data_type); }
  43. unsigned int getVolume(CoreToken core) { return _call(GETVOLUME,0,core); }
  44. // 0..255
  45. void setVolume(CoreToken core, unsigned int vol) { _voidcall(SETVOLUME,core,vol); }
  46. // -127..127
  47. int getPan(CoreToken core) { return _call(GETPAN,0,core); }
  48. // -127..127
  49. void setPan(CoreToken core, int bal) { _voidcall(SETPAN,core,bal); }
  50. void setMute(CoreToken core, int mute) { _voidcall(SETMUTE,core,mute); }
  51. int getMute(CoreToken core) { return _call(GETMUTE,0,core); }
  52. // register here for general callbacks in core status.
  53. void addCallback(CoreToken core, CoreCallback *cb) { _voidcall(ADDCALLBACK,core,cb); }
  54. void delCallback(CoreToken core, CoreCallback *cb) { _voidcall(DELCALLBACK,core,cb); }
  55. // get visualization data, returns 0 if you should blank out
  56. int getVisData(CoreToken core, void *dataptr, int sizedataptr) { return _call(GETVISDATA,0,core,dataptr,sizedataptr); }
  57. int getLeftVuMeter(CoreToken core) { return _call(GETLEFTVUMETER,0,core); }
  58. int getRightVuMeter(CoreToken core) { return _call(GETRIGHTVUMETER,0,core); }
  59. int registerSequencer(CoreToken core, ItemSequencer *seq) { return _call(REGISTERSEQUENCER,0,core,seq); }
  60. int deregisterSequencer(CoreToken core, ItemSequencer *seq) { return _call(DEREGISTERSEQUENCER,0,core,seq); }
  61. ItemSequencer *getSequencer(CoreToken core) { return _call(GETSEQUENCER, (ItemSequencer*)NULL,core); }
  62. // see buttons.h
  63. void userButton(CoreToken core, int button) { _voidcall(USERBUTTON,core,button); }
  64. // returns 1 if on, 0 if off
  65. int getEqStatus(CoreToken core) { return _call(GETEQSTATUS,0,core); }
  66. void setEqStatus(CoreToken core, int enable) { _voidcall(SETEQSTATUS,core,enable); }
  67. // -127 to 127 (-20db to +20db)
  68. int getEqPreamp(CoreToken core) { return _call(GETEQPREAMP,0,core); }
  69. void setEqPreamp(CoreToken core, int pre) { _voidcall(SETEQPREAMP,core,pre); }
  70. // band=0-9
  71. int getEqBand(CoreToken core, int band) { return _call(GETEQBAND,0,core,band); }
  72. void setEqBand(CoreToken core, int band, int val) { _voidcall(SETEQBAND,core,band,val); }
  73. // returns 1 if on, 0 if off
  74. int getEqAuto(CoreToken core) { return _call(GETEQAUTO,0,core); }
  75. void setEqAuto(CoreToken core, int enable) { _voidcall(SETEQAUTO,core,enable); }
  76. // for status msgs
  77. void setCustomMsg(CoreToken core, const char *text) { _voidcall(SETCUSTOMMSG,core,text); }
  78. void setPriority(CoreToken core, int priority) { _voidcall(SETPRIORITY,core,priority); }
  79. int getPriority(CoreToken core) { return _call(GETPRIORITY,0,core); }
  80. void rebuildConvertersChain(CoreToken core) { _voidcall(REBUILDCONVERTERSCHAIN,core); }
  81. int sendConvertersMsg(CoreToken core, const char *msg, const char *value) { return _call(SENDCONVERTERSMSG,0,core,msg,value); }
  82. const char *getTitle(CoreToken core) { return _call(GETTITLE,(const char *)NULL, core); }
  83. enum {
  84. CREATECORE=10,
  85. NAMETOTOKEN=20,
  86. FREECOREBYTOKEN=30,
  87. FREECOREBYNAME=40,
  88. VERIFYTOKEN=50,
  89. GETSUPPORTEDEXTENSIONS=100,
  90. GETEXTSUPPORTEDEXTENSIONS=110,
  91. REGISTEREXTENSION=121, //120 retired
  92. GETEXTENSIONFAMILY=122,
  93. UNREGISTEREXTENSION=130,
  94. SETNEXTFILEOLD=200,
  95. SETNEXTFILE=210,
  96. GETSTATUS=300,
  97. GETCURRENT=310,
  98. GETCURPLAYBACKNUMBER=315,
  99. GETNUMTRACKS=317,
  100. GETPOSITION=320,
  101. GETWRITEPOSITION=330,
  102. GETLENGTH=340,
  103. GETPLUGINDATA=350,
  104. GETVOLUME=360,
  105. GETPAN=370,
  106. GETVISDATA=380,
  107. GETLEFTVUMETER=390,
  108. GETRIGHTVUMETER=400,
  109. GETEQSTATUS=410,
  110. GETEQPREAMP=420,
  111. GETEQBAND=430,
  112. GETEQAUTO=440,
  113. GETMUTE=450,
  114. SETPOSITION=500,
  115. SETVOLUME=510,
  116. SETPAN=520,
  117. SETEQSTATUS=530,
  118. SETEQPREAMP=540,
  119. SETEQBAND=550,
  120. SETEQAUTO=560,
  121. SETMUTE=570,
  122. ADDCALLBACK=700,
  123. DELCALLBACK=710,
  124. REGISTERSEQUENCER=800,
  125. DEREGISTERSEQUENCER=810,
  126. GETSEQUENCER=812,
  127. USERBUTTON=820,
  128. SETCUSTOMMSG=900,
  129. SETPRIORITY=1000,
  130. GETPRIORITY=1100,
  131. REBUILDCONVERTERSCHAIN=1200,
  132. SENDCONVERTERSMSG=1300,
  133. GETTITLE=1400,
  134. };
  135. };
  136. class NOVTABLE svc_coreAdminI : public svc_coreAdmin {
  137. public:
  138. virtual CoreToken createCore(const char *name=NULL)=0;
  139. virtual CoreToken nameToToken(const char *name)=0;
  140. virtual int freeCoreByToken(CoreToken core)=0;
  141. virtual int freeCoreByName(const char *name)=0;
  142. virtual int verifyToken(CoreToken token)=0;
  143. virtual const char *getSupportedExtensions()=0;
  144. virtual const char *getExtSupportedExtensions()=0;
  145. virtual void registerExtension(const char *extensions, const char *extension_name, const char *family=NULL)=0;
  146. virtual const char *getExtensionFamily(const char *extension)=0;
  147. virtual void unregisterExtension(const char *extensions)=0;
  148. virtual int setNextFile(CoreToken core, const char *playstring, const char *destination)=0;
  149. virtual int getStatus(CoreToken core)=0;
  150. virtual const char *getCurrent(CoreToken core)=0;
  151. virtual int getCurPlaybackNumber(CoreToken core)=0;
  152. virtual int getNumTracks(CoreToken core)=0;
  153. virtual int getPosition(CoreToken core)=0;
  154. virtual int getWritePosition(CoreToken core)=0;
  155. virtual int setPosition(CoreToken core, int ms)=0;
  156. virtual int getLength(CoreToken core)=0;
  157. virtual int getPluginData(const char *playstring, const char *name, char *data, int data_len, int data_type=0)=0;
  158. virtual unsigned int getVolume(CoreToken core)=0;
  159. virtual void setVolume(CoreToken core, unsigned int vol)=0;
  160. virtual int getPan(CoreToken core)=0;
  161. virtual void setPan(CoreToken core, int bal)=0;
  162. virtual void addCallback(CoreToken core, CoreCallback *cb)=0;
  163. virtual void delCallback(CoreToken core, CoreCallback *cb)=0;
  164. virtual int getVisData(CoreToken core, void *dataptr, int sizedataptr)=0;
  165. virtual int getLeftVuMeter(CoreToken core)=0;
  166. virtual int getRightVuMeter(CoreToken core)=0;
  167. virtual void setMute(CoreToken core, int mute)=0;
  168. virtual int getMute(CoreToken core)=0;
  169. virtual int registerSequencer(CoreToken core, ItemSequencer *seq)=0;
  170. virtual int deregisterSequencer(CoreToken core, ItemSequencer *seq)=0;
  171. virtual ItemSequencer *getSequencer(CoreToken core)=0;
  172. virtual void userButton(CoreToken core, int button)=0;
  173. virtual int getEqStatus(CoreToken core)=0;
  174. virtual void setEqStatus(CoreToken core, int enable)=0;
  175. virtual int getEqPreamp(CoreToken core)=0;
  176. virtual void setEqPreamp(CoreToken core, int pre)=0;
  177. virtual int getEqBand(CoreToken core, int band)=0;
  178. virtual void setEqBand(CoreToken core, int band, int val)=0;
  179. virtual int getEqAuto(CoreToken core)=0;
  180. virtual void setEqAuto(CoreToken core, int enable)=0;
  181. virtual void setCustomMsg(CoreToken core, const char *text)=0;
  182. virtual void setPriority(CoreToken core, int priority)=0;
  183. virtual int getPriority(CoreToken core)=0;
  184. virtual void rebuildConvertersChain(CoreToken core)=0;
  185. virtual int sendConvertersMsg(CoreToken core, const char *msg, const char *value)=0;
  186. virtual const char *getTitle(CoreToken core)=0;
  187. protected:
  188. RECVS_DISPATCH;
  189. };
  190. #endif