summaryrefslogtreecommitdiffhomepage
path: root/examples/web/audio
diff options
context:
space:
mode:
authorRay San <[email protected]>2017-11-03 20:01:48 +0100
committerRay San <[email protected]>2017-11-03 20:01:48 +0100
commitd918334a2e1ce32961c0797a4b13fdd5b4ce5630 (patch)
tree1f16feb32953200c2a47cf425352f1bba70ab99a /examples/web/audio
parente4041e4eb8c55db0a37c8af575c7a98c17963a9a (diff)
downloadraylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.tar.gz
raylib.com-d918334a2e1ce32961c0797a4b13fdd5b4ce5630.zip
Updated to support Android platform
Diffstat (limited to 'examples/web/audio')
-rw-r--r--examples/web/audio/audio_module_playing.c17
-rw-r--r--examples/web/audio/audio_music_stream.c19
-rw-r--r--examples/web/audio/audio_raw_stream.c17
-rw-r--r--examples/web/audio/audio_sound_loading.c17
4 files changed, 61 insertions, 9 deletions
diff --git a/examples/web/audio/audio_module_playing.c b/examples/web/audio/audio_module_playing.c
index 2f0f8c1..a5af00e 100644
--- a/examples/web/audio/audio_module_playing.c
+++ b/examples/web/audio/audio_module_playing.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#define MAX_CIRCLES 32
//----------------------------------------------------------------------------------
@@ -55,11 +59,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -98,8 +110,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_music_stream.c b/examples/web/audio/audio_music_stream.c
index da5ac83..e56fc30 100644
--- a/examples/web/audio/audio_music_stream.c
+++ b/examples/web/audio/audio_music_stream.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -37,12 +41,20 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
-
+#endif
+
InitAudioDevice(); // Initialize audio device
music = LoadMusicStream("resources/guitar_noodling.ogg");
@@ -69,8 +81,9 @@ int main()
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_raw_stream.c b/examples/web/audio/audio_raw_stream.c
index e3b4ad6..76a065f 100644
--- a/examples/web/audio/audio_raw_stream.c
+++ b/examples/web/audio/audio_raw_stream.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
#include <stdlib.h> // Required for: malloc(), free()
#include <math.h> // Required for: sinf()
@@ -45,11 +49,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -91,8 +103,9 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------
diff --git a/examples/web/audio/audio_sound_loading.c b/examples/web/audio/audio_sound_loading.c
index e422f09..64a730c 100644
--- a/examples/web/audio/audio_sound_loading.c
+++ b/examples/web/audio/audio_sound_loading.c
@@ -17,6 +17,10 @@
#include <emscripten/emscripten.h>
#endif
+#if defined(PLATFORM_ANDROID)
+ #include "android_native_app_glue.h"
+#endif
+
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -34,11 +38,19 @@ void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
// Main Enry Point
//----------------------------------------------------------------------------------
-int main()
+#if defined(PLATFORM_ANDROID)
+void android_main(struct android_app *app)
+#else
+int main(void)
+#endif
{
// Initialization
//--------------------------------------------------------------------------------------
+#if defined(PLATFORM_ANDROID)
+ InitWindow(screenWidth, screenHeight, app);
+#else
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
+#endif
InitAudioDevice(); // Initialize audio device
@@ -66,8 +78,9 @@ int main()
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+#if !defined(PLATFORM_ANDROID)
return 0;
+#endif
}
//----------------------------------------------------------------------------------