Skip to content

Commit d619e10

Browse files
committed
Merge branch 'master' of github.com:openframeworks/openFrameworks
2 parents 7fc0dcd + 82522d8 commit d619e10

187 files changed

Lines changed: 254 additions & 216 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addons/ofxAndroid/src/ofAppAndroidWindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ void ofAppAndroidWindow::setup(const ofxAndroidWindowSettings & settings){
129129
glesVersion = settings.glesVersion;
130130
ofLogError() << "setup gles" << glesVersion;
131131
if(glesVersion<2){
132-
currentRenderer = make_shared<ofGLRenderer>(this);
132+
currentRenderer = std::make_shared<ofGLRenderer>(this);
133133
}else{
134-
currentRenderer = make_shared<ofGLProgrammableRenderer>(this);
134+
currentRenderer = std::make_shared<ofGLProgrammableRenderer>(this);
135135
}
136136

137137
jclass javaClass = ofGetJNIEnv()->FindClass("cc/openframeworks/OFAndroid");

addons/ofxAssimpModelLoader/src/ofxAssimpMeshHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void ofxAssimpMeshHelper::addTexture(ofxAssimpTexture & aAssimpTex){
2424
meshTextures.push_back(shared_ptr<ofxAssimpTexture>(&assimpTexture,[](ofxAssimpTexture*){}));
2525
}
2626
}else{
27-
auto otherTex = make_shared<ofxAssimpTexture>();
27+
auto otherTex = std::make_shared<ofxAssimpTexture>();
2828
(*otherTex.get()) = aAssimpTex;
2929

3030
meshTextures.push_back(otherTex);

addons/ofxEmscripten/libs/html5audio/lib/emscripten/library_html5audio.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,41 @@ var LibraryHTML5Audio = {
8080
},
8181

8282
html5audio_sound_load: function (player_id, url) {
83-
AUDIO.player[player_id].src = UTF8ToString(url);
83+
try {
84+
var filePath = UTF8ToString(url);
85+
86+
if( filePath.indexOf("http") == 0 ) {
87+
AUDIO.player[player_id].src = filePath;
88+
}else{
89+
90+
//console.log("file path is" + filePath);
91+
92+
var data = FS.readFile(filePath, { encoding: 'binary' });
93+
94+
var ext = filePath.split('.').pop();
95+
96+
var stats = FS.stat(filePath)
97+
var fileSizeInBytes = stats.size;
98+
99+
var tag = ext; //this covers most types
100+
if( ext == mp3 ){
101+
tag = 'mpeg';
102+
}else if( ext == 'oga'){
103+
tag = 'ogg';
104+
}else if( ext == 'weba'){
105+
tag = 'webm';
106+
}
107+
108+
const blob = new Blob([data], { type: 'audio/' + tag });
109+
const audioSrc = URL.createObjectURL(blob);
110+
111+
AUDIO.player[player_id].src = audioSrc;
112+
}
113+
114+
} catch (error) {
115+
console.error('Error reading file:' + filePath + " " + error);
116+
}
117+
84118
},
85119

86120
html5audio_sound_play: function (player_id, multiplay, volume, speed, pan, offset) {

addons/ofxEmscripten/src/ofxAppEmscriptenWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void ofxAppEmscriptenWindow::setup(const ofGLESWindowSettings & settings){
4747

4848
makeCurrent();
4949

50-
_renderer = make_shared<ofGLProgrammableRenderer>(this);
50+
_renderer = std::make_shared<ofGLProgrammableRenderer>(this);
5151
((ofGLProgrammableRenderer*)_renderer.get())->setup(2,0);
5252

5353
emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW,this,1,&keydown_cb);

addons/ofxEmscripten/src/ofxEmscriptenSoundPlayer.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ ofxEmscriptenSoundPlayer::~ofxEmscriptenSoundPlayer(){
3737
html5audio_sound_free(player_id);
3838
}
3939

40-
bool ofxEmscriptenSoundPlayer::load(const std::filesystem::path& fileName, bool stream){
41-
html5audio_sound_load(player_id, ofToDataPath(fileName).c_str());
40+
bool ofxEmscriptenSoundPlayer::load(const of::filesystem::path& filePath, bool stream){
41+
auto soundFilePath = filePath.string();
42+
if ( soundFilePath.substr(0, 7) != "http://" && soundFilePath.substr(0, 8) != "https://"){
43+
soundFilePath = ofToDataPath(soundFilePath);
44+
}
45+
html5audio_sound_load(player_id, soundFilePath.c_str());
4246
return true;
4347
}
4448

45-
bool ofxEmscriptenSoundPlayer::load(const std::string& fileName, bool stream){
46-
html5audio_sound_load(player_id, fileName.c_str());
47-
return true;
48-
}
49+
//bool ofxEmscriptenSoundPlayer::load(const std::string& fileName, bool stream){
50+
// html5audio_sound_load(player_id, fileName.c_str());
51+
// return true;
52+
//}
4953

5054
void ofxEmscriptenSoundPlayer::unload(){
5155
html5audio_sound_free(player_id);

addons/ofxEmscripten/src/ofxEmscriptenSoundPlayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class ofxEmscriptenSoundPlayer: public ofBaseSoundPlayer {
88
ofxEmscriptenSoundPlayer();
99
~ofxEmscriptenSoundPlayer();
1010

11-
bool load(const std::filesystem::path& fileName, bool stream = false);
12-
bool load(const std::string& fileName, bool stream = false);
11+
bool load(const of::filesystem::path& fileName, bool stream = false);
12+
// bool load(const std::string& fileName, bool stream = false);
1313
void unload();
1414
void play();
1515
void stop();

apps/devApps/random explorer/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main( ){
1010

1111
auto window = ofCreateWindow(settings);
1212

13-
ofRunApp(window, make_shared<ofApp>());
13+
ofRunApp(window, std::make_shared<ofApp>());
1414
ofRunMainLoop();
1515

1616
}

examples/3d/3DPrimitivesExample/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main(){
1010

1111
auto window = ofCreateWindow(settings);
1212

13-
ofRunApp(window, make_shared<ofApp>());
13+
ofRunApp(window, std::make_shared<ofApp>());
1414
ofRunMainLoop();
1515

1616
}

examples/3d/advanced3dExample/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int main( ){
1111

1212
auto window = ofCreateWindow(settings);
1313

14-
ofRunApp(window, make_shared<ofApp>());
14+
ofRunApp(window, std::make_shared<ofApp>());
1515
ofRunMainLoop();
1616

1717
}

examples/3d/assimp3DModelLoaderExample/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int main( ){
1212

1313
auto window = ofCreateWindow(settings);
1414

15-
ofRunApp(window, make_shared<ofApp>());
15+
ofRunApp(window, std::make_shared<ofApp>());
1616
ofRunMainLoop();
1717

1818
}

0 commit comments

Comments
 (0)