Merge commit 'upstream/master'
commit
05382f206e
@ -1,14 +0,0 @@
|
||||
project(SoundTest)
|
||||
|
||||
# local files
|
||||
|
||||
# Main executable
|
||||
add_executable(sound_test main.cpp ${OENGINE_SOUND})
|
||||
|
||||
include_directories(${SOUND_INPUT_INCLUDES})
|
||||
add_definitions(${SOUND_DEFINE})
|
||||
|
||||
target_link_libraries(sound_test
|
||||
${OPENAL_LIBRARY}
|
||||
${SOUND_INPUT_LIBRARY}
|
||||
)
|
@ -1,65 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <mangle/stream/servers/file_stream.hpp>
|
||||
#include <mangle/sound/sources/stream_source.hpp>
|
||||
#include <mangle/stream/filters/buffer_stream.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace Mangle::Stream;
|
||||
using namespace Mangle::Sound;
|
||||
|
||||
#ifdef OPENMW_USE_AUDIERE
|
||||
#include <mangle/sound/filters/openal_audiere.hpp>
|
||||
AudiereLoader loader;
|
||||
#endif
|
||||
|
||||
#ifdef OPENMW_USE_FFMPEG
|
||||
#include <mangle/sound/filters/openal_ffmpeg.hpp>
|
||||
FFMpegLoader loader;
|
||||
#endif
|
||||
|
||||
#ifdef OPENMW_USE_MPG123
|
||||
#include <mangle/sound/filters/openal_mpg123.hpp>
|
||||
Mpg123Loader loader;
|
||||
#endif
|
||||
|
||||
OpenAL_Factory openal;
|
||||
|
||||
void play(const char* name)
|
||||
{
|
||||
try
|
||||
{
|
||||
cout << "Opening " << name << "\n";
|
||||
SampleSourcePtr samples = loader.load(name);
|
||||
cout << "Loading entire file into memory\n";
|
||||
StreamPtr buf(new BufferStream(samples));
|
||||
|
||||
// Recreate the stream as a sample source (we're only doing it
|
||||
// this complicated to test each step individually)
|
||||
int a,b,c;
|
||||
samples->getInfo(&a,&b,&c);
|
||||
samples.reset(new Stream2Samples(buf, a,b,c));
|
||||
|
||||
cout << "Creating OpenAL sound from data\n";
|
||||
SoundPtr snd = openal.loadRaw(samples);
|
||||
cout << "Playing (abort with Ctrl-C)\n";
|
||||
snd->play();
|
||||
|
||||
while(snd->isPlaying())
|
||||
usleep(10000);
|
||||
cout << "Done playing\n";
|
||||
}
|
||||
catch(exception &e)
|
||||
{
|
||||
cout << " ERROR: " << e.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if(argc==1)
|
||||
cout << "Specify sound file (wav, mp3, ogg) on command line.\n";
|
||||
for(int i=1; i<argc; i++)
|
||||
play(argv[i]);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
# Locate SNDFILE
|
||||
# This module defines
|
||||
# SNDFILE_LIBRARY
|
||||
# SNDFILE_FOUND, if false, do not try to link to Sndfile
|
||||
# SNDFILE_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# Created by Nicolay Korslund for OpenMW (http://openmw.com)
|
||||
|
||||
FIND_PATH(SNDFILE_INCLUDE_DIR sndfile.h
|
||||
HINTS
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SNDFILE_LIBRARY
|
||||
NAMES sndfile
|
||||
HINTS
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
SET(SNDFILE_FOUND "NO")
|
||||
IF(SNDFILE_LIBRARY AND SNDFILE_INCLUDE_DIR)
|
||||
SET(SNDFILE_FOUND "YES")
|
||||
ENDIF(SNDFILE_LIBRARY AND SNDFILE_INCLUDE_DIR)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3db61c8bdde65910e43a3a06b34738296960e9e8
|
||||
Subproject commit c982f701cacdd2932bfdc22b168f54221a549b62
|
Loading…
Reference in New Issue