77
88#include " ofFileUtils.h"
99#include " ofxEmscriptenSoundPlayer.h"
10- #include " html5audio.h"
10+ // #include "html5audio.h"
1111
1212using namespace std ;
1313
@@ -17,7 +17,7 @@ int ofxEmscriptenAudioContext(){
1717 static bool initialized=false ;
1818 static int context = -1 ;
1919 if (!initialized){
20- context = html5audio_context_create ();
20+ context = // html5audio_context_create();
2121 initialized = true ;
2222 }
2323 return context;
@@ -30,126 +30,128 @@ ofxEmscriptenSoundPlayer::ofxEmscriptenSoundPlayer()
3030,speed(1 )
3131,pan(0 )
3232,playing(false )
33- ,player_id(html5audio_player_create()){
33+ ,player_id(0 ){
34+ // ,player_id(//html5audio_player_create()){
3435}
3536
3637ofxEmscriptenSoundPlayer::~ofxEmscriptenSoundPlayer (){
37- html5audio_sound_free (player_id);
38+ // html5audio_sound_free(player_id);
3839}
3940
4041bool ofxEmscriptenSoundPlayer::load (const of::filesystem::path& filePath, bool stream){
4142 auto soundFilePath = filePath.string ();
4243 if ( soundFilePath.substr (0 , 7 ) != " http://" && soundFilePath.substr (0 , 8 ) != " https://" ){
4344 soundFilePath = ofToDataPath (soundFilePath);
4445 }
45- html5audio_sound_load (player_id, soundFilePath.c_str ());
46+ // html5audio_sound_load(player_id, soundFilePath.c_str());
4647 return true ;
4748}
4849
4950// bool ofxEmscriptenSoundPlayer::load(const std::string& fileName, bool stream){
50- // html5audio_sound_load(player_id, fileName.c_str());
51+ // // html5audio_sound_load(player_id, fileName.c_str());
5152// return true;
5253// }
5354
5455void ofxEmscriptenSoundPlayer::unload (){
55- html5audio_sound_free (player_id);
56+ // html5audio_sound_free(player_id);
5657}
5758
5859void ofxEmscriptenSoundPlayer::play (){
59- if (playing && !multiplay && !html5audio_sound_done (player_id)){
60- html5audio_sound_stop (player_id);
61- }
62- html5audio_sound_play (player_id, multiplay, volume, speed, pan, 0 );
63- html5audio_sound_set_rate (player_id, speed);
64- html5audio_sound_set_volume (player_id, volume);
60+ // if(playing && !multiplay && !// html5audio_sound_done(player_id)){
61+ // html5audio_sound_stop(player_id);
62+ // }
63+ // html5audio_sound_play(player_id, multiplay, volume, speed, pan, 0);
64+ // html5audio_sound_set_rate(player_id, speed);
65+ // html5audio_sound_set_volume(player_id, volume);
6566 playing = true ;
6667}
6768
6869void ofxEmscriptenSoundPlayer::stop (){
69- html5audio_sound_stop (player_id);
70+ // html5audio_sound_stop(player_id);
7071 playing = false ;
7172}
7273
7374
7475void ofxEmscriptenSoundPlayer::setVolume (float vol){
7576 volume = vol;
76- html5audio_sound_set_volume (player_id, vol);
77+ // html5audio_sound_set_volume(player_id, vol);
7778}
7879
7980void ofxEmscriptenSoundPlayer::setPan (float panorama){
8081 pan = panorama;
81- html5audio_sound_set_pan (player_id, pan);
82+ // html5audio_sound_set_pan(player_id, pan);
8283}
8384
8485void ofxEmscriptenSoundPlayer::setSpeed (float spd){
8586 speed = spd;
86- html5audio_sound_set_rate (player_id, spd);
87+ // html5audio_sound_set_rate(player_id, spd);
8788}
8889
8990void ofxEmscriptenSoundPlayer::setPaused (bool bP){
90- if (bP) html5audio_sound_pause (player_id);
91- else html5audio_sound_play (player_id, multiplay, volume, speed, pan, 0 );
91+ // if(bP) // html5audio_sound_pause(player_id);
92+ // else // html5audio_sound_play(player_id, multiplay, volume, speed, pan, 0);
9293}
9394
9495void ofxEmscriptenSoundPlayer::setLoop (bool bLp){
95- html5audio_sound_set_loop (player_id, bLp);
96+ // html5audio_sound_set_loop(player_id, bLp);
9697}
9798
9899void ofxEmscriptenSoundPlayer::setMultiPlay (bool bMp){
99100 multiplay = bMp;
100101}
101102
102103void ofxEmscriptenSoundPlayer::setPosition (float pct){
103- html5audio_sound_set_position (player_id, pct);
104+ // html5audio_sound_set_position(player_id, pct);
104105}
105106
106107void ofxEmscriptenSoundPlayer::setPositionMS (int ms){
107- html5audio_sound_set_position (player_id, ms / html5audio_sound_duration (player_id) / 1000 );
108+ // html5audio_sound_set_position(player_id, ms / // html5audio_sound_duration(player_id) / 1000);
108109}
109110
110111float ofxEmscriptenSoundPlayer::getPosition () const {
111- return html5audio_sound_position (player_id);
112+ return 0 ; // html5audio_sound_position(player_id);
112113}
113114
114115int ofxEmscriptenSoundPlayer::getPositionMS () const {
115- return html5audio_sound_position (player_id) * html5audio_sound_duration (player_id) * 1000 ;
116+ return 0 ; // html5audio_sound_position(player_id) * // html5audio_sound_duration(player_id) * 1000;
116117}
117118
118119bool ofxEmscriptenSoundPlayer::isPlaying () const {
119- return playing && !html5audio_sound_done (player_id);
120+ return false ;
121+ // return playing && !//html5audio_sound_done(player_id);
120122}
121123
122124float ofxEmscriptenSoundPlayer::getSpeed () const {
123- return html5audio_sound_rate (player_id);
125+ return 0 ; // html5audio_sound_rate(player_id);
124126}
125127
126128float ofxEmscriptenSoundPlayer::getPan () const {
127- return html5audio_sound_pan (player_id);
129+ return 0 ; // html5audio_sound_pan(player_id);
128130}
129131
130132bool ofxEmscriptenSoundPlayer::isLoaded () const {
131- return html5audio_sound_is_loaded (player_id);
133+ return false ; // html5audio_sound_is_loaded(player_id);
132134}
133135
134136float ofxEmscriptenSoundPlayer::getVolume () const {
135- return html5audio_sound_volume (player_id);
137+ return 0 ; // html5audio_sound_volume(player_id);
136138}
137139
138140float ofxEmscriptenSoundPlayer::getDuration () const {
139- return html5audio_sound_duration (player_id);
141+ return 0 ; // html5audio_sound_duration(player_id);
140142}
141143
142144unsigned int ofxEmscriptenSoundPlayer::getDurationMS () const {
143- return html5audio_sound_duration (player_id) * 1000 ;
145+ return 0 ; // html5audio_sound_duration(player_id) * 1000;
144146}
145147
146148double ofxEmscriptenSoundPlayer::getDurationSecs () const {
147- return html5audio_sound_duration (player_id);
149+ return 0 ; // html5audio_sound_duration(player_id);
148150}
149151
150152float * ofxEmscriptenSoundPlayer::getSystemSpectrum (int bands){
151153 systemSpectrum.resize (bands);
152- html5audio_context_spectrum (bands, &systemSpectrum[0 ]);
154+ // html5audio_context_spectrum(bands, &systemSpectrum[0]);
153155 for (size_t i = 0 ; i < systemSpectrum.size (); i++){
154156 systemSpectrum[i] = (systemSpectrum[i]+100 ) * 0.01 ;
155157 }
0 commit comments