ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SIDPlayer/src/clamp_includes/InputPlugin.h
Revision: 1.1.1.1 (vendor branch)
Committed: 2000-07-28T12:42:30Z (23 years, 9 months ago) by cebix
Content type: text/plain
Branch: MAIN, cebix
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
- sources imported to CVS

File Contents

# Content
1
2 #ifndef CLAMP_INPUT_PLUGIN_H
3 #define CLAMP_INPUT_PLUGIN_H
4
5 #include <AppKit.h>
6 #include <StorageKit.h>
7
8 #include "Plugin_Messages.h"
9 #include "Plugin_ConstructorStruct.h"
10
11 #include "InputPlugin_InfoStruct.h"
12
13 #define MAX_GETAUDIO_SIZE (10*1024)
14
15 // The class description of the object that will be returned when CL-Amp ask the AddOn (Plugin) for its object...
16 class InputPlugin {
17 public:
18 // Used by CL-Amp. Don't bother about these functions!
19 // InputPlugin(char *label, char *desc, struct InputPluginFuncs *F) { CLAmpHandler=NULL; Label= label; Description= desc; Master= false; }
20 InputPlugin(char *label, char *desc) { CLAmpHandler=NULL; Label= label; Description= desc; Master= false; }
21 virtual ~InputPlugin() { }
22 void SetHandler(BHandler *handler) { CLAmpHandler= handler; }
23 void SetMaster() { Master= true; }
24
25 // =================================================================
26 // Here comes the functions you have to provide in your plugin code!
27
28 // No thread considerations with this function!
29 virtual void Init()=0;
30 virtual void Cleanup() {};
31 // 2 special special functions follows, not needed for most plugins!!
32 virtual void *GetUserData() { return(NULL); }
33 virtual void SetUserData(void *UserData) { }
34
35 // These functions will run in thread A, dont let functions from A use data from B or vice verse...
36 virtual bool About(bool Question)=0;
37 virtual bool Prefs(bool Question)=0;
38 virtual bool Edit (const char *FileName, bool Question)=0;
39 virtual bool GetMimeType(BMimeType *m, int Nr)=0;
40 virtual bool IsOur(const char *FileName)=0;
41 virtual bool GetSongInfo(const char *FileName, struct PlayerInfoStruct *Info)=0;
42 virtual void AbortPlaying()=0;
43 virtual void Pause(bool On)=0;
44 virtual void NewSpeed (long Promille)=0;
45 virtual void NewVolume (long Promille)=0;
46 // 2 special functions follows, not needed for most plugins!!
47 virtual void NewPanning(long Promille) {}
48 virtual bool CanCrossFade(char *FileName1, char *FileName2) { return(true); }
49
50 // These functions will run in thread B, dont let functions from B use data from A or vice verse...
51 virtual bool InitPlaying(const char *FileName, struct PlayerInfoStruct *Info)=0;
52 virtual int GetAudio(char **Buff, int Size)=0;
53 virtual void JumpTo(long NewTime)=0;
54 virtual void CleanupPlaying()=0;
55
56 // End of the functions you have to provide in your plugin code!
57 // =================================================================
58
59 // Help functions you can call to get data from the InputPlugin class itself
60 const char *GetLabel() { return Label; }
61 const char *GetDescription() { return Description; }
62 BHandler *GetCLAmpHandler() { return CLAmpHandler; }
63 void SendToCLAmp(struct PlayerInfoStruct *info) { BMessage Msg(CLAMP_MSG_PLAYINFO); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddData(CLAMP_PLAYINFO_LABEL, B_STRING_TYPE, (char *)info, sizeof(*info)); l->PostMessage (&Msg, CLAmpHandler); } }
64 void SendToCLAmp_ChangedFile(const char *FileName) { BMessage Msg(CLAMP_MSG_CHANGED); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddString(CLAMP_CHANGED_LABEL, FileName); l->PostMessage (&Msg, CLAmpHandler); } }
65 void SendToCLAmp_AddFile(const char *FileName) { BMessage Msg(CLAMP_MSG_ADD); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddString(CLAMP_ADD_LABEL, FileName); l->PostMessage (&Msg, CLAmpHandler); } }
66 void SendToCLAmp_AddFile(const char *FileName, long SongId) { BMessage Msg(CLAMP_MSG_ADD); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddString(CLAMP_ADD_LABEL, FileName); Msg.AddInt32(CLAMP_SONG_ID, SongId); l->PostMessage (&Msg, CLAmpHandler); } }
67 void SendToCLAmp_DelFile(const char *FileName) { BMessage Msg(CLAMP_MSG_DEL); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddString(CLAMP_DEL_LABEL, FileName); l->PostMessage (&Msg, CLAmpHandler); } }
68 void SendToCLAmp_DelFile(long SongId) { BMessage Msg(CLAMP_MSG_DEL); BLooper *l; if (CLAmpHandler && (l=CLAmpHandler->Looper())) { Msg.AddInt32(CLAMP_SONG_ID, SongId); l->PostMessage (&Msg, CLAmpHandler); } }
69 bool IsMaster() { return (Master); }
70 private:
71 char *Label, *Description;
72 BHandler *CLAmpHandler;
73 bool Master;
74 };
75
76 #define CURRENT_INPUT_PLUGIN_VERSION 3
77 #define INPUT_PLUGIN_VERSION_MASK 0x0fff
78 #define PUT_THIS_PLUGIN_LAST 0x1000
79
80 #endif