Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions addons/ofxiOS/src/utils/ofxiOSExternalDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#pragma once

#include "ofConstants.h"
#include <vector>


#include <TargetConditionals.h>
#if TARGET_OS_IOS || (TARGET_OS_IPHONE && !TARGET_OS_TV)
Expand All @@ -19,14 +21,14 @@ struct ofxiOSExternalDisplayMode{
};

class ofxiOSExternalDisplay {

public:

//-------------------------------------------------------
static void alertExternalDisplayConnected();
static void alertExternalDisplayDisconnected();
static void alertExternalDisplayChanged();

//-------------------------------------------------------
static std::vector<ofxiOSExternalDisplayMode> getExternalDisplayModes();
static bool displayOnExternalScreen(ofxiOSExternalDisplayMode externalDisplayMode);
Expand All @@ -40,16 +42,16 @@ class ofxiOSExternalDisplay {
static bool isDisplayingOnDeviceScreen();
static bool isExternalScreenConnected();
static bool isMirroring();

//-------------------------------------------------------
ofxiOSExternalDisplay();
~ofxiOSExternalDisplay();

//-------------------------------------------------------
virtual void externalDisplayConnected(){}
virtual void externalDisplayDisconnected(){}
virtual void externalDisplayChanged(){}

};

#define ofxiPhoneExternalDisplay ofxiOSExternalDisplay
Expand Down
1 change: 1 addition & 0 deletions addons/ofxiOS/src/utils/ofxiOSExternalDisplay.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "ofxiOSExternalDisplay.h"
#include <TargetConditionals.h>
#include <vector>

using std::vector;

Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/3d/of3dPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "ofMesh.h"
#include "ofNode.h"
#include <vector>

class ofTexture;
class ofVboMesh;
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/3d/ofMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define OF_MESH_H

#include "ofGLUtils.h"
#include <vector>

template<class V, class N, class C, class T>
class ofMeshFace_;
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/communication/ofSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// MARK: ofConstants targets
#include "ofConstants.h"
#include <vector>

class ofBuffer;

Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/gl/ofBufferObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// MARK: Targets plus GL/ headers
#include "ofConstants.h"
#include <vector>

template<typename T>
class ofPixels_;
Expand Down
2 changes: 2 additions & 0 deletions libs/openFrameworks/gl/ofGLUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
#pragma once

#include "ofGraphicsConstants.h"
#include <vector>
// MARK: Targets / Defines
//#include "ofConstants.h"


class ofShader;
class ofGLProgrammableRenderer;
class ofBaseGLRenderer;
Expand Down
3 changes: 2 additions & 1 deletion libs/openFrameworks/gl/ofShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "ofxAndroidUtils.h"
#endif
#include <regex>
#include <vector>

using std::endl;
using std::ostringstream;
Expand Down Expand Up @@ -958,7 +959,7 @@ void ofShader::setUniformTexture(const string & name, const ofTexture & tex, int
setUniformTexture( name, texData, textureLocation);
}
}

//--------------------------------------------------------------
void ofShader::setUniformTexture(const string & name, const ofTextureData & texData, int textureLocation) const{
if (bLoaded) {
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/gl/ofShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// MARK: ofConstants Targets
#include "ofConstants.h"
#include <vector>

#include <glm/detail/qualifier.hpp>
namespace glm {
Expand Down
2 changes: 2 additions & 0 deletions libs/openFrameworks/graphics/ofPixels.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "ofGraphicsConstants.h"
#include "ofPixels.h"
#include "ofColor.h"
#include <string.h> // memcpy
#include <functional> // std::function

static ofImageType getImageTypeFromChannels(size_t channels){
switch(channels){
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/graphics/ofTessellator.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "ofGraphicsBaseTypes.h"
#include <vector>

typedef struct TESStesselator TESStesselator;
typedef struct TESSalloc TESSalloc;
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/graphics/ofTrueTypeFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "ofRectangle.h"
#include "ofTexture.h"
#include <unordered_map>
#include <vector>

class ofPath;

Expand Down
12 changes: 12 additions & 0 deletions libs/openFrameworks/ofMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,15 @@ using std::vector;
using std::weak_ptr;
#endif
#endif


// core: ---------------------------
#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <iostream>
#include <vector>
#include <memory>
#include <functional>
3 changes: 2 additions & 1 deletion libs/openFrameworks/sound/ofRtAudioSoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "ofAppRunner.h"
#include "ofLog.h"
#include <RtAudio.h>
#include <string.h>

using std::vector;
using std::shared_ptr;
Expand Down Expand Up @@ -146,7 +147,7 @@ bool ofRtAudioSoundStream::setup(const ofSoundStreamSettings & settings_)
ofLogNotice() << "Initialing RtAudio with UNSPECIFIED API";
audio = std::make_shared<RtAudio>();
}
//needs latest RtAudio - this breaks in slightly older linux
//needs latest RtAudio - this breaks in slightly older linux
//ofLogNotice() << "Initialized RtAudio with API: " << RtAudio::getApiName(audio->getCurrentApi());
}
catch (std::exception &error) {
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/sound/ofSoundBaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// MARK: ofConstants FS
#include "ofConstants.h"
#include <functional>
#include <vector>

class ofSoundBuffer;

Expand Down
38 changes: 19 additions & 19 deletions libs/openFrameworks/sound/ofSoundBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#endif
#include <glm/trigonometric.hpp>
#include <limits>
#include <cstring>

using std::vector;
using std::string;
Expand Down Expand Up @@ -223,7 +224,7 @@ void ofSoundBuffer::copyTo(float * outBuffer, std::size_t nFrames, std::size_t o
if ((fromFrame + nFrames) >= this->getNumFrames()){
nFramesToCopy = this->getNumFrames() - fromFrame;
}

const float * buffPtr = &buffer[fromFrame * channels];
// if channels count matches we can just memcpy
if(channels == outChannels){
Expand Down Expand Up @@ -321,14 +322,14 @@ void ofSoundBuffer::append(ofSoundBuffer & other){

static bool prepareBufferForResampling(const ofSoundBuffer &in, ofSoundBuffer &out, std::size_t numFrames) {
std::size_t totalOutBufferSize = numFrames * in.getNumChannels();

if(totalOutBufferSize < out.getBuffer().max_size()) {
out.resize(totalOutBufferSize,0);
} else {
ofLogError("ofSoundUtils") << "resampling would create a buffer size of " << totalOutBufferSize << " (too large for std::vector)";
return false;
}

out.setNumChannels(in.getNumChannels());
out.setSampleRate(in.getSampleRate());
return true;
Expand All @@ -337,36 +338,36 @@ static bool prepareBufferForResampling(const ofSoundBuffer &in, ofSoundBuffer &o
// based on maximilian optimized for performance.
// might lose 1 or 2 samples when it reaches the end of the buffer
void ofSoundBuffer::linearResampleTo(ofSoundBuffer &outBuffer, std::size_t fromFrame, std::size_t numFrames, float speed, bool loop) const {

std::size_t inChannels = getNumChannels();
std::size_t inFrames = getNumFrames();
bool bufferReady = prepareBufferForResampling(*this, outBuffer, numFrames);

if(!bufferReady) {
outBuffer = *this;
return;
}

std::size_t start = fromFrame;
std::size_t end = start*inChannels + double(numFrames*inChannels)*speed;
double position = start;
std::size_t intPosition = position;
float increment = speed;
std::size_t copySize = inChannels*sizeof(float);
std::size_t to;

if(end<size()-2*inChannels){
to = numFrames;
}else if(fromFrame+2>inFrames){
to = 0;
}else{
to = std::ceil(float(inFrames-2-fromFrame)/speed);
}

float remainder = position - intPosition;
float * resBufferPtr = &outBuffer[0];
float a, b;

for(std::size_t i=0;i<to;i++){
intPosition *= inChannels;
for(std::size_t j=0;j<inChannels;j++){
Expand Down Expand Up @@ -401,16 +402,16 @@ void ofSoundBuffer::linearResampleTo(ofSoundBuffer &outBuffer, std::size_t fromF
// based on maximilian optimized for performance.
// might lose 1 to 3 samples when it reaches the end of the buffer
void ofSoundBuffer::hermiteResampleTo(ofSoundBuffer &outBuffer, std::size_t fromFrame, std::size_t numFrames, float speed, bool loop) const {

std::size_t inChannels = getNumChannels();
std::size_t inFrames = getNumFrames();
bool bufferReady = prepareBufferForResampling(*this, outBuffer, numFrames);

if(!bufferReady) {
outBuffer = *this;
return;
}

std::size_t start = fromFrame;
std::size_t end = start*inChannels + double(numFrames*inChannels)*speed;
double position = start;
Expand All @@ -419,19 +420,19 @@ void ofSoundBuffer::hermiteResampleTo(ofSoundBuffer &outBuffer, std::size_t from
float increment = speed;
std::size_t copySize = inChannels*sizeof(float);
std::size_t to;

if(end<size()-3*inChannels){
to = numFrames;
}else if(fromFrame+3>inFrames){
to = 0;
}else{
to = double(inFrames-3-fromFrame)/speed;
}

float * resBufferPtr = &outBuffer[0];
float a,b,c,d;
std::size_t from = 0;

while(intPosition==0){
intPosition *= inChannels;
for(std::size_t j=0;j<inChannels;++j){
Expand All @@ -446,7 +447,7 @@ void ofSoundBuffer::hermiteResampleTo(ofSoundBuffer &outBuffer, std::size_t from
remainder = position - intPosition;
from++;
}

for(std::size_t i=from;i<to;++i){
intPosition *= inChannels;
for(std::size_t j=0;j<inChannels;++j){
Expand All @@ -460,7 +461,7 @@ void ofSoundBuffer::hermiteResampleTo(ofSoundBuffer &outBuffer, std::size_t from
intPosition = position;
remainder = position - intPosition;
}

if(end>=size()-3*inChannels){
to = numFrames-to;
if(loop){
Expand Down Expand Up @@ -535,7 +536,7 @@ void ofSoundBuffer::setChannel(const ofSoundBuffer & inBuffer, std::size_t targe
*bufferPtr = *inBufferPtr;
bufferPtr += channels;
// inBuffer.getNumChannels() is probably 1 but let's be safe
inBufferPtr += inBuffer.getNumChannels();
inBufferPtr += inBuffer.getNumChannels();
}
}

Expand Down Expand Up @@ -627,4 +628,3 @@ namespace std{
src.swap(dst);
}
}

11 changes: 1 addition & 10 deletions libs/openFrameworks/utils/ofConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
#define OF_VERSION_PATCH 1
#define OF_VERSION_PRE_RELEASE ""

// core: ---------------------------
#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <iostream>
#include <vector>
#include <memory>
#include <functional>


// Set to 1 for compatibility with old projects using ofVec instead of glm
#ifndef OF_USE_LEGACY_VECTOR_MATH
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/utils/ofFileUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// MARK: ofConstants FS
#include "ofConstants.h"
#include <fstream>
#include <vector>

//----------------------------------------------------------
// ofBuffer
Expand Down
Loading
Loading