Skip to content

Commit

Permalink
-added ofSoundStream to project
Browse files Browse the repository at this point in the history
**needs testing**

-fixed retina bug
  • Loading branch information
zach gage committed Jul 21, 2011
1 parent 85e9f53 commit a617b38
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 86 deletions.
18 changes: 0 additions & 18 deletions addons/ofxiPhone/src/ofAppiPhoneWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -155,35 +155,17 @@ void setWindowShape(int w, int h) {

int ofAppiPhoneWindow::getWidth(){
if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){

if(retinaEnabled)
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
return (int)getScreenSize().x * [[UIScreen mainScreen] scale];

return (int)getScreenSize().x;
}

if(retinaEnabled)
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
return (int)getScreenSize().y * [[UIScreen mainScreen] scale];

return (int)getScreenSize().y;
}

int ofAppiPhoneWindow::getHeight(){
if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){

if(retinaEnabled)
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
return (int)getScreenSize().y * [[UIScreen mainScreen] scale];

return (int)getScreenSize().y;
}

if(retinaEnabled)
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
return (int)getScreenSize().x * [[UIScreen mainScreen] scale];

return (int)getScreenSize().x;
}

Expand Down
6 changes: 4 additions & 2 deletions libs/openFrameworks/sound/ofSoundStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "ofBaseTypes.h"
#include "ofBaseApp.h"
#include "ofTypes.h"
#include "ofBaseSoundStream.h"

#ifdef OF_SOUNDSTREAM_RTAUDIO
#include "ofRtAudioSoundStream.h"
Expand All @@ -14,8 +15,9 @@
#elif defined(OF_SOUNDSTREAM_ANDROID)
#include "ofxAndroidSoundStream.h"
#define OF_SOUND_STREAM_TYPE ofxAndroidSoundStream
#else
// iphone soundstream
#elif defined(OF_SOUNDSTREAM_IPHONE)
#include "ofxiPhoneSoundStream.h"
#define OF_SOUND_STREAM_TYPE ofxiPhoneSoundStream
#endif

void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, ofBaseApp * appPtr = NULL);
Expand Down
38 changes: 38 additions & 0 deletions libs/openFrameworks/sound/ofxiPhoneSoundStream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once

#include "ofConstants.h"

#include "ofBaseSoundStream.h"
#include "ofTypes.h"


class ofxiPhoneSoundStream : public ofBaseSoundStream{
public:
ofxiPhoneSoundStream();
~ofxiPhoneSoundStream();

void listDevices();
void setDeviceID(int deviceID);

void setInput(ofBaseSoundInput * soundInput);
void setOutput(ofBaseSoundOutput * soundOutput);
bool setup(int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers);
bool setup(ofBaseApp * app, int outChannels, int inChannels, int sampleRate, int bufferSize, int nBuffers);

void start();
void stop();
void close();

long unsigned long getTickCount(); // always returns 0. not implemented on iphone

int getNumInputChannels();
int getNumOutputChannels();

private:
long unsigned long tickCount;
int nInputChannels;
int nOutputChannels;
int sampleRate;
};


Loading

0 comments on commit a617b38

Please sign in to comment.