GEAudioOut.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Copyright (c) 2011 Nokia Corporation.
  3. *
  4. * Part of the Qt GameEnabler.
  5. */
  6. #ifndef GEAUDIOOUT_H
  7. #define GEAUDIOOUT_H
  8. #include <QThread>
  9. #include "GEInterfaces.h"
  10. // Forward declarations
  11. class QAudioOutput;
  12. class QIODevice;
  13. namespace GE {
  14. class AudioOut : public QThread
  15. {
  16. Q_OBJECT
  17. public: // Data types
  18. enum ThreadStates {
  19. NotRunning = 0,
  20. DoRun = 1,
  21. DoExit = 2
  22. };
  23. public:
  24. AudioOut(AudioSource *source, QObject *parent = 0);
  25. virtual ~AudioOut();
  26. public:
  27. bool usingThead() const { return m_usingThread; }
  28. public slots:
  29. void tick();
  30. private slots:
  31. void audioNotify();
  32. protected: // From QThread
  33. virtual void run(); // For the threaded mode only!
  34. protected: // Data
  35. QAudioOutput *m_audioOutput; // Owned
  36. QIODevice *m_outTarget; // Not owned
  37. AudioSource *m_source; // Not owned
  38. AUDIO_SAMPLE_TYPE *m_sendBuffer; // Owned
  39. int m_sendBufferSize;
  40. qint64 m_samplesMixed;
  41. int m_threadState;
  42. bool m_usingThread;
  43. };
  44. } // namespace GE
  45. #endif // GEAUDIOOUT_H