From df6213ed7906732613df8b9377bacd25abb85fa1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 12 Apr 2012 00:27:03 +0200 Subject: [PATCH] Fixed: #795 #1460 Linux compile of new sound samples --- .../samples/sound/stream_file/stream_file.cpp | 13 +++++++++++- .../stream_ogg_vorbis/stream_ogg_vorbis.cpp | 21 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/code/nel/samples/sound/stream_file/stream_file.cpp b/code/nel/samples/sound/stream_file/stream_file.cpp index 6ded512eb..14314c16d 100644 --- a/code/nel/samples/sound/stream_file/stream_file.cpp +++ b/code/nel/samples/sound/stream_file/stream_file.cpp @@ -18,7 +18,11 @@ // STL includes #include -#include +#ifdef NL_OS_WINDOWS +# include +#else +# include +#endif // NeL includes #include @@ -110,9 +114,16 @@ static void runSample() printf("Press ANY other key to exit\n"); for (; ; ) { +#ifdef NL_OS_WINDOWS if (_kbhit()) { switch (_getch()) +#else + char ch; + if (read(0, &ch, 1)) + { + switch (ch) +#endif { case '+': s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f); diff --git a/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp b/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp index 2709a0b81..b3645913c 100644 --- a/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp +++ b/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp @@ -18,7 +18,11 @@ // STL includes #include -#include +#ifdef NL_OS_WINDOWS +# include +#else +# include +#endif // NeL includes #include @@ -138,9 +142,16 @@ static void runSample() printf("Press ANY other key to exit\n"); while (!s_AudioDecoder->isMusicEnded()) { +#ifdef NL_OS_WINDOWS if (_kbhit()) { switch (_getch()) +#else + char ch; + if (read(0, &ch, 1)) + { + switch (ch) +#endif { case '+': s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f); @@ -172,7 +183,13 @@ static void runSample() printf("End of song\n"); printf("Press ANY key to exit\n"); - while (!_kbhit()) { s_AudioMixer->update(); nlSleep(10); } _getch(); +#ifdef NL_OS_WINDOWS + while (!_kbhit()) +#else + char ch; + while (!read(0, &ch, 1)) +#endif + { s_AudioMixer->update(); nlSleep(10); } return; }