2013-09-03 18:29:10 +02:00
|
|
|
|
2013-09-06 01:28:11 +02:00
|
|
|
#ifndef LUPPP_STATELY_H
|
|
|
|
#define LUPPP_STATELY_H
|
2013-09-03 18:29:10 +02:00
|
|
|
|
2013-09-06 01:28:11 +02:00
|
|
|
/** Stately
|
|
|
|
* This class is inherited from by all classes that have state.
|
2013-09-03 18:29:10 +02:00
|
|
|
*
|
2013-09-06 01:28:11 +02:00
|
|
|
* save() should be overriden if the object needs to save its state
|
|
|
|
* reset() should be overriden if the object can clear its state
|
|
|
|
*
|
|
|
|
* The flexibility allows eg LooperClips to request buffers to tranfser audio
|
2013-09-03 18:29:10 +02:00
|
|
|
* data into the GUI thread for disk serialization, and scales for future
|
|
|
|
* classes which also need to request memory in order to save in a RT safe way.
|
|
|
|
**/
|
2013-09-06 01:28:11 +02:00
|
|
|
class Stately
|
2013-09-03 18:29:10 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-09-06 01:28:11 +02:00
|
|
|
Stately();
|
2013-09-03 18:29:10 +02:00
|
|
|
|
2013-09-06 00:48:47 +02:00
|
|
|
/// this function being called resets the state of the instance to blank
|
|
|
|
virtual void reset();
|
|
|
|
|
2013-09-03 18:29:10 +02:00
|
|
|
/// this function is called when the user initiates a save action
|
|
|
|
virtual void save();
|
2013-09-03 21:06:11 +02:00
|
|
|
|
|
|
|
/// this function *must* be called by each sub-class when it is *finished*
|
2013-11-13 13:03:24 +01:00
|
|
|
/// a successful save action. Once each Stately is done, the final save is OK-ed.
|
2013-09-03 21:06:11 +02:00
|
|
|
static void done();
|
2013-11-13 13:03:24 +01:00
|
|
|
|
|
|
|
/// this function notes that a stately could *not* successfully save: buffer
|
|
|
|
/// size mismatch in LooperClip for example.
|
|
|
|
static void error();
|
2013-09-03 21:06:11 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
static int savesDone;
|
2013-09-03 18:29:10 +02:00
|
|
|
};
|
|
|
|
|
2013-09-06 01:28:11 +02:00
|
|
|
#endif // LUPPP_STATELY_H
|
2013-09-03 18:29:10 +02:00
|
|
|
|