-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a bunch of improvements and new classes
- Loading branch information
1 parent
16da79c
commit e9e21b2
Showing
7 changed files
with
170 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Panner.cpp | ||
// ofxHapPlayerMultiAudio | ||
// | ||
// Created by Shadow Tuner on 10-10-23. | ||
// | ||
|
||
#include "Panner.h" | ||
#include "ofSoundUtils.h" | ||
|
||
Panner::Panner(): | ||
ofxSoundObject(OFX_SOUND_OBJECT_PROCESSOR), | ||
_pan(0), | ||
leftPan(1), rightPan(1) | ||
{ | ||
setPan(0); | ||
} | ||
|
||
Panner::Panner(const Panner& a){ | ||
this->_pan = a.getPan(); | ||
} | ||
|
||
Panner& Panner::operator=(const Panner& mom){ | ||
this->_pan = mom.getPan(); | ||
return *this; | ||
} | ||
|
||
void Panner::setPan(float pan){ | ||
float left, right; | ||
ofStereoVolumes(1, pan, left, right); | ||
_pan = pan; | ||
leftPan = left; | ||
rightPan = right; | ||
} | ||
|
||
float Panner::getPan() const{ | ||
return _pan; | ||
} | ||
|
||
|
||
void Panner::process(ofSoundBuffer &input, ofSoundBuffer &output){ | ||
|
||
output = input; | ||
if(isBypassed())return; | ||
|
||
if(output.getNumChannels() == 2){ | ||
output.stereoPan(leftPan, rightPan); | ||
}else{ | ||
if(bShowNotice){ | ||
ofLogNotice("Panner::process") << "Not applying pan to buffer as it only works on stereo signals"; | ||
bShowNotice = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Panner.hpp | ||
// ofxHapPlayerMultiAudio | ||
// | ||
// Created by Shadow Tuner on 10-10-23. | ||
// | ||
#pragma once | ||
#include "ofMain.h" | ||
#include "ofxSoundObject.h" | ||
|
||
#include <atomic> | ||
|
||
|
||
///\brief This object sets the pan for a mono or stereo buffer passing through it | ||
class Panner: public ofxSoundObject{ | ||
public: | ||
|
||
Panner(); | ||
Panner(const Panner& a); | ||
Panner& operator=(const Panner& mom); | ||
|
||
///\brief set the pan applied to the signal | ||
///\param pan the pan value. range is -1 to 1. (left - right) | ||
void setPan(float pan); | ||
|
||
///\brief get the pan applied to the signal | ||
///\returns pan in the range -1 to 1. (left - right) | ||
float getPan() const; | ||
|
||
|
||
virtual void process(ofSoundBuffer &input, ofSoundBuffer &output) override; | ||
private: | ||
|
||
std::atomic<float> _pan; | ||
std::atomic<float> leftPan, rightPan; | ||
|
||
bool bShowNotice = true; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters