reference

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

ofFmodSoundPlayer.h
Go to the documentation of this file.
1#pragma once
2
3#include "ofConstants.h"
4
5#ifdef OF_SOUND_PLAYER_FMOD
6
7#include "ofSoundBaseTypes.h"
8
9
10extern "C" {
11#include "fmod.h"
12#include "fmod_errors.h"
13}
14
15// TO DO :
16// ---------------------------
17// -fft via fmod, as in the last time...
18// -close fmod if it's up
19// -loadSoundForStreaming(char * fileName);
20// ---------------------------
21
22// interesting:
23// http://www.compuphase.com/mp3/mp3loops.htm
24
25
26// ---------------------------------------------------------------------------- SOUND SYSTEM FMOD
27
28// --------------------- global functions:
29void ofFmodSoundStopAll();
30void ofFmodSoundSetVolume(float vol);
31void ofFmodSoundUpdate(); // calls FMOD update.
32float * ofFmodSoundGetSpectrum(int nBands); // max 512...
33void ofFmodSetBuffersize(unsigned int bs);
34
35
36// --------------------- player functions:
37class ofFmodSoundPlayer : public ofBaseSoundPlayer {
38
39 public:
40
41 ofFmodSoundPlayer();
42 virtual ~ofFmodSoundPlayer();
43
44 bool load(const of::filesystem::path& fileName, bool stream = false);
45 void unload();
46 void play();
47 void stop();
48
49 void setVolume(float vol);
50 void setPan(float vol);
51 void setSpeed(float spd);
52 void setPaused(bool bP);
53 void setLoop(bool bLp);
54 void setMultiPlay(bool bMp);
55 void setPosition(float pct); // 0 = start, 1 = end;
56 void setPositionMS(int ms);
57
58 float getPosition() const;
59 int getPositionMS() const;
60 bool isPlaying() const;
61 float getSpeed() const;
62 float getPan() const;
63 float getVolume() const;
64 bool isLoaded() const;
65
66 static void initializeFmod();
67 static void closeFmod();
68
69
70 bool isStreaming;
71 bool bMultiPlay;
72 bool bLoop;
73 bool bLoadedOk;
74 bool bPaused;
75 float pan; // -1 to 1
76 float volume; // 0 - 1
77 float internalFreq; // 44100 ?
78 float speed; // -n to n, 1 = normal, -1 backwards
79 unsigned int length; // in samples;
80
81 FMOD_RESULT result;
82 FMOD_CHANNEL * channel = NULL;
83 FMOD_SOUND * sound = NULL;
84};
85
86#endif //OF_SOUND_PLAYER_FMOD
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
float * ofFmodSoundGetSpectrum(int nBands)
void ofFmodSetBuffersize(unsigned int bs)