summaryrefslogtreecommitdiffstats
path: root/ksayit/src/fxpluginhandler.h
blob: 4da5fb6cf0c2172366e4e547527f40f8e3b81627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// C++ Interface: fxpluginhandler
//
// Description: 
//
//
// Author: Robert Vogl <voglrobe@lapislazuli>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef FXPLUGINHANDLER_H
#define FXPLUGINHANDLER_H

// QT includes
#include <tqobject.h>
#include <tqlibrary.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqmap.h>
// #include <tqvaluelist.h>

// KDE includes
#include <kconfig.h>
#include <arts/kartsserver.h>
#include <arts/artsflow.h>

using namespace Arts;

// App specific includes
#include "ksayit_fxplugin.h"

/**
@author Robert Vogl
*/
/** Internal structure of the effect plugin
 */
typedef struct {
    TQString name; // KService::Ptr->name()
    TQString library; // KService::Ptr->library()
    TQString description;
    long EffectID; // !=0, if effect is on the effect stack.
    FXPlugin *p; // factory->create(...)
} fx_struct;


class FXPluginHandler : public TQObject
{
Q_OBJECT
  
public:
    FXPluginHandler(TQObject *parent = 0, const char *name = 0, KConfig *config=0);
    ~FXPluginHandler();

public: // Methods  
    /** Loads the activated plugins.
     */
    void readConfiguration();

    /** Loads any available plugin from the directories containing KSayIt plugins,
     *  fills the plugin_struct with the corresponding data and unloads the plugin.
     */
    void searchPlugins();
    
    /** Shows the GUI to setup the effect named name
    \param pname The name of the effect to configure.
     */ 
    void showEffectGUI(const TQString &pname);
    
    /** Activates the named effect
    \param pname Name of the effect to activate.
    \param server A pointer to the soundserver instance.
    \param fx_stack A pointer to the effect stack of the soundserver.
     */
    void activateEffect(const TQString &pname,
                        KArtsServer *server,
                        StereoEffectStack *fx_stack);

    /** Removes all effects from the soundservers effect stack.
    \param fx_stack A pointer to the effect stack of the soundserver.
     */
    void deactivateEffects(StereoEffectStack *fx_stack);
    
    /** Returns a list of all available plugins.
    \param pluginlist A reference to a TQStringList that contains the available plugins.
     */
    void getPlugins(TQStringList &pluginlist); 

private: // Attributes
    KConfig *m_config;
    TQMap<TQString, fx_struct> m_mapPluginList; // holds all plugins found on the system
    // TQMap<TQString, fx_struct> m_mapActivePlugins; // holds the active effects
    TQStringList m_lstActivePlugins;
          

};



#endif