mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Changed: #1030 Implement music streaming in OpenAL driver
This commit is contained in:
parent
5045b0ea8a
commit
4d586ef8d0
21 changed files with 180 additions and 52 deletions
|
@ -17,12 +17,14 @@
|
|||
#ifndef NLSOUND_MUSIC_BUFFER_H
|
||||
#define NLSOUND_MUSIC_BUFFER_H
|
||||
|
||||
namespace NLMISC {
|
||||
namespace NLMISC
|
||||
{
|
||||
class IStream;
|
||||
class CIFile;
|
||||
}
|
||||
|
||||
namespace NLSOUND {
|
||||
namespace NLSOUND
|
||||
{
|
||||
|
||||
/*
|
||||
* TODO: Streaming
|
|
@ -34,7 +34,8 @@
|
|||
// Project includes
|
||||
#include "music_buffer.h"
|
||||
|
||||
namespace NLSOUND {
|
||||
namespace NLSOUND
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief CMusicBufferVorbis
|
|
@ -16,16 +16,17 @@
|
|||
|
||||
#ifndef NL_SOUND_DRIVER_H
|
||||
#define NL_SOUND_DRIVER_H
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/string_mapper.h>
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/common.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/string_mapper.h"
|
||||
|
||||
#include "effect.h"
|
||||
|
||||
/// This namespace contains the sound classes
|
||||
namespace NLSOUND {
|
||||
namespace NLSOUND
|
||||
{
|
||||
class IBuffer;
|
||||
class IListener;
|
||||
class ISource;
|
||||
|
@ -40,7 +41,7 @@ namespace NLSOUND {
|
|||
/*
|
||||
* Sound sample format
|
||||
*/
|
||||
enum TSampleFormat { Mono8, Mono16ADPCM, Mono16, Stereo8, Stereo16 };
|
||||
enum TSampleFormat { SampleFormatUnknown, Mono8, Mono16ADPCM, Mono16, Stereo8, Stereo16 };
|
||||
|
||||
/**
|
||||
* Abstract sound driver (implemented in sound driver dynamic library)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="sound"
|
||||
ProjectGUID="{4AF7ADB2-DAF8-4F04-9793-F92010001470}"
|
||||
RootNamespace="sound"
|
||||
|
|
|
@ -9,6 +9,10 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
|||
NL_ADD_STATIC_VID_DRIVERS(nelsnd_lowlevel)
|
||||
nl_add_lib_suffix(nelsnd_lowlevel)
|
||||
|
||||
IF(WITH_PCH)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(nelsnd_lowlevel ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.cpp)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||
|
||||
IF(WITH_DRIVER_OPENAL)
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
#include "nel/sound/driver/buffer.h"
|
||||
#include "nel/misc/fast_mem.h"
|
||||
#include "nel/misc/stream.h"
|
||||
|
@ -117,7 +119,7 @@ void IBuffer::bufferFormatToSampleFormat(TBufferFormat bufferFormat, uint8 chann
|
|||
break;
|
||||
case FormatUnknown:
|
||||
default:
|
||||
sampleFormat = (TSampleFormat)~0;
|
||||
sampleFormat = SampleFormatUnknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/sound/driver/effect.h"
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "nel/sound/driver/listener.h"
|
||||
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
// leave not static else this workaround don't work
|
||||
void dummyToAvoidStupidCompilerWarning_sound_listener_cpp()
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdxaudio2.h"
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
// Project includes
|
||||
#include "music_buffer_vorbis.h"
|
||||
#include "music_buffer.h"
|
||||
#include "nel/sound/driver/music_buffer_vorbis.h"
|
||||
#include "nel/sound/driver/music_buffer.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
|
@ -14,15 +14,16 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdxaudio2.h"
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
// Project includes
|
||||
#include "music_buffer_vorbis.h"
|
||||
#include "nel/sound/driver/music_buffer_vorbis.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
namespace NLSOUND {
|
||||
namespace NLSOUND
|
||||
{
|
||||
|
||||
size_t vorbisReadFunc(void *ptr, size_t size, size_t nmemb, void *datasource)
|
||||
{
|
|
@ -14,7 +14,8 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
#include "nel/sound/driver/music_channel.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
#include "nel/sound/driver/sound_driver.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="sound_lowlevel"
|
||||
ProjectGUID="{89064E9B-14E9-4FB2-8536-A9151DF55C68}"
|
||||
RootNamespace="sound_lowlevel"
|
||||
|
@ -54,6 +54,8 @@
|
|||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="true"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdsound_lowlevel.h"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
|
@ -71,6 +73,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies=" libogg.lib libvorbis.lib libvorbisfile.lib"
|
||||
OutputFile="..\..\..\lib\nl$(ProjectName)_d.lib"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -126,6 +129,8 @@
|
|||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="true"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdsound_lowlevel.h"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
|
@ -143,6 +148,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies=" libogg.lib libvorbis.lib libvorbisfile.lib"
|
||||
OutputFile="..\..\..\lib64\nl$(ProjectName)_d.lib"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -201,6 +207,8 @@
|
|||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdsound_lowlevel.h"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
|
@ -218,6 +226,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies=" libogg.lib libvorbis.lib libvorbisfile.lib"
|
||||
OutputFile="..\..\..\lib\nl$(ProjectName)_r.lib"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -277,6 +286,8 @@
|
|||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdsound_lowlevel.h"
|
||||
WarningLevel="2"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
|
@ -294,6 +305,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies=" libogg.lib libvorbis.lib libvorbisfile.lib"
|
||||
OutputFile="..\..\..\lib64\nl$(ProjectName)_r.lib"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -331,6 +343,14 @@
|
|||
RelativePath="..\..\..\include\nel\sound\driver\listener.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\include\nel\sound\driver\music_buffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\include\nel\sound\driver\music_buffer_vorbis.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\include\nel\sound\driver\music_channel.h"
|
||||
>
|
||||
|
@ -356,6 +376,14 @@
|
|||
RelativePath="listener.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_buffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_buffer_vorbis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_channel.cpp"
|
||||
>
|
||||
|
@ -368,6 +396,46 @@
|
|||
RelativePath="source.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdsound_lowlevel.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdsound_lowlevel.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "nel/sound/driver/source.h"
|
||||
#include "nel/misc/common.h"
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
#include <limits>
|
||||
#include "nel/sound/driver/source.h"
|
||||
|
||||
using namespace NLMISC;
|
||||
|
||||
|
|
24
code/nel/src/sound/driver/stdsound_lowlevel.cpp
Normal file
24
code/nel/src/sound/driver/stdsound_lowlevel.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdsound_lowlevel.h"
|
||||
|
||||
|
||||
// leave not static else this workaround don't work
|
||||
void dummyToAvoidStupidCompilerWarning_std_sound_lowlevel_cpp()
|
||||
{
|
||||
}
|
||||
|
42
code/nel/src/sound/driver/stdsound_lowlevel.h
Normal file
42
code/nel/src/sound/driver/stdsound_lowlevel.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/common.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
//#include <sstream>
|
||||
#include <exception>
|
||||
#include <utility>
|
||||
#include <deque>
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
#include <iomanip>
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/file.h"
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="driver_xaudio2"
|
||||
ProjectGUID="{23DCF574-1CEB-4DF4-9C59-D614580AC0C0}"
|
||||
RootNamespace="xaudio2"
|
||||
|
@ -67,7 +67,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libogg.lib libvorbis.lib libvorbisfile.lib x3daudio.lib"
|
||||
AdditionalDependencies="x3daudio.lib"
|
||||
OutputFile="..\..\..\..\lib\nel_drv_$(RootNamespace)_win_d.dll"
|
||||
IgnoreDefaultLibraryNames="msvcrt.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
|
@ -148,7 +148,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libogg.lib libvorbis.lib libvorbisfile.lib x3daudio.lib"
|
||||
AdditionalDependencies="x3daudio.lib"
|
||||
OutputFile="..\..\..\..\lib64\nel_drv_$(RootNamespace)_win_d.dll"
|
||||
IgnoreDefaultLibraryNames="msvcrt.lib"
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
|
@ -231,7 +231,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libogg.lib libvorbis.lib libvorbisfile.lib x3daudio.lib"
|
||||
AdditionalDependencies="x3daudio.lib"
|
||||
OutputFile="..\..\..\..\lib\nel_drv_$(RootNamespace)_win_r.dll"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
|
@ -317,7 +317,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libogg.lib libvorbis.lib libvorbisfile.lib x3daudio.lib"
|
||||
AdditionalDependencies="x3daudio.lib"
|
||||
OutputFile="..\..\..\..\lib64\nel_drv_$(RootNamespace)_win_r.dll"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
ModuleDefinitionFile="$(ProjectName).def"
|
||||
|
@ -405,26 +405,6 @@
|
|||
RelativePath=".\music_channel_xaudio2.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="utility"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\music_buffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_buffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_buffer_vorbis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\music_buffer_vorbis.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="efx"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
// Project includes
|
||||
#include "sound_driver_xaudio2.h"
|
||||
#include "music_buffer.h"
|
||||
#include "music_channel_xaudio2.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "music_channel_xaudio2.h"
|
||||
#include "effect_xaudio2.h"
|
||||
#include "sound_driver_xaudio2.h"
|
||||
#include "music_buffer.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "nel/sound/driver/listener.h"
|
||||
#include "nel/sound/driver/sound_driver.h"
|
||||
#include "nel/sound/driver/source.h"
|
||||
#include "nel/sound/driver/music_buffer.h"
|
||||
|
||||
// Defines
|
||||
#define NLSOUND_XAUDIO2_NAME "NeLSound XAudio2 Driver"
|
||||
|
|
|
@ -38,3 +38,5 @@
|
|||
#include <iomanip>
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/file.h"
|
||||
|
|
Loading…
Reference in a new issue