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;
|
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 */
|
#endif /* OCARINA_CORE_DRIVER_H */
|
||||||
|
|
|
@ -11,24 +11,52 @@ Track *TRACK_NULL = NULL;
|
||||||
static unsigned int eos_count = 0;
|
static unsigned int eos_count = 0;
|
||||||
static unsigned int error_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)())
|
class TestDriver : public Driver
|
||||||
{ on_eos = eos_cb; on_error = error_cb; }
|
{
|
||||||
void TestDriver :: load(const std::string &file)
|
public:
|
||||||
{ cur_file = file; playing = false; cur_pos = 0; }
|
bool playing;
|
||||||
bool TestDriver :: play() { playing = true; return true; }
|
long cur_pos;
|
||||||
bool TestDriver :: pause() { playing = false; return true; }
|
long cur_duration;
|
||||||
bool TestDriver :: is_playing() { return playing; }
|
std::string cur_file;
|
||||||
|
|
||||||
void TestDriver :: seek_to(long pos) { cur_pos = pos; }
|
TestDriver() : playing(false), cur_pos(0), cur_duration(0) {}
|
||||||
long TestDriver :: position() { return cur_pos; }
|
~TestDriver() {};
|
||||||
long TestDriver :: duration() { return cur_duration; }
|
|
||||||
|
|
||||||
void TestDriver :: eos() { on_eos(); }
|
void init(int *argc, char ***argv, void (*eos_cb)(), void (*error_cb)())
|
||||||
void TestDriver :: error() { on_error(); }
|
{
|
||||||
|
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()
|
void on_eos()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue