forked from goldendict/goldendict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
audioplayerinterface.hh
30 lines (24 loc) · 943 Bytes
/
audioplayerinterface.hh
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
/* This file is (c) 2018 Igor Kushnir <[email protected]>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef AUDIOPLAYERINTERFACE_HH_INCLUDED
#define AUDIOPLAYERINTERFACE_HH_INCLUDED
#include <QScopedPointer>
#include <QString>
#include <QObject>
class AudioPlayerInterface : public QObject
{
Q_OBJECT
public:
/// Stops current playback if any, copies the audio buffer at [data, data + size),
/// then plays this buffer. It is safe to invalidate \p data after this function call.
/// Returns an error message in case of immediate failure; an empty string
/// in case of success.
virtual QString play( const char * data, int size ) = 0;
/// Stops current playback if any.
virtual void stop() = 0;
signals:
/// Notifies of asynchronous errors.
void error( QString message );
};
typedef QScopedPointer< AudioPlayerInterface > AudioPlayerPtr;
#endif // AUDIOPLAYERINTERFACE_HH_INCLUDED