Fixed: #795 #1460 Linux compile of new sound samples

This commit is contained in:
kaetemi 2012-04-12 00:27:03 +02:00
parent afb32cfe1a
commit df6213ed79
2 changed files with 31 additions and 3 deletions

View file

@ -18,7 +18,11 @@
// STL includes // STL includes
#include <stdio.h> #include <stdio.h>
#include <conio.h> #ifdef NL_OS_WINDOWS
# include <conio.h>
#else
# include <curses.h>
#endif
// NeL includes // NeL includes
#include <nel/misc/app_context.h> #include <nel/misc/app_context.h>
@ -110,9 +114,16 @@ static void runSample()
printf("Press ANY other key to exit\n"); printf("Press ANY other key to exit\n");
for (; ; ) for (; ; )
{ {
#ifdef NL_OS_WINDOWS
if (_kbhit()) if (_kbhit())
{ {
switch (_getch()) switch (_getch())
#else
char ch;
if (read(0, &ch, 1))
{
switch (ch)
#endif
{ {
case '+': case '+':
s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f); s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f);

View file

@ -18,7 +18,11 @@
// STL includes // STL includes
#include <stdio.h> #include <stdio.h>
#include <conio.h> #ifdef NL_OS_WINDOWS
# include <conio.h>
#else
# include <curses.h>
#endif
// NeL includes // NeL includes
#include <nel/misc/app_context.h> #include <nel/misc/app_context.h>
@ -138,9 +142,16 @@ static void runSample()
printf("Press ANY other key to exit\n"); printf("Press ANY other key to exit\n");
while (!s_AudioDecoder->isMusicEnded()) while (!s_AudioDecoder->isMusicEnded())
{ {
#ifdef NL_OS_WINDOWS
if (_kbhit()) if (_kbhit())
{ {
switch (_getch()) switch (_getch())
#else
char ch;
if (read(0, &ch, 1))
{
switch (ch)
#endif
{ {
case '+': case '+':
s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f); s_GroupController->setUserGain(s_GroupController->getUserGain() + 0.1f);
@ -172,7 +183,13 @@ static void runSample()
printf("End of song\n"); printf("End of song\n");
printf("Press ANY key to exit\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; return;
} }