summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-01-16 19:19:45 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-01-16 19:19:45 +0100
commit7b059965e8df745c5b45b4ec6bfbdfe1a7397642 (patch)
treebdba6b41f51fcb4c8aa5178aebd378bdf97b93a8 /platform/javascript
parent6a3dae5be944d9e226cca7bf0bd80fb0036e8324 (diff)
Adapt platforms to AudioServer refactoring
Fixes compilation on Windows and likely other platforms (at least as far as AudioServer changes were concerned), though they were not tested.
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/audio_driver_javascript.cpp19
-rw-r--r--platform/javascript/audio_driver_javascript.h4
-rw-r--r--platform/javascript/audio_server_javascript.h1
-rw-r--r--platform/javascript/os_javascript.cpp31
-rw-r--r--platform/javascript/os_javascript.h9
5 files changed, 19 insertions, 45 deletions
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 71332c897e..bff01d7c37 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -27,20 +27,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_javascript.h"
-#include <string.h>
-
-
-
-
+#include <string.h>
#define MAX_NUMBER_INTERFACES 3
#define MAX_NUMBER_OUTPUT_DEVICES 6
/* Structure for passing information to callback function */
-
-
//AudioDriverJavaScript* AudioDriverJavaScript::s_ad=NULL;
const char* AudioDriverJavaScript::get_name() const {
@@ -53,19 +47,23 @@ Error AudioDriverJavaScript::init(){
return OK;
}
+
void AudioDriverJavaScript::start(){
}
+
int AudioDriverJavaScript::get_mix_rate() const {
return 44100;
}
-AudioDriver::OutputFormat AudioDriverJavaScript::get_output_format() const{
- return OUTPUT_STEREO;
+AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const{
+
+ return SPEAKER_MODE_STEREO;
}
+
void AudioDriverJavaScript::lock(){
/*
@@ -74,6 +72,7 @@ void AudioDriverJavaScript::lock(){
*/
}
+
void AudioDriverJavaScript::unlock() {
/*
@@ -82,11 +81,11 @@ void AudioDriverJavaScript::unlock() {
*/
}
+
void AudioDriverJavaScript::finish(){
}
-
AudioDriverJavaScript::AudioDriverJavaScript()
{
}
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index 572d24b4fc..da146fcdd0 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -29,8 +29,8 @@
#ifndef AUDIO_DRIVER_JAVASCRIPT_H
#define AUDIO_DRIVER_JAVASCRIPT_H
+#include "servers/audio_server.h"
-#include "servers/audio/audio_server_sw.h"
#include "os/mutex.h"
class AudioDriverJavaScript : public AudioDriver {
@@ -43,7 +43,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const ;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h
index 8e61e94dfc..f8c8774e4c 100644
--- a/platform/javascript/audio_server_javascript.h
+++ b/platform/javascript/audio_server_javascript.h
@@ -29,7 +29,6 @@
#ifndef AUDIO_SERVER_JAVASCRIPT_H
#define AUDIO_SERVER_JAVASCRIPT_H
-
#include "servers/audio_server.h"
class AudioServerJavascript : public AudioServer {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 396657461b..317a6676a4 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -27,24 +27,24 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "os_javascript.h"
+
#include "drivers/gles2/rasterizer_gles2.h"
#include "core/io/file_access_buffered_fa.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/dir_access_unix.h"
-
#include "servers/visual/visual_server_raster.h"
-
#include "main/main.h"
-
#include "core/globals.h"
-#include "stdlib.h"
-#include "emscripten.h"
#include "dom_keys.h"
+#include <stdlib.h>
+#include <emscripten.h>
+
int OS_JavaScript::get_video_driver_count() const {
return 1;
}
+
const char * OS_JavaScript::get_video_driver_name(int p_driver) const {
return "GLES2";
@@ -261,27 +261,6 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
ERR_PRINT("Initializing audio failed.");
}*/
- print_line("Init SM");
-
- //sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerJavascript );
-
- print_line("Init Mixer");
-
- //audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
- audio_server->init();
-
- print_line("Init SoundServer");
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- print_line("Init SpatialSoundServer");
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
- //
print_line("Init Physicsserver");
physics_server = memnew( PhysicsServerSW );
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 370322e93d..d11494a8aa 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -35,15 +35,16 @@
#include "servers/physics/physics_server_sw.h"
#include "servers/spatial_sound/spatial_sound_server_sw.h"
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
#include "audio_server_javascript.h"
#include "audio_driver_javascript.h"
#include "main/input_default.h"
-#include "emscripten/html5.h"
#include "javascript_eval.h"
+#include <emscripten/html5.h>
+
typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs);
typedef String (*GetDataDirFunc)();
@@ -71,10 +72,6 @@ private:
Rasterizer *rasterizer;
VisualServer *visual_server;
- AudioServerJavascript *audio_server;
- //SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
AudioDriverJavaScript audio_driver_javascript;