aboutsummaryrefslogtreecommitdiff
path: root/include/aomusicplayer.h
blob: 255cc456c993a366aae0bf53cad954043f050680 (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
#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H

#if defined(BASSAUDIO)
#include "bass.h"
#elif defined(QTAUDIO)
#include <QMediaPlayer>
#endif

#include "aoapplication.h"

#include <QWidget>
#include <string.h>
#include <QDebug>
#include <QTimer>
#include <QObject>

#if defined(BASSAUDIO)
class AOMusicPlayer : public QObject
{
  Q_OBJECT
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  virtual ~AOMusicPlayer();

  void play(QString p_song);
  void set_volume(int p_value);

  void kill_loop();
  QString get_path();
  bool enable_looping = true;

private:
  QWidget *m_parent;
  AOApplication *ao_app;

  int m_volume = 0;
  QString f_path;

  HSTREAM m_stream;

};
#elif defined(QTAUDIO)
class AOMusicPlayer : public QObject
{
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  ~AOMusicPlayer();

  void play(QString p_song);
  void set_volume(int p_value);

  void kill_loop();
  QString get_path();
  bool enable_looping = true;

private:
  QWidget *m_parent;
  AOApplication *ao_app;

  QMediaPlayer m_player;

  int m_volume = 0;
  QString f_path;
};
#else
class AOMusicPlayer : public QObject
{
public:
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
  ~AOMusicPlayer();

  void play(QString p_song);
  void set_volume(int p_value);

  void kill_loop();
  QString get_path();
  bool enable_looping = true;

private:
  QWidget *m_parent;
  AOApplication *ao_app;

  int m_volume = 0;
  QString f_path;
};
#endif

#endif // AOMUSICPLAYER_H