reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofAVEngineSoundPlayer.h
Go to the documentation of this file.
1//
2// ofAVEngineSoundPlayer.hpp
3// soundPlayerExample
4//
5// Created by Theo Watson on 3/24/21.
6//
7
8#pragma once
9
10#include "ofConstants.h"
11
12#ifdef OF_SOUND_PLAYER_AV_ENGINE
13
14#include "ofSoundBaseTypes.h"
15#include "ofEvents.h"
16
17#ifdef __OBJC__
18 #import <Foundation/Foundation.h>
19 #import <AVFoundation/AVFoundation.h>
20 #import <Accelerate/Accelerate.h>
21#endif
22
23class ofAVEngineSoundPlayer : public ofBaseSoundPlayer {
24
25public:
26
27//thanks to @bangnoise for this trick
28#ifdef __OBJC__
29 using ObjectType = id<NSObject>;
30#else
31 using ObjectType = void *;
32#endif
33
34 ofAVEngineSoundPlayer();
35 ~ofAVEngineSoundPlayer();
36
37 static std::vector <float> getSystemSpectrum(int bands);
38
39 bool load(const std::filesystem::path& fileName, bool stream = false);
40 void unload();
41 void play();
42 void stop();
43
44 void setVolume(float vol);
45 void setPan(float vol);
46 void setSpeed(float spd);
47 void setPaused(bool bP);
48 void setLoop(bool bLp);
49 void setMultiPlay(bool bMp);
50 void setPosition(float pct);
51 void setPositionMS(int ms);
52
53 float getPosition() const;
54 int getPositionMS() const;
55 bool isPlaying() const;
56 float getSpeed() const;
57 float getPan() const;
58 bool isLoaded() const;
59 float getVolume() const;
60
61 void * getAVEnginePlayer();
62
63protected:
64
65 void updateFunction(ofEventArgs & args);
66 bool bAddedUpdate = false;
67
68 void cleanupMultiplayers();
69 static bool removeMultiPlayer(void * aPlayer);
70 ObjectType soundPlayer;
71 std::vector <ObjectType> mMultiplayerSoundPlayers;
72 static std::vector<float> systemBins;
73
74};
75
76#endif
Definition ofSoundBaseTypes.h:161
virtual void setSpeed(float spd)=0
virtual bool load(const of::filesystem::path &fileName, bool stream=false)=0
virtual void setPositionMS(int ms)=0
virtual bool isLoaded() const =0
virtual bool isPlaying() const =0
virtual void setMultiPlay(bool bMp)=0
virtual float getPosition() const =0
virtual void play()=0
virtual void stop()=0
virtual void setPan(float vol)=0
virtual void setVolume(float vol)=0
virtual float getVolume() const =0
virtual void setPaused(bool bP)=0
virtual float getPan() const =0
virtual int getPositionMS() const =0
virtual float getSpeed() const =0
virtual void setPosition(float pct)=0
virtual void unload()=0
virtual void setLoop(bool bLp)=0
Definition ofEvents.h:119