Audio: Make the TestDriver class completely internal to the audio test
It's not used anywhere else except during this one test, so move it out of the global include files. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
b9d4c6749d
commit
5b32bb16b4
|
@ -86,32 +86,4 @@ public:
|
|||
virtual long duration() = 0;
|
||||
};
|
||||
|
||||
|
||||
#ifdef CONFIG_TEST
|
||||
class TestDriver : public Driver
|
||||
{
|
||||
public:
|
||||
bool playing;
|
||||
long cur_pos;
|
||||
long cur_duration;
|
||||
std::string cur_file;
|
||||
|
||||
TestDriver();
|
||||
~TestDriver();
|
||||
void init(int *, char ***, void (*)(), void (*)());
|
||||
|
||||
void load(const std::string &);
|
||||
bool play();
|
||||
bool pause();
|
||||
bool is_playing();
|
||||
|
||||
void seek_to(long);
|
||||
long position();
|
||||
long duration();
|
||||
|
||||
void eos();
|
||||
void error();
|
||||
};
|
||||
#endif /* CONFIG_TEST */
|
||||
|
||||
#endif /* OCARINA_CORE_DRIVER_H */
|
||||
|
|
|
@ -11,24 +11,52 @@ Track *TRACK_NULL = NULL;
|
|||
static unsigned int eos_count = 0;
|
||||
static unsigned int error_count = 0;
|
||||
|
||||
TestDriver :: TestDriver() : playing(false), cur_pos(0), cur_duration(0) {}
|
||||
TestDriver :: ~TestDriver() {}
|
||||
|
||||
void TestDriver :: init(int *argc, char ***argv, void (*eos_cb)(), void (*error_cb)())
|
||||
{ on_eos = eos_cb; on_error = error_cb; }
|
||||
void TestDriver :: load(const std::string &file)
|
||||
{ cur_file = file; playing = false; cur_pos = 0; }
|
||||
bool TestDriver :: play() { playing = true; return true; }
|
||||
bool TestDriver :: pause() { playing = false; return true; }
|
||||
bool TestDriver :: is_playing() { return playing; }
|
||||
class TestDriver : public Driver
|
||||
{
|
||||
public:
|
||||
bool playing;
|
||||
long cur_pos;
|
||||
long cur_duration;
|
||||
std::string cur_file;
|
||||
|
||||
void TestDriver :: seek_to(long pos) { cur_pos = pos; }
|
||||
long TestDriver :: position() { return cur_pos; }
|
||||
long TestDriver :: duration() { return cur_duration; }
|
||||
TestDriver() : playing(false), cur_pos(0), cur_duration(0) {}
|
||||
~TestDriver() {};
|
||||
|
||||
void TestDriver :: eos() { on_eos(); }
|
||||
void TestDriver :: error() { on_error(); }
|
||||
void init(int *argc, char ***argv, void (*eos_cb)(), void (*error_cb)())
|
||||
{
|
||||
on_eos = eos_cb;
|
||||
on_error = error_cb;
|
||||
}
|
||||
|
||||
void load(const std::string &file)
|
||||
{
|
||||
cur_file = file;
|
||||
playing = false;
|
||||
cur_pos = 0;
|
||||
}
|
||||
|
||||
bool play()
|
||||
{
|
||||
playing = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pause()
|
||||
{
|
||||
playing = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_playing() { return playing; }
|
||||
|
||||
void seek_to(long offset) { cur_pos = offset; }
|
||||
long position() { return cur_pos; }
|
||||
long duration() { return cur_duration; }
|
||||
|
||||
void eos() { on_eos(); }
|
||||
void error() { on_error(); }
|
||||
};
|
||||
|
||||
void on_eos()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue