summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-03-18 18:18:57 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2018-03-18 18:18:57 +0100
commit57f4d38841c40cad3c206abdd16eebaed753aa1c (patch)
treec7e5a40b457845b2fb296563add9599d2e81384e /src/player.h
parent9364b9bb84f607d8603f60b86f965b77e03d8c70 (diff)
Update all fiels to adhere to style-guide
Diffstat (limited to 'src/player.h')
-rw-r--r--src/player.h133
1 files changed, 56 insertions, 77 deletions
diff --git a/src/player.h b/src/player.h
index 60b2ccb..8548c0a 100644
--- a/src/player.h
+++ b/src/player.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_PLAYER_H__
-#define __DRUMGIZMO_PLAYER_H__
+#pragma once
#include <QThread>
#include <QTimer>
@@ -35,97 +34,77 @@
#include "selection.h"
-class Player : public QThread {
-Q_OBJECT
+class Player
+ : public QThread
+{
+ Q_OBJECT
public:
- Player();
- ~Player();
+ Player();
+ ~Player();
- void run();
+ void run();
- // TODO: Make these private.
- // These two need to be public in order for the ugly hack in
- // CanvasToolListen::playRange to work...
- // volatile bool playing;
- volatile size_t pos;
- volatile size_t end;
+ // TODO: Make these private.
+ // These two need to be public in order for the ugly hack in
+ // CanvasToolListen::playRange to work...
+ // volatile bool playing;
+ volatile size_t pos;
+ volatile size_t end;
public slots:
- /**
- * Assign PCM data to the player.
- */
- void setPcmData(float *data, size_t num_samples);
-
- /**
- * Set gain scalar.
- * This value is multiplied with each sample before it is played.
- */
- void setGainScalar(double gain_scalar);
-
- /**
- * Set gain is dB.
- * Convenience method for setGainScalar. It simple recalculates the dB value
- * to a scalar and sets the gain scalar accordingly.
- */
- void setGainDB(double gain_db);
-
- /**
- * Set player position as sample offset.
- */
- void setPosition(size_t position);
-
- /**
- * Play range based on selection including fade-in/out.
- * @param length Stop playing after length samples. -1 means play all.
- */
- void playSelection(Selection selection, int length = -1);
-
- /**
- * Return true if last selection is done playing.
- */
- bool playSelectionDone();
-
- /**
- * Stop playing
- */
- void stop();
+ //! Assign PCM data to the player.
+ void setPcmData(float *data, size_t num_samples);
+
+ //! Set gain scalar.
+ //! This value is multiplied with each sample before it is played.
+ void setGainScalar(double gain_scalar);
+
+ //! Set gain is dB.
+ //! Convenience method for setGainScalar. It simple recalculates the dB value
+ //! to a scalar and sets the gain scalar accordingly.
+ void setGainDB(double gain_db);
+
+ //! Set player position as sample offset.
+ void setPosition(size_t position);
+
+ //! Play range based on selection including fade-in/out.
+ //! \param length Stop playing after length samples. -1 means play all.
+ void playSelection(Selection selection, int length = -1);
+
+ //! Return true if last selection is done playing.
+ bool playSelectionDone();
+
+ //! Stop playing
+ void stop();
signals:
- /**
- * The absolute maximum of samples seen since last update.
- */
- void peakUpdate(double peak);
+ //! The absolute maximum of samples seen since last update.
+ void peakUpdate(double peak);
- /**
- * The absolute maximum of samples seen since last update in dB.
- */
- void peakUpdateDB(double peak_db);
+ //! The absolute maximum of samples seen since last update in dB.
+ void peakUpdateDB(double peak_db);
- /**
- * The sample position of the player.
- */
- void positionUpdate(size_t position);
+ //! The sample position of the player.
+ void positionUpdate(size_t position);
private slots:
- void reportTimeout();
+ void reportTimeout();
private:
- ao_device *dev;
+ ao_device *dev;
- float *pcm_data;
- size_t pcm_size;
+ float *pcm_data;
+ size_t pcm_size;
- QTimer report_timer;
+ QTimer report_timer;
- double gain_scalar;
- double peak;
+ double gain_scalar;
+ double peak;
- bool running;
+ bool running;
- QMutex mutex;
- volatile bool new_selection;
- size_t sel_end;
- Selection selection;
+ QMutex mutex;
+ volatile bool new_selection;
+ size_t sel_end;
+ Selection selection;
};
-
-#endif/*__DRUMGIZMO_PLAYER_H__*/