Last upstream release
This commit is contained in:
commit
ad473b259b
103
Makefile
Normal file
103
Makefile
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
#--- generic settings ----------------------------------------------
|
||||||
|
# settings for C++ compiler:
|
||||||
|
C = gcc
|
||||||
|
CC = g++
|
||||||
|
CFLAGS = -O2 -Wall # -D_DEBUG -g
|
||||||
|
INCDIR = -Irtaudio -Irtaudio/include -I../lua/src
|
||||||
|
|
||||||
|
# linker settings:
|
||||||
|
LCC = ar
|
||||||
|
LFLAGS = -rcs
|
||||||
|
LNAME = libproAudio.a
|
||||||
|
LIB = $(LNAME)
|
||||||
|
LIBDIR =
|
||||||
|
|
||||||
|
# settings for optional libSDL backend:
|
||||||
|
INCDIR += -I../archive/baseCode/include
|
||||||
|
SDLLIB = -lSDLmain -lSDL
|
||||||
|
SDLDIR = -L/usr/lib -L../archive/baseCode/lib
|
||||||
|
|
||||||
|
#--- platform specific settings ------------------------------------
|
||||||
|
ARCH = $(shell uname -s)
|
||||||
|
ifeq ($(ARCH),Linux)
|
||||||
|
LIBS = $(LIBDIR) $(LIB) -lpthread -lasound
|
||||||
|
LUALIB = -llua -ldl
|
||||||
|
CFLAGS += -DHAVE_GETTIMEOFDAY -D__LINUX_ALSA__ #-D__LINUX_OSS__
|
||||||
|
DLLFLAGS = -fPIC -shared
|
||||||
|
DLLSUFFIX = .so
|
||||||
|
EXESUFFIX =
|
||||||
|
|
||||||
|
else
|
||||||
|
ifeq ($(ARCH),Darwin) # MacOSX
|
||||||
|
LIBS = $(LIBDIR) $(LIB)
|
||||||
|
LUALIB = -L/usr/local/lib -llua
|
||||||
|
CFLAGS += -DHAVE_GETTIMEOFDAY -D__MACOSX_CORE__
|
||||||
|
DLLFLAGS = -bundle
|
||||||
|
DLLSUFFIX = .so
|
||||||
|
EXESUFFIX = .app
|
||||||
|
|
||||||
|
else # windows, MinGW
|
||||||
|
LIBS = $(LIBDIR) $(LIB) -lole32 -ldsound -lwinmm -mconsole -s
|
||||||
|
LUALIB = -L../lua/src -llua51
|
||||||
|
SDLLIB = -lmingw32 -lSDLmain -lSDL -mconsole -s
|
||||||
|
CFLAGS += -D__WINDOWS_DS__
|
||||||
|
DLLFLAGS = -shared
|
||||||
|
DLLSUFFIX = .dll
|
||||||
|
EXESUFFIX = .exe
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
#--- make targets and rules ----------------------------------------
|
||||||
|
|
||||||
|
# by default, proteaAudio makes use of the included rtAudio backend
|
||||||
|
rtaudio: $(LNAME) example$(EXESUFFIX) playAudioRt$(EXESUFFIX)
|
||||||
|
|
||||||
|
# the make all target additionally builds the Lua frontend and SDL backend, and therefore has additional dependencies
|
||||||
|
ALL = $(LNAME) example$(EXESUFFIX) playAudioRt$(EXESUFFIX) proAudioRt$(DLLSUFFIX) playAudioSdl$(EXESUFFIX)
|
||||||
|
all: $(ALL)
|
||||||
|
|
||||||
|
# static library
|
||||||
|
OBJ = proAudio.o proAudioRt.o stb_vorbis.o rtaudio/RtAudio.o
|
||||||
|
$(LNAME) : $(OBJ)
|
||||||
|
$(LCC) $(LFLAGS) $@ $^
|
||||||
|
|
||||||
|
# minimal example
|
||||||
|
example$(EXESUFFIX) : example.o
|
||||||
|
$(CC) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
# flexible example
|
||||||
|
playAudioRt$(EXESUFFIX) : playAudioRt.o
|
||||||
|
$(CC) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
# optional Lua frontend
|
||||||
|
lua: proAudioRt$(DLLSUFFIX)
|
||||||
|
|
||||||
|
proAudioRt$(DLLSUFFIX): proAudioRt_lua.o
|
||||||
|
$(CC) -o $@ $(DLLFLAGS) $^ $(LIBS) $(LUALIB)
|
||||||
|
|
||||||
|
# example for optional libSDL backend
|
||||||
|
sdl: playAudioSdl$(EXESUFFIX)
|
||||||
|
|
||||||
|
playAudioSdl$(EXESUFFIX): playAudioSdl.o proAudio.o proAudioSdl.o stb_vorbis.o
|
||||||
|
$(CC) $(CFLAGS) $^ $(SDLDIR) $(SDLLIB) -o $@
|
||||||
|
|
||||||
|
# generic rules
|
||||||
|
.c.o:
|
||||||
|
$(C) $(CFLAGS) $(INCDIR) -c $< -o $@
|
||||||
|
.cpp.o:
|
||||||
|
$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
|
||||||
|
clean:
|
||||||
|
rm -f *.o *~ $(OBJ) $(ALL)
|
||||||
|
|
||||||
|
#--- project specific dependencies ---------------------------------
|
||||||
|
HDR = proAudio.h proAudioRt.h
|
||||||
|
playAudioRt.o: playAudioRt.cpp $(HDR)
|
||||||
|
serverAudioRt.o: serverAudioRt.cpp $(HDR)
|
||||||
|
proAudioRt_lua.o: proAudioRt_lua.cpp $(HDR)
|
||||||
|
proAudio.o: proAudio.cpp proAudio.h
|
||||||
|
proAudioRt.o: proAudioRt.cpp $(HDR)
|
||||||
|
stb_vorbis.o: stb_vorbis.c
|
||||||
|
rtaudio/RtAudio.o: rtaudio/RtAudio.cpp rtaudio/RtAudio.h rtaudio/RtError.h
|
||||||
|
example.o: example.cpp $(HDR)
|
||||||
|
playAudioSdl.o: playAudioSdl.cpp proAudioSdl.h proAudio.h
|
||||||
|
proAudioSdl.o: proAudioSdl.cpp proAudioSdl.h proAudio.h
|
||||||
228
build/proAudio.vcproj
Normal file
228
build/proAudio.vcproj
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8,00"
|
||||||
|
Name="serverAudioRt"
|
||||||
|
ProjectGUID="{8DC73909-327A-45CD-93CA-7BA09993357E}"
|
||||||
|
RootNamespace="serverAudioRt"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="Debug"
|
||||||
|
IntermediateDirectory="Debug"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\rtaudio;..\rtaudio\include"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__WINDOWS_DS__"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="dsound.lib ole32.lib winmm.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="Release"
|
||||||
|
IntermediateDirectory="Release"
|
||||||
|
ConfigurationType="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\proAudio.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\proAudioRt.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rtaudio\RtAudio.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rtaudio\RtError.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\proAudio.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\proAudioRt.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rtaudio\RtAudio.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\serverAudioRt.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\stb_vorbis.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
20
build/proteaAudio.sln
Normal file
20
build/proteaAudio.sln
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# Visual C++ Express 2005
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proAudio", "proAudio.vcproj", "{8DC73909-327A-45CD-93CA-7BA09993357E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8DC73909-327A-45CD-93CA-7BA09993357E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{8DC73909-327A-45CD-93CA-7BA09993357E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{8DC73909-327A-45CD-93CA-7BA09993357E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{8DC73909-327A-45CD-93CA-7BA09993357E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
7
changelog.txt
Normal file
7
changelog.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/** \page Changelog Changelog
|
||||||
|
|
||||||
|
\section v062 Version 0.6.2 (2009-02-04)
|
||||||
|
- switch to new rtAudio version 4.0.5
|
||||||
|
- additional includes to support also newer versions of gcc/g++
|
||||||
|
- proteaAudio zip archives expand to single folders
|
||||||
|
*/
|
||||||
27
doc/annotated.html
Normal file
27
doc/annotated.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindexHL" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proteaAudio Class List</h1>Here are the classes, structs, unions and interfaces with brief descriptions:<table>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="class_audio_sample.html">AudioSample</a></td><td class="indexvalue">Class representing an audio sample </td></tr>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td class="indexvalue">Abstract base class for stereo audio mixer/playback devices </td></tr>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td class="indexvalue">RtAudio based stereo audio mixer/playback device </td></tr>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td class="indexvalue">SDL based stereo audio mixer/playback device </td></tr>
|
||||||
|
</table>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
25
doc/changelog.html
Normal file
25
doc/changelog.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1><a class="anchor" name="Changelog">Changelog</a></h1><h2><a class="anchor" name="v062">
|
||||||
|
Version 0.6.2 (2009-02-04)</a></h2>
|
||||||
|
<ul>
|
||||||
|
<li>switch to new rtAudio version 4.0.5</li><li>additional includes to support also newer versions of gcc/g++</li><li>proteaAudio zip archives expand to single folders </li></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
doc/class_audio_sample-members.html
Normal file
43
doc/class_audio_sample-members.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>AudioSample Member List</h1>This is the complete list of members for <a class="el" href="class_audio_sample.html">AudioSample</a>, including all inherited members.<p><table>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a0">AudioSample</a>(unsigned char *data, unsigned int size, unsigned short channels, unsigned int sampleRate, unsigned short bitsPerSample)</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a1">AudioSample</a>(const AudioSample &source)</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a10">bitsPerSample</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a11">bitsPerSample</a>(unsigned short bits)</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a12">bytesPerSample</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a8">channels</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a3">data</a>()</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a4">data</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a6">frames</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#e0">loadWav</a>(const std::string &fname)</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#p4">m_bitsPerSample</a></td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#p2">m_channels</a></td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#p0">m_data</a></td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#p3">m_sampleRate</a></td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#p1">m_size</a></td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#e1">readWav</a>(FILE *stream, size_t(*readFunc)(void *, size_t, size_t, FILE *))</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a9">sampleRate</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a5">size</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a7">sizeFrame</a>() const </td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a13">volume</a>(float f)</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_audio_sample.html#a2">~AudioSample</a>()</td><td><a class="el" href="class_audio_sample.html">AudioSample</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
</table><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
713
doc/class_audio_sample.html
Normal file
713
doc/class_audio_sample.html
Normal file
@ -0,0 +1,713 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>AudioSample Class Reference</h1><!-- doxytag: class=<AudioSample> -->class representing an audio sample
|
||||||
|
<a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <<a class="el" href="pro_audio_8h-source.html">proAudio.h</a>></code>
|
||||||
|
<p>
|
||||||
|
<a href="class_audio_sample-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a0">AudioSample</a> (unsigned char *data, unsigned int size, unsigned short channels, unsigned int sampleRate, unsigned short bitsPerSample)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a1">AudioSample</a> (const <a class="el" href="class_audio_sample.html">AudioSample</a> &source)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a2">~AudioSample</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a3">data</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">const unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a4">data</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a5">size</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a6">frames</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a7">sizeFrame</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a8">channels</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a9">sampleRate</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a10">bitsPerSample</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a11">bitsPerSample</a> (unsigned short bits)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a12">bytesPerSample</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#a13">volume</a> (float f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_audio_sample.html">AudioSample</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#e0">loadWav</a> (const std::string &fname)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_audio_sample.html">AudioSample</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#e1">readWav</a> (FILE *stream, size_t(*readFunc)(void *, size_t, size_t, FILE *))</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned char * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#p0">m_data</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#p1">m_size</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#p2">m_channels</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#p3">m_sampleRate</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned short </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html#p4">m_bitsPerSample</a></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
class representing an audio sample
|
||||||
|
<p>
|
||||||
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
||||||
|
<a class="anchor" name="a0"></a><!-- doxytag: member=<AudioSample::AudioSample> ref=<a0> args=<(unsigned char *data, unsigned int size, unsigned short channels, unsigned int sampleRate, unsigned short bitsPerSample)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">AudioSample::AudioSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned char * </td>
|
||||||
|
<td class="mdname" nowrap> <em>data</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>size</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned short </td>
|
||||||
|
<td class="mdname" nowrap> <em>channels</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sampleRate</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned short </td>
|
||||||
|
<td class="mdname" nowrap> <em>bitsPerSample</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
constructor from memory data
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a1"></a><!-- doxytag: member=<AudioSample::AudioSample> ref=<a1> args=<(const AudioSample &source)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">AudioSample::AudioSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const <a class="el" href="class_audio_sample.html">AudioSample</a> & </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>source</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
copy constructor
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a2"></a><!-- doxytag: member=<AudioSample::~AudioSample> ref=<a2> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">AudioSample::~AudioSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
destructor
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Function Documentation</h2>
|
||||||
|
<a class="anchor" name="a11"></a><!-- doxytag: member=<AudioSample::bitsPerSample> ref=<a11> args=<(unsigned short bits)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">bool AudioSample::bitsPerSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>bits</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
converts to a different bit rate, e.g., 8, 16
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a10"></a><!-- doxytag: member=<AudioSample::bitsPerSample> ref=<a10> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short AudioSample::bitsPerSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of bits per mono sample, e.g., 8, 16
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a12"></a><!-- doxytag: member=<AudioSample::bytesPerSample> ref=<a12> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short AudioSample::bytesPerSample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of bytes per sample, e.g., 1, 2
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a8"></a><!-- doxytag: member=<AudioSample::channels> ref=<a8> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short AudioSample::channels </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of parallel channels, 1 mono, 2 stereo
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a4"></a><!-- doxytag: member=<AudioSample::data> ref=<a4> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">const unsigned char* AudioSample::data </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
allows reading sample data
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a3"></a><!-- doxytag: member=<AudioSample::data> ref=<a3> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned char* AudioSample::data </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
allows accessing sample data
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a6"></a><!-- doxytag: member=<AudioSample::frames> ref=<a6> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int AudioSample::frames </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns sample size in number of frames
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="e0"></a><!-- doxytag: member=<AudioSample::loadWav> ref=<e0> args=<(const std::string &fname)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static <a class="el" href="class_audio_sample.html">AudioSample</a>* AudioSample::loadWav </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const std::string & </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>fname</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
loads a WAV file
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="e1"></a><!-- doxytag: member=<AudioSample::readWav> ref=<e1> args=<(FILE *stream, size_t(*readFunc)(void *, size_t, size_t, FILE *))> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static <a class="el" href="class_audio_sample.html">AudioSample</a>* AudioSample::readWav </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">FILE * </td>
|
||||||
|
<td class="mdname" nowrap> <em>stream</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>size_t(*)(void *, size_t, size_t, FILE *) </td>
|
||||||
|
<td class="mdname" nowrap> <em>readFunc</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
reads WAV data from a stream via a function compatible to std::fread
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a9"></a><!-- doxytag: member=<AudioSample::sampleRate> ref=<a9> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int AudioSample::sampleRate </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of frames per second, e.g., 44100, 22050
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a5"></a><!-- doxytag: member=<AudioSample::size> ref=<a5> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int AudioSample::size </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns sample size in bytes
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a7"></a><!-- doxytag: member=<AudioSample::sizeFrame> ref=<a7> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int AudioSample::sizeFrame </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns size of a single frame in bytes
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a13"></a><!-- doxytag: member=<AudioSample::volume> ref=<a13> args=<(float f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">void AudioSample::volume </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">float </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>f</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
changes volume by given factor
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Data Documentation</h2>
|
||||||
|
<a class="anchor" name="p4"></a><!-- doxytag: member=<AudioSample::m_bitsPerSample> ref=<p4> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short <a class="el" href="class_audio_sample.html#p4">AudioSample::m_bitsPerSample</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
number of bits per sample, e.g., 8, 16
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p2"></a><!-- doxytag: member=<AudioSample::m_channels> ref=<p2> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned short <a class="el" href="class_audio_sample.html#p2">AudioSample::m_channels</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
number of parallel channels, 1 mono, 2 stereo
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p0"></a><!-- doxytag: member=<AudioSample::m_data> ref=<p0> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned char* <a class="el" href="class_audio_sample.html#p0">AudioSample::m_data</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores sample data
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p3"></a><!-- doxytag: member=<AudioSample::m_sampleRate> ref=<p3> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_audio_sample.html#p3">AudioSample::m_sampleRate</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
number of samples per second, e.g., 44100, 22050
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p1"></a><!-- doxytag: member=<AudioSample::m_size> ref=<p1> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_audio_sample.html#p1">AudioSample::m_size</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
sample size in bytes
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr>The documentation for this class was generated from the following file:<ul>
|
||||||
|
<li><a class="el" href="pro_audio_8h-source.html">proAudio.h</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
45
doc/class_device_audio-members.html
Normal file
45
doc/class_device_audio-members.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudio Member List</h1>This is the complete list of members for <a class="el" href="class_device_audio.html">DeviceAudio</a>, including all inherited members.<p><table>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e1">destroy</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b0">DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a3">loaderAvailable</a>(const std::string &suffix) const </td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a2">loaderRegister</a>(AudioSample *(*loadFunc)(const std::string &), const std::string &suffix)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p0">m_freqOut</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p1">m_volL</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p2">m_volR</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p3">mm_loader</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#t0">s_instance</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a7">sample</a>(unsigned int handle) const </td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a6">sampleDestroy</a>(unsigned int sample)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a4">sampleFromFile</a>(const std::string &filename, float volume=1.0f)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a5">sampleFromMemory</a>(const AudioSample &sample, float volume=1.0f)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e0">singleton</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a13">soundActive</a>() const =0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a9">soundLoop</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a8">soundPlay</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a11">soundStop</a>(unsigned int sound)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a12">soundStop</a>()=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a10">soundUpdate</a>(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)=0</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [pure virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a0">volume</a>(float left, float right)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a1">volume</a>(float leftAndRight)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b1">~DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, protected, virtual]</code></td></tr>
|
||||||
|
</table><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
919
doc/class_device_audio.html
Normal file
919
doc/class_device_audio.html
Normal file
@ -0,0 +1,919 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudio Class Reference</h1><!-- doxytag: class=<DeviceAudio> -->abstract base class for stereo audio mixer/playback devices
|
||||||
|
<a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <<a class="el" href="pro_audio_8h-source.html">proAudio.h</a>></code>
|
||||||
|
<p>
|
||||||
|
<p>Inheritance diagram for DeviceAudio:
|
||||||
|
<p><center><img src="class_device_audio.png" usemap="#DeviceAudio_map" border="0" alt=""></center>
|
||||||
|
<map name="DeviceAudio_map">
|
||||||
|
<area href="class_device_audio_rt.html" alt="DeviceAudioRt" shape="rect" coords="0,56,103,80">
|
||||||
|
<area href="class_device_audio_sdl.html" alt="DeviceAudioSdl" shape="rect" coords="113,56,216,80">
|
||||||
|
</map>
|
||||||
|
<a href="class_device_audio-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a0">volume</a> (float left, float right)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a1">volume</a> (float leftAndRight)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a2">loaderRegister</a> (<a class="el" href="class_audio_sample.html">AudioSample</a> *(*loadFunc)(const std::string &), const std::string &suffix)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a3">loaderAvailable</a> (const std::string &suffix) const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a4">sampleFromFile</a> (const std::string &filename, float volume=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a5">sampleFromMemory</a> (const <a class="el" href="class_audio_sample.html">AudioSample</a> &sample, float volume=1.0f)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a6">sampleDestroy</a> (unsigned int sample)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const <a class="el" href="class_audio_sample.html">AudioSample</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a7">sample</a> (unsigned int handle) const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a8">soundPlay</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a9">soundLoop</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a10">soundUpdate</a> (unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a11">soundStop</a> (unsigned int sound)=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a12">soundStop</a> ()=0</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#a13">soundActive</a> () const =0</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#e0">singleton</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#e1">destroy</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#b0">DeviceAudio</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#b1">~DeviceAudio</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#p0">m_freqOut</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#p1">m_volL</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#p2">m_volR</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::map< std::string, <a class="el" href="class_audio_sample.html">AudioSample</a> <br>
|
||||||
|
*(*)(const std::string &)> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#p3">mm_loader</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Protected Attributes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html#t0">s_instance</a></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
abstract base class for stereo audio mixer/playback devices
|
||||||
|
<p>
|
||||||
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
||||||
|
<a class="anchor" name="b0"></a><!-- doxytag: member=<DeviceAudio::DeviceAudio> ref=<b0> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">DeviceAudio::DeviceAudio </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
constructor
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b1"></a><!-- doxytag: member=<DeviceAudio::~DeviceAudio> ref=<b1> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual DeviceAudio::~DeviceAudio </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline, protected, virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
destructor
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Function Documentation</h2>
|
||||||
|
<a class="anchor" name="e1"></a><!-- doxytag: member=<DeviceAudio::destroy> ref=<e1> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static void DeviceAudio::destroy </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline, static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
calls the destructor of the singleton object
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a3"></a><!-- doxytag: member=<DeviceAudio::loaderAvailable> ref=<a3> args=<(const std::string &suffix) const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">bool DeviceAudio::loaderAvailable </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const std::string & </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>suffix</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns true in case a loader for this file type is available
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a2"></a><!-- doxytag: member=<DeviceAudio::loaderRegister> ref=<a2> args=<(AudioSample *(*loadFunc)(const std::string &), const std::string &suffix)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">bool DeviceAudio::loaderRegister </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top"><a class="el" href="class_audio_sample.html">AudioSample</a> *(*)(const std::string &) </td>
|
||||||
|
<td class="mdname" nowrap> <em>loadFunc</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>const std::string & </td>
|
||||||
|
<td class="mdname" nowrap> <em>suffix</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
registers an audio sample loader function handling a file type identified by suffix
|
||||||
|
<p>
|
||||||
|
The function has to be of type <a class="el" href="class_audio_sample.html">AudioSample</a> * loadXYZ(const std::string & filename). </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a7"></a><!-- doxytag: member=<DeviceAudio::sample> ref=<a7> args=<(unsigned int handle) const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual const <a class="el" href="class_audio_sample.html">AudioSample</a>* DeviceAudio::sample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>handle</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [inline, virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
allows read access to a sample identified by its handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Reimplemented in <a class="el" href="class_device_audio_rt.html#a2">DeviceAudioRt</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a6"></a><!-- doxytag: member=<DeviceAudio::sampleDestroy> ref=<a6> args=<(unsigned int sample)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudio::sampleDestroy </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sample</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
deletes a previously created sound sample resource identified by its handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a1">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a1">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a4"></a><!-- doxytag: member=<DeviceAudio::sampleFromFile> ref=<a4> args=<(const std::string &filename, float volume=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudio::sampleFromFile </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const std::string & </td>
|
||||||
|
<td class="mdname" nowrap> <em>filename</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volume</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
loads a sound sample from file, optionally adjusts volume, returns handle
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a5"></a><!-- doxytag: member=<DeviceAudio::sampleFromMemory> ref=<a5> args=<(const AudioSample &sample, float volume=1.0f)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudio::sampleFromMemory </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const <a class="el" href="class_audio_sample.html">AudioSample</a> & </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volume</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
converts a sound sample to internal audio format, returns handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a0">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a0">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="e0"></a><!-- doxytag: member=<DeviceAudio::singleton> ref=<e0> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a>& DeviceAudio::singleton </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline, static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns singleton object
|
||||||
|
<p>
|
||||||
|
This call is only allowed after a successful precedent creation of an audio device </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a13"></a><!-- doxytag: member=<DeviceAudio::soundActive> ref=<a13> args=<() const =0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudio::soundActive </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of currently active sounds
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a8">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a7">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a9"></a><!-- doxytag: member=<DeviceAudio::soundLoop> ref=<a9> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudio::soundLoop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sound sample continuously and sets its parameters
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>handle of a previously loaded sample </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or -1 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a4">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a3">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a8"></a><!-- doxytag: member=<DeviceAudio::soundPlay> ref=<a8> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudio::soundPlay </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sound sample once and sets its parameters
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>handle of a previously loaded sample </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or -1 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a3">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a2">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a12"></a><!-- doxytag: member=<DeviceAudio::soundStop> ref=<a12> args=<()=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual void DeviceAudio::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops all sounds immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a7">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a6">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a11"></a><!-- doxytag: member=<DeviceAudio::soundStop> ref=<a11> args=<(unsigned int sound)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudio::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sound</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops a specified sound immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a6">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a5">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a10"></a><!-- doxytag: member=<DeviceAudio::soundUpdate> ref=<a10> args=<(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)=0> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudio::soundUpdate </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sound</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [pure virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
updates parameters of a specified sound
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sound</em> </td><td>handle of a currently active sound </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>true in case the parameters have been updated successfully </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implemented in <a class="el" href="class_device_audio_rt.html#a5">DeviceAudioRt</a>, and <a class="el" href="class_device_audio_sdl.html#a4">DeviceAudioSdl</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a1"></a><!-- doxytag: member=<DeviceAudio::volume> ref=<a1> args=<(float leftAndRight)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">void DeviceAudio::volume </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">float </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>leftAndRight</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
sets master volume
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a0"></a><!-- doxytag: member=<DeviceAudio::volume> ref=<a0> args=<(float left, float right)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">void DeviceAudio::volume </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">float </td>
|
||||||
|
<td class="mdname" nowrap> <em>left</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>right</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [inline]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
sets master volume
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Data Documentation</h2>
|
||||||
|
<a class="anchor" name="p0"></a><!-- doxytag: member=<DeviceAudio::m_freqOut> ref=<p0> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_device_audio.html#p0">DeviceAudio::m_freqOut</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores output stream frequency
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p1"></a><!-- doxytag: member=<DeviceAudio::m_volL> ref=<p1> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">float <a class="el" href="class_device_audio.html#p1">DeviceAudio::m_volL</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores left master volume
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p2"></a><!-- doxytag: member=<DeviceAudio::m_volR> ref=<p2> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">float <a class="el" href="class_device_audio.html#p2">DeviceAudio::m_volR</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores right master volume
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p3"></a><!-- doxytag: member=<DeviceAudio::mm_loader> ref=<p3> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">std::map<std::string, <a class="el" href="class_audio_sample.html">AudioSample</a> * (*)(const std::string &)> <a class="el" href="class_device_audio.html#p3">DeviceAudio::mm_loader</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
map associating suffixes to loader functions
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="t0"></a><!-- doxytag: member=<DeviceAudio::s_instance> ref=<t0> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top"><a class="el" href="class_device_audio.html">DeviceAudio</a>* <a class="el" href="class_device_audio.html#t0">DeviceAudio::s_instance</a><code> [static, protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
pointer to singleton
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr>The documentation for this class was generated from the following file:<ul>
|
||||||
|
<li><a class="el" href="pro_audio_8h-source.html">proAudio.h</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
doc/class_device_audio.png
Normal file
BIN
doc/class_device_audio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 509 B |
55
doc/class_device_audio_rt-members.html
Normal file
55
doc/class_device_audio_rt-members.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudioRt Member List</h1>This is the complete list of members for <a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a>, including all inherited members.<p><table>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#f0">cbMix</a>(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *data)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [inline, protected, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#e0">create</a>(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e1">destroy</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b0">DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#b0">DeviceAudioRt</a>(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a3">loaderAvailable</a>(const std::string &suffix) const </td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a2">loaderRegister</a>(AudioSample *(*loadFunc)(const std::string &), const std::string &suffix)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#p4">m_dac</a></td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p0">m_freqOut</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#p3">m_nSound</a></td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#p1">m_sampleCounter</a></td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p1">m_volL</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p2">m_volR</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#p2">ma_sound</a></td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#b2">mixOutputFloat</a>(signed short *outputBuffer, unsigned int nFrames)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p3">mm_loader</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#p0">mm_sample</a></td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#t0">s_instance</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a2">sample</a>(unsigned int handle) const </td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a1">sampleDestroy</a>(unsigned int sample)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a4">sampleFromFile</a>(const std::string &filename, float volume=1.0f)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a0">sampleFromMemory</a>(const AudioSample &sample, float volume=1.0f)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e0">singleton</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a8">soundActive</a>() const </td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a4">soundLoop</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a3">soundPlay</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a6">soundStop</a>(unsigned int sound)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a7">soundStop</a>()</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#a5">soundUpdate</a>(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a0">volume</a>(float left, float right)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a1">volume</a>(float leftAndRight)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b1">~DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, protected, virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_rt.html#b1">~DeviceAudioRt</a>()</td><td><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td><td><code> [protected, virtual]</code></td></tr>
|
||||||
|
</table><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
845
doc/class_device_audio_rt.html
Normal file
845
doc/class_device_audio_rt.html
Normal file
@ -0,0 +1,845 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudioRt Class Reference</h1><!-- doxytag: class=<DeviceAudioRt> --><!-- doxytag: inherits=<DeviceAudio> -->an rtAudio based stereo audio mixer/playback device
|
||||||
|
<a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <<a class="el" href="pro_audio_rt_8h-source.html">proAudioRt.h</a>></code>
|
||||||
|
<p>
|
||||||
|
<p>Inheritance diagram for DeviceAudioRt:
|
||||||
|
<p><center><img src="class_device_audio_rt.png" usemap="#DeviceAudioRt_map" border="0" alt=""></center>
|
||||||
|
<map name="DeviceAudioRt_map">
|
||||||
|
<area href="class_device_audio.html" alt="DeviceAudio" shape="rect" coords="0,0,96,24">
|
||||||
|
</map>
|
||||||
|
<a href="class_device_audio_rt-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a0">sampleFromMemory</a> (const <a class="el" href="class_audio_sample.html">AudioSample</a> &sample, float volume=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a1">sampleDestroy</a> (unsigned int sample)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const <a class="el" href="class_audio_sample.html">AudioSample</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a2">sample</a> (unsigned int handle) const </td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a3">soundPlay</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a4">soundLoop</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a5">soundUpdate</a> (unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a6">soundStop</a> (unsigned int sound)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a7">soundStop</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#a8">soundActive</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#e0">create</a> (unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#b0">DeviceAudioRt</a> (unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#b1">~DeviceAudioRt</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#b2">mixOutputFloat</a> (signed short *outputBuffer, unsigned int nFrames)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Protected Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#f0">cbMix</a> (void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *data)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::map< unsigned int, <a class="el" href="class_audio_sample.html">AudioSample</a> * > </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#p0">mm_sample</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#p1">m_sampleCounter</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">_AudioTrack * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#p2">ma_sound</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#p3">m_nSound</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">RtAudio </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html#p4">m_dac</a></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
an rtAudio based stereo audio mixer/playback device
|
||||||
|
<p>
|
||||||
|
DeviceAudioRt offers some advanced features such as dynamic pitch, independent volume control for both channels, and user-defined time shifts between the channels.
|
||||||
|
<p>
|
||||||
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
||||||
|
<a class="anchor" name="b0"></a><!-- doxytag: member=<DeviceAudioRt::DeviceAudioRt> ref=<b0> args=<(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">DeviceAudioRt::DeviceAudioRt </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nTracks</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>frequency</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>chunkSize</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
constructor. Use the <a class="el" href="class_device_audio_rt.html#e0">create()</a> method instead
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b1"></a><!-- doxytag: member=<DeviceAudioRt::~DeviceAudioRt> ref=<b1> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual DeviceAudioRt::~DeviceAudioRt </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [protected, virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
destructor. Use the <a class="el" href="class_device_audio.html#e1">destroy()</a> method instead
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Function Documentation</h2>
|
||||||
|
<a class="anchor" name="f0"></a><!-- doxytag: member=<DeviceAudioRt::cbMix> ref=<f0> args=<(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *data)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static int DeviceAudioRt::cbMix </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">void * </td>
|
||||||
|
<td class="mdname" nowrap> <em>outputBuffer</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>void * </td>
|
||||||
|
<td class="mdname" nowrap> <em>inputBuffer</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nFrames</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>double </td>
|
||||||
|
<td class="mdname" nowrap> <em>streamTime</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>RtAudioStreamStatus </td>
|
||||||
|
<td class="mdname" nowrap> <em>status</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>void * </td>
|
||||||
|
<td class="mdname" nowrap> <em>data</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [inline, static, protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
mixer callback
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="e0"></a><!-- doxytag: member=<DeviceAudioRt::create> ref=<e0> args=<(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a>* DeviceAudioRt::create </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nTracks</em> = <code>8</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>frequency</em> = <code>22050</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>chunkSize</em> = <code>1024</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
creates audio device
|
||||||
|
<p>
|
||||||
|
Use this method instead of a constructor. <dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>nTracks</em> </td><td>(optional) the maximum number of sounds that are played parallely. Computation time is linearly correlated to this factor. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>frequency</em> </td><td>(optional) sample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>chunkSize</em> </td><td>(optional) the number of bytes that are sent to the sound card at once. Low numbers lead to smaller latencies but need more computation time (thread switches). If a too small number is chosen, the sounds might not be played continuously. The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a pointer to an audio device object in case of success Note that the parameters are only handled when calling for the first time. Afterwards always the same object is returned until an explicit <a class="el" href="class_device_audio.html#e1">destroy()</a> is called.</dd></dl>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b2"></a><!-- doxytag: member=<DeviceAudioRt::mixOutputFloat> ref=<b2> args=<(signed short *outputBuffer, unsigned int nFrames)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">int DeviceAudioRt::mixOutputFloat </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">signed short * </td>
|
||||||
|
<td class="mdname" nowrap> <em>outputBuffer</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nFrames</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
mixes tracks to a single output stream
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a2"></a><!-- doxytag: member=<DeviceAudioRt::sample> ref=<a2> args=<(unsigned int handle) const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual const <a class="el" href="class_audio_sample.html">AudioSample</a>* DeviceAudioRt::sample </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>handle</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
allows read access to a sample identified by its handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Reimplemented from <a class="el" href="class_device_audio.html#a7">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a1"></a><!-- doxytag: member=<DeviceAudioRt::sampleDestroy> ref=<a1> args=<(unsigned int sample)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioRt::sampleDestroy </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sample</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
deletes a previously created sound sample resource identified by its handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a6">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a0"></a><!-- doxytag: member=<DeviceAudioRt::sampleFromMemory> ref=<a0> args=<(const AudioSample &sample, float volume=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioRt::sampleFromMemory </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const <a class="el" href="class_audio_sample.html">AudioSample</a> & </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volume</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
converts a sound sample to internal audio format, returns handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a5">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a8"></a><!-- doxytag: member=<DeviceAudioRt::soundActive> ref=<a8> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned DeviceAudioRt::soundActive </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of currently active sounds
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a13">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a4"></a><!-- doxytag: member=<DeviceAudioRt::soundLoop> ref=<a4> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioRt::soundLoop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sample continuously and sets its parameters <dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>a sample handle returned by a previous load() call </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or 0 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a9">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a3"></a><!-- doxytag: member=<DeviceAudioRt::soundPlay> ref=<a3> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioRt::soundPlay </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sample once and sets its parameters
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>a sample handle returned by a previous load() call </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or 0 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a8">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a7"></a><!-- doxytag: member=<DeviceAudioRt::soundStop> ref=<a7> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual void DeviceAudioRt::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops all sounds immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a12">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a6"></a><!-- doxytag: member=<DeviceAudioRt::soundStop> ref=<a6> args=<(unsigned int sound)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioRt::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sound</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops a specified sound immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a11">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a5"></a><!-- doxytag: member=<DeviceAudioRt::soundUpdate> ref=<a5> args=<(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioRt::soundUpdate </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sound</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
updates parameters of a specified sound
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sound</em> </td><td>handle of a currently active sound </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>true in case the parameters have been updated successfully </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a10">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Data Documentation</h2>
|
||||||
|
<a class="anchor" name="p4"></a><!-- doxytag: member=<DeviceAudioRt::m_dac> ref=<p4> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">RtAudio <a class="el" href="class_device_audio_rt.html#p4">DeviceAudioRt::m_dac</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
audio manager
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p3"></a><!-- doxytag: member=<DeviceAudioRt::m_nSound> ref=<p3> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_device_audio_rt.html#p3">DeviceAudioRt::m_nSound</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores number of parallel sounds
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p1"></a><!-- doxytag: member=<DeviceAudioRt::m_sampleCounter> ref=<p1> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_device_audio_rt.html#p1">DeviceAudioRt::m_sampleCounter</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores maximum sample id
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p2"></a><!-- doxytag: member=<DeviceAudioRt::ma_sound> ref=<p2> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">_AudioTrack* <a class="el" href="class_device_audio_rt.html#p2">DeviceAudioRt::ma_sound</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores sounds to be mixed
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p0"></a><!-- doxytag: member=<DeviceAudioRt::mm_sample> ref=<p0> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">std::map<unsigned int, <a class="el" href="class_audio_sample.html">AudioSample</a>*> <a class="el" href="class_device_audio_rt.html#p0">DeviceAudioRt::mm_sample</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores loaded sound samples
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr>The documentation for this class was generated from the following file:<ul>
|
||||||
|
<li><a class="el" href="pro_audio_rt_8h-source.html">proAudioRt.h</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
doc/class_device_audio_rt.png
Normal file
BIN
doc/class_device_audio_rt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 385 B |
57
doc/class_device_audio_sdl-members.html
Normal file
57
doc/class_device_audio_sdl-members.html
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudioSdl Member List</h1>This is the complete list of members for <a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a>, including all inherited members.<p><table>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#f0">cbOutput</a>(void *userData, Uint8 *stream, int len)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#e0">create</a>(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e1">destroy</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b0">DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#b0">DeviceAudioSdl</a>(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a3">loaderAvailable</a>(const std::string &suffix) const </td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a2">loaderRegister</a>(AudioSample *(*loadFunc)(const std::string &), const std::string &suffix)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p0">m_freqOut</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p3">m_isDesiredFormat</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p5">m_nSound</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p2">m_sampleCounter</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p0">m_spec</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p1">m_volL</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p2">m_volR</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p4">ma_sound</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#b2">mixOutputFloat</a>(signed short *outputBuffer, unsigned int nFrames)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#b3">mixOutputSInt</a>(Uint8 *stream, int len)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#p3">mm_loader</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#p1">mm_sample</a></td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#t0">s_instance</a></td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [protected, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a7">sample</a>(unsigned int handle) const </td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a1">sampleDestroy</a>(unsigned int sample)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a4">sampleFromFile</a>(const std::string &filename, float volume=1.0f)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a0">sampleFromMemory</a>(const AudioSample &sample, float volume=1.0f)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#e0">singleton</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, static]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a7">soundActive</a>() const </td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a3">soundLoop</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a2">soundPlay</a>(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a5">soundStop</a>(unsigned int sound)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a6">soundStop</a>()</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#a4">soundUpdate</a>(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a0">volume</a>(float left, float right)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#a1">volume</a>(float leftAndRight)</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio.html#b1">~DeviceAudio</a>()</td><td><a class="el" href="class_device_audio.html">DeviceAudio</a></td><td><code> [inline, protected, virtual]</code></td></tr>
|
||||||
|
<tr class="memlist"><td><a class="el" href="class_device_audio_sdl.html#b1">~DeviceAudioSdl</a>()</td><td><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td><td><code> [protected, virtual]</code></td></tr>
|
||||||
|
</table><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
859
doc/class_device_audio_sdl.html
Normal file
859
doc/class_device_audio_sdl.html
Normal file
@ -0,0 +1,859 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>DeviceAudioSdl Class Reference</h1><!-- doxytag: class=<DeviceAudioSdl> --><!-- doxytag: inherits=<DeviceAudio> -->SDL based stereo audio mixer/playback device.
|
||||||
|
<a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <<a class="el" href="pro_audio_sdl_8h-source.html">proAudioSdl.h</a>></code>
|
||||||
|
<p>
|
||||||
|
<p>Inheritance diagram for DeviceAudioSdl:
|
||||||
|
<p><center><img src="class_device_audio_sdl.png" usemap="#DeviceAudioSdl_map" border="0" alt=""></center>
|
||||||
|
<map name="DeviceAudioSdl_map">
|
||||||
|
<area href="class_device_audio.html" alt="DeviceAudio" shape="rect" coords="0,0,103,24">
|
||||||
|
</map>
|
||||||
|
<a href="class_device_audio_sdl-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a0">sampleFromMemory</a> (const <a class="el" href="class_audio_sample.html">AudioSample</a> &sample, float volume=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a1">sampleDestroy</a> (unsigned int sample)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a2">soundPlay</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a3">soundLoop</a> (unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a4">soundUpdate</a> (unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a5">soundStop</a> (unsigned int sound)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a6">soundStop</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#a7">soundActive</a> () const </td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#e0">create</a> (unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#b0">DeviceAudioSdl</a> (unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#b1">~DeviceAudioSdl</a> ()</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#b2">mixOutputFloat</a> (signed short *outputBuffer, unsigned int nFrames)</td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#b3">mixOutputSInt</a> (Uint8 *stream, int len)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Static Protected Member Functions</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#f0">cbOutput</a> (void *userData, Uint8 *stream, int len)</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">SDL_AudioSpec </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p0">m_spec</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::map< unsigned int, _AudioTrack > </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p1">mm_sample</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p2">m_sampleCounter</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p3">m_isDesiredFormat</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">_AudioTrack * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p4">ma_sound</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html#p5">m_nSound</a></td></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
SDL based stereo audio mixer/playback device.
|
||||||
|
<p>
|
||||||
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
||||||
|
<a class="anchor" name="b0"></a><!-- doxytag: member=<DeviceAudioSdl::DeviceAudioSdl> ref=<b0> args=<(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">DeviceAudioSdl::DeviceAudioSdl </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nTracks</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>frequency</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>chunkSize</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
constructor. Use the <a class="el" href="class_device_audio_sdl.html#e0">create()</a> method instead
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b1"></a><!-- doxytag: member=<DeviceAudioSdl::~DeviceAudioSdl> ref=<b1> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual DeviceAudioSdl::~DeviceAudioSdl </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [protected, virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
destructor. Use the <a class="el" href="class_device_audio.html#e1">destroy()</a> method instead
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Function Documentation</h2>
|
||||||
|
<a class="anchor" name="f0"></a><!-- doxytag: member=<DeviceAudioSdl::cbOutput> ref=<f0> args=<(void *userData, Uint8 *stream, int len)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static void DeviceAudioSdl::cbOutput </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">void * </td>
|
||||||
|
<td class="mdname" nowrap> <em>userData</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>Uint8 * </td>
|
||||||
|
<td class="mdname" nowrap> <em>stream</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>int </td>
|
||||||
|
<td class="mdname" nowrap> <em>len</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [static, protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
output callback
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="e0"></a><!-- doxytag: member=<DeviceAudioSdl::create> ref=<e0> args=<(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">static <a class="el" href="class_device_audio.html">DeviceAudio</a>* DeviceAudioSdl::create </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nTracks</em> = <code>8</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>frequency</em> = <code>22050</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>chunkSize</em> = <code>1024</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [static]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
creates audio device
|
||||||
|
<p>
|
||||||
|
Use this method instead of a constructor. <dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>nTracks</em> </td><td>(optional) the maximum number of sounds that are played parallely. Computation time is linearly correlated to this factor. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>frequency</em> </td><td>(optional) sample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>chunkSize</em> </td><td>(optional) the number of bytes that are sent to the sound card at once. Low numbers lead to smaller latencies but need more computation time (thread switches). If a too small number is chosen, the sounds might not be played continuously. The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a pointer to an audio device object in case of success Note that the parameters are only handled when calling for the first time. Afterwards always the same object is returned until an explicit <a class="el" href="class_device_audio.html#e1">destroy()</a> is called.</dd></dl>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b2"></a><!-- doxytag: member=<DeviceAudioSdl::mixOutputFloat> ref=<b2> args=<(signed short *outputBuffer, unsigned int nFrames)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">void DeviceAudioSdl::mixOutputFloat </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">signed short * </td>
|
||||||
|
<td class="mdname" nowrap> <em>outputBuffer</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>nFrames</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
advanced mixer method
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="b3"></a><!-- doxytag: member=<DeviceAudioSdl::mixOutputSInt> ref=<b3> args=<(Uint8 *stream, int len)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">void DeviceAudioSdl::mixOutputSInt </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">Uint8 * </td>
|
||||||
|
<td class="mdname" nowrap> <em>stream</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>int </td>
|
||||||
|
<td class="mdname" nowrap> <em>len</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [protected]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
fallback mixer method
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a1"></a><!-- doxytag: member=<DeviceAudioSdl::sampleDestroy> ref=<a1> args=<(unsigned int sample)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioSdl::sampleDestroy </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sample</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
deletes a previously created sound sample resource identified by its handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a6">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a0"></a><!-- doxytag: member=<DeviceAudioSdl::sampleFromMemory> ref=<a0> args=<(const AudioSample &sample, float volume=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioSdl::sampleFromMemory </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">const <a class="el" href="class_audio_sample.html">AudioSample</a> & </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volume</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
converts a sound sample to internal audio format, returns handle
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a5">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a7"></a><!-- doxytag: member=<DeviceAudioSdl::soundActive> ref=<a7> args=<() const > --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioSdl::soundActive </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap> const<code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
returns number of currently active sounds
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a13">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a3"></a><!-- doxytag: member=<DeviceAudioSdl::soundLoop> ref=<a3> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioSdl::soundLoop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sample continuously and sets its parameters <dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>a sample handle returned by a previous load() call </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or 0 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a9">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a2"></a><!-- doxytag: member=<DeviceAudioSdl::soundPlay> ref=<a2> args=<(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual unsigned int DeviceAudioSdl::soundPlay </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sample</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em> = <code>1.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
plays a specified sample once and sets its parameters
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sample</em> </td><td>a sample handle returned by a previous load() call </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>(optional) left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>(optional) right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>a handle to the currently played sound or 0 in case of error </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a8">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a6"></a><!-- doxytag: member=<DeviceAudioSdl::soundStop> ref=<a6> args=<()> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual void DeviceAudioSdl::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops all sounds immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a12">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a5"></a><!-- doxytag: member=<DeviceAudioSdl::soundStop> ref=<a5> args=<(unsigned int sound)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioSdl::soundStop </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname1" valign="top" nowrap> <em>sound</em> </td>
|
||||||
|
<td class="md" valign="top"> ) </td>
|
||||||
|
<td class="md" nowrap><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stops a specified sound immediately
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a11">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="a4"></a><!-- doxytag: member=<DeviceAudioSdl::soundUpdate> ref=<a4> args=<(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f)> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">virtual bool DeviceAudioSdl::soundUpdate </td>
|
||||||
|
<td class="md" valign="top">( </td>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int </td>
|
||||||
|
<td class="mdname" nowrap> <em>sound</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeL</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>volumeR</em>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>disparity</em> = <code>0.0f</code>, </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap align="right"></td>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md" nowrap>float </td>
|
||||||
|
<td class="mdname" nowrap> <em>pitch</em> = <code>1.0f</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md"></td>
|
||||||
|
<td class="md">) </td>
|
||||||
|
<td class="md" colspan="2"><code> [virtual]</code></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
updates parameters of a specified sound
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
||||||
|
<table border="0" cellspacing="2" cellpadding="0">
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>sound</em> </td><td>handle of a currently active sound </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeL</em> </td><td>left volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>volumeR</em> </td><td>right volume </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>disparity</em> </td><td>(optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right. </td></tr>
|
||||||
|
<tr><td valign="top"></td><td valign="top"><em>pitch</em> </td><td>(optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample. </td></tr>
|
||||||
|
</table>
|
||||||
|
</dl>
|
||||||
|
<dl compact><dt><b>Returns:</b></dt><dd>true in case the parameters have been updated successfully </dd></dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Implements <a class="el" href="class_device_audio.html#a10">DeviceAudio</a>. </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr><h2>Member Data Documentation</h2>
|
||||||
|
<a class="anchor" name="p3"></a><!-- doxytag: member=<DeviceAudioSdl::m_isDesiredFormat> ref=<p3> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">bool <a class="el" href="class_device_audio_sdl.html#p3">DeviceAudioSdl::m_isDesiredFormat</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores whether obtained audio format corresponds to expectations
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p5"></a><!-- doxytag: member=<DeviceAudioSdl::m_nSound> ref=<p5> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_device_audio_sdl.html#p5">DeviceAudioSdl::m_nSound</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores number of parallel tracks
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p2"></a><!-- doxytag: member=<DeviceAudioSdl::m_sampleCounter> ref=<p2> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">unsigned int <a class="el" href="class_device_audio_sdl.html#p2">DeviceAudioSdl::m_sampleCounter</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores maximum sample id
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p0"></a><!-- doxytag: member=<DeviceAudioSdl::m_spec> ref=<p0> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">SDL_AudioSpec <a class="el" href="class_device_audio_sdl.html#p0">DeviceAudioSdl::m_spec</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores audio specification
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p4"></a><!-- doxytag: member=<DeviceAudioSdl::ma_sound> ref=<p4> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">_AudioTrack* <a class="el" href="class_device_audio_sdl.html#p4">DeviceAudioSdl::ma_sound</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores sounds to be mixed
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<a class="anchor" name="p1"></a><!-- doxytag: member=<DeviceAudioSdl::mm_sample> ref=<p1> args=<> --><p>
|
||||||
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="mdRow">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="md" nowrap valign="top">std::map<unsigned int, _AudioTrack> <a class="el" href="class_device_audio_sdl.html#p1">DeviceAudioSdl::mm_sample</a><code> [protected]</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table cellspacing="5" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
stores loaded sound samples
|
||||||
|
<p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr>The documentation for this class was generated from the following file:<ul>
|
||||||
|
<li><a class="el" href="pro_audio_sdl_8h-source.html">proAudioSdl.h</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
doc/class_device_audio_sdl.png
Normal file
BIN
doc/class_device_audio_sdl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 398 B |
26
doc/files.html
Normal file
26
doc/files.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindexHL" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proteaAudio File List</h1>Here is a list of all documented files with brief descriptions:<table>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="pro_audio_8h.html">proAudio.h</a> <a href="pro_audio_8h-source.html">[code]</a></td><td class="indexvalue">Public interface of proteaAudio </td></tr>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="pro_audio_rt_8h.html">proAudioRt.h</a> <a href="pro_audio_rt_8h-source.html">[code]</a></td><td class="indexvalue">RtAudio backend of proteaAudio </td></tr>
|
||||||
|
<tr><td class="indexkey"><a class="el" href="pro_audio_sdl_8h.html">proAudioSdl.h</a> <a href="pro_audio_sdl_8h-source.html">[code]</a></td><td class="indexvalue">SDL backend of proteaAudio </td></tr>
|
||||||
|
</table>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
103
doc/functions.html
Normal file
103
doc/functions.html
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindexHL" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<div class="qindex"><a class="qindexHL" href="functions.html">All</a> | <a class="qindex" href="functions_func.html">Functions</a> | <a class="qindex" href="functions_vars.html">Variables</a></div>
|
||||||
|
<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_b">b</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_f">f</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_r">r</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_v">v</a> | <a class="qindex" href="#index_~">~</a></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here is a list of all documented class members with links to the class documentation for each member:
|
||||||
|
<p>
|
||||||
|
<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
|
||||||
|
<li>AudioSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a1">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_b">- b -</a></h3><ul>
|
||||||
|
<li>bitsPerSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a11">AudioSample</a><li>bytesPerSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a12">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
|
||||||
|
<li>cbMix()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#f0">DeviceAudioRt</a><li>cbOutput()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#f0">DeviceAudioSdl</a><li>channels()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a8">AudioSample</a><li>create()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#e0">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#e0">DeviceAudioRt</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
|
||||||
|
<li>data()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a4">AudioSample</a><li>destroy()
|
||||||
|
: <a class="el" href="class_device_audio.html#e1">DeviceAudio</a><li>DeviceAudio()
|
||||||
|
: <a class="el" href="class_device_audio.html#b0">DeviceAudio</a><li>DeviceAudioRt()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#b0">DeviceAudioRt</a><li>DeviceAudioSdl()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b0">DeviceAudioSdl</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
|
||||||
|
<li>frames()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a6">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
|
||||||
|
<li>loaderAvailable()
|
||||||
|
: <a class="el" href="class_device_audio.html#a3">DeviceAudio</a><li>loaderRegister()
|
||||||
|
: <a class="el" href="class_device_audio.html#a2">DeviceAudio</a><li>loadWav()
|
||||||
|
: <a class="el" href="class_audio_sample.html#e0">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
|
||||||
|
<li>m_bitsPerSample
|
||||||
|
: <a class="el" href="class_audio_sample.html#p4">AudioSample</a><li>m_channels
|
||||||
|
: <a class="el" href="class_audio_sample.html#p2">AudioSample</a><li>m_dac
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#p4">DeviceAudioRt</a><li>m_data
|
||||||
|
: <a class="el" href="class_audio_sample.html#p0">AudioSample</a><li>m_freqOut
|
||||||
|
: <a class="el" href="class_device_audio.html#p0">DeviceAudio</a><li>m_isDesiredFormat
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p3">DeviceAudioSdl</a><li>m_nSound
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p5">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p3">DeviceAudioRt</a><li>m_sampleCounter
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p1">DeviceAudioRt</a><li>m_sampleRate
|
||||||
|
: <a class="el" href="class_audio_sample.html#p3">AudioSample</a><li>m_size
|
||||||
|
: <a class="el" href="class_audio_sample.html#p1">AudioSample</a><li>m_spec
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p0">DeviceAudioSdl</a><li>m_volL
|
||||||
|
: <a class="el" href="class_device_audio.html#p1">DeviceAudio</a><li>m_volR
|
||||||
|
: <a class="el" href="class_device_audio.html#p2">DeviceAudio</a><li>ma_sound
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p4">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p2">DeviceAudioRt</a><li>mixOutputFloat()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#b2">DeviceAudioRt</a><li>mixOutputSInt()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b3">DeviceAudioSdl</a><li>mm_loader
|
||||||
|
: <a class="el" href="class_device_audio.html#p3">DeviceAudio</a><li>mm_sample
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p1">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p0">DeviceAudioRt</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_r">- r -</a></h3><ul>
|
||||||
|
<li>readWav()
|
||||||
|
: <a class="el" href="class_audio_sample.html#e1">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
|
||||||
|
<li>s_instance
|
||||||
|
: <a class="el" href="class_device_audio.html#t0">DeviceAudio</a><li>sample()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#a2">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a7">DeviceAudio</a><li>sampleDestroy()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a1">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a1">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a6">DeviceAudio</a><li>sampleFromFile()
|
||||||
|
: <a class="el" href="class_device_audio.html#a4">DeviceAudio</a><li>sampleFromMemory()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a0">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a0">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a5">DeviceAudio</a><li>sampleRate()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a9">AudioSample</a><li>singleton()
|
||||||
|
: <a class="el" href="class_device_audio.html#e0">DeviceAudio</a><li>size()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a5">AudioSample</a><li>sizeFrame()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a7">AudioSample</a><li>soundActive()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a7">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a8">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a13">DeviceAudio</a><li>soundLoop()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a3">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a4">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a9">DeviceAudio</a><li>soundPlay()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a3">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a8">DeviceAudio</a><li>soundStop()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a6">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a7">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a12">DeviceAudio</a><li>soundUpdate()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a4">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a5">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a10">DeviceAudio</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_v">- v -</a></h3><ul>
|
||||||
|
<li>volume()
|
||||||
|
: <a class="el" href="class_device_audio.html#a1">DeviceAudio</a>, <a class="el" href="class_audio_sample.html#a13">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_~">- ~ -</a></h3><ul>
|
||||||
|
<li>~AudioSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a2">AudioSample</a><li>~DeviceAudio()
|
||||||
|
: <a class="el" href="class_device_audio.html#b1">DeviceAudio</a><li>~DeviceAudioRt()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#b1">DeviceAudioRt</a><li>~DeviceAudioSdl()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b1">DeviceAudioSdl</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
86
doc/functions_func.html
Normal file
86
doc/functions_func.html
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindexHL" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<div class="qindex"><a class="qindex" href="functions.html">All</a> | <a class="qindexHL" href="functions_func.html">Functions</a> | <a class="qindex" href="functions_vars.html">Variables</a></div>
|
||||||
|
<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_b">b</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_f">f</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_r">r</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_v">v</a> | <a class="qindex" href="#index_~">~</a></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
|
||||||
|
<li>AudioSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a1">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_b">- b -</a></h3><ul>
|
||||||
|
<li>bitsPerSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a11">AudioSample</a><li>bytesPerSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a12">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
|
||||||
|
<li>cbMix()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#f0">DeviceAudioRt</a><li>cbOutput()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#f0">DeviceAudioSdl</a><li>channels()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a8">AudioSample</a><li>create()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#e0">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#e0">DeviceAudioRt</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
|
||||||
|
<li>data()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a4">AudioSample</a><li>destroy()
|
||||||
|
: <a class="el" href="class_device_audio.html#e1">DeviceAudio</a><li>DeviceAudio()
|
||||||
|
: <a class="el" href="class_device_audio.html#b0">DeviceAudio</a><li>DeviceAudioRt()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#b0">DeviceAudioRt</a><li>DeviceAudioSdl()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b0">DeviceAudioSdl</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
|
||||||
|
<li>frames()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a6">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
|
||||||
|
<li>loaderAvailable()
|
||||||
|
: <a class="el" href="class_device_audio.html#a3">DeviceAudio</a><li>loaderRegister()
|
||||||
|
: <a class="el" href="class_device_audio.html#a2">DeviceAudio</a><li>loadWav()
|
||||||
|
: <a class="el" href="class_audio_sample.html#e0">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
|
||||||
|
<li>mixOutputFloat()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#b2">DeviceAudioRt</a><li>mixOutputSInt()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b3">DeviceAudioSdl</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_r">- r -</a></h3><ul>
|
||||||
|
<li>readWav()
|
||||||
|
: <a class="el" href="class_audio_sample.html#e1">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
|
||||||
|
<li>sample()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#a2">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a7">DeviceAudio</a><li>sampleDestroy()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a1">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a1">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a6">DeviceAudio</a><li>sampleFromFile()
|
||||||
|
: <a class="el" href="class_device_audio.html#a4">DeviceAudio</a><li>sampleFromMemory()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a0">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a0">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a5">DeviceAudio</a><li>sampleRate()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a9">AudioSample</a><li>singleton()
|
||||||
|
: <a class="el" href="class_device_audio.html#e0">DeviceAudio</a><li>size()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a5">AudioSample</a><li>sizeFrame()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a7">AudioSample</a><li>soundActive()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a7">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a8">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a13">DeviceAudio</a><li>soundLoop()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a3">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a4">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a9">DeviceAudio</a><li>soundPlay()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a3">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a8">DeviceAudio</a><li>soundStop()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a6">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a7">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a12">DeviceAudio</a><li>soundUpdate()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#a4">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#a5">DeviceAudioRt</a>, <a class="el" href="class_device_audio.html#a10">DeviceAudio</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_v">- v -</a></h3><ul>
|
||||||
|
<li>volume()
|
||||||
|
: <a class="el" href="class_device_audio.html#a1">DeviceAudio</a>, <a class="el" href="class_audio_sample.html#a13">AudioSample</a></ul>
|
||||||
|
<h3><a class="anchor" name="index_~">- ~ -</a></h3><ul>
|
||||||
|
<li>~AudioSample()
|
||||||
|
: <a class="el" href="class_audio_sample.html#a2">AudioSample</a><li>~DeviceAudio()
|
||||||
|
: <a class="el" href="class_device_audio.html#b1">DeviceAudio</a><li>~DeviceAudioRt()
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#b1">DeviceAudioRt</a><li>~DeviceAudioSdl()
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#b1">DeviceAudioSdl</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
doc/functions_vars.html
Normal file
43
doc/functions_vars.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindexHL" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<div class="qindex"><a class="qindex" href="functions.html">All</a> | <a class="qindex" href="functions_func.html">Functions</a> | <a class="qindexHL" href="functions_vars.html">Variables</a></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
<li>m_bitsPerSample
|
||||||
|
: <a class="el" href="class_audio_sample.html#p4">AudioSample</a><li>m_channels
|
||||||
|
: <a class="el" href="class_audio_sample.html#p2">AudioSample</a><li>m_dac
|
||||||
|
: <a class="el" href="class_device_audio_rt.html#p4">DeviceAudioRt</a><li>m_data
|
||||||
|
: <a class="el" href="class_audio_sample.html#p0">AudioSample</a><li>m_freqOut
|
||||||
|
: <a class="el" href="class_device_audio.html#p0">DeviceAudio</a><li>m_isDesiredFormat
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p3">DeviceAudioSdl</a><li>m_nSound
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p5">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p3">DeviceAudioRt</a><li>m_sampleCounter
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p2">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p1">DeviceAudioRt</a><li>m_sampleRate
|
||||||
|
: <a class="el" href="class_audio_sample.html#p3">AudioSample</a><li>m_size
|
||||||
|
: <a class="el" href="class_audio_sample.html#p1">AudioSample</a><li>m_spec
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p0">DeviceAudioSdl</a><li>m_volL
|
||||||
|
: <a class="el" href="class_device_audio.html#p1">DeviceAudio</a><li>m_volR
|
||||||
|
: <a class="el" href="class_device_audio.html#p2">DeviceAudio</a><li>ma_sound
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p4">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p2">DeviceAudioRt</a><li>mm_loader
|
||||||
|
: <a class="el" href="class_device_audio.html#p3">DeviceAudio</a><li>mm_sample
|
||||||
|
: <a class="el" href="class_device_audio_sdl.html#p1">DeviceAudioSdl</a>, <a class="el" href="class_device_audio_rt.html#p0">DeviceAudioRt</a><li>s_instance
|
||||||
|
: <a class="el" href="class_device_audio.html#t0">DeviceAudio</a></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
29
doc/hierarchy.html
Normal file
29
doc/hierarchy.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindexHL" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proteaAudio Class Hierarchy</h1>This inheritance list is sorted roughly, but not completely, alphabetically:<ul>
|
||||||
|
<li><a class="el" href="class_audio_sample.html">AudioSample</a>
|
||||||
|
<li><a class="el" href="class_device_audio.html">DeviceAudio</a>
|
||||||
|
<ul>
|
||||||
|
<li><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a>
|
||||||
|
<li><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
52
doc/index.html
Normal file
52
doc/index.html
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindexHL" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proteaAudio Documentation</h1>
|
||||||
|
<p>
|
||||||
|
<h3 align="center">v0.6.2 </h3><h2><a class="anchor" name="intro">
|
||||||
|
Overview</a></h2>
|
||||||
|
proteaAudio is a free cross-platform 2D audio library for C++ and Lua.<p>
|
||||||
|
Due to its straightforward interface and minimal open-source code base, proteaAudio is both easy to maintain and use.<p>
|
||||||
|
By default proteaAudio internally makes use of the excellent RtAudio low-level realtime audio input/output API, and therefore has no external dependencies apart from standard system libraries. Together with its liberal open-source licensing conditions (zlib style), this makes the integration of proteaAudio into both free and closed-source commercial software very easy. Alternatively, proteaAudio contains optional bindings for the highly portable SDL multimedia library and is therefore also usable on a plentitude of further platforms (e.g., iPhone, BEOS, FreeBSD).<p>
|
||||||
|
Despite its minimalistic design, proteaAudio offers advanced features such as dynamic pitch, per-channel volume control, and user-definable time shifts between channels. proteaAudio is capable of handling normal .wav files as well as ogg/vorbis audio samples (via stb_vorbis). Additionally it offers a simple interface for integrating further custom audio format loaders (e.g., .mp3).<h2><a class="anchor" name="features">
|
||||||
|
Main features at a glance</a></h2>
|
||||||
|
<ul>
|
||||||
|
<li>clean minimal C++ code base, portable, extendable class design</li><li>supports playback of an arbitrary number of parallel mono/stereo sounds</li><li>dynamic pitch shifts, panning between the stereo channels, user-definable disparity</li><li>low CPU consumption, runs in its own dedicated thread</li><li>regularly tested on MS Windows (MinGW/VisualStudio) and Linux (gcc)</li><li>loaders for standard wav and ogg/vorbis audio samples included</li><li>easily extensible to support further audio sample formats, e.g., mp3</li><li>C++ and Lua API</li><li>by default makes use of the RtAudio low-level cross-platform audio backend, supporting Windows (DirectSound, ASIO), Linux (ALSA, OSS, JACK), and MacOSX (CoreAudio, JACK)</li><li>makes optionally use of libSDL as cross-platform audio backend, supporting various further platforms</li></ul>
|
||||||
|
<h2><a class="anchor" name="download">
|
||||||
|
Download</a></h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="proteaAudio_src_090204.zip">proteaAudio source code release 2009-02-04</a></li><li><a href="proteaAudio_lua_090204.zip">proteaAudio Lua Windows/Linux binary release 2009-02-04</a></li></ul>
|
||||||
|
<h2><a class="anchor" name="documentation">
|
||||||
|
Documentation</a></h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="annotated.html">C++ API</a></li><li><a href="proteaaudiolua.html">Lua API</a></li><li><a href="changelog.html">Changelog</a></li></ul>
|
||||||
|
<h2><a class="anchor" name="links">
|
||||||
|
Links</a></h2>
|
||||||
|
proteaAudio internally makes use of the following excellent open-source components:<p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://music.mcgill.ca/~gary/rtaudio">RtAudio</a> cross-platform low-level audio library (optional)</li><li><a href="http://www.libsdl.org">SDL</a> cross-platform multimedia layer (optional)</li><li><a href="http://nothings.org/stb_vorbis">stb_vorbis</a> Ogg Vorbis audio decoder</li></ul>
|
||||||
|
<h2><a class="anchor" name="license">
|
||||||
|
License notice (zlib license):</a></h2>
|
||||||
|
(c) 2009 by Gerald Franz, www.viremo.de<p>
|
||||||
|
This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.<p>
|
||||||
|
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:<p>
|
||||||
|
<ol type=1>
|
||||||
|
<li>The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.</li><li>Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.</li><li>This notice may not be removed or altered from any source distribution. </li></ol>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
27
doc/pages.html
Normal file
27
doc/pages.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindexHL" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proteaAudio Related Pages</h1>Here is a list of all related documentation pages:<ul>
|
||||||
|
<li><a class="el" href="proteaaudiolua.html">proteaAudio Lua API</a>
|
||||||
|
|
||||||
|
<li><a class="el" href="changelog.html">Changelog</a>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
100
doc/pro_audio_8h-source.html
Normal file
100
doc/pro_audio_8h-source.html
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudio.h</h1><a href="pro_audio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _PRO_AUDIO</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _PRO_AUDIO</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||||
|
<a name="l00004"></a>00004 <span class="preprocessor">#include <string></span>
|
||||||
|
<a name="l00005"></a>00005 <span class="preprocessor">#include <map></span>
|
||||||
|
<a name="l00006"></a>00006
|
||||||
|
<a name="l00036"></a>00036 <span class="comment">//--- class AudioSample --------------------------------------------</span>
|
||||||
|
<a name="l00038"></a><a class="code" href="class_audio_sample.html">00038</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_audio_sample.html">AudioSample</a> {
|
||||||
|
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||||
|
<a name="l00041"></a><a class="code" href="class_audio_sample.html#a0">00041</a> <a class="code" href="class_audio_sample.html#a0">AudioSample</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * <a class="code" href="class_audio_sample.html#a3">data</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a5">size</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#a8">channels</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a9">sampleRate</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#a10">bitsPerSample</a>) :
|
||||||
|
<a name="l00042"></a>00042 <a class="code" href="class_audio_sample.html#p0">m_data</a>(data), <a class="code" href="class_audio_sample.html#p1">m_size</a>(size), <a class="code" href="class_audio_sample.html#p2">m_channels</a>(channels), <a class="code" href="class_audio_sample.html#p3">m_sampleRate</a>(sampleRate), <a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>(bitsPerSample) { }
|
||||||
|
<a name="l00044"></a>00044 <a class="code" href="class_audio_sample.html#a0">AudioSample</a>(<span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a> & source);
|
||||||
|
<a name="l00046"></a><a class="code" href="class_audio_sample.html#a2">00046</a> <a class="code" href="class_audio_sample.html#a2">~AudioSample</a>() { <span class="keyword">delete</span>[] <a class="code" href="class_audio_sample.html#p0">m_data</a>; }
|
||||||
|
<a name="l00047"></a>00047
|
||||||
|
<a name="l00049"></a><a class="code" href="class_audio_sample.html#a3">00049</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * <a class="code" href="class_audio_sample.html#a3">data</a>() { <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p0">m_data</a>; };
|
||||||
|
<a name="l00051"></a><a class="code" href="class_audio_sample.html#a4">00051</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * <a class="code" href="class_audio_sample.html#a3">data</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p0">m_data</a>; };
|
||||||
|
<a name="l00053"></a><a class="code" href="class_audio_sample.html#a5">00053</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a5">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p1">m_size</a>; }
|
||||||
|
<a name="l00055"></a><a class="code" href="class_audio_sample.html#a6">00055</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a6">frames</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p1">m_size</a>/<a class="code" href="class_audio_sample.html#p2">m_channels</a>/(<a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>>>3); }
|
||||||
|
<a name="l00057"></a><a class="code" href="class_audio_sample.html#a7">00057</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a7">sizeFrame</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p2">m_channels</a>*(<a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>>>3); }
|
||||||
|
<a name="l00059"></a><a class="code" href="class_audio_sample.html#a8">00059</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#a8">channels</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p2">m_channels</a>; }
|
||||||
|
<a name="l00061"></a><a class="code" href="class_audio_sample.html#a9">00061</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#a9">sampleRate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p3">m_sampleRate</a>; }
|
||||||
|
<a name="l00063"></a><a class="code" href="class_audio_sample.html#a10">00063</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#a10">bitsPerSample</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>; }
|
||||||
|
<a name="l00065"></a>00065 <span class="keywordtype">bool</span> <a class="code" href="class_audio_sample.html#a10">bitsPerSample</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> bits);
|
||||||
|
<a name="l00067"></a><a class="code" href="class_audio_sample.html#a12">00067</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#a12">bytesPerSample</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>>>3; }
|
||||||
|
<a name="l00068"></a>00068
|
||||||
|
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="class_audio_sample.html#a13">volume</a>(<span class="keywordtype">float</span> f);
|
||||||
|
<a name="l00071"></a>00071
|
||||||
|
<a name="l00073"></a>00073 <span class="keyword">static</span> <a class="code" href="class_audio_sample.html">AudioSample</a>* <a class="code" href="class_audio_sample.html#e0">loadWav</a>(<span class="keyword">const</span> std::string & fname);
|
||||||
|
<a name="l00075"></a>00075 <span class="keyword">static</span> <a class="code" href="class_audio_sample.html">AudioSample</a>* <a class="code" href="class_audio_sample.html#e1">readWav</a>(FILE* stream, size_t (*readFunc)( <span class="keywordtype">void</span> *, size_t, size_t, FILE *));
|
||||||
|
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00078"></a><a class="code" href="class_audio_sample.html#p0">00078</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> * <a class="code" href="class_audio_sample.html#p0">m_data</a>;
|
||||||
|
<a name="l00080"></a><a class="code" href="class_audio_sample.html#p1">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#p1">m_size</a>;
|
||||||
|
<a name="l00082"></a><a class="code" href="class_audio_sample.html#p2">00082</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#p2">m_channels</a>;
|
||||||
|
<a name="l00084"></a><a class="code" href="class_audio_sample.html#p3">00084</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_audio_sample.html#p3">m_sampleRate</a>;
|
||||||
|
<a name="l00086"></a><a class="code" href="class_audio_sample.html#p4">00086</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="class_audio_sample.html#p4">m_bitsPerSample</a>;
|
||||||
|
<a name="l00087"></a>00087 };
|
||||||
|
<a name="l00088"></a>00088
|
||||||
|
<a name="l00089"></a>00089 <span class="comment">//--- class DeviceAudio --------------------------------------------</span>
|
||||||
|
<a name="l00090"></a>00090
|
||||||
|
<a name="l00092"></a><a class="code" href="class_device_audio.html">00092</a> <span class="keyword">class </span><a class="code" href="class_device_audio.html">DeviceAudio</a> {
|
||||||
|
<a name="l00093"></a>00093 <span class="keyword">public</span>:
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00096"></a><a class="code" href="class_device_audio.html#e0">00096</a> <span class="keyword">static</span> <a class="code" href="class_device_audio.html">DeviceAudio</a>& <a class="code" href="class_device_audio.html#e0">singleton</a>() { <span class="keywordflow">return</span> *<a class="code" href="class_device_audio.html#t0">s_instance</a>; }
|
||||||
|
<a name="l00098"></a><a class="code" href="class_device_audio.html#e1">00098</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_device_audio.html#e1">destroy</a>() { <span class="keywordflow">if</span>(<a class="code" href="class_device_audio.html#t0">s_instance</a>) <span class="keyword">delete</span> <a class="code" href="class_device_audio.html#t0">s_instance</a>; <a class="code" href="class_device_audio.html#t0">s_instance</a>=0; };
|
||||||
|
<a name="l00099"></a>00099
|
||||||
|
<a name="l00101"></a><a class="code" href="class_device_audio.html#a0">00101</a> <span class="keywordtype">void</span> <a class="code" href="class_device_audio.html#a0">volume</a>(<span class="keywordtype">float</span> left, <span class="keywordtype">float</span> right) { <a class="code" href="class_device_audio.html#p1">m_volL</a>=left; <a class="code" href="class_device_audio.html#p2">m_volR</a>=right; }
|
||||||
|
<a name="l00103"></a><a class="code" href="class_device_audio.html#a1">00103</a> <span class="keywordtype">void</span> <a class="code" href="class_device_audio.html#a0">volume</a>(<span class="keywordtype">float</span> leftAndRight) { <a class="code" href="class_device_audio.html#p1">m_volL</a>=<a class="code" href="class_device_audio.html#p2">m_volR</a>=leftAndRight; }
|
||||||
|
<a name="l00105"></a>00105
|
||||||
|
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> <a class="code" href="class_device_audio.html#a2">loaderRegister</a>(<a class="code" href="class_audio_sample.html">AudioSample</a> *(*loadFunc)(<span class="keyword">const</span> std::string &), <span class="keyword">const</span> std::string & suffix);
|
||||||
|
<a name="l00108"></a>00108 <span class="keywordtype">bool</span> <a class="code" href="class_device_audio.html#a3">loaderAvailable</a>(<span class="keyword">const</span> std::string & suffix) <span class="keyword">const</span>;
|
||||||
|
<a name="l00109"></a>00109
|
||||||
|
<a name="l00111"></a>00111 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a4">sampleFromFile</a>(<span class="keyword">const</span> std::string & filename, <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#a0">volume</a>=1.0f);
|
||||||
|
<a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a5">sampleFromMemory</a>(<span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a> & <a class="code" href="class_device_audio.html#a7">sample</a>, <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#a0">volume</a>=1.0f)=0;
|
||||||
|
<a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio.html#a6">sampleDestroy</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a7">sample</a>)=0;
|
||||||
|
<a name="l00117"></a><a class="code" href="class_device_audio.html#a7">00117</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a>* <a class="code" href="class_device_audio.html#a7">sample</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> handle)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 0; }
|
||||||
|
<a name="l00118"></a>00118
|
||||||
|
<a name="l00120"></a>00120
|
||||||
|
<a name="l00126"></a>00126 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a8">soundPlay</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a7">sample</a>, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f )=0;
|
||||||
|
<a name="l00128"></a>00128
|
||||||
|
<a name="l00134"></a>00134 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a9">soundLoop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a7">sample</a>, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f )=0;
|
||||||
|
<a name="l00136"></a>00136
|
||||||
|
<a name="l00142"></a>00142 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio.html#a10">soundUpdate</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound, <span class="keywordtype">float</span> volumeL, <span class="keywordtype">float</span> volumeR, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f )=0;
|
||||||
|
<a name="l00144"></a>00144 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio.html#a12">soundStop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound)=0;
|
||||||
|
<a name="l00146"></a>00146 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_device_audio.html#a12">soundStop</a>()=0;
|
||||||
|
<a name="l00148"></a>00148 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#a13">soundActive</a>() <span class="keyword">const</span>=0;
|
||||||
|
<a name="l00149"></a>00149
|
||||||
|
<a name="l00150"></a>00150 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00152"></a>00152 <a class="code" href="class_device_audio.html#b0">DeviceAudio</a>();
|
||||||
|
<a name="l00154"></a><a class="code" href="class_device_audio.html#b1">00154</a> <span class="keyword">virtual</span> <a class="code" href="class_device_audio.html#b1">~DeviceAudio</a>() { <a class="code" href="class_device_audio.html#t0">s_instance</a> = 0; }
|
||||||
|
<a name="l00155"></a>00155
|
||||||
|
<a name="l00157"></a><a class="code" href="class_device_audio.html#p0">00157</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio.html#p0">m_freqOut</a>;
|
||||||
|
<a name="l00159"></a><a class="code" href="class_device_audio.html#p1">00159</a> <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#p1">m_volL</a>;
|
||||||
|
<a name="l00161"></a><a class="code" href="class_device_audio.html#p2">00161</a> <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#p2">m_volR</a>;
|
||||||
|
<a name="l00163"></a><a class="code" href="class_device_audio.html#p3">00163</a> std::map<std::string, AudioSample * (*)(const std::string &)> <a class="code" href="class_device_audio.html#p3">mm_loader</a>;
|
||||||
|
<a name="l00164"></a>00164
|
||||||
|
<a name="l00166"></a><a class="code" href="class_device_audio.html#t0">00166</a> <span class="keyword">static</span> <a class="code" href="class_device_audio.html">DeviceAudio</a> * <a class="code" href="class_device_audio.html#t0">s_instance</a>;
|
||||||
|
<a name="l00167"></a>00167 };
|
||||||
|
<a name="l00168"></a>00168
|
||||||
|
<a name="l00169"></a>00169 <span class="preprocessor">#endif // _PRO_AUDIO</span>
|
||||||
|
</pre></div><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
47
doc/pro_audio_8h.html
Normal file
47
doc/pro_audio_8h.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudio.h File Reference</h1>Public interface of proteaAudio. <a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <string></code><br>
|
||||||
|
<code>#include <map></code><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="pro_audio_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_audio_sample.html">AudioSample</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">class representing an audio sample <a href="class_audio_sample.html#_details">More...</a><br></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio.html">DeviceAudio</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">abstract base class for stereo audio mixer/playback devices <a href="class_device_audio.html#_details">More...</a><br></td></tr>
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
Public interface of proteaAudio.
|
||||||
|
<p>
|
||||||
|
Contains the declaration of the audio sample class and the abstract base class for audio mixer/playback devices<p>
|
||||||
|
<dl compact><dt><b>Author:</b></dt><dd>Gerald Franz, www.viremo.de </dd></dl>
|
||||||
|
<dl compact><dt><b>Version:</b></dt><dd>0.6</dd></dl>
|
||||||
|
License notice (zlib license):<p>
|
||||||
|
(c) 2009 by Gerald Franz, www.viremo.de<p>
|
||||||
|
This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.<p>
|
||||||
|
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:<p>
|
||||||
|
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
doc/pro_audio_rt_8h-source.html
Normal file
60
doc/pro_audio_rt_8h-source.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudioRt.h</h1><a href="pro_audio_rt_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="pro_audio_8h.html">proAudio.h</a>"</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="preprocessor">#include <RtAudio.h></span>
|
||||||
|
<a name="l00003"></a>00003 <span class="preprocessor">#include <map></span>
|
||||||
|
<a name="l00004"></a>00004
|
||||||
|
<a name="l00011"></a>00011 <span class="keyword">struct </span>_AudioTrack;
|
||||||
|
<a name="l00012"></a>00012
|
||||||
|
<a name="l00014"></a>00014
|
||||||
|
<a name="l00016"></a><a class="code" href="class_device_audio_rt.html">00016</a> <span class="keyword">class </span><a class="code" href="class_device_audio_rt.html">DeviceAudioRt</a> : <span class="keyword">public</span> <a class="code" href="class_device_audio.html">DeviceAudio</a> {
|
||||||
|
<a name="l00017"></a>00017 <span class="keyword">public</span>:
|
||||||
|
<a name="l00019"></a>00019
|
||||||
|
<a name="l00026"></a>00026 <span class="keyword">static</span> <a class="code" href="class_device_audio.html">DeviceAudio</a>* <a class="code" href="class_device_audio_rt.html#e0">create</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks=8, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> frequency=22050, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunkSize=1024);
|
||||||
|
<a name="l00027"></a>00027
|
||||||
|
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#a0">sampleFromMemory</a>(<span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a> & <a class="code" href="class_device_audio_rt.html#a2">sample</a>, <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#a0">volume</a>=1.0f);
|
||||||
|
<a name="l00031"></a>00031 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_rt.html#a1">sampleDestroy</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample);
|
||||||
|
<a name="l00033"></a>00033 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a>* <a class="code" href="class_device_audio_rt.html#a2">sample</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> handle) <span class="keyword">const</span>;
|
||||||
|
<a name="l00034"></a>00034
|
||||||
|
<a name="l00036"></a>00036
|
||||||
|
<a name="l00042"></a>00042 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#a3">soundPlay</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00050"></a>00050 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#a4">soundLoop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00052"></a>00052
|
||||||
|
<a name="l00058"></a>00058 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_rt.html#a5">soundUpdate</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound, <span class="keywordtype">float</span> volumeL, <span class="keywordtype">float</span> volumeR, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00060"></a>00060 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_rt.html#a7">soundStop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound);
|
||||||
|
<a name="l00062"></a>00062 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_device_audio_rt.html#a7">soundStop</a>();
|
||||||
|
<a name="l00064"></a>00064 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <a class="code" href="class_device_audio_rt.html#a8">soundActive</a>() <span class="keyword">const</span>;
|
||||||
|
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00067"></a>00067 <a class="code" href="class_device_audio_rt.html#b0">DeviceAudioRt</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> frequency, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunkSize);
|
||||||
|
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <a class="code" href="class_device_audio_rt.html#b1">~DeviceAudioRt</a>();
|
||||||
|
<a name="l00071"></a>00071 <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#b2">mixOutputFloat</a>(<span class="keywordtype">signed</span> <span class="keywordtype">short</span> *outputBuffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames);
|
||||||
|
<a name="l00072"></a>00072
|
||||||
|
<a name="l00074"></a><a class="code" href="class_device_audio_rt.html#p0">00074</a> std::map<unsigned int, AudioSample*> <a class="code" href="class_device_audio_rt.html#p0">mm_sample</a>;
|
||||||
|
<a name="l00076"></a><a class="code" href="class_device_audio_rt.html#p1">00076</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#p1">m_sampleCounter</a>;
|
||||||
|
<a name="l00077"></a>00077
|
||||||
|
<a name="l00079"></a><a class="code" href="class_device_audio_rt.html#p2">00079</a> _AudioTrack * <a class="code" href="class_device_audio_rt.html#p2">ma_sound</a>;
|
||||||
|
<a name="l00081"></a><a class="code" href="class_device_audio_rt.html#p3">00081</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#p3">m_nSound</a>;
|
||||||
|
<a name="l00083"></a><a class="code" href="class_device_audio_rt.html#p4">00083</a> RtAudio <a class="code" href="class_device_audio_rt.html#p4">m_dac</a>;
|
||||||
|
<a name="l00084"></a>00084
|
||||||
|
<a name="l00086"></a><a class="code" href="class_device_audio_rt.html#f0">00086</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_rt.html#f0">cbMix</a>(<span class="keywordtype">void</span> *outputBuffer, <span class="keywordtype">void</span> *inputBuffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames, <span class="keywordtype">double</span> streamTime, RtAudioStreamStatus status, <span class="keywordtype">void</span> *data) {
|
||||||
|
<a name="l00087"></a>00087 <span class="keywordflow">return</span> static_cast<DeviceAudioRt*>(data)->mixOutputFloat((<span class="keywordtype">signed</span> <span class="keywordtype">short</span>*)outputBuffer, nFrames); }
|
||||||
|
<a name="l00088"></a>00088 };
|
||||||
|
</pre></div><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
40
doc/pro_audio_rt_8h.html
Normal file
40
doc/pro_audio_rt_8h.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudioRt.h File Reference</h1>RtAudio backend of proteaAudio. <a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include "<a class="el" href="pro_audio_8h-source.html">proAudio.h</a>"</code><br>
|
||||||
|
<code>#include <RtAudio.h></code><br>
|
||||||
|
<code>#include <map></code><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="pro_audio_rt_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_rt.html">DeviceAudioRt</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">an rtAudio based stereo audio mixer/playback device <a href="class_device_audio_rt.html#_details">More...</a><br></td></tr>
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
RtAudio backend of proteaAudio.
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Author:</b></dt><dd>Gerald Franz, www.viremo.de </dd></dl>
|
||||||
|
<dl compact><dt><b>Version:</b></dt><dd>0.6</dd></dl>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
67
doc/pro_audio_sdl_8h-source.html
Normal file
67
doc/pro_audio_sdl_8h-source.html
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudioSdl.h</h1><a href="pro_audio_sdl_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _AUDIO_SDL_H</span>
|
||||||
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _AUDIO_SDL_H</span>
|
||||||
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||||
|
<a name="l00004"></a>00004 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
|
||||||
|
<a name="l00005"></a>00005 <span class="preprocessor">#include <SDL_audio.h></span>
|
||||||
|
<a name="l00006"></a>00006 };
|
||||||
|
<a name="l00007"></a>00007 <span class="preprocessor">#include "<a class="code" href="pro_audio_8h.html">proAudio.h</a>"</span>
|
||||||
|
<a name="l00008"></a>00008 <span class="preprocessor">#include <map></span>
|
||||||
|
<a name="l00009"></a>00009
|
||||||
|
<a name="l00016"></a>00016 <span class="comment">//--- class DeviceAudioSdl -----------------------------------------</span>
|
||||||
|
<a name="l00017"></a>00017
|
||||||
|
<a name="l00019"></a>00019 <span class="keyword">class </span>_AudioTrack;
|
||||||
|
<a name="l00020"></a>00020
|
||||||
|
<a name="l00022"></a><a class="code" href="class_device_audio_sdl.html">00022</a> <span class="keyword">class </span><a class="code" href="class_device_audio_sdl.html">DeviceAudioSdl</a> : <span class="keyword">public</span> <a class="code" href="class_device_audio.html">DeviceAudio</a> {
|
||||||
|
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||||
|
<a name="l00025"></a>00025
|
||||||
|
<a name="l00032"></a>00032 <span class="keyword">static</span> <a class="code" href="class_device_audio.html">DeviceAudio</a>* <a class="code" href="class_device_audio_sdl.html#e0">create</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks=8, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> frequency=22050, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunkSize=1024);
|
||||||
|
<a name="l00033"></a>00033
|
||||||
|
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#a0">sampleFromMemory</a>(<span class="keyword">const</span> <a class="code" href="class_audio_sample.html">AudioSample</a> & <a class="code" href="class_device_audio.html#a7">sample</a>, <span class="keywordtype">float</span> <a class="code" href="class_device_audio.html#a0">volume</a>=1.0f);
|
||||||
|
<a name="l00037"></a>00037 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_sdl.html#a1">sampleDestroy</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample);
|
||||||
|
<a name="l00038"></a>00038
|
||||||
|
<a name="l00040"></a>00040
|
||||||
|
<a name="l00046"></a>00046 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#a2">soundPlay</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#a3">soundLoop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sample, <span class="keywordtype">float</span> volumeL=1.0f, <span class="keywordtype">float</span> volumeR=1.0f, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00056"></a>00056
|
||||||
|
<a name="l00062"></a>00062 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_sdl.html#a4">soundUpdate</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound, <span class="keywordtype">float</span> volumeL, <span class="keywordtype">float</span> volumeR, <span class="keywordtype">float</span> disparity=0.0f, <span class="keywordtype">float</span> pitch=1.0f );
|
||||||
|
<a name="l00064"></a>00064 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_sdl.html#a6">soundStop</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sound);
|
||||||
|
<a name="l00066"></a>00066 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_device_audio_sdl.html#a6">soundStop</a>();
|
||||||
|
<a name="l00068"></a>00068 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#a7">soundActive</a>() <span class="keyword">const</span>;
|
||||||
|
<a name="l00069"></a>00069 <span class="keyword">protected</span>:
|
||||||
|
<a name="l00071"></a>00071 <a class="code" href="class_device_audio_sdl.html#b0">DeviceAudioSdl</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> frequency, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chunkSize);
|
||||||
|
<a name="l00073"></a>00073 <span class="keyword">virtual</span> <a class="code" href="class_device_audio_sdl.html#b1">~DeviceAudioSdl</a>();
|
||||||
|
<a name="l00075"></a><a class="code" href="class_device_audio_sdl.html#p0">00075</a> SDL_AudioSpec <a class="code" href="class_device_audio_sdl.html#p0">m_spec</a>;
|
||||||
|
<a name="l00077"></a><a class="code" href="class_device_audio_sdl.html#p1">00077</a> std::map<unsigned int, _AudioTrack> <a class="code" href="class_device_audio_sdl.html#p1">mm_sample</a>;
|
||||||
|
<a name="l00079"></a><a class="code" href="class_device_audio_sdl.html#p2">00079</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#p2">m_sampleCounter</a>;
|
||||||
|
<a name="l00081"></a><a class="code" href="class_device_audio_sdl.html#p3">00081</a> <span class="keywordtype">bool</span> <a class="code" href="class_device_audio_sdl.html#p3">m_isDesiredFormat</a>;
|
||||||
|
<a name="l00082"></a>00082
|
||||||
|
<a name="l00084"></a><a class="code" href="class_device_audio_sdl.html#p4">00084</a> _AudioTrack * <a class="code" href="class_device_audio_sdl.html#p4">ma_sound</a>;
|
||||||
|
<a name="l00086"></a><a class="code" href="class_device_audio_sdl.html#p5">00086</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_device_audio_sdl.html#p5">m_nSound</a>;
|
||||||
|
<a name="l00087"></a>00087
|
||||||
|
<a name="l00089"></a>00089 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_device_audio_sdl.html#f0">cbOutput</a>(<span class="keywordtype">void</span> *userData, Uint8 *stream, <span class="keywordtype">int</span> len);
|
||||||
|
<a name="l00091"></a>00091 <span class="keywordtype">void</span> <a class="code" href="class_device_audio_sdl.html#b2">mixOutputFloat</a>(<span class="keywordtype">signed</span> <span class="keywordtype">short</span> *outputBuffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames);
|
||||||
|
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="class_device_audio_sdl.html#b3">mixOutputSInt</a>(Uint8 *stream, <span class="keywordtype">int</span> len);
|
||||||
|
<a name="l00094"></a>00094 };
|
||||||
|
<a name="l00095"></a>00095
|
||||||
|
<a name="l00096"></a>00096 <span class="preprocessor">#endif // _AUDIO_SDL_H</span>
|
||||||
|
</pre></div><div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
40
doc/pro_audio_sdl_8h.html
Normal file
40
doc/pro_audio_sdl_8h.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1>proAudioSdl.h File Reference</h1>SDL backend of proteaAudio. <a href="#_details">More...</a>
|
||||||
|
<p>
|
||||||
|
<code>#include <SDL_audio.h></code><br>
|
||||||
|
<code>#include "<a class="el" href="pro_audio_8h-source.html">proAudio.h</a>"</code><br>
|
||||||
|
<code>#include <map></code><br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="pro_audio_sdl_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr><td></td></tr>
|
||||||
|
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
|
||||||
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_device_audio_sdl.html">DeviceAudioSdl</a></td></tr>
|
||||||
|
|
||||||
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">SDL based stereo audio mixer/playback device. <a href="class_device_audio_sdl.html#_details">More...</a><br></td></tr>
|
||||||
|
</table>
|
||||||
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||||
|
SDL backend of proteaAudio.
|
||||||
|
<p>
|
||||||
|
<dl compact><dt><b>Author:</b></dt><dd>Gerald Franz, www.viremo.de </dd></dl>
|
||||||
|
<dl compact><dt><b>Version:</b></dt><dd>2.0</dd></dl>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
116
doc/protea.css
Normal file
116
doc/protea.css
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
body {
|
||||||
|
font-family: Helvetica,sans-serif;
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
margin: 30px 50px 50px 50px;
|
||||||
|
text-align: left;
|
||||||
|
width: 640px;
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
color: maroon;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 25px 0px 10px 0px;
|
||||||
|
font-size: 110%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link, a:visited, a:link:active {
|
||||||
|
text-decoration: none;
|
||||||
|
color: maroon;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link:hover, a:visited:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, ul {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background-color: #DDD;
|
||||||
|
width: 100%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CAPTION { font-weight: bold }
|
||||||
|
DIV.qindex {
|
||||||
|
font-size: 90%;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid #b0b0b0;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 2px;
|
||||||
|
line-height: 140%;
|
||||||
|
}
|
||||||
|
|
||||||
|
TD {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
TABLE.mdtable {
|
||||||
|
background-color: #DDD;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
TD.md {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
TD.mdPrefix {
|
||||||
|
color: #606060;
|
||||||
|
}
|
||||||
|
TD.mdname {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #602020;
|
||||||
|
}
|
||||||
|
|
||||||
|
DIV.groupHeader {
|
||||||
|
margin-left: 16px;
|
||||||
|
margin-top: 12px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
|
||||||
|
TD.indexkey {
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right : 10px;
|
||||||
|
padding-top : 2px;
|
||||||
|
padding-left : 10px;
|
||||||
|
padding-bottom : 2px;
|
||||||
|
margin-left : 0px;
|
||||||
|
margin-right : 0px;
|
||||||
|
margin-top : 2px;
|
||||||
|
margin-bottom : 2px;
|
||||||
|
border-top: 1px solid #CCCCCC;
|
||||||
|
border-bottom: 1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
TD.indexvalue {
|
||||||
|
font-style: italic;
|
||||||
|
padding-right : 10px;
|
||||||
|
padding-top : 2px;
|
||||||
|
padding-left : 10px;
|
||||||
|
padding-bottom : 2px;
|
||||||
|
margin-left : 0px;
|
||||||
|
margin-right : 0px;
|
||||||
|
margin-top : 2px;
|
||||||
|
margin-bottom : 2px;
|
||||||
|
border-top: 1px solid #CCCCCC;
|
||||||
|
border-bottom: 1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
TR.memlist {
|
||||||
|
background-color: #DDD;
|
||||||
|
}
|
||||||
|
SPAN.keyword { color: #008000 }
|
||||||
|
SPAN.keywordtype { color: #604020 }
|
||||||
|
SPAN.keywordflow { color: #e08000 }
|
||||||
|
SPAN.comment { color: #800000 }
|
||||||
|
SPAN.preprocessor { color: #806020 }
|
||||||
|
SPAN.stringliteral { color: #002080 }
|
||||||
|
SPAN.charliteral { color: #008080 }
|
||||||
BIN
doc/proteaAudio.png
Normal file
BIN
doc/proteaAudio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
112
doc/proteaaudiolua.html
Normal file
112
doc/proteaaudiolua.html
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
|
<!-- Generated by Doxygen 1.4.3 -->
|
||||||
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
|
||||||
|
<h1><a class="anchor" name="proteaAudioLua">proteaAudio Lua API</a></h1><h2><a class="anchor" name="intro">
|
||||||
|
Overview</a></h2>
|
||||||
|
<a href="http://www.lua.org">Lua</a> is a lightweight yet powerful dynamic language. proteaAudio contains almost complete Lua bindings that widely correspond to the <a href="annotated.html">C++ API</a>. By default, the proteaAudio Lua bindings are compiled to a dynamic library based on the RtAudio backend which is imported via the following statement:<p>
|
||||||
|
<pre>require("proAudioRt")</pre><p>
|
||||||
|
All API calls are collected in the global table proAudio. Therefore, proteaAudio is initialized (using the default parameters) by the following call:<p>
|
||||||
|
<pre>proAudio.create()</pre><p>
|
||||||
|
After that the individual methods and functions may be called analogous to the C++ interface of class <a class="el" href="class_device_audio.html">DeviceAudio</a>.<h2><a class="anchor" name="functions">
|
||||||
|
Functions</a></h2>
|
||||||
|
<pre>proAudio.create( tracks = 8, frequency = 22050, chunkSize = 1024 )</pre> initializes audio playback device<p>
|
||||||
|
Parameters:<ul>
|
||||||
|
<li>tracks (optional) number of sounds that can be played in parallel</li><li>frequency (optional) playback frequency</li><li>chunkSize (optional) size of the internal buffer in bytes. Note that a small chunkSize results in low playback latency, but may cause computational overhead and hick-ups under higher system load</li></ul>
|
||||||
|
<p>
|
||||||
|
Returns: true in case the device initialization was successful<p>
|
||||||
|
<pre>proAudio.destroy( )</pre> closes audio device and terminates playback<p>
|
||||||
|
Returns: true in case the device was successfully closed<p>
|
||||||
|
<pre>proAudio.loaderAvailable ( suffix )</pre> returns true in case a loader for this file type is available<p>
|
||||||
|
<pre>proAudio.volume ( left, [ right ] )</pre> sets master volume, either for both channels uniformly, or individually<p>
|
||||||
|
<pre>proAudio.sleep( seconds )</pre> Suspends the execution of the current thread for a definable number of seconds. Note that audio mixing and playback runs in its own background thread and is therefore not affected by this auxiliary call.<p>
|
||||||
|
<pre>proAudio.sampleFromFile ( filename, volume = 1.0 )</pre> loads a sound sample from file, optionally adjusts volume, returns handle<p>
|
||||||
|
<pre>proAudio.sampleFromMemory ( data, sampleRate )</pre> converts an array of numeric data into a sound sample having the defined sample rate, returns handle<p>
|
||||||
|
<pre>proAudio.sampleDestroy ( sample )</pre> deletes a previously created sound sample resource identified by its handle<p>
|
||||||
|
<pre>duration, channels, sampleRate, bitsPerSample = proAudio.sampleProperties ( sample )</pre> returns properties of a sample identified by its handle<p>
|
||||||
|
<pre>proAudio.soundActive ( )</pre> returns number of currently active sounds<p>
|
||||||
|
<pre>proAudio.soundLoop ( sample, volumeL = 1.0, volumeR = 1.0, disparity = 0.0, pitch = 1.0 )</pre> plays a specified sound sample continuously and sets its parameters<p>
|
||||||
|
Parameters:<ul>
|
||||||
|
<li>sample handle of a previously loaded sample</li><li>volumeL (optional) left volume</li><li>volumeR (optional) right volume</li><li>disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.</li><li>pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.</li></ul>
|
||||||
|
<p>
|
||||||
|
Returns: a handle to the currently played sound or -1 in case of error<p>
|
||||||
|
<pre>proAudio.soundPlay ( sample, volumeL = 1.0, volumeR = 1.0, disparity = 0.0, pitch = 1.0 )</pre> plays a specified sound sample once and sets its parameters<p>
|
||||||
|
Parameters:<ul>
|
||||||
|
<li>sample handle of a previously loaded sample</li><li>volumeL (optional) left volume</li><li>volumeR (optional) right volume</li><li>disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.</li><li>pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.</li></ul>
|
||||||
|
<p>
|
||||||
|
Returns: a handle to the currently played sound or -1 in case of error<p>
|
||||||
|
<pre>proAudio.soundStop ( [ sound ] ) </pre> stops a specified sound immediately, if a sound handle is passed, or stops all sounds<p>
|
||||||
|
<pre>proAudio.soundUpdate ( sound, volumeL, volumeR, disparity = 0.0, pitch = 1.0 )</pre> updates parameters of a specified sound<p>
|
||||||
|
Parameters:<ul>
|
||||||
|
<li>sound handle of a currently active sound</li><li>volumeL left volume</li><li>volumeR right volume</li><li>disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.</li><li>pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.</li></ul>
|
||||||
|
<p>
|
||||||
|
Returns: true in case the parameters have been updated successfully<h2><a class="anchor" name="example1">
|
||||||
|
Example 1</a></h2>
|
||||||
|
<pre>
|
||||||
|
-- create an audio device using default parameters or exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end</pre><p>
|
||||||
|
<pre>-- load and play a sample:
|
||||||
|
sample = proAudio.sampleFromFile("sample.ogg")
|
||||||
|
if sample then proAudio.soundPlay(sample) end</pre><p>
|
||||||
|
<pre>-- wait until the sound has finished:
|
||||||
|
while proAudio.soundActive()>0 do
|
||||||
|
proAudio.sleep(0.05)
|
||||||
|
end</pre><p>
|
||||||
|
<pre>-- close audio device
|
||||||
|
proAudio.destroy()
|
||||||
|
</pre><h2><a class="anchor" name="dynSamples">
|
||||||
|
Dynamic creation of audio samples</a></h2>
|
||||||
|
There is no equivalent to the C++ <a class="el" href="class_audio_sample.html">AudioSample</a> class in the proteaAudio Lua API. However, mono audio samples may be dynamically created by the following call:<p>
|
||||||
|
<pre>proAudio.sampleFromMemory(data, sampleRate)</pre><p>
|
||||||
|
The <em>data</em> parameter has to be a table reference containing an array of numeric PCM data ranging from -1.0 to +1.0. The <em>sampleRate</em> parameter defines the number of samples per second. Typical sample rates are 22050 or 44100. Note that for obtaining good qualities when doing dynamic pitch shifts high sample rates (up to 88200) are recommended.<h2><a class="anchor" name="example2">
|
||||||
|
Example 2</a></h2>
|
||||||
|
<pre>
|
||||||
|
-- function creating a sine wave sample:
|
||||||
|
function sampleSine(freq, duration, sampleRate)
|
||||||
|
local data = { }
|
||||||
|
for i = 1,duration*sampleRate do
|
||||||
|
data[i] = math.sin( (i*freq/sampleRate)*math.pi*2)
|
||||||
|
end
|
||||||
|
return proAudio.sampleFromMemory(data, sampleRate)
|
||||||
|
end</pre><p>
|
||||||
|
<pre>-- plays a sample shifted by a number of halftones for a definable period of time
|
||||||
|
function playNote(sample, pitch, duration, volumeL, volumeR, disparity)
|
||||||
|
local scale = 2^(pitch/12)
|
||||||
|
local sound = proAudio.soundLoop(sample, volumeL, volumeR, disparity, scale)
|
||||||
|
proAudio.sleep(duration)
|
||||||
|
proAudio.soundStop(sound)
|
||||||
|
end</pre><p>
|
||||||
|
<pre>-- create an audio device using default parameters and exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end</pre><p>
|
||||||
|
<pre>-- generate a sample:
|
||||||
|
local sample = sampleSine(440, 0.5, 88200)</pre><p>
|
||||||
|
<pre>-- play scale (a major):
|
||||||
|
local duration = 0.5
|
||||||
|
for i,note in ipairs({ 0, 2, 4, 5, 7, 9, 11, 12 }) do
|
||||||
|
playNote(sample, note, duration)
|
||||||
|
end</pre><p>
|
||||||
|
<pre>-- cleanup
|
||||||
|
proAudio.destroy()
|
||||||
|
</pre><h2><a class="anchor" name="limitations">
|
||||||
|
Limitations</a></h2>
|
||||||
|
<ul>
|
||||||
|
<li>The proteaAudio Lua API currently has no equivalent to the C++ API's <a class="el" href="class_device_audio.html#a2">DeviceAudio::loaderRegister()</a> method.</li><li>no bindings to the SDL backend yet </li></ul>
|
||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
18
example.cpp
Normal file
18
example.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "proAudioRt.h"
|
||||||
|
|
||||||
|
int main( int argc, char **argv ) {
|
||||||
|
// create an audio device using the RtAudio backend and default parameters:
|
||||||
|
DeviceAudio* audio=DeviceAudioRt::create();
|
||||||
|
if(!audio) return 1; // exit in case of errors
|
||||||
|
|
||||||
|
// load and play a sample:
|
||||||
|
unsigned int sample = audio->sampleFromFile("sample.ogg");
|
||||||
|
if(sample) audio->soundPlay(sample);
|
||||||
|
|
||||||
|
// wait until the sound has finished:
|
||||||
|
while(audio->soundActive()); // for the sake of simplicity busy waiting instead of a preferable sleep() call
|
||||||
|
|
||||||
|
// cleanup and exit:
|
||||||
|
audio->destroy();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
15
example.lua
Normal file
15
example.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-- create an audio device using default parameters and exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end
|
||||||
|
|
||||||
|
-- load and play a sample:
|
||||||
|
sample = proAudio.sampleFromFile("sample.ogg")
|
||||||
|
if sample then proAudio.soundPlay(sample) end
|
||||||
|
|
||||||
|
-- wait until the sound has finished:
|
||||||
|
while proAudio.soundActive()>0 do
|
||||||
|
proAudio.sleep(0.05)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- close audio device
|
||||||
|
proAudio.destroy()
|
||||||
13
footer.html
Normal file
13
footer.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<div style="border-width: 1px; border-top-color: gray; border-top-style: solid; margin: 2em 0 0 0;">
|
||||||
|
<table cols="2" width="100%" border="0"><tr>
|
||||||
|
<td style = "text-align: left; font-size: 75%; padding: 0em 2em;">
|
||||||
|
© 2009-02-04 by Gerald Franz, www.viremo.de
|
||||||
|
</td>
|
||||||
|
<td style = "text-align: right; font-size: 75%; padding: 0em 2em;">
|
||||||
|
<a href="../impressum.html">impressum</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
header.html
Normal file
6
header.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||||
|
<title>proteaAudio</title>
|
||||||
|
<link href="protea.css" rel="stylesheet" type="text/css">
|
||||||
|
</head><body>
|
||||||
|
<div style="text-align: center"><img src="proteaAudio.png"/></div>
|
||||||
176
lua.txt
Normal file
176
lua.txt
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
/** \page proteaAudioLua proteaAudio Lua API
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section intro Overview
|
||||||
|
<a href="http://www.lua.org">Lua</a> is a lightweight yet powerful dynamic language. proteaAudio contains almost complete Lua bindings that widely correspond to the <a href="annotated.html">C++ API</a>. By default, the proteaAudio Lua bindings are compiled to a dynamic library based on the RtAudio backend which is imported via the following statement:
|
||||||
|
|
||||||
|
<pre>require("proAudioRt")</pre>
|
||||||
|
|
||||||
|
All API calls are collected in the global table proAudio. Therefore, proteaAudio is initialized (using the default parameters) by the following call:
|
||||||
|
|
||||||
|
<pre>proAudio.create()</pre>
|
||||||
|
|
||||||
|
After that the individual methods and functions may be called analogous to the C++ interface of class DeviceAudio.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section functions Functions
|
||||||
|
|
||||||
|
<pre>proAudio.create( tracks = 8, frequency = 22050, chunkSize = 1024 )</pre>
|
||||||
|
initializes audio playback device
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- tracks (optional) number of sounds that can be played in parallel
|
||||||
|
- frequency (optional) playback frequency
|
||||||
|
- chunkSize (optional) size of the internal buffer in bytes. Note that a small chunkSize results in low playback latency, but may cause computational overhead and hick-ups under higher system load
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
true in case the device initialization was successful
|
||||||
|
|
||||||
|
<pre>proAudio.destroy( )</pre>
|
||||||
|
closes audio device and terminates playback
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
true in case the device was successfully closed
|
||||||
|
|
||||||
|
<pre>proAudio.loaderAvailable ( suffix )</pre>
|
||||||
|
returns true in case a loader for this file type is available
|
||||||
|
|
||||||
|
<pre>proAudio.volume ( left, [ right ] )</pre>
|
||||||
|
sets master volume, either for both channels uniformly, or individually
|
||||||
|
|
||||||
|
<pre>proAudio.sleep( seconds )</pre>
|
||||||
|
Suspends the execution of the current thread for a definable number of seconds. Note that audio mixing and playback runs in its own background thread and is therefore not affected by this auxiliary call.
|
||||||
|
|
||||||
|
<pre>proAudio.sampleFromFile ( filename, volume = 1.0 )</pre>
|
||||||
|
loads a sound sample from file, optionally adjusts volume, returns handle
|
||||||
|
|
||||||
|
<pre>proAudio.sampleFromMemory ( data, sampleRate )</pre>
|
||||||
|
converts an array of numeric data into a sound sample having the defined sample rate, returns handle
|
||||||
|
|
||||||
|
<pre>proAudio.sampleDestroy ( sample )</pre>
|
||||||
|
deletes a previously created sound sample resource identified by its handle
|
||||||
|
|
||||||
|
<pre>duration, channels, sampleRate, bitsPerSample = proAudio.sampleProperties ( sample )</pre>
|
||||||
|
returns properties of a sample identified by its handle
|
||||||
|
|
||||||
|
<pre>proAudio.soundActive ( )</pre>
|
||||||
|
returns number of currently active sounds
|
||||||
|
|
||||||
|
<pre>proAudio.soundLoop ( sample, volumeL = 1.0, volumeR = 1.0, disparity = 0.0, pitch = 1.0 )</pre>
|
||||||
|
plays a specified sound sample continuously and sets its parameters
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- sample handle of a previously loaded sample
|
||||||
|
- volumeL (optional) left volume
|
||||||
|
- volumeR (optional) right volume
|
||||||
|
- disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
- pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a handle to the currently played sound or -1 in case of error
|
||||||
|
|
||||||
|
<pre>proAudio.soundPlay ( sample, volumeL = 1.0, volumeR = 1.0, disparity = 0.0, pitch = 1.0 )</pre>
|
||||||
|
plays a specified sound sample once and sets its parameters
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- sample handle of a previously loaded sample
|
||||||
|
- volumeL (optional) left volume
|
||||||
|
- volumeR (optional) right volume
|
||||||
|
- disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
- pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
a handle to the currently played sound or -1 in case of error
|
||||||
|
|
||||||
|
<pre>proAudio.soundStop ( [ sound ] ) </pre>
|
||||||
|
stops a specified sound immediately, if a sound handle is passed, or stops all sounds
|
||||||
|
|
||||||
|
<pre>proAudio.soundUpdate ( sound, volumeL, volumeR, disparity = 0.0, pitch = 1.0 )</pre>
|
||||||
|
updates parameters of a specified sound
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- sound handle of a currently active sound
|
||||||
|
- volumeL left volume
|
||||||
|
- volumeR right volume
|
||||||
|
- disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
- pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
true in case the parameters have been updated successfully
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\section example1 Example 1
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
-- create an audio device using default parameters or exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end
|
||||||
|
|
||||||
|
-- load and play a sample:
|
||||||
|
sample = proAudio.sampleFromFile("sample.ogg")
|
||||||
|
if sample then proAudio.soundPlay(sample) end
|
||||||
|
|
||||||
|
-- wait until the sound has finished:
|
||||||
|
while proAudio.soundActive()>0 do
|
||||||
|
proAudio.sleep(0.05)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- close audio device
|
||||||
|
proAudio.destroy()
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
\section dynSamples Dynamic creation of audio samples
|
||||||
|
|
||||||
|
There is no equivalent to the C++ AudioSample class in the proteaAudio Lua API. However, mono audio samples may be dynamically created by the following call:
|
||||||
|
|
||||||
|
<pre>proAudio.sampleFromMemory(data, sampleRate)</pre>
|
||||||
|
|
||||||
|
The <em>data</em> parameter has to be a table reference containing an array of numeric PCM data ranging from -1.0 to +1.0. The <em>sampleRate</em> parameter defines the number of samples per second. Typical sample rates are 22050 or 44100. Note that for obtaining good qualities when doing dynamic pitch shifts high sample rates (up to 88200) are recommended.
|
||||||
|
|
||||||
|
\section example2 Example 2
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
-- function creating a sine wave sample:
|
||||||
|
function sampleSine(freq, duration, sampleRate)
|
||||||
|
local data = { }
|
||||||
|
for i = 1,duration*sampleRate do
|
||||||
|
data[i] = math.sin( (i*freq/sampleRate)*math.pi*2)
|
||||||
|
end
|
||||||
|
return proAudio.sampleFromMemory(data, sampleRate)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- plays a sample shifted by a number of halftones for a definable period of time
|
||||||
|
function playNote(sample, pitch, duration, volumeL, volumeR, disparity)
|
||||||
|
local scale = 2^(pitch/12)
|
||||||
|
local sound = proAudio.soundLoop(sample, volumeL, volumeR, disparity, scale)
|
||||||
|
proAudio.sleep(duration)
|
||||||
|
proAudio.soundStop(sound)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- create an audio device using default parameters and exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end
|
||||||
|
|
||||||
|
-- generate a sample:
|
||||||
|
local sample = sampleSine(440, 0.5, 88200)
|
||||||
|
|
||||||
|
-- play scale (a major):
|
||||||
|
local duration = 0.5
|
||||||
|
for i,note in ipairs({ 0, 2, 4, 5, 7, 9, 11, 12 }) do
|
||||||
|
playNote(sample, note, duration)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cleanup
|
||||||
|
proAudio.destroy()
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
\section limitations Limitations
|
||||||
|
|
||||||
|
- The proteaAudio Lua API currently has no equivalent to the C++ API's DeviceAudio::loaderRegister() method.
|
||||||
|
- no bindings to the SDL backend yet
|
||||||
|
|
||||||
|
*/
|
||||||
38
playAudioRt.cpp
Normal file
38
playAudioRt.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "proAudioRt.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// Platform-dependent sleep routines.
|
||||||
|
#if defined( __WINDOWS_ASIO__ ) || defined( __WINDOWS_DS__ )
|
||||||
|
#include <windows.h>
|
||||||
|
#define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds )
|
||||||
|
#else // Unix variants
|
||||||
|
#include <unistd.h>
|
||||||
|
#define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char **argv ) {
|
||||||
|
if(argc<2) {
|
||||||
|
fprintf(stderr, "usage: %s audiofile [volumeFactor] [pitchFactor]\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DeviceAudio* audio=DeviceAudioRt::create();
|
||||||
|
if(!audio) {
|
||||||
|
fprintf(stderr, "ERROR opening audio device. Abort.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float volume = (argc>2) ? atof(argv[2]) : 1.0f;
|
||||||
|
float pitch = (argc>3) ? atof(argv[3]) : 1.0f;
|
||||||
|
unsigned int sample1=audio->sampleFromFile(argv[1], volume);
|
||||||
|
if(sample1) audio->soundPlay(sample1, 1.0f,1.0f,0.0f, pitch);
|
||||||
|
|
||||||
|
// main loop:
|
||||||
|
while(audio->soundActive())
|
||||||
|
SLEEP(100);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
32
playAudioSdl.cpp
Normal file
32
playAudioSdl.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
#include "proAudioSdl.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//--- main ---------------------------------------------------------
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if(argc<2) {
|
||||||
|
fprintf(stderr, "usage: %s audiofile [volumeFactor] [pitchFactor]\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DeviceAudio* audio=DeviceAudioSdl::create();
|
||||||
|
if(!audio) {
|
||||||
|
fprintf(stderr, "ERROR opening audio device. Abort.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float volume = (argc>2) ? atof(argv[2]) : 1.0f;
|
||||||
|
float pitch = (argc>3) ? atof(argv[3]) : 1.0f;
|
||||||
|
unsigned int sample1=audio->sampleFromFile(argv[1], volume);
|
||||||
|
if(sample1) audio->soundPlay(sample1, 1.0f,1.0f,0.0f, pitch);
|
||||||
|
|
||||||
|
// main loop:
|
||||||
|
while(audio->soundActive())
|
||||||
|
SDL_Delay(10);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
167
proAudio.cpp
Normal file
167
proAudio.cpp
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
#include "proAudio.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//--- class AudioSample --------------------------------------------
|
||||||
|
AudioSample::AudioSample(const AudioSample & source) :
|
||||||
|
m_size(source.m_size), m_channels(source.m_channels), m_sampleRate(source.m_sampleRate), m_bitsPerSample(source.m_bitsPerSample) {
|
||||||
|
m_data = new unsigned char [m_size]; memcpy(m_data,source.m_data, m_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioSample::bitsPerSample(unsigned short bits) {
|
||||||
|
if(bits==16) {
|
||||||
|
if(m_bitsPerSample==8) {
|
||||||
|
unsigned char* data = new unsigned char[2*m_size];
|
||||||
|
for(unsigned int i=0; i<m_size; ++i) {
|
||||||
|
signed short *ptr =(signed short*)data+i;
|
||||||
|
*ptr = m_data[i]*255;
|
||||||
|
}
|
||||||
|
delete [] m_data;
|
||||||
|
m_data = data;
|
||||||
|
m_size*=2;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(m_bitsPerSample==16) {
|
||||||
|
return true; // nothing to do
|
||||||
|
}
|
||||||
|
else if(m_bitsPerSample==32) { // float, normalized from -1.0f to 1.0f
|
||||||
|
unsigned char* data = new unsigned char[m_size/2];
|
||||||
|
for(unsigned int i=0; i<m_size/4; ++i) {
|
||||||
|
signed short *ptr =(signed short*)data+i;
|
||||||
|
float* src=(float*)m_data+i;
|
||||||
|
*ptr =(signed short)(*src*SHRT_MAX);
|
||||||
|
}
|
||||||
|
delete [] m_data;
|
||||||
|
m_data = data;
|
||||||
|
m_size/=2;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(stderr,"AudioSample::bitsPerSample ERROR: conversion from %i to %i bits not supported.\n", m_bitsPerSample, bits);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioSample::volume(float f) {
|
||||||
|
if(m_bitsPerSample==8) for(signed char *ptr =(signed char *)m_data; ptr<(signed char *)m_data+m_size; ++ptr) {
|
||||||
|
float value=*ptr * f;
|
||||||
|
if(value>CHAR_MAX) *ptr =CHAR_MAX;
|
||||||
|
else if(value<CHAR_MIN) *ptr =CHAR_MIN;
|
||||||
|
else *ptr =(signed char)value;
|
||||||
|
}
|
||||||
|
else if(m_bitsPerSample==16) for(signed short *ptr =(signed short*)m_data; ptr<(signed short*)m_data+m_size/2; ++ptr) {
|
||||||
|
float value=*ptr * f;
|
||||||
|
if(value>SHRT_MAX) *ptr =SHRT_MAX;
|
||||||
|
else if(value<SHRT_MIN) *ptr =SHRT_MIN;
|
||||||
|
else *ptr =(signed short)value;
|
||||||
|
}
|
||||||
|
else if(m_bitsPerSample==32) for(float *ptr =(float*)m_data; ptr<(float*)m_data+m_size/4; ++ptr) {
|
||||||
|
*ptr *= f;
|
||||||
|
if(*ptr>1.0f) *ptr=1.0f;
|
||||||
|
else if(*ptr<-1.0f) *ptr=-1.0f;
|
||||||
|
}
|
||||||
|
else fprintf(stderr,"AudioSample::changeVolume ERROR: %i bits per sample not supported.\n",m_bitsPerSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioSample* AudioSample::readWav(FILE* stream, size_t (*readFunc)( void *, size_t, size_t, FILE *)) {
|
||||||
|
char id[4]; //four unsigned chars to hold chunk IDs
|
||||||
|
readFunc(id,sizeof(unsigned char),4,stream);
|
||||||
|
if (strncmp(id,"RIFF",4)!=0) return 0;
|
||||||
|
|
||||||
|
unsigned int size;
|
||||||
|
readFunc(&size,sizeof(unsigned int),1,stream);
|
||||||
|
|
||||||
|
readFunc(id,sizeof(unsigned char),4,stream);
|
||||||
|
if (strncmp(id,"WAVE",4)!=0) return 0;
|
||||||
|
|
||||||
|
unsigned short encoding, block_align, channels, bitsPerSample;
|
||||||
|
unsigned int chunk_length, byte_rate, sampleRate;
|
||||||
|
|
||||||
|
readFunc(id, sizeof(unsigned char), 4, stream); //read ID 'fmt ';
|
||||||
|
readFunc(&chunk_length, sizeof(unsigned int),1,stream); // header length, 16 expected
|
||||||
|
readFunc(&encoding, sizeof(short), 1, stream); // should be "1" for simple PCM data
|
||||||
|
if(encoding!=1) return 0;
|
||||||
|
|
||||||
|
readFunc(&channels, sizeof(short),1,stream);
|
||||||
|
readFunc(&sampleRate, sizeof(unsigned int), 1, stream);
|
||||||
|
readFunc(&byte_rate, sizeof(unsigned int), 1, stream);
|
||||||
|
readFunc(&block_align, sizeof(short), 1, stream);
|
||||||
|
readFunc(&bitsPerSample, sizeof(short), 1, stream);
|
||||||
|
|
||||||
|
readFunc(id, sizeof(unsigned char), 4, stream); // read ID 'data'
|
||||||
|
readFunc(&size, sizeof(unsigned int), 1, stream);
|
||||||
|
unsigned char *data = new unsigned char[size];
|
||||||
|
readFunc(data, sizeof(unsigned char), size, stream);
|
||||||
|
|
||||||
|
return new AudioSample(data,size, channels, sampleRate, bitsPerSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioSample* AudioSample::loadWav(const std::string & fname) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
FILE *fp = 0;
|
||||||
|
fopen_s(&fp, fname.c_str(), "rb");
|
||||||
|
#else
|
||||||
|
FILE *fp = fopen(fname.c_str(), "rb");
|
||||||
|
#endif
|
||||||
|
if (!fp) return 0;
|
||||||
|
AudioSample * pSample = readWav(fp, fread);
|
||||||
|
fclose(fp);
|
||||||
|
return pSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- class DeviceAudio --------------------------------------------
|
||||||
|
|
||||||
|
DeviceAudio* DeviceAudio::s_instance=0;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern int stb_vorbis_decode_filename(char *filename, int *channels, int* sample_rate, short **output);
|
||||||
|
};
|
||||||
|
|
||||||
|
static AudioSample* loadOgg(const std::string & fname) {
|
||||||
|
int channels, sampleRate;
|
||||||
|
short *decoded;
|
||||||
|
int len = stb_vorbis_decode_filename(const_cast<char*>(fname.c_str()), &channels, &sampleRate, &decoded);
|
||||||
|
if(len<0) return 0;
|
||||||
|
// convert to AudioSample:
|
||||||
|
unsigned int size = len*channels*sizeof(short);
|
||||||
|
unsigned char * data = new unsigned char[size];
|
||||||
|
if(!data) return 0;
|
||||||
|
memcpy(data,decoded, size);
|
||||||
|
free(decoded);
|
||||||
|
return new AudioSample(data, size, channels, sampleRate, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static string toLower(const string & s) {
|
||||||
|
string retStr(s);
|
||||||
|
for(size_t i=0; i<s.size(); ++i)
|
||||||
|
retStr[i]=static_cast<char>(tolower(retStr[i]));
|
||||||
|
return retStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceAudio::DeviceAudio() : m_freqOut(0), m_volL(1.0f), m_volR(1.0f) {
|
||||||
|
loaderRegister(AudioSample::loadWav,"wav");
|
||||||
|
loaderRegister(loadOgg,"ogg");
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudio::sampleFromFile(const std::string & filename, float volume) {
|
||||||
|
if(filename.rfind('.')>filename.size()) return 0;
|
||||||
|
string suffix=toLower(filename.substr(filename.rfind('.')+1));
|
||||||
|
map<string, AudioSample * (*)(const string &)>::iterator it = mm_loader.find(suffix);
|
||||||
|
if(it==mm_loader.end()) return 0;
|
||||||
|
AudioSample* pSample = (*(it->second))(filename);
|
||||||
|
if(!pSample) return 0;
|
||||||
|
unsigned int ret = sampleFromMemory(*pSample, volume);
|
||||||
|
delete pSample;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudio::loaderRegister(AudioSample *(*loadFunc)(const std::string &), const std::string & suffix) {
|
||||||
|
return mm_loader.insert(std::make_pair(toLower(suffix),loadFunc)).second;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudio::loaderAvailable(const std::string & suffix) const {
|
||||||
|
return mm_loader.find(toLower(suffix))!=mm_loader.end();
|
||||||
|
}
|
||||||
169
proAudio.h
Normal file
169
proAudio.h
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
#ifndef _PRO_AUDIO
|
||||||
|
#define _PRO_AUDIO
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
/** @file proAudio.h
|
||||||
|
\brief Public interface of proteaAudio
|
||||||
|
|
||||||
|
Contains the declaration of the audio sample class and the abstract base class for audio mixer/playback devices
|
||||||
|
|
||||||
|
\author Gerald Franz, www.viremo.de
|
||||||
|
\version 0.6
|
||||||
|
|
||||||
|
License notice (zlib license):
|
||||||
|
|
||||||
|
(c) 2009 by Gerald Franz, www.viremo.de
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the author be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//--- class AudioSample --------------------------------------------
|
||||||
|
/// class representing an audio sample
|
||||||
|
class AudioSample {
|
||||||
|
public:
|
||||||
|
/// constructor from memory data
|
||||||
|
AudioSample(unsigned char * data, unsigned int size, unsigned short channels, unsigned int sampleRate, unsigned short bitsPerSample) :
|
||||||
|
m_data(data), m_size(size), m_channels(channels), m_sampleRate(sampleRate), m_bitsPerSample(bitsPerSample) { }
|
||||||
|
/// copy constructor
|
||||||
|
AudioSample(const AudioSample & source);
|
||||||
|
/// destructor
|
||||||
|
~AudioSample() { delete[] m_data; }
|
||||||
|
|
||||||
|
/// allows accessing sample data
|
||||||
|
unsigned char * data() { return m_data; };
|
||||||
|
/// allows reading sample data
|
||||||
|
const unsigned char * data() const { return m_data; };
|
||||||
|
/// returns sample size in bytes
|
||||||
|
unsigned int size() const { return m_size; }
|
||||||
|
/// returns sample size in number of frames
|
||||||
|
unsigned int frames() const { return m_size/m_channels/(m_bitsPerSample>>3); }
|
||||||
|
/// returns size of a single frame in bytes
|
||||||
|
unsigned int sizeFrame() const { return m_channels*(m_bitsPerSample>>3); }
|
||||||
|
/// returns number of parallel channels, 1 mono, 2 stereo
|
||||||
|
unsigned short channels() const { return m_channels; }
|
||||||
|
/// returns number of frames per second, e.g., 44100, 22050
|
||||||
|
unsigned int sampleRate() const { return m_sampleRate; }
|
||||||
|
/// returns number of bits per mono sample, e.g., 8, 16
|
||||||
|
unsigned short bitsPerSample() const { return m_bitsPerSample; }
|
||||||
|
/// converts to a different bit rate, e.g., 8, 16
|
||||||
|
bool bitsPerSample(unsigned short bits);
|
||||||
|
/// returns number of bytes per sample, e.g., 1, 2
|
||||||
|
unsigned short bytesPerSample() const { return m_bitsPerSample>>3; }
|
||||||
|
|
||||||
|
/// changes volume by given factor
|
||||||
|
void volume(float f);
|
||||||
|
|
||||||
|
/// loads a WAV file
|
||||||
|
static AudioSample* loadWav(const std::string & fname);
|
||||||
|
/// reads WAV data from a stream via a function compatible to std::fread
|
||||||
|
static AudioSample* readWav(FILE* stream, size_t (*readFunc)( void *, size_t, size_t, FILE *));
|
||||||
|
protected:
|
||||||
|
/// stores sample data
|
||||||
|
unsigned char * m_data;
|
||||||
|
/// sample size in bytes
|
||||||
|
unsigned int m_size;
|
||||||
|
/// number of parallel channels, 1 mono, 2 stereo
|
||||||
|
unsigned short m_channels;
|
||||||
|
/// number of samples per second, e.g., 44100, 22050
|
||||||
|
unsigned int m_sampleRate;
|
||||||
|
/// number of bits per sample, e.g., 8, 16
|
||||||
|
unsigned short m_bitsPerSample;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--- class DeviceAudio --------------------------------------------
|
||||||
|
|
||||||
|
/// abstract base class for stereo audio mixer/playback devices
|
||||||
|
class DeviceAudio {
|
||||||
|
public:
|
||||||
|
/// returns singleton object
|
||||||
|
/** This call is only allowed after a successful precedent creation of an audio device */
|
||||||
|
static DeviceAudio& singleton() { return *s_instance; }
|
||||||
|
/// calls the destructor of the singleton object
|
||||||
|
static void destroy() { if(s_instance) delete s_instance; s_instance=0; };
|
||||||
|
|
||||||
|
/// sets master volume
|
||||||
|
void volume(float left, float right) { m_volL=left; m_volR=right; }
|
||||||
|
/// sets master volume
|
||||||
|
void volume(float leftAndRight) { m_volL=m_volR=leftAndRight; }
|
||||||
|
/// registers an audio sample loader function handling a file type identified by suffix
|
||||||
|
/** The function has to be of type AudioSample * loadXYZ(const std::string & filename).*/
|
||||||
|
bool loaderRegister(AudioSample *(*loadFunc)(const std::string &), const std::string & suffix);
|
||||||
|
/// returns true in case a loader for this file type is available
|
||||||
|
bool loaderAvailable(const std::string & suffix) const;
|
||||||
|
|
||||||
|
/// loads a sound sample from file, optionally adjusts volume, returns handle
|
||||||
|
virtual unsigned int sampleFromFile(const std::string & filename, float volume=1.0f);
|
||||||
|
/// converts a sound sample to internal audio format, returns handle
|
||||||
|
virtual unsigned int sampleFromMemory(const AudioSample & sample, float volume=1.0f)=0;
|
||||||
|
/// deletes a previously created sound sample resource identified by its handle
|
||||||
|
virtual bool sampleDestroy(unsigned int sample)=0;
|
||||||
|
/// allows read access to a sample identified by its handle
|
||||||
|
virtual const AudioSample* sample(unsigned int handle) const { return 0; }
|
||||||
|
|
||||||
|
/// plays a specified sound sample once and sets its parameters
|
||||||
|
/** \param sample handle of a previously loaded sample
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or -1 in case of error */
|
||||||
|
virtual unsigned int soundPlay(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f )=0;
|
||||||
|
/// plays a specified sound sample continuously and sets its parameters
|
||||||
|
/** \param sample handle of a previously loaded sample
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or -1 in case of error */
|
||||||
|
virtual unsigned int soundLoop(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f )=0;
|
||||||
|
/// updates parameters of a specified sound
|
||||||
|
/** \param sound handle of a currently active sound
|
||||||
|
\param volumeL left volume
|
||||||
|
\param volumeR right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return true in case the parameters have been updated successfully */
|
||||||
|
virtual bool soundUpdate(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f )=0;
|
||||||
|
/// stops a specified sound immediately
|
||||||
|
virtual bool soundStop(unsigned int sound)=0;
|
||||||
|
/// stops all sounds immediately
|
||||||
|
virtual void soundStop()=0;
|
||||||
|
/// returns number of currently active sounds
|
||||||
|
virtual unsigned int soundActive() const=0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// constructor
|
||||||
|
DeviceAudio();
|
||||||
|
/// destructor
|
||||||
|
virtual ~DeviceAudio() { s_instance = 0; }
|
||||||
|
|
||||||
|
/// stores output stream frequency
|
||||||
|
unsigned int m_freqOut;
|
||||||
|
/// stores left master volume
|
||||||
|
float m_volL;
|
||||||
|
/// stores right master volume
|
||||||
|
float m_volR;
|
||||||
|
/// map associating suffixes to loader functions
|
||||||
|
std::map<std::string, AudioSample * (*)(const std::string &)> mm_loader;
|
||||||
|
|
||||||
|
/// pointer to singleton
|
||||||
|
static DeviceAudio * s_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _PRO_AUDIO
|
||||||
242
proAudioRt.cpp
Normal file
242
proAudioRt.cpp
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
#include "proAudioRt.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <climits>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
struct _AudioTrack {
|
||||||
|
/// sample
|
||||||
|
AudioSample * sample;
|
||||||
|
|
||||||
|
/// position in sample in frames
|
||||||
|
unsigned int dpos;
|
||||||
|
/// length of sample in frames
|
||||||
|
unsigned int dlen;
|
||||||
|
/// disparity in seconds between left and right, normally 0.0f
|
||||||
|
float disparity;
|
||||||
|
/// left volume
|
||||||
|
float volL;
|
||||||
|
/// right volume
|
||||||
|
float volR;
|
||||||
|
/// pitch factor, normally 1.0f
|
||||||
|
float pitch;
|
||||||
|
/// stores whether sample has to be looped
|
||||||
|
bool isLoop;
|
||||||
|
/// stores whether sample is currently playing
|
||||||
|
bool isPlaying;
|
||||||
|
};
|
||||||
|
|
||||||
|
DeviceAudio* DeviceAudioRt::create(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize) {
|
||||||
|
if(!s_instance) {
|
||||||
|
DeviceAudioRt* pAudio = new DeviceAudioRt(nTracks,frequency,chunkSize);
|
||||||
|
if(!pAudio->m_freqOut) delete pAudio;
|
||||||
|
else s_instance = pAudio;
|
||||||
|
}
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceAudioRt::DeviceAudioRt(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize) : DeviceAudio() {
|
||||||
|
if ( m_dac.getDeviceCount() < 1 ) {
|
||||||
|
fprintf(stderr,"DeviceAudioRt ERROR: No audio devices found!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Set our stream parameters for output only.
|
||||||
|
RtAudio::StreamParameters oParams;
|
||||||
|
oParams.deviceId = m_dac.getDefaultOutputDevice(); // default device
|
||||||
|
oParams.nChannels = 2; // stereo
|
||||||
|
oParams.firstChannel = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
m_dac.openStream( &oParams, NULL, RTAUDIO_SINT16, frequency, &chunkSize, &cbMix, (void *)this );
|
||||||
|
m_dac.startStream();
|
||||||
|
}
|
||||||
|
catch ( RtError& e ) {
|
||||||
|
fprintf(stderr,"%s\n", e.getMessage().c_str());
|
||||||
|
if(m_dac.isStreamOpen()) m_dac.closeStream();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize tracks:
|
||||||
|
m_nSound=nTracks;
|
||||||
|
ma_sound=new _AudioTrack[m_nSound];
|
||||||
|
memset(ma_sound,0,m_nSound*sizeof(_AudioTrack));
|
||||||
|
m_freqOut = frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceAudioRt::~DeviceAudioRt() {
|
||||||
|
if(m_dac.isStreamOpen()) m_dac.closeStream();
|
||||||
|
delete [] ma_sound;
|
||||||
|
for( map<unsigned int,AudioSample*>::iterator it=mm_sample.begin(); it!=mm_sample.end(); ++it)
|
||||||
|
delete it->second;
|
||||||
|
mm_sample.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioRt::sampleFromMemory(const AudioSample & sample, float volume) {
|
||||||
|
AudioSample * pSample = new AudioSample(sample);
|
||||||
|
if(volume!=1.0f) pSample->volume(volume);
|
||||||
|
pSample->bitsPerSample(16);
|
||||||
|
mm_sample.insert(make_pair(++m_sampleCounter,pSample));
|
||||||
|
return m_sampleCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioRt::sampleDestroy(unsigned int sample) {
|
||||||
|
// look for sample:
|
||||||
|
map<unsigned int,AudioSample*>::iterator iter=mm_sample.find(sample);
|
||||||
|
if( iter == mm_sample.end() ) return false;
|
||||||
|
// stop currently playing sounds referring to this sample:
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) if(ma_sound[i].sample == iter->second)
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
// cleanup:
|
||||||
|
delete iter->second;
|
||||||
|
if(iter->first==m_sampleCounter) --m_sampleCounter;
|
||||||
|
mm_sample.erase(iter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AudioSample* DeviceAudioRt::sample(unsigned int handle) const {
|
||||||
|
map<unsigned int,AudioSample*>::const_iterator it=mm_sample.find(handle);
|
||||||
|
if( it == mm_sample.end() ) return 0;
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int DeviceAudioRt::soundPlay(unsigned int sample, float volumeL, float volumeR, float disparity, float pitch ) {
|
||||||
|
// look for sample:
|
||||||
|
map<unsigned int,AudioSample*>::iterator iter=mm_sample.find(sample);
|
||||||
|
if( iter == mm_sample.end() ) return 0; // no sample found
|
||||||
|
// look for an empty (or finished) sound track
|
||||||
|
unsigned int i;
|
||||||
|
for ( i=0; i<m_nSound; ++i )
|
||||||
|
if (!ma_sound[i].isPlaying) break;
|
||||||
|
if ( i == m_nSound ) return 0; // no empty slot found
|
||||||
|
|
||||||
|
unsigned int sampleRate = iter->second->sampleRate();
|
||||||
|
if(sampleRate!=m_freqOut) pitch*=(float)sampleRate/(float)m_freqOut;
|
||||||
|
|
||||||
|
// put the sample data in the slot and play it
|
||||||
|
ma_sound[i].sample = iter->second;
|
||||||
|
ma_sound[i].dlen = iter->second->frames();
|
||||||
|
ma_sound[i].dpos = 0;
|
||||||
|
ma_sound[i].volL=volumeL;
|
||||||
|
ma_sound[i].volR=volumeR;
|
||||||
|
ma_sound[i].disparity=disparity;
|
||||||
|
ma_sound[i].pitch=fabs(pitch);
|
||||||
|
ma_sound[i].isLoop=false;
|
||||||
|
ma_sound[i].isPlaying=true;
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioRt::soundLoop(unsigned int sample, float volumeL, float volumeR, float disparity, float pitch ) {
|
||||||
|
unsigned int ret=soundPlay(sample,volumeL,volumeR,disparity, pitch);
|
||||||
|
if(ret) ma_sound[ret-1].isLoop=true;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioRt::soundUpdate(unsigned int sound, float volumeL, float volumeR, float disparity, float pitch ) {
|
||||||
|
if(!sound || (sound>m_nSound) || !ma_sound[sound-1].isPlaying) return false;
|
||||||
|
ma_sound[--sound].volL=volumeL;
|
||||||
|
ma_sound[sound].volR=volumeR;
|
||||||
|
ma_sound[sound].disparity=disparity;
|
||||||
|
unsigned int sampleRate = ma_sound[sound].sample->sampleRate();
|
||||||
|
if(sampleRate!=m_freqOut) pitch*=(float)sampleRate/(float)m_freqOut;
|
||||||
|
ma_sound[sound].pitch=fabs(pitch);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioRt::soundStop(unsigned int sound) {
|
||||||
|
if(!sound||(sound>m_nSound)||!ma_sound[sound-1].isPlaying) return false;
|
||||||
|
ma_sound[sound-1].isPlaying=false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceAudioRt::soundStop() {
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i )
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioRt::soundActive() const {
|
||||||
|
if(!const_cast<RtAudio*>(&m_dac)->isStreamRunning() ) return 0;
|
||||||
|
unsigned int ret = 0, i;
|
||||||
|
for ( i=0; i<m_nSound; ++i )
|
||||||
|
if (ma_sound[i].isPlaying) ++ret;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DeviceAudioRt::mixOutputFloat(signed short *outputBuffer, unsigned int nFrames) {
|
||||||
|
for(unsigned int j=0; j<nFrames; ++j) {
|
||||||
|
float left=0.0f;
|
||||||
|
float right=0.0f;
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) if(ma_sound[i].isPlaying) {
|
||||||
|
unsigned int nChannels = ma_sound[i].sample->channels();
|
||||||
|
if((ma_sound[i].pitch==1.0f)&&!ma_sound[i].disparity) { // use optimized default mixing:
|
||||||
|
unsigned int currPos=ma_sound[i].dpos+j;
|
||||||
|
if(ma_sound[i].isLoop) currPos%=ma_sound[i].dlen;
|
||||||
|
else if(currPos >= ma_sound[i].dlen) continue;
|
||||||
|
currPos*=ma_sound[i].sample->sizeFrame();
|
||||||
|
float dataL = (float)(*((signed short *)(&ma_sound[i].sample->data()[currPos])));
|
||||||
|
left += dataL * m_volL*ma_sound[i].volL;
|
||||||
|
float dataR = (nChannels>1) ? (float)(*((signed short *)(&ma_sound[i].sample->data()[currPos+2]))) : dataL;
|
||||||
|
right+= dataR * m_volR*ma_sound[i].volR;
|
||||||
|
}
|
||||||
|
else { // use nearest sample and disparity:
|
||||||
|
double fract=ma_sound[i].dpos+j*ma_sound[i].pitch;
|
||||||
|
unsigned int currPos=(unsigned int)fract;
|
||||||
|
fract = fmod(fract,1.0);
|
||||||
|
int currPosL= (ma_sound[i].disparity<0.0f) ? currPos+int(m_freqOut*ma_sound[i].disparity) : currPos;
|
||||||
|
int currPosR= (ma_sound[i].disparity>0.0f) ? currPos-int(m_freqOut*ma_sound[i].disparity) : currPos;
|
||||||
|
if(nChannels>1) currPosR+=sizeof(signed short); // use second channel
|
||||||
|
if(ma_sound[i].isLoop) {
|
||||||
|
currPosL+=ma_sound[i].dlen;
|
||||||
|
currPosL%=ma_sound[i].dlen;
|
||||||
|
currPosR+=ma_sound[i].dlen;
|
||||||
|
currPosR%=ma_sound[i].dlen;
|
||||||
|
}
|
||||||
|
if(currPosL<0) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else if((unsigned int)currPosL+1 < ma_sound[i].dlen) {
|
||||||
|
currPosL*=ma_sound[i].sample->sizeFrame();
|
||||||
|
float dataL = (1.0f-(float)fract)*(float)(*((signed short *)(&ma_sound[i].sample->data()[currPosL])))
|
||||||
|
+ (float)fract*(float)(*((signed short *)(&ma_sound[i].sample->data()[currPosL+ma_sound[i].sample->sizeFrame()])));
|
||||||
|
left += dataL * m_volL*ma_sound[i].volL;
|
||||||
|
}
|
||||||
|
else if((unsigned int)currPosL+1 == ma_sound[i].dlen) {
|
||||||
|
currPosL*=ma_sound[i].sample->sizeFrame();
|
||||||
|
float dataL = (float)(*((signed short *)(&ma_sound[i].sample->data()[currPosL])));
|
||||||
|
left += dataL * m_volL*ma_sound[i].volL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currPosR<0) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else if((unsigned int)currPosR+1 < ma_sound[i].dlen) {
|
||||||
|
currPosR*=ma_sound[i].sample->sizeFrame();
|
||||||
|
float dataR = (1.0f-(float)fract)*(float)(*((signed short *)(&ma_sound[i].sample->data()[currPosR])))
|
||||||
|
+ (float)fract*(float)(*((signed short *)(&ma_sound[i].sample->data()[currPosR+ma_sound[i].sample->sizeFrame()])));
|
||||||
|
right += dataR * m_volR*ma_sound[i].volR;
|
||||||
|
}
|
||||||
|
else if((unsigned int)currPosR+1 == ma_sound[i].dlen) {
|
||||||
|
currPosR*=ma_sound[i].sample->sizeFrame();
|
||||||
|
float dataR = (float)(*((signed short *)(&ma_sound[i].sample->data()[currPosR])));
|
||||||
|
right += dataR * m_volR*ma_sound[i].volR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// clamp and set output:
|
||||||
|
outputBuffer[2*j] = left>SHRT_MAX ? SHRT_MAX : left<SHRT_MIN ? SHRT_MIN : (signed short)left;
|
||||||
|
outputBuffer[2*j+1] = right>SHRT_MAX ? SHRT_MAX : right<SHRT_MIN ? SHRT_MIN : (signed short)right;
|
||||||
|
}
|
||||||
|
// calculate new pos:
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) {
|
||||||
|
if(ma_sound[i].pitch==1.0f) ma_sound[i].dpos += nFrames;
|
||||||
|
else ma_sound[i].dpos += (unsigned int)(nFrames*ma_sound[i].pitch);
|
||||||
|
|
||||||
|
if(ma_sound[i].isLoop) ma_sound[i].dpos%=ma_sound[i].dlen;
|
||||||
|
else if(ma_sound[i].dpos>ma_sound[i].dlen+2*abs(int(m_freqOut*-ma_sound[i].disparity)))
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
88
proAudioRt.h
Normal file
88
proAudioRt.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#include "proAudio.h"
|
||||||
|
#include <RtAudio.h>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
/** @file proAudioRt.h
|
||||||
|
\brief RtAudio backend of proteaAudio
|
||||||
|
\author Gerald Franz, www.viremo.de
|
||||||
|
\version 0.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _AudioTrack;
|
||||||
|
|
||||||
|
/// an rtAudio based stereo audio mixer/playback device
|
||||||
|
/** DeviceAudioRt offers some advanced features such as dynamic pitch,
|
||||||
|
independent volume control for both channels, and user-defined time shifts between the channels. */
|
||||||
|
class DeviceAudioRt : public DeviceAudio {
|
||||||
|
public:
|
||||||
|
///creates audio device
|
||||||
|
/** Use this method instead of a constructor.
|
||||||
|
\param nTracks (optional) the maximum number of sounds that are played parallely. Computation time is linearly correlated to this factor.
|
||||||
|
\param frequency (optional) sample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor.
|
||||||
|
\param chunkSize (optional) the number of bytes that are sent to the sound card at once. Low numbers lead to smaller latencies but need more computation time (thread switches). If a too small number is chosen, the sounds might not be played continuously. The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency.
|
||||||
|
\return a pointer to an audio device object in case of success
|
||||||
|
Note that the parameters are only handled when calling for the first time. Afterwards always the same object is returned until an explicit destroy() is called.
|
||||||
|
*/
|
||||||
|
static DeviceAudio* create(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024);
|
||||||
|
|
||||||
|
/// converts a sound sample to internal audio format, returns handle
|
||||||
|
virtual unsigned int sampleFromMemory(const AudioSample & sample, float volume=1.0f);
|
||||||
|
/// deletes a previously created sound sample resource identified by its handle
|
||||||
|
virtual bool sampleDestroy(unsigned int sample);
|
||||||
|
/// allows read access to a sample identified by its handle
|
||||||
|
virtual const AudioSample* sample(unsigned int handle) const;
|
||||||
|
|
||||||
|
/// plays a specified sample once and sets its parameters
|
||||||
|
/** \param sample a sample handle returned by a previous load() call
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or 0 in case of error */
|
||||||
|
virtual unsigned int soundPlay(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/** plays a specified sample continuously and sets its parameters
|
||||||
|
\param sample a sample handle returned by a previous load() call
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or 0 in case of error */
|
||||||
|
virtual unsigned int soundLoop(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/// updates parameters of a specified sound
|
||||||
|
/** \param sound handle of a currently active sound
|
||||||
|
\param volumeL left volume
|
||||||
|
\param volumeR right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return true in case the parameters have been updated successfully */
|
||||||
|
virtual bool soundUpdate(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/// stops a specified sound immediately
|
||||||
|
virtual bool soundStop(unsigned int sound);
|
||||||
|
/// stops all sounds immediately
|
||||||
|
virtual void soundStop();
|
||||||
|
/// returns number of currently active sounds
|
||||||
|
virtual unsigned soundActive() const;
|
||||||
|
protected:
|
||||||
|
/// constructor. Use the create() method instead
|
||||||
|
DeviceAudioRt(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize);
|
||||||
|
/// destructor. Use the destroy() method instead
|
||||||
|
virtual ~DeviceAudioRt();
|
||||||
|
/// mixes tracks to a single output stream
|
||||||
|
int mixOutputFloat(signed short *outputBuffer, unsigned int nFrames);
|
||||||
|
|
||||||
|
/// stores loaded sound samples
|
||||||
|
std::map<unsigned int, AudioSample*> mm_sample;
|
||||||
|
/// stores maximum sample id
|
||||||
|
unsigned int m_sampleCounter;
|
||||||
|
|
||||||
|
/// stores sounds to be mixed
|
||||||
|
_AudioTrack * ma_sound;
|
||||||
|
/// stores number of parallel sounds
|
||||||
|
unsigned int m_nSound;
|
||||||
|
/// audio manager
|
||||||
|
RtAudio m_dac;
|
||||||
|
|
||||||
|
/// mixer callback
|
||||||
|
static int cbMix(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *data) {
|
||||||
|
return static_cast<DeviceAudioRt*>(data)->mixOutputFloat((signed short*)outputBuffer, nFrames); }
|
||||||
|
};
|
||||||
219
proAudioRt_lua.cpp
Normal file
219
proAudioRt_lua.cpp
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
#if defined __WIN32__ || defined WIN32
|
||||||
|
# define WINDOWS_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
# define _EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
|
# define _EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <lua.h>
|
||||||
|
#include <lauxlib.h>
|
||||||
|
#include <lualib.h>
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "proAudioRt.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static int create(lua_State *L) {
|
||||||
|
unsigned int nTracks = lua_isnumber(L,1) ? lua_tointeger(L,1) : 8;
|
||||||
|
unsigned int frequency = lua_isnumber(L,2) ? lua_tointeger(L,2) : 22050;
|
||||||
|
unsigned int chunkSize = lua_isnumber(L,3) ? lua_tointeger(L,3) : 1024;
|
||||||
|
DeviceAudio* pAudio = DeviceAudioRt::create(nTracks, frequency, chunkSize);
|
||||||
|
lua_pushboolean(L, pAudio ? 1 : 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int destroy(lua_State *L) {
|
||||||
|
DeviceAudio::destroy();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int loaderAvailable(lua_State *L) {
|
||||||
|
const char * fname = luaL_checkstring(L,1);
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
lua_pushboolean(L, audio.loaderAvailable(fname));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int volume(lua_State *L) {
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
if(!argc) return 0;
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
if(argc==1) audio.volume(luaL_checknumber(L,1));
|
||||||
|
else audio.volume(luaL_checknumber(L,1),luaL_checknumber(L,2));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sleep(lua_State*L) {
|
||||||
|
double secs = luaL_checknumber(L,1);
|
||||||
|
#if defined __WIN32__ || defined WIN32
|
||||||
|
Sleep( (DWORD)(secs*1000.0) ) ;
|
||||||
|
#else // Unix variants
|
||||||
|
usleep( (unsigned long) (secs * 1000000.0) );
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sampleFromFile(lua_State *L) {
|
||||||
|
const char * fname = luaL_checkstring(L,1);
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
float volume = argc>1 ? luaL_checknumber(L,2) : 1.0f;
|
||||||
|
int ret = (int)audio.sampleFromFile(fname, volume);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sampleFromMemory(lua_State *L) {
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio||argc<2||!lua_istable(L,1)) return 0;
|
||||||
|
|
||||||
|
size_t len = lua_objlen(L,1);
|
||||||
|
if(!len) return 0;
|
||||||
|
int sampleRate = luaL_checkinteger(L,2);
|
||||||
|
signed short *data = new signed short[len];
|
||||||
|
for(size_t i = 0; i<len; ++i) {
|
||||||
|
lua_rawgeti(L, 1, i+1);
|
||||||
|
if(lua_isnumber(L, -1)) {
|
||||||
|
float value = lua_tonumber(L,-1);
|
||||||
|
if(value<-1.0f) data[i] = SHRT_MIN;
|
||||||
|
else if(value>=1.0f) data[i] = SHRT_MAX;
|
||||||
|
else data[i] = (signed short)(value*SHRT_MAX);
|
||||||
|
}
|
||||||
|
lua_pop(L,1);
|
||||||
|
}
|
||||||
|
AudioSample sample((unsigned char*)data, len*sizeof(signed short), 1, sampleRate, 16);
|
||||||
|
int ret = (int)audio.sampleFromMemory(sample);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sampleDestroy(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
lua_pushboolean(L, audio.sampleDestroy(luaL_checkinteger(L,1)));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sampleProperties(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
const AudioSample *pSample = audio.sample(luaL_checkinteger(L,1));
|
||||||
|
if(!pSample) return 0;
|
||||||
|
lua_pushnumber(L, (double)pSample->frames() / (double)pSample->sampleRate());
|
||||||
|
lua_pushinteger(L, pSample->channels());
|
||||||
|
lua_pushinteger(L, pSample->sampleRate());
|
||||||
|
lua_pushinteger(L, pSample->bitsPerSample());
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int soundPlay(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
unsigned int sample = luaL_checkinteger(L,1);
|
||||||
|
float volL= lua_isnumber(L,2) ? lua_tonumber(L,2) : 1.0f;
|
||||||
|
float volR= lua_isnumber(L,3) ? lua_tonumber(L,3) : 1.0f;
|
||||||
|
float disparity= lua_isnumber(L,4) ? lua_tonumber(L,4) : 0.0f;
|
||||||
|
float pitch = lua_isnumber(L,5) ? lua_tonumber(L,5) : 1.0f;
|
||||||
|
int ret = (int)audio.soundPlay(sample, volL,volR,disparity,pitch);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int soundLoop(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
unsigned int sample = luaL_checkinteger(L,1);
|
||||||
|
float volL= lua_isnumber(L,2) ? lua_tonumber(L,2) : 1.0f;
|
||||||
|
float volR= lua_isnumber(L,3) ? lua_tonumber(L,3) : 1.0f;
|
||||||
|
float disparity= lua_isnumber(L,4) ? lua_tonumber(L,4) : 0.0f;
|
||||||
|
float pitch = lua_isnumber(L,5) ? lua_tonumber(L,5) : 1.0f;
|
||||||
|
int ret = (int)audio.soundLoop(sample, volL,volR,disparity,pitch);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int soundUpdate(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
unsigned int sound = luaL_checkinteger(L,1);
|
||||||
|
float volL= lua_isnumber(L,2) ? lua_tonumber(L,2) : 1.0f;
|
||||||
|
float volR= lua_isnumber(L,3) ? lua_tonumber(L,3) : 1.0f;
|
||||||
|
float disparity= lua_isnumber(L,4) ? lua_tonumber(L,4) : 0.0f;
|
||||||
|
float pitch = lua_isnumber(L,5) ? lua_tonumber(L,5) : 1.0f;
|
||||||
|
int ret = (int)audio.soundUpdate(sound, volL,volR,disparity,pitch);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int soundStop(lua_State *L) {
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
if(!argc) {
|
||||||
|
audio.soundStop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
unsigned int sound = luaL_checkinteger(L,1);
|
||||||
|
int ret = (int)audio.soundStop(sound);
|
||||||
|
if(ret) {
|
||||||
|
lua_pushinteger(L, ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int soundActive(lua_State *L) {
|
||||||
|
DeviceAudio & audio = DeviceAudio::singleton();
|
||||||
|
if(!&audio) return 0;
|
||||||
|
lua_pushinteger(L, (int)audio.soundActive());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int _EXPORT luaopen_proAudioRt (lua_State* L) {
|
||||||
|
static const struct luaL_Reg funcs[] = {
|
||||||
|
{"create", create },
|
||||||
|
{"destroy", destroy },
|
||||||
|
{"loaderAvailable", loaderAvailable },
|
||||||
|
{"volume", volume },
|
||||||
|
{"sleep", sleep },
|
||||||
|
|
||||||
|
{"sampleFromFile", sampleFromFile },
|
||||||
|
{"sampleFromMemory", sampleFromMemory },
|
||||||
|
{"sampleDestroy", sampleDestroy },
|
||||||
|
{"sampleProperties", sampleProperties },
|
||||||
|
|
||||||
|
{"soundPlay", soundPlay },
|
||||||
|
{"soundLoop", soundLoop },
|
||||||
|
{"soundUpdate", soundUpdate },
|
||||||
|
{"soundStop", soundStop },
|
||||||
|
{"soundActive", soundActive },
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
luaL_register(L, "proAudio", funcs);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
289
proAudioSdl.cpp
Normal file
289
proAudioSdl.cpp
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
#include "proAudioSdl.h"
|
||||||
|
extern "C" {
|
||||||
|
#include <SDL.h>
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <cmath>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//--- class DeviceAudioSdl ------------------------------------------
|
||||||
|
|
||||||
|
/// internal class to store sample data
|
||||||
|
class _AudioTrack {
|
||||||
|
public:
|
||||||
|
/// default constructor
|
||||||
|
_AudioTrack(Uint8 * pData=0, unsigned int length=0) : data(pData), dlen(length) {
|
||||||
|
dpos=0; disparity=0.0f; volL=1.0f; volR=1.0f; pitch=1.0f; isLoop=false; isPlaying=false; };
|
||||||
|
/// pointer to raw sample data
|
||||||
|
Uint8 *data;
|
||||||
|
/// position in playback
|
||||||
|
Uint32 dpos;
|
||||||
|
/// length of sample in bytes
|
||||||
|
Uint32 dlen;
|
||||||
|
/// disparity in seconds between left and right, normally 0.0f
|
||||||
|
float disparity;
|
||||||
|
/// left volume
|
||||||
|
float volL;
|
||||||
|
/// right volume
|
||||||
|
float volR;
|
||||||
|
/// pitch factor, normally 1.0f
|
||||||
|
float pitch;
|
||||||
|
/// stores whether sample has to be looped
|
||||||
|
bool isLoop;
|
||||||
|
/// stores whether sample is currently playing
|
||||||
|
bool isPlaying;
|
||||||
|
};
|
||||||
|
|
||||||
|
DeviceAudio* DeviceAudioSdl::create(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize) {
|
||||||
|
if(!s_instance) {
|
||||||
|
DeviceAudioSdl* pAudio = new DeviceAudioSdl(nTracks,frequency,chunkSize);
|
||||||
|
if(!pAudio->m_freqOut) delete pAudio;
|
||||||
|
else s_instance = pAudio;
|
||||||
|
}
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceAudioSdl::DeviceAudioSdl(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize) : DeviceAudio(), m_sampleCounter(0) {
|
||||||
|
// initialize SDL sound system:
|
||||||
|
if(!SDL_WasInit(SDL_INIT_AUDIO)&&(SDL_InitSubSystem(SDL_INIT_AUDIO)<0)) {
|
||||||
|
fprintf(stderr, "DeviceAudioSdl ERROR: cannot initialize SDL audio subsystem.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the audio format:
|
||||||
|
SDL_AudioSpec desired;
|
||||||
|
desired.freq = frequency;
|
||||||
|
desired.format = AUDIO_S16;
|
||||||
|
desired.channels = 2; // 1 = mono, 2 = stereo
|
||||||
|
desired.samples = chunkSize; // good low-latency value for callback
|
||||||
|
desired.callback = cbOutput;
|
||||||
|
desired.userdata = NULL;
|
||||||
|
// open the audio device
|
||||||
|
if ( SDL_OpenAudio(&desired, &m_spec) < 0 ) {
|
||||||
|
fprintf(stderr, "DeviceAudioSdl ERROR: Couldn't open audio.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if((m_spec.format!=AUDIO_S16)||(m_spec.channels!=2)) {
|
||||||
|
fprintf(stderr, "DeviceAudioSdl WARNING: Could not get desired signed 16 bit stereo. Expect low quality sound.\n");
|
||||||
|
m_isDesiredFormat=false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_isDesiredFormat=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize tracks:
|
||||||
|
m_nSound=nTracks;
|
||||||
|
ma_sound=new _AudioTrack[m_nSound];
|
||||||
|
|
||||||
|
SDL_PauseAudio(0); // start sound
|
||||||
|
m_freqOut = frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceAudioSdl::~DeviceAudioSdl() {
|
||||||
|
SDL_PauseAudio(1);
|
||||||
|
SDL_CloseAudio();
|
||||||
|
delete [] ma_sound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceAudioSdl::cbOutput(void * userData, Uint8 *stream, int len) {
|
||||||
|
if(dynamic_cast<DeviceAudioSdl*>(s_instance)->m_isDesiredFormat)
|
||||||
|
dynamic_cast<DeviceAudioSdl*>(s_instance)->mixOutputFloat((signed short *)stream, len/2);
|
||||||
|
else dynamic_cast<DeviceAudioSdl*>(s_instance)->mixOutputSInt(stream, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceAudioSdl::mixOutputFloat(signed short *outputBuffer, unsigned int nFrames) {
|
||||||
|
for(unsigned int j=0; j<nFrames; j+=2) {
|
||||||
|
float left=0.0f;
|
||||||
|
float right=0.0f;
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) if(ma_sound[i].isPlaying) {
|
||||||
|
if((ma_sound[i].pitch==1.0f)&&!ma_sound[i].disparity) { // use optimized default mixing:
|
||||||
|
unsigned int currPos=ma_sound[i].dpos+j;
|
||||||
|
if(ma_sound[i].isLoop) currPos%=ma_sound[i].dlen;
|
||||||
|
else if(currPos >= ma_sound[i].dlen) continue;
|
||||||
|
left +=float(*((Sint16 *)(&ma_sound[i].data[currPos])))
|
||||||
|
*m_volL*ma_sound[i].volL;
|
||||||
|
right+=float(*((Sint16 *)(&ma_sound[i].data[currPos])))
|
||||||
|
*m_volR*ma_sound[i].volR;
|
||||||
|
}
|
||||||
|
else { // use linear interpolation and disparity:
|
||||||
|
double fract=ma_sound[i].dpos+j*ma_sound[i].pitch;
|
||||||
|
int currPos=int(fract*0.5f)*2;
|
||||||
|
fract=(fract-currPos)*0.5f;
|
||||||
|
|
||||||
|
int currPosL= (ma_sound[i].disparity<0.0f)
|
||||||
|
? currPos-2*int(m_spec.freq*-ma_sound[i].disparity)
|
||||||
|
: currPos;
|
||||||
|
int currPosR= (ma_sound[i].disparity>0.0f)
|
||||||
|
? currPos-2*int(m_spec.freq*ma_sound[i].disparity)
|
||||||
|
: currPos;
|
||||||
|
|
||||||
|
if(ma_sound[i].isLoop) {
|
||||||
|
currPosL=(currPosL+10*ma_sound[i].dlen-2)%(ma_sound[i].dlen-2);
|
||||||
|
currPosR=(currPosR+10*ma_sound[i].dlen-2)%(ma_sound[i].dlen-2);
|
||||||
|
}
|
||||||
|
if((currPosL < int(ma_sound[i].dlen)-2)&&(currPosL>=0)) {
|
||||||
|
float currWavL=(1.0f-fract)*float(*((Sint16 *)(&ma_sound[i].data[currPosL])))
|
||||||
|
+fract*float(*((Sint16 *)(&ma_sound[i].data[currPosL+2])));
|
||||||
|
left +=currWavL*m_volL*ma_sound[i].volL;
|
||||||
|
}
|
||||||
|
if((currPosR < int(ma_sound[i].dlen)-2)&&(currPosR>=0)) {
|
||||||
|
float currWavR=(1.0f-fract)*float(*((Sint16 *)(&ma_sound[i].data[currPosR])))
|
||||||
|
+fract*float(*((Sint16 *)(&ma_sound[i].data[currPosR+2])));
|
||||||
|
right+=currWavR*m_volR*ma_sound[i].volR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// clamp:
|
||||||
|
if(left>(float)SHRT_MAX) outputBuffer[j]=SHRT_MAX;
|
||||||
|
else if(left<(float)SHRT_MIN) outputBuffer[j]=SHRT_MIN;
|
||||||
|
else outputBuffer[j]=(Sint16)left;
|
||||||
|
if(right>(float)SHRT_MAX) outputBuffer[j+1]=SHRT_MAX;
|
||||||
|
else if(right<(float)SHRT_MIN) outputBuffer[j+1]=SHRT_MIN;
|
||||||
|
else outputBuffer[j+1]=(Sint16)right;
|
||||||
|
}
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) {
|
||||||
|
if(ma_sound[i].pitch==1.0f) ma_sound[i].dpos += nFrames;
|
||||||
|
else ma_sound[i].dpos += (unsigned int)(nFrames*ma_sound[i].pitch);
|
||||||
|
|
||||||
|
if(ma_sound[i].isLoop) ma_sound[i].dpos%=ma_sound[i].dlen;
|
||||||
|
else if(ma_sound[i].dpos>ma_sound[i].dlen+2*abs(int(m_spec.freq*-ma_sound[i].disparity)))
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceAudioSdl::mixOutputSInt(Uint8 *stream, int len) {
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) {
|
||||||
|
unsigned int amount = ma_sound[i].dlen-ma_sound[i].dpos;
|
||||||
|
if (amount > (unsigned int)len) amount = (unsigned int)len;
|
||||||
|
SDL_MixAudio(stream, &ma_sound[i].data[ma_sound[i].dpos], amount, SDL_MIX_MAXVOLUME);
|
||||||
|
ma_sound[i].dpos += amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void adjustVolume(signed short* data, size_t len, float volume) {
|
||||||
|
for(size_t i=0; i<len; ++i) {
|
||||||
|
signed short & shortValue=data[i];
|
||||||
|
float value=shortValue*volume;
|
||||||
|
if(value>(float)SHRT_MAX) value=(float)SHRT_MAX; // clamp
|
||||||
|
else if(value<(float)SHRT_MIN) value=(float)SHRT_MIN;
|
||||||
|
shortValue=(signed short)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioSdl::sampleFromMemory(const AudioSample & sample, float volume) {
|
||||||
|
Uint8 destChannels= m_isDesiredFormat ? 1 : m_spec.channels; // convert to mono
|
||||||
|
Uint16 format = sample.bytesPerSample()==2 ? AUDIO_S16 : sample.bytesPerSample()==1 ? AUDIO_S8 : 0;
|
||||||
|
if(!format) {
|
||||||
|
fprintf(stderr, "DeviceAudioSdl WARNING: %i bit samples not supported.\n", sample.bitsPerSample());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SDL_AudioCVT cvt;
|
||||||
|
SDL_BuildAudioCVT(&cvt, format, sample.channels(), sample.sampleRate(),
|
||||||
|
m_spec.format, destChannels, m_spec.freq);
|
||||||
|
cvt.buf = new Uint8[sample.size()*cvt.len_mult];
|
||||||
|
memcpy(cvt.buf, sample.data(), sample.size());
|
||||||
|
cvt.len = sample.size();
|
||||||
|
SDL_ConvertAudio(&cvt);
|
||||||
|
|
||||||
|
_AudioTrack track;
|
||||||
|
track.data = cvt.buf;
|
||||||
|
track.dlen = cvt.len_cvt;
|
||||||
|
track.dpos = 0;
|
||||||
|
if (!track.dlen) {
|
||||||
|
fprintf(stderr, "DeviceAudioSdl WARNING: Sample has zero length.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// adjust volume:
|
||||||
|
if((volume!=1.0f)&&m_isDesiredFormat)
|
||||||
|
adjustVolume((signed short *)track.data, track.dlen/2, volume);
|
||||||
|
|
||||||
|
mm_sample.insert(make_pair(++m_sampleCounter,track));
|
||||||
|
return m_sampleCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioSdl::sampleDestroy(unsigned int sample) {
|
||||||
|
// look for sample:
|
||||||
|
map<unsigned int,_AudioTrack>::iterator iter=mm_sample.find(sample);
|
||||||
|
if( iter == mm_sample.end() ) return false;
|
||||||
|
// stop currently playing sounds referring to this sample:
|
||||||
|
SDL_LockAudio();
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i ) if(ma_sound[i].data == iter->second.data)
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
// cleanup:
|
||||||
|
delete iter->second.data;
|
||||||
|
if(iter->first==m_sampleCounter) --m_sampleCounter;
|
||||||
|
mm_sample.erase(iter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioSdl::soundPlay(unsigned int sample, float volumeL, float volumeR, float disparity, float pitch) {
|
||||||
|
// look for sample:
|
||||||
|
map<unsigned int,_AudioTrack>::iterator iter=mm_sample.find(sample);
|
||||||
|
if(iter==mm_sample.end()) return 0; // no sample found
|
||||||
|
// look for an empty (or finished) sound track
|
||||||
|
unsigned int i;
|
||||||
|
for ( i=0; i<m_nSound; ++i )
|
||||||
|
if (!ma_sound[i].isPlaying) break;
|
||||||
|
if ( i == m_nSound ) return 0; // no empty slot found
|
||||||
|
|
||||||
|
// put the sample data in the slot and play it
|
||||||
|
SDL_LockAudio();
|
||||||
|
ma_sound[i].data = iter->second.data;
|
||||||
|
ma_sound[i].dlen = iter->second.dlen;
|
||||||
|
ma_sound[i].dpos = 0;
|
||||||
|
ma_sound[i].volL=volumeL;
|
||||||
|
ma_sound[i].volR=volumeR;
|
||||||
|
ma_sound[i].disparity=disparity;
|
||||||
|
ma_sound[i].pitch=fabs(pitch);
|
||||||
|
ma_sound[i].isLoop=false;
|
||||||
|
ma_sound[i].isPlaying=true;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioSdl::soundLoop(unsigned int sample, float volumeL, float volumeR, float disparity, float pitch) {
|
||||||
|
unsigned int ret=soundPlay(sample,volumeL,volumeR,disparity, pitch);
|
||||||
|
if(ret) {
|
||||||
|
SDL_LockAudio();
|
||||||
|
ma_sound[ret-1].isLoop=true;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioSdl::soundUpdate(unsigned int sound, float volumeL, float volumeR, float disparity, float pitch ) {
|
||||||
|
if(!sound || (sound>m_nSound) || !ma_sound[sound-1].isPlaying) return false;
|
||||||
|
SDL_LockAudio();
|
||||||
|
ma_sound[--sound].volL=volumeL;
|
||||||
|
ma_sound[sound].volR=volumeR;
|
||||||
|
ma_sound[sound].disparity=disparity;
|
||||||
|
ma_sound[sound].pitch=fabs(pitch);
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeviceAudioSdl::soundStop(unsigned int sound) {
|
||||||
|
if(!sound||(sound>m_nSound)||!ma_sound[sound-1].isPlaying) return false;
|
||||||
|
SDL_LockAudio();
|
||||||
|
ma_sound[sound-1].isPlaying=false;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceAudioSdl::soundStop() {
|
||||||
|
SDL_LockAudio();
|
||||||
|
for (unsigned int i=0; i<m_nSound; ++i )
|
||||||
|
ma_sound[i].isPlaying=false;
|
||||||
|
SDL_UnlockAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int DeviceAudioSdl::soundActive() const {
|
||||||
|
unsigned int ret = 0, i;
|
||||||
|
for ( i=0; i<m_nSound; ++i )
|
||||||
|
if (ma_sound[i].isPlaying) ++ret;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
96
proAudioSdl.h
Normal file
96
proAudioSdl.h
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#ifndef _AUDIO_SDL_H
|
||||||
|
#define _AUDIO_SDL_H
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <SDL_audio.h>
|
||||||
|
};
|
||||||
|
#include "proAudio.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
/** @file proAudioSdl.h
|
||||||
|
\brief SDL backend of proteaAudio
|
||||||
|
\author Gerald Franz, www.viremo.de
|
||||||
|
\version 2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
//--- class DeviceAudioSdl -----------------------------------------
|
||||||
|
|
||||||
|
/// internal class to manage sample data
|
||||||
|
class _AudioTrack;
|
||||||
|
|
||||||
|
/// SDL based stereo audio mixer/playback device
|
||||||
|
class DeviceAudioSdl : public DeviceAudio {
|
||||||
|
public:
|
||||||
|
///creates audio device
|
||||||
|
/** Use this method instead of a constructor.
|
||||||
|
\param nTracks (optional) the maximum number of sounds that are played parallely. Computation time is linearly correlated to this factor.
|
||||||
|
\param frequency (optional) sample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor.
|
||||||
|
\param chunkSize (optional) the number of bytes that are sent to the sound card at once. Low numbers lead to smaller latencies but need more computation time (thread switches). If a too small number is chosen, the sounds might not be played continuously. The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency.
|
||||||
|
\return a pointer to an audio device object in case of success
|
||||||
|
Note that the parameters are only handled when calling for the first time. Afterwards always the same object is returned until an explicit destroy() is called.
|
||||||
|
*/
|
||||||
|
static DeviceAudio* create(unsigned int nTracks=8, unsigned int frequency=22050, unsigned int chunkSize=1024);
|
||||||
|
|
||||||
|
/// converts a sound sample to internal audio format, returns handle
|
||||||
|
virtual unsigned int sampleFromMemory(const AudioSample & sample, float volume=1.0f);
|
||||||
|
/// deletes a previously created sound sample resource identified by its handle
|
||||||
|
virtual bool sampleDestroy(unsigned int sample);
|
||||||
|
|
||||||
|
/// plays a specified sample once and sets its parameters
|
||||||
|
/** \param sample a sample handle returned by a previous load() call
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or 0 in case of error */
|
||||||
|
virtual unsigned int soundPlay(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/** plays a specified sample continuously and sets its parameters
|
||||||
|
\param sample a sample handle returned by a previous load() call
|
||||||
|
\param volumeL (optional) left volume
|
||||||
|
\param volumeR (optional) right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return a handle to the currently played sound or 0 in case of error */
|
||||||
|
virtual unsigned int soundLoop(unsigned int sample, float volumeL=1.0f, float volumeR=1.0f, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/// updates parameters of a specified sound
|
||||||
|
/** \param sound handle of a currently active sound
|
||||||
|
\param volumeL left volume
|
||||||
|
\param volumeR right volume
|
||||||
|
\param disparity (optional) time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right.
|
||||||
|
\param pitch (optional) pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample.
|
||||||
|
\return true in case the parameters have been updated successfully */
|
||||||
|
virtual bool soundUpdate(unsigned int sound, float volumeL, float volumeR, float disparity=0.0f, float pitch=1.0f );
|
||||||
|
/// stops a specified sound immediately
|
||||||
|
virtual bool soundStop(unsigned int sound);
|
||||||
|
/// stops all sounds immediately
|
||||||
|
virtual void soundStop();
|
||||||
|
/// returns number of currently active sounds
|
||||||
|
virtual unsigned int soundActive() const;
|
||||||
|
protected:
|
||||||
|
/// constructor. Use the create() method instead
|
||||||
|
DeviceAudioSdl(unsigned int nTracks, unsigned int frequency, unsigned int chunkSize);
|
||||||
|
/// destructor. Use the destroy() method instead
|
||||||
|
virtual ~DeviceAudioSdl();
|
||||||
|
/// stores audio specification
|
||||||
|
SDL_AudioSpec m_spec;
|
||||||
|
/// stores loaded sound samples
|
||||||
|
std::map<unsigned int, _AudioTrack> mm_sample;
|
||||||
|
/// stores maximum sample id
|
||||||
|
unsigned int m_sampleCounter;
|
||||||
|
/// stores whether obtained audio format corresponds to expectations
|
||||||
|
bool m_isDesiredFormat;
|
||||||
|
|
||||||
|
/// stores sounds to be mixed
|
||||||
|
_AudioTrack * ma_sound;
|
||||||
|
/// stores number of parallel tracks
|
||||||
|
unsigned int m_nSound;
|
||||||
|
|
||||||
|
/// output callback
|
||||||
|
static void cbOutput(void *userData, Uint8 *stream, int len);
|
||||||
|
/// advanced mixer method
|
||||||
|
void mixOutputFloat(signed short *outputBuffer, unsigned int nFrames);
|
||||||
|
/// fallback mixer method
|
||||||
|
void mixOutputSInt(Uint8 *stream, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _AUDIO_SDL_H
|
||||||
116
protea.css
Normal file
116
protea.css
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
body {
|
||||||
|
font-family: Helvetica,sans-serif;
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
margin: 30px 50px 50px 50px;
|
||||||
|
text-align: left;
|
||||||
|
width: 640px;
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
color: maroon;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 25px 0px 10px 0px;
|
||||||
|
font-size: 110%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link, a:visited, a:link:active {
|
||||||
|
text-decoration: none;
|
||||||
|
color: maroon;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link:hover, a:visited:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, ul {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background-color: #DDD;
|
||||||
|
width: 100%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CAPTION { font-weight: bold }
|
||||||
|
DIV.qindex {
|
||||||
|
font-size: 90%;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid #b0b0b0;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 2px;
|
||||||
|
line-height: 140%;
|
||||||
|
}
|
||||||
|
|
||||||
|
TD {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
TABLE.mdtable {
|
||||||
|
background-color: #DDD;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
TD.md {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
TD.mdPrefix {
|
||||||
|
color: #606060;
|
||||||
|
}
|
||||||
|
TD.mdname {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #602020;
|
||||||
|
}
|
||||||
|
|
||||||
|
DIV.groupHeader {
|
||||||
|
margin-left: 16px;
|
||||||
|
margin-top: 12px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
|
||||||
|
TD.indexkey {
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right : 10px;
|
||||||
|
padding-top : 2px;
|
||||||
|
padding-left : 10px;
|
||||||
|
padding-bottom : 2px;
|
||||||
|
margin-left : 0px;
|
||||||
|
margin-right : 0px;
|
||||||
|
margin-top : 2px;
|
||||||
|
margin-bottom : 2px;
|
||||||
|
border-top: 1px solid #CCCCCC;
|
||||||
|
border-bottom: 1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
TD.indexvalue {
|
||||||
|
font-style: italic;
|
||||||
|
padding-right : 10px;
|
||||||
|
padding-top : 2px;
|
||||||
|
padding-left : 10px;
|
||||||
|
padding-bottom : 2px;
|
||||||
|
margin-left : 0px;
|
||||||
|
margin-right : 0px;
|
||||||
|
margin-top : 2px;
|
||||||
|
margin-bottom : 2px;
|
||||||
|
border-top: 1px solid #CCCCCC;
|
||||||
|
border-bottom: 1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
TR.memlist {
|
||||||
|
background-color: #DDD;
|
||||||
|
}
|
||||||
|
SPAN.keyword { color: #008000 }
|
||||||
|
SPAN.keywordtype { color: #604020 }
|
||||||
|
SPAN.keywordflow { color: #e08000 }
|
||||||
|
SPAN.comment { color: #800000 }
|
||||||
|
SPAN.preprocessor { color: #806020 }
|
||||||
|
SPAN.stringliteral { color: #002080 }
|
||||||
|
SPAN.charliteral { color: #008080 }
|
||||||
BIN
proteaAudio.png
Normal file
BIN
proteaAudio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
63
readme.txt
Normal file
63
readme.txt
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/**\mainpage
|
||||||
|
|
||||||
|
\section intro Overview
|
||||||
|
proteaAudio is a free cross-platform 2D audio library for C++ and Lua.
|
||||||
|
|
||||||
|
Due to its straightforward interface and minimal open-source code base, proteaAudio is both easy to maintain and use.
|
||||||
|
|
||||||
|
By default proteaAudio internally makes use of the excellent RtAudio low-level realtime audio input/output API, and therefore has no external dependencies apart from standard system libraries. Together with its liberal open-source licensing conditions (zlib style), this makes the integration of proteaAudio into both free and closed-source commercial software very easy. Alternatively, proteaAudio contains optional bindings for the highly portable SDL multimedia library and is therefore also usable on a plentitude of further platforms (e.g., iPhone, BEOS, FreeBSD).
|
||||||
|
|
||||||
|
Despite its minimalistic design, proteaAudio offers advanced features such as dynamic pitch, per-channel volume control, and user-definable time shifts between channels. proteaAudio is capable of handling normal .wav files as well as ogg/vorbis audio samples (via stb_vorbis). Additionally it offers a simple interface for integrating further custom audio format loaders (e.g., .mp3).
|
||||||
|
|
||||||
|
\section features Main features at a glance
|
||||||
|
- clean minimal C++ code base, portable, extendable class design
|
||||||
|
- supports playback of an arbitrary number of parallel mono/stereo sounds
|
||||||
|
- dynamic pitch shifts, panning between the stereo channels, user-definable disparity
|
||||||
|
- low CPU consumption, runs in its own dedicated thread
|
||||||
|
- regularly tested on MS Windows (MinGW/VisualStudio) and Linux (gcc)
|
||||||
|
- loaders for standard wav and ogg/vorbis audio samples included
|
||||||
|
- easily extensible to support further audio sample formats, e.g., mp3
|
||||||
|
- C++ and Lua API
|
||||||
|
- by default makes use of the RtAudio low-level cross-platform audio backend, supporting Windows (DirectSound, ASIO), Linux (ALSA, OSS, JACK), and MacOSX (CoreAudio, JACK)
|
||||||
|
- makes optionally use of libSDL as cross-platform audio backend, supporting various further platforms
|
||||||
|
|
||||||
|
\section download Download
|
||||||
|
- <a href="proteaAudio_src_090204.zip">proteaAudio source code release 2009-02-04</a>
|
||||||
|
- <a href="proteaAudio_lua_090204.zip">proteaAudio Lua Windows/Linux binary release 2009-02-04</a>
|
||||||
|
|
||||||
|
\section documentation Documentation
|
||||||
|
- <a href="annotated.html">C++ API</a>
|
||||||
|
- <a href="proteaaudiolua.html">Lua API</a>
|
||||||
|
- <a href="changelog.html">Changelog</a>
|
||||||
|
|
||||||
|
\section links Links
|
||||||
|
|
||||||
|
proteaAudio internally makes use of the following excellent open-source components:
|
||||||
|
|
||||||
|
- <a href="http://music.mcgill.ca/~gary/rtaudio">RtAudio</a> cross-platform low-level audio library (optional)
|
||||||
|
- <a href="http://www.libsdl.org">SDL</a> cross-platform multimedia layer (optional)
|
||||||
|
- <a href="http://nothings.org/stb_vorbis">stb_vorbis</a> Ogg Vorbis audio decoder
|
||||||
|
|
||||||
|
|
||||||
|
\section license License notice (zlib license):
|
||||||
|
|
||||||
|
(c) 2009 by Gerald Franz, www.viremo.de
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the author be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
-# The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
-# Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
-# This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
7889
rtaudio/RtAudio.cpp
Normal file
7889
rtaudio/RtAudio.cpp
Normal file
File diff suppressed because it is too large
Load Diff
946
rtaudio/RtAudio.h
Normal file
946
rtaudio/RtAudio.h
Normal file
@ -0,0 +1,946 @@
|
|||||||
|
/************************************************************************/
|
||||||
|
/*! \class RtAudio
|
||||||
|
\brief Realtime audio i/o C++ classes.
|
||||||
|
|
||||||
|
RtAudio provides a common API (Application Programming Interface)
|
||||||
|
for realtime audio input/output across Linux (native ALSA, Jack,
|
||||||
|
and OSS), SGI, Macintosh OS X (CoreAudio and Jack), and Windows
|
||||||
|
(DirectSound and ASIO) operating systems.
|
||||||
|
|
||||||
|
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
|
||||||
|
|
||||||
|
RtAudio: realtime audio i/o C++ classes
|
||||||
|
Copyright (c) 2001-2008 Gary P. Scavone
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation files
|
||||||
|
(the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
Any person wishing to distribute modifications to the Software is
|
||||||
|
asked to send the modifications to the original developer so that
|
||||||
|
they can be incorporated into the canonical version. This is,
|
||||||
|
however, not a binding provision of this license.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||||
|
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||||
|
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\file RtAudio.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
// RtAudio: Version 4.0.4
|
||||||
|
|
||||||
|
#ifndef __RTAUDIO_H
|
||||||
|
#define __RTAUDIO_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "RtError.h"
|
||||||
|
|
||||||
|
/*! \typedef typedef unsigned long RtAudioFormat;
|
||||||
|
\brief RtAudio data format type.
|
||||||
|
|
||||||
|
Support for signed integers and floats. Audio data fed to/from an
|
||||||
|
RtAudio stream is assumed to ALWAYS be in host byte order. The
|
||||||
|
internal routines will automatically take care of any necessary
|
||||||
|
byte-swapping between the host format and the soundcard. Thus,
|
||||||
|
endian-ness is not a concern in the following format definitions.
|
||||||
|
|
||||||
|
- \e RTAUDIO_SINT8: 8-bit signed integer.
|
||||||
|
- \e RTAUDIO_SINT16: 16-bit signed integer.
|
||||||
|
- \e RTAUDIO_SINT24: Upper 3 bytes of 32-bit signed integer.
|
||||||
|
- \e RTAUDIO_SINT32: 32-bit signed integer.
|
||||||
|
- \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0.
|
||||||
|
- \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0.
|
||||||
|
*/
|
||||||
|
typedef unsigned long RtAudioFormat;
|
||||||
|
static const RtAudioFormat RTAUDIO_SINT8 = 0x1; // 8-bit signed integer.
|
||||||
|
static const RtAudioFormat RTAUDIO_SINT16 = 0x2; // 16-bit signed integer.
|
||||||
|
static const RtAudioFormat RTAUDIO_SINT24 = 0x4; // Lower 3 bytes of 32-bit signed integer.
|
||||||
|
static const RtAudioFormat RTAUDIO_SINT32 = 0x8; // 32-bit signed integer.
|
||||||
|
static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0.
|
||||||
|
static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0.
|
||||||
|
|
||||||
|
/*! \typedef typedef unsigned long RtAudioStreamFlags;
|
||||||
|
\brief RtAudio stream option flags.
|
||||||
|
|
||||||
|
The following flags can be OR'ed together to allow a client to
|
||||||
|
make changes to the default stream behavior:
|
||||||
|
|
||||||
|
- \e RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).
|
||||||
|
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
|
||||||
|
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
|
||||||
|
|
||||||
|
By default, RtAudio streams pass and receive audio data from the
|
||||||
|
client in an interleaved format. By passing the
|
||||||
|
RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio
|
||||||
|
data will instead be presented in non-interleaved buffers. In
|
||||||
|
this case, each buffer argument in the RtAudioCallback function
|
||||||
|
will point to a single array of data, with \c nFrames samples for
|
||||||
|
each channel concatenated back-to-back. For example, the first
|
||||||
|
sample of data for the second channel would be located at index \c
|
||||||
|
nFrames (assuming the \c buffer pointer was recast to the correct
|
||||||
|
data type for the stream).
|
||||||
|
|
||||||
|
Certain audio APIs offer a number of parameters that influence the
|
||||||
|
I/O latency of a stream. By default, RtAudio will attempt to set
|
||||||
|
these parameters internally for robust (glitch-free) performance
|
||||||
|
(though some APIs, like Windows Direct Sound, make this difficult).
|
||||||
|
By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
|
||||||
|
function, internal stream settings will be influenced in an attempt
|
||||||
|
to minimize stream latency, though possibly at the expense of stream
|
||||||
|
performance.
|
||||||
|
|
||||||
|
If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to
|
||||||
|
open the input and/or output stream device(s) for exclusive use.
|
||||||
|
Note that this is not possible with all supported audio APIs.
|
||||||
|
*/
|
||||||
|
typedef unsigned int RtAudioStreamFlags;
|
||||||
|
static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved).
|
||||||
|
static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency.
|
||||||
|
static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others.
|
||||||
|
|
||||||
|
/*! \typedef typedef unsigned long RtAudioStreamStatus;
|
||||||
|
\brief RtAudio stream status (over- or underflow) flags.
|
||||||
|
|
||||||
|
Notification of a stream over- or underflow is indicated by a
|
||||||
|
non-zero stream \c status argument in the RtAudioCallback function.
|
||||||
|
The stream status can be one of the following two options,
|
||||||
|
depending on whether the stream is open for output and/or input:
|
||||||
|
|
||||||
|
- \e RTAUDIO_INPUT_OVERFLOW: Input data was discarded because of an overflow condition at the driver.
|
||||||
|
- \e RTAUDIO_OUTPUT_UNDERFLOW: The output buffer ran low, likely producing a break in the output sound.
|
||||||
|
*/
|
||||||
|
typedef unsigned int RtAudioStreamStatus;
|
||||||
|
static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1; // Input data was discarded because of an overflow condition at the driver.
|
||||||
|
static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output buffer ran low, likely causing a gap in the output sound.
|
||||||
|
|
||||||
|
//! RtAudio callback function prototype.
|
||||||
|
/*!
|
||||||
|
All RtAudio clients must create a function of type RtAudioCallback
|
||||||
|
to read and/or write data from/to the audio stream. When the
|
||||||
|
underlying audio system is ready for new input or output data, this
|
||||||
|
function will be invoked.
|
||||||
|
|
||||||
|
\param outputBuffer For output (or duplex) streams, the client
|
||||||
|
should write \c nFrames of audio sample frames into this
|
||||||
|
buffer. This argument should be recast to the datatype
|
||||||
|
specified when the stream was opened. For input-only
|
||||||
|
streams, this argument will be NULL.
|
||||||
|
|
||||||
|
\param inputBuffer For input (or duplex) streams, this buffer will
|
||||||
|
hold \c nFrames of input audio sample frames. This
|
||||||
|
argument should be recast to the datatype specified when the
|
||||||
|
stream was opened. For output-only streams, this argument
|
||||||
|
will be NULL.
|
||||||
|
|
||||||
|
\param nFrames The number of sample frames of input or output
|
||||||
|
data in the buffers. The actual buffer size in bytes is
|
||||||
|
dependent on the data type and number of channels in use.
|
||||||
|
|
||||||
|
\param streamTime The number of seconds that have elapsed since the
|
||||||
|
stream was started.
|
||||||
|
|
||||||
|
\param status If non-zero, this argument indicates a data overflow
|
||||||
|
or underflow condition for the stream. The particular
|
||||||
|
condition can be determined by comparison with the
|
||||||
|
RtAudioStreamStatus flags.
|
||||||
|
|
||||||
|
\param userData A pointer to optional data provided by the client
|
||||||
|
when opening the stream (default = NULL).
|
||||||
|
|
||||||
|
To continue normal stream operation, the RtAudioCallback function
|
||||||
|
should return a value of zero. To stop the stream and drain the
|
||||||
|
output buffer, the function should return a value of one. To abort
|
||||||
|
the stream immediately, the client should return a value of two.
|
||||||
|
*/
|
||||||
|
typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
|
||||||
|
unsigned int nFrames,
|
||||||
|
double streamTime,
|
||||||
|
RtAudioStreamStatus status,
|
||||||
|
void *userData );
|
||||||
|
|
||||||
|
|
||||||
|
// **************************************************************** //
|
||||||
|
//
|
||||||
|
// RtAudio class declaration.
|
||||||
|
//
|
||||||
|
// RtAudio is a "controller" used to select an available audio i/o
|
||||||
|
// interface. It presents a common API for the user to call but all
|
||||||
|
// functionality is implemented by the class RtApi and its
|
||||||
|
// subclasses. RtAudio creates an instance of an RtApi subclass
|
||||||
|
// based on the user's API choice. If no choice is made, RtAudio
|
||||||
|
// attempts to make a "logical" API selection.
|
||||||
|
//
|
||||||
|
// **************************************************************** //
|
||||||
|
|
||||||
|
class RtApi;
|
||||||
|
|
||||||
|
class RtAudio
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Audio API specifier arguments.
|
||||||
|
enum Api {
|
||||||
|
UNSPECIFIED, /*!< Search for a working compiled API. */
|
||||||
|
LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */
|
||||||
|
LINUX_OSS, /*!< The Linux Open Sound System API. */
|
||||||
|
UNIX_JACK, /*!< The Jack Low-Latency Audio Server API. */
|
||||||
|
MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */
|
||||||
|
WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */
|
||||||
|
WINDOWS_DS, /*!< The Microsoft Direct Sound API. */
|
||||||
|
RTAUDIO_DUMMY /*!< A compilable but non-functional API. */
|
||||||
|
};
|
||||||
|
|
||||||
|
//! The public device information structure for returning queried values.
|
||||||
|
struct DeviceInfo {
|
||||||
|
bool probed; /*!< true if the device capabilities were successfully probed. */
|
||||||
|
std::string name; /*!< Character string device identifier. */
|
||||||
|
unsigned int outputChannels; /*!< Maximum output channels supported by device. */
|
||||||
|
unsigned int inputChannels; /*!< Maximum input channels supported by device. */
|
||||||
|
unsigned int duplexChannels; /*!< Maximum simultaneous input/output channels supported by device. */
|
||||||
|
bool isDefaultOutput; /*!< true if this is the default output device. */
|
||||||
|
bool isDefaultInput; /*!< true if this is the default input device. */
|
||||||
|
std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
|
||||||
|
RtAudioFormat nativeFormats; /*!< Bit mask of supported data formats. */
|
||||||
|
|
||||||
|
// Default constructor.
|
||||||
|
DeviceInfo()
|
||||||
|
:probed(false), outputChannels(0), inputChannels(0), duplexChannels(0),
|
||||||
|
isDefaultOutput(false), isDefaultInput(false), nativeFormats(0) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! The structure for specifying input or ouput stream parameters.
|
||||||
|
struct StreamParameters {
|
||||||
|
unsigned int deviceId; /*!< Device index (0 to getDeviceCount() - 1). */
|
||||||
|
unsigned int nChannels; /*!< Number of channels. */
|
||||||
|
unsigned int firstChannel; /*!< First channel index on device (default = 0). */
|
||||||
|
|
||||||
|
// Default constructor.
|
||||||
|
StreamParameters()
|
||||||
|
: deviceId(0), nChannels(0), firstChannel(0) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! The structure for specifying stream options.
|
||||||
|
/*!
|
||||||
|
The following flags can be OR'ed together to allow a client to
|
||||||
|
make changes to the default stream behavior:
|
||||||
|
|
||||||
|
- \e RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).
|
||||||
|
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
|
||||||
|
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
|
||||||
|
|
||||||
|
By default, RtAudio streams pass and receive audio data from the
|
||||||
|
client in an interleaved format. By passing the
|
||||||
|
RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio
|
||||||
|
data will instead be presented in non-interleaved buffers. In
|
||||||
|
this case, each buffer argument in the RtAudioCallback function
|
||||||
|
will point to a single array of data, with \c nFrames samples for
|
||||||
|
each channel concatenated back-to-back. For example, the first
|
||||||
|
sample of data for the second channel would be located at index \c
|
||||||
|
nFrames (assuming the \c buffer pointer was recast to the correct
|
||||||
|
data type for the stream).
|
||||||
|
|
||||||
|
Certain audio APIs offer a number of parameters that influence the
|
||||||
|
I/O latency of a stream. By default, RtAudio will attempt to set
|
||||||
|
these parameters internally for robust (glitch-free) performance
|
||||||
|
(though some APIs, like Windows Direct Sound, make this difficult).
|
||||||
|
By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
|
||||||
|
function, internal stream settings will be influenced in an attempt
|
||||||
|
to minimize stream latency, though possibly at the expense of stream
|
||||||
|
performance.
|
||||||
|
|
||||||
|
If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to
|
||||||
|
open the input and/or output stream device(s) for exclusive use.
|
||||||
|
Note that this is not possible with all supported audio APIs.
|
||||||
|
|
||||||
|
The \c numberOfBuffers parameter can be used to control stream
|
||||||
|
latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs
|
||||||
|
only. A value of two is usually the smallest allowed. Larger
|
||||||
|
numbers can potentially result in more robust stream performance,
|
||||||
|
though likely at the cost of stream latency. The value set by the
|
||||||
|
user is replaced during execution of the RtAudio::openStream()
|
||||||
|
function by the value actually used by the system.
|
||||||
|
|
||||||
|
The \c streamName parameter can be used to set the client name
|
||||||
|
when using the Jack API. By default, the client name is set to
|
||||||
|
RtApiJack. However, if you wish to create multiple instances of
|
||||||
|
RtAudio with Jack, each instance must have a unique client name.
|
||||||
|
*/
|
||||||
|
struct StreamOptions {
|
||||||
|
RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE). */
|
||||||
|
unsigned int numberOfBuffers; /*!< Number of stream buffers. */
|
||||||
|
std::string streamName; /*!< A stream name (currently used only in Jack). */
|
||||||
|
|
||||||
|
// Default constructor.
|
||||||
|
StreamOptions()
|
||||||
|
: flags(0), numberOfBuffers(0) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! A static function to determine the available compiled audio APIs.
|
||||||
|
/*!
|
||||||
|
The values returned in the std::vector can be compared against
|
||||||
|
the enumerated list values. Note that there can be more than one
|
||||||
|
API compiled for certain operating systems.
|
||||||
|
*/
|
||||||
|
static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw();
|
||||||
|
|
||||||
|
//! The class constructor.
|
||||||
|
/*!
|
||||||
|
The constructor performs minor initialization tasks. No exceptions
|
||||||
|
can be thrown.
|
||||||
|
|
||||||
|
If no API argument is specified and multiple API support has been
|
||||||
|
compiled, the default order of use is JACK, ALSA, OSS (Linux
|
||||||
|
systems) and ASIO, DS (Windows systems).
|
||||||
|
*/
|
||||||
|
RtAudio( RtAudio::Api api=UNSPECIFIED ) throw();
|
||||||
|
|
||||||
|
//! The destructor.
|
||||||
|
/*!
|
||||||
|
If a stream is running or open, it will be stopped and closed
|
||||||
|
automatically.
|
||||||
|
*/
|
||||||
|
~RtAudio() throw();
|
||||||
|
|
||||||
|
//! Returns the audio API specifier for the current instance of RtAudio.
|
||||||
|
RtAudio::Api getCurrentApi( void ) throw();
|
||||||
|
|
||||||
|
//! A public function that queries for the number of audio devices available.
|
||||||
|
/*!
|
||||||
|
This function performs a system query of available devices each time it
|
||||||
|
is called, thus supporting devices connected \e after instantiation. If
|
||||||
|
a system error occurs during processing, a warning will be issued.
|
||||||
|
*/
|
||||||
|
unsigned int getDeviceCount( void ) throw();
|
||||||
|
|
||||||
|
//! Return an RtAudio::DeviceInfo structure for a specified device number.
|
||||||
|
/*!
|
||||||
|
|
||||||
|
Any device integer between 0 and getDeviceCount() - 1 is valid.
|
||||||
|
If an invalid argument is provided, an RtError (type = INVALID_USE)
|
||||||
|
will be thrown. If a device is busy or otherwise unavailable, the
|
||||||
|
structure member "probed" will have a value of "false" and all
|
||||||
|
other members are undefined. If the specified device is the
|
||||||
|
current default input or output device, the corresponding
|
||||||
|
"isDefault" member will have a value of "true".
|
||||||
|
*/
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
|
||||||
|
//! A function that returns the index of the default output device.
|
||||||
|
/*!
|
||||||
|
If the underlying audio API does not provide a "default
|
||||||
|
device", or if no devices are available, the return value will be
|
||||||
|
0. Note that this is a valid device identifier and it is the
|
||||||
|
client's responsibility to verify that a device is available
|
||||||
|
before attempting to open a stream.
|
||||||
|
*/
|
||||||
|
unsigned int getDefaultOutputDevice( void ) throw();
|
||||||
|
|
||||||
|
//! A function that returns the index of the default input device.
|
||||||
|
/*!
|
||||||
|
If the underlying audio API does not provide a "default
|
||||||
|
device", or if no devices are available, the return value will be
|
||||||
|
0. Note that this is a valid device identifier and it is the
|
||||||
|
client's responsibility to verify that a device is available
|
||||||
|
before attempting to open a stream.
|
||||||
|
*/
|
||||||
|
unsigned int getDefaultInputDevice( void ) throw();
|
||||||
|
|
||||||
|
//! A public function for opening a stream with the specified parameters.
|
||||||
|
/*!
|
||||||
|
An RtError (type = SYSTEM_ERROR) is thrown if a stream cannot be
|
||||||
|
opened with the specified parameters or an error occurs during
|
||||||
|
processing. An RtError (type = INVALID_USE) is thrown if any
|
||||||
|
invalid device ID or channel number parameters are specified.
|
||||||
|
|
||||||
|
\param outputParameters Specifies output stream parameters to use
|
||||||
|
when opening a stream, including a device ID, number of channels,
|
||||||
|
and starting channel number. For input-only streams, this
|
||||||
|
argument should be NULL. The device ID is an index value between
|
||||||
|
0 and getDeviceCount() - 1.
|
||||||
|
\param inputParameters Specifies input stream parameters to use
|
||||||
|
when opening a stream, including a device ID, number of channels,
|
||||||
|
and starting channel number. For output-only streams, this
|
||||||
|
argument should be NULL. The device ID is an index value between
|
||||||
|
0 and getDeviceCount() - 1.
|
||||||
|
\param format An RtAudioFormat specifying the desired sample data format.
|
||||||
|
\param sampleRate The desired sample rate (sample frames per second).
|
||||||
|
\param *bufferFrames A pointer to a value indicating the desired
|
||||||
|
internal buffer size in sample frames. The actual value
|
||||||
|
used by the device is returned via the same pointer. A
|
||||||
|
value of zero can be specified, in which case the lowest
|
||||||
|
allowable value is determined.
|
||||||
|
\param callback A client-defined function that will be invoked
|
||||||
|
when input data is available and/or output data is needed.
|
||||||
|
\param userData An optional pointer to data that can be accessed
|
||||||
|
from within the callback function.
|
||||||
|
\param options An optional pointer to a structure containing various
|
||||||
|
global stream options, including a list of OR'ed RtAudioStreamFlags
|
||||||
|
and a suggested number of stream buffers that can be used to
|
||||||
|
control stream latency. More buffers typically result in more
|
||||||
|
robust performance, though at a cost of greater latency. If a
|
||||||
|
value of zero is specified, a system-specific median value is
|
||||||
|
chosen. If the RTAUDIO_MINIMIZE_LATENCY flag bit is set, the
|
||||||
|
lowest allowable value is used. The actual value used is
|
||||||
|
returned via the structure argument. The parameter is API dependent.
|
||||||
|
*/
|
||||||
|
void openStream( RtAudio::StreamParameters *outputParameters,
|
||||||
|
RtAudio::StreamParameters *inputParameters,
|
||||||
|
RtAudioFormat format, unsigned int sampleRate,
|
||||||
|
unsigned int *bufferFrames, RtAudioCallback callback,
|
||||||
|
void *userData = NULL, RtAudio::StreamOptions *options = NULL );
|
||||||
|
|
||||||
|
//! A function that closes a stream and frees any associated stream memory.
|
||||||
|
/*!
|
||||||
|
If a stream is not open, this function issues a warning and
|
||||||
|
returns (no exception is thrown).
|
||||||
|
*/
|
||||||
|
void closeStream( void ) throw();
|
||||||
|
|
||||||
|
//! A function that starts a stream.
|
||||||
|
/*!
|
||||||
|
An RtError (type = SYSTEM_ERROR) is thrown if an error occurs
|
||||||
|
during processing. An RtError (type = INVALID_USE) is thrown if a
|
||||||
|
stream is not open. A warning is issued if the stream is already
|
||||||
|
running.
|
||||||
|
*/
|
||||||
|
void startStream( void );
|
||||||
|
|
||||||
|
//! Stop a stream, allowing any samples remaining in the output queue to be played.
|
||||||
|
/*!
|
||||||
|
An RtError (type = SYSTEM_ERROR) is thrown if an error occurs
|
||||||
|
during processing. An RtError (type = INVALID_USE) is thrown if a
|
||||||
|
stream is not open. A warning is issued if the stream is already
|
||||||
|
stopped.
|
||||||
|
*/
|
||||||
|
void stopStream( void );
|
||||||
|
|
||||||
|
//! Stop a stream, discarding any samples remaining in the input/output queue.
|
||||||
|
/*!
|
||||||
|
An RtError (type = SYSTEM_ERROR) is thrown if an error occurs
|
||||||
|
during processing. An RtError (type = INVALID_USE) is thrown if a
|
||||||
|
stream is not open. A warning is issued if the stream is already
|
||||||
|
stopped.
|
||||||
|
*/
|
||||||
|
void abortStream( void );
|
||||||
|
|
||||||
|
//! Returns true if a stream is open and false if not.
|
||||||
|
bool isStreamOpen( void ) throw();
|
||||||
|
|
||||||
|
//! Returns true if the stream is running and false if it is stopped or not open.
|
||||||
|
bool isStreamRunning( void ) throw();
|
||||||
|
|
||||||
|
//! Returns the number of elapsed seconds since the stream was started.
|
||||||
|
/*!
|
||||||
|
If a stream is not open, an RtError (type = INVALID_USE) will be thrown.
|
||||||
|
*/
|
||||||
|
double getStreamTime( void );
|
||||||
|
|
||||||
|
//! Returns the internal stream latency in sample frames.
|
||||||
|
/*!
|
||||||
|
The stream latency refers to delay in audio input and/or output
|
||||||
|
caused by internal buffering by the audio system and/or hardware.
|
||||||
|
For duplex streams, the returned value will represent the sum of
|
||||||
|
the input and output latencies. If a stream is not open, an
|
||||||
|
RtError (type = INVALID_USE) will be thrown. If the API does not
|
||||||
|
report latency, the return value will be zero.
|
||||||
|
*/
|
||||||
|
long getStreamLatency( void );
|
||||||
|
|
||||||
|
//! Specify whether warning messages should be printed to stderr.
|
||||||
|
void showWarnings( bool value = true ) throw();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void openRtApi( RtAudio::Api api );
|
||||||
|
RtApi *rtapi_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Operating system dependent thread functionality.
|
||||||
|
#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)
|
||||||
|
#include <windows.h>
|
||||||
|
#include <process.h>
|
||||||
|
|
||||||
|
typedef unsigned long ThreadHandle;
|
||||||
|
typedef CRITICAL_SECTION StreamMutex;
|
||||||
|
|
||||||
|
#elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
|
||||||
|
// Using pthread library for various flavors of unix.
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
typedef pthread_t ThreadHandle;
|
||||||
|
typedef pthread_mutex_t StreamMutex;
|
||||||
|
|
||||||
|
#else // Setup for "dummy" behavior
|
||||||
|
|
||||||
|
#define __RTAUDIO_DUMMY__
|
||||||
|
typedef int ThreadHandle;
|
||||||
|
typedef int StreamMutex;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// This global structure type is used to pass callback information
|
||||||
|
// between the private RtAudio stream structure and global callback
|
||||||
|
// handling functions.
|
||||||
|
struct CallbackInfo {
|
||||||
|
void *object; // Used as a "this" pointer.
|
||||||
|
ThreadHandle thread;
|
||||||
|
void *callback;
|
||||||
|
void *userData;
|
||||||
|
void *apiInfo; // void pointer for API specific callback information
|
||||||
|
bool isRunning;
|
||||||
|
|
||||||
|
// Default constructor.
|
||||||
|
CallbackInfo()
|
||||||
|
:object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// **************************************************************** //
|
||||||
|
//
|
||||||
|
// RtApi class declaration.
|
||||||
|
//
|
||||||
|
// Subclasses of RtApi contain all API- and OS-specific code necessary
|
||||||
|
// to fully implement the RtAudio API.
|
||||||
|
//
|
||||||
|
// Note that RtApi is an abstract base class and cannot be
|
||||||
|
// explicitly instantiated. The class RtAudio will create an
|
||||||
|
// instance of an RtApi subclass (RtApiOss, RtApiAlsa,
|
||||||
|
// RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio).
|
||||||
|
//
|
||||||
|
// **************************************************************** //
|
||||||
|
|
||||||
|
#if defined( HAVE_GETTIMEOFDAY )
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
class RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApi();
|
||||||
|
virtual ~RtApi();
|
||||||
|
virtual RtAudio::Api getCurrentApi( void ) = 0;
|
||||||
|
virtual unsigned int getDeviceCount( void ) = 0;
|
||||||
|
virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
|
||||||
|
virtual unsigned int getDefaultInputDevice( void );
|
||||||
|
virtual unsigned int getDefaultOutputDevice( void );
|
||||||
|
void openStream( RtAudio::StreamParameters *outputParameters,
|
||||||
|
RtAudio::StreamParameters *inputParameters,
|
||||||
|
RtAudioFormat format, unsigned int sampleRate,
|
||||||
|
unsigned int *bufferFrames, RtAudioCallback callback,
|
||||||
|
void *userData, RtAudio::StreamOptions *options );
|
||||||
|
virtual void closeStream( void );
|
||||||
|
virtual void startStream( void ) = 0;
|
||||||
|
virtual void stopStream( void ) = 0;
|
||||||
|
virtual void abortStream( void ) = 0;
|
||||||
|
long getStreamLatency( void );
|
||||||
|
virtual double getStreamTime( void );
|
||||||
|
bool isStreamOpen( void ) { return stream_.state != STREAM_CLOSED; };
|
||||||
|
bool isStreamRunning( void ) { return stream_.state == STREAM_RUNNING; };
|
||||||
|
void showWarnings( bool value ) { showWarnings_ = value; };
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static const unsigned int MAX_SAMPLE_RATES;
|
||||||
|
static const unsigned int SAMPLE_RATES[];
|
||||||
|
|
||||||
|
enum { FAILURE, SUCCESS };
|
||||||
|
|
||||||
|
enum StreamState {
|
||||||
|
STREAM_STOPPED,
|
||||||
|
STREAM_RUNNING,
|
||||||
|
STREAM_CLOSED = -50
|
||||||
|
};
|
||||||
|
|
||||||
|
enum StreamMode {
|
||||||
|
OUTPUT,
|
||||||
|
INPUT,
|
||||||
|
DUPLEX,
|
||||||
|
UNINITIALIZED = -75
|
||||||
|
};
|
||||||
|
|
||||||
|
// A protected structure used for buffer conversion.
|
||||||
|
struct ConvertInfo {
|
||||||
|
int channels;
|
||||||
|
int inJump, outJump;
|
||||||
|
RtAudioFormat inFormat, outFormat;
|
||||||
|
std::vector<int> inOffset;
|
||||||
|
std::vector<int> outOffset;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A protected structure for audio streams.
|
||||||
|
struct RtApiStream {
|
||||||
|
unsigned int device[2]; // Playback and record, respectively.
|
||||||
|
void *apiHandle; // void pointer for API specific stream handle information
|
||||||
|
StreamMode mode; // OUTPUT, INPUT, or DUPLEX.
|
||||||
|
StreamState state; // STOPPED, RUNNING, or CLOSED
|
||||||
|
char *userBuffer[2]; // Playback and record, respectively.
|
||||||
|
char *deviceBuffer;
|
||||||
|
bool doConvertBuffer[2]; // Playback and record, respectively.
|
||||||
|
bool userInterleaved;
|
||||||
|
bool deviceInterleaved[2]; // Playback and record, respectively.
|
||||||
|
bool doByteSwap[2]; // Playback and record, respectively.
|
||||||
|
unsigned int sampleRate;
|
||||||
|
unsigned int bufferSize;
|
||||||
|
unsigned int nBuffers;
|
||||||
|
unsigned int nUserChannels[2]; // Playback and record, respectively.
|
||||||
|
unsigned int nDeviceChannels[2]; // Playback and record channels, respectively.
|
||||||
|
unsigned int channelOffset[2]; // Playback and record, respectively.
|
||||||
|
unsigned long latency[2]; // Playback and record, respectively.
|
||||||
|
RtAudioFormat userFormat;
|
||||||
|
RtAudioFormat deviceFormat[2]; // Playback and record, respectively.
|
||||||
|
StreamMutex mutex;
|
||||||
|
CallbackInfo callbackInfo;
|
||||||
|
ConvertInfo convertInfo[2];
|
||||||
|
double streamTime; // Number of elapsed seconds since the stream started.
|
||||||
|
|
||||||
|
#if defined(HAVE_GETTIMEOFDAY)
|
||||||
|
struct timeval lastTickTimestamp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RtApiStream()
|
||||||
|
:apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef signed short Int16;
|
||||||
|
typedef signed int Int32;
|
||||||
|
typedef float Float32;
|
||||||
|
typedef double Float64;
|
||||||
|
|
||||||
|
std::ostringstream errorStream_;
|
||||||
|
std::string errorText_;
|
||||||
|
bool showWarnings_;
|
||||||
|
RtApiStream stream_;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Protected, api-specific method that attempts to open a device
|
||||||
|
with the given parameters. This function MUST be implemented by
|
||||||
|
all subclasses. If an error is encountered during the probe, a
|
||||||
|
"warning" message is reported and FAILURE is returned. A
|
||||||
|
successful probe is indicated by a return value of SUCCESS.
|
||||||
|
*/
|
||||||
|
virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
|
||||||
|
//! A protected function used to increment the stream time.
|
||||||
|
void tickStreamTime( void );
|
||||||
|
|
||||||
|
//! Protected common method to clear an RtApiStream structure.
|
||||||
|
void clearStreamInfo();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Protected common method that throws an RtError (type =
|
||||||
|
INVALID_USE) if a stream is not open.
|
||||||
|
*/
|
||||||
|
void verifyStream( void );
|
||||||
|
|
||||||
|
//! Protected common error method to allow global control over error handling.
|
||||||
|
void error( RtError::Type type );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Protected method used to perform format, channel number, and/or interleaving
|
||||||
|
conversions between the user and device buffers.
|
||||||
|
*/
|
||||||
|
void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
|
||||||
|
|
||||||
|
//! Protected common method used to perform byte-swapping on buffers.
|
||||||
|
void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format );
|
||||||
|
|
||||||
|
//! Protected common method that returns the number of bytes for a given format.
|
||||||
|
unsigned int formatBytes( RtAudioFormat format );
|
||||||
|
|
||||||
|
//! Protected common method that sets up the parameters for buffer conversion.
|
||||||
|
void setConvertInfo( StreamMode mode, unsigned int firstChannel );
|
||||||
|
};
|
||||||
|
|
||||||
|
// **************************************************************** //
|
||||||
|
//
|
||||||
|
// Inline RtAudio definitions.
|
||||||
|
//
|
||||||
|
// **************************************************************** //
|
||||||
|
|
||||||
|
inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
|
||||||
|
inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); }
|
||||||
|
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
|
||||||
|
inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); }
|
||||||
|
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); }
|
||||||
|
inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); }
|
||||||
|
inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
|
||||||
|
inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
|
||||||
|
inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
|
||||||
|
inline bool RtAudio :: isStreamOpen( void ) throw() { return rtapi_->isStreamOpen(); }
|
||||||
|
inline bool RtAudio :: isStreamRunning( void ) throw() { return rtapi_->isStreamRunning(); }
|
||||||
|
inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
|
||||||
|
inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
|
||||||
|
inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); }
|
||||||
|
|
||||||
|
// RtApi Subclass prototypes.
|
||||||
|
|
||||||
|
#if defined(__MACOSX_CORE__)
|
||||||
|
|
||||||
|
#include <CoreAudio/AudioHardware.h>
|
||||||
|
|
||||||
|
class RtApiCore: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiCore();
|
||||||
|
~RtApiCore();
|
||||||
|
RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
unsigned int getDefaultOutputDevice( void );
|
||||||
|
unsigned int getDefaultInputDevice( void );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
long getStreamLatency( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
bool callbackEvent( AudioDeviceID deviceId,
|
||||||
|
const AudioBufferList *inBufferList,
|
||||||
|
const AudioBufferList *outBufferList );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
static const char* getErrorCode( OSStatus code );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__UNIX_JACK__)
|
||||||
|
|
||||||
|
class RtApiJack: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiJack();
|
||||||
|
~RtApiJack();
|
||||||
|
RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
long getStreamLatency( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
bool callbackEvent( unsigned long nframes );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WINDOWS_ASIO__)
|
||||||
|
|
||||||
|
class RtApiAsio: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiAsio();
|
||||||
|
~RtApiAsio();
|
||||||
|
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
long getStreamLatency( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
bool callbackEvent( long bufferIndex );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::vector<RtAudio::DeviceInfo> devices_;
|
||||||
|
void saveDeviceInfo( void );
|
||||||
|
bool coInitialized_;
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WINDOWS_DS__)
|
||||||
|
|
||||||
|
class RtApiDs: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiDs();
|
||||||
|
~RtApiDs();
|
||||||
|
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
unsigned int getDefaultOutputDevice( void );
|
||||||
|
unsigned int getDefaultInputDevice( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
long getStreamLatency( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
void callbackEvent( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool coInitialized_;
|
||||||
|
bool buffersRolling;
|
||||||
|
long duplexPrerollBytes;
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__LINUX_ALSA__)
|
||||||
|
|
||||||
|
class RtApiAlsa: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiAlsa();
|
||||||
|
~RtApiAlsa();
|
||||||
|
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
void callbackEvent( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::vector<RtAudio::DeviceInfo> devices_;
|
||||||
|
void saveDeviceInfo( void );
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__LINUX_OSS__)
|
||||||
|
|
||||||
|
class RtApiOss: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiOss();
|
||||||
|
~RtApiOss();
|
||||||
|
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; };
|
||||||
|
unsigned int getDeviceCount( void );
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
|
||||||
|
void closeStream( void );
|
||||||
|
void startStream( void );
|
||||||
|
void stopStream( void );
|
||||||
|
void abortStream( void );
|
||||||
|
|
||||||
|
// This function is intended for internal use only. It must be
|
||||||
|
// public because it is called by the internal callback handler,
|
||||||
|
// which is not a member of RtAudio. External use of this function
|
||||||
|
// will most likely produce highly undesireable results!
|
||||||
|
void callbackEvent( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__RTAUDIO_DUMMY__)
|
||||||
|
|
||||||
|
class RtApiDummy: public RtApi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtError::WARNING ); };
|
||||||
|
RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; };
|
||||||
|
unsigned int getDeviceCount( void ) { return 0; };
|
||||||
|
RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) { RtAudio::DeviceInfo info; return info; };
|
||||||
|
void closeStream( void ) {};
|
||||||
|
void startStream( void ) {};
|
||||||
|
void stopStream( void ) {};
|
||||||
|
void abortStream( void ) {};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
|
||||||
|
unsigned int firstChannel, unsigned int sampleRate,
|
||||||
|
RtAudioFormat format, unsigned int *bufferSize,
|
||||||
|
RtAudio::StreamOptions *options ) { return false; };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Indentation settings for Vim and Emacs
|
||||||
|
//
|
||||||
|
// Local Variables:
|
||||||
|
// c-basic-offset: 2
|
||||||
|
// indent-tabs-mode: nil
|
||||||
|
// End:
|
||||||
|
//
|
||||||
|
// vim: et sts=2 sw=2
|
||||||
61
rtaudio/RtError.h
Normal file
61
rtaudio/RtError.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/************************************************************************/
|
||||||
|
/*! \class RtError
|
||||||
|
\brief Exception handling class for RtAudio & RtMidi.
|
||||||
|
|
||||||
|
The RtError class is quite simple but it does allow errors to be
|
||||||
|
"caught" by RtError::Type. See the RtAudio and RtMidi
|
||||||
|
documentation to know which methods can throw an RtError.
|
||||||
|
|
||||||
|
*/
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
#ifndef RTERROR_H
|
||||||
|
#define RTERROR_H
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
//#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
class RtError : public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Defined RtError types.
|
||||||
|
enum Type {
|
||||||
|
WARNING, /*!< A non-critical error. */
|
||||||
|
DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */
|
||||||
|
UNSPECIFIED, /*!< The default, unspecified error type. */
|
||||||
|
NO_DEVICES_FOUND, /*!< No devices found on system. */
|
||||||
|
INVALID_DEVICE, /*!< An invalid device ID was specified. */
|
||||||
|
MEMORY_ERROR, /*!< An error occured during memory allocation. */
|
||||||
|
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
|
||||||
|
INVALID_USE, /*!< The function was called incorrectly. */
|
||||||
|
DRIVER_ERROR, /*!< A system driver error occured. */
|
||||||
|
SYSTEM_ERROR, /*!< A system error occured. */
|
||||||
|
THREAD_ERROR /*!< A thread error occured. */
|
||||||
|
};
|
||||||
|
|
||||||
|
//! The constructor.
|
||||||
|
RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
|
||||||
|
|
||||||
|
//! The destructor.
|
||||||
|
virtual ~RtError( void ) throw() {}
|
||||||
|
|
||||||
|
//! Prints thrown error message to stderr.
|
||||||
|
virtual void printMessage( ) throw() { std::fprintf(stderr,"%s\n", message_.c_str()); }
|
||||||
|
|
||||||
|
//! Returns the thrown error message type.
|
||||||
|
virtual const Type& getType(void) throw() { return type_; }
|
||||||
|
|
||||||
|
//! Returns the thrown error message string.
|
||||||
|
virtual const std::string& getMessage(void) throw() { return message_; }
|
||||||
|
|
||||||
|
//! Returns the thrown error message as a c-style string.
|
||||||
|
virtual const char* what( void ) const throw() { return message_.c_str(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string message_;
|
||||||
|
Type type_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
257
rtaudio/include/asio.cpp
Normal file
257
rtaudio/include/asio.cpp
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
/*
|
||||||
|
Steinberg Audio Stream I/O API
|
||||||
|
(c) 1996, Steinberg Soft- und Hardware GmbH
|
||||||
|
|
||||||
|
asio.cpp
|
||||||
|
|
||||||
|
asio functions entries which translate the
|
||||||
|
asio interface to the asiodrvr class methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "asiosys.h" // platform definition
|
||||||
|
#include "asio.h"
|
||||||
|
|
||||||
|
#if MAC
|
||||||
|
#include "asiodrvr.h"
|
||||||
|
|
||||||
|
#pragma export on
|
||||||
|
|
||||||
|
AsioDriver *theAsioDriver = 0;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
|
long main()
|
||||||
|
{
|
||||||
|
return 'ASIO';
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif WINDOWS
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
#include "iasiodrv.h"
|
||||||
|
#include "asiodrivers.h"
|
||||||
|
|
||||||
|
IASIO *theAsioDriver = 0;
|
||||||
|
extern AsioDrivers *asioDrivers;
|
||||||
|
|
||||||
|
#elif SGI || SUN || BEOS || LINUX
|
||||||
|
#include "asiodrvr.h"
|
||||||
|
static AsioDriver *theAsioDriver = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------------
|
||||||
|
ASIOError ASIOInit(ASIODriverInfo *info)
|
||||||
|
{
|
||||||
|
#if MAC || SGI || SUN || BEOS || LINUX
|
||||||
|
if(theAsioDriver)
|
||||||
|
{
|
||||||
|
delete theAsioDriver;
|
||||||
|
theAsioDriver = 0;
|
||||||
|
}
|
||||||
|
info->driverVersion = 0;
|
||||||
|
strcpy(info->name, "No ASIO Driver");
|
||||||
|
theAsioDriver = getDriver();
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
strcpy(info->errorMessage, "Not enough memory for the ASIO driver!");
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
if(!theAsioDriver->init(info->sysRef))
|
||||||
|
{
|
||||||
|
theAsioDriver->getErrorMessage(info->errorMessage);
|
||||||
|
delete theAsioDriver;
|
||||||
|
theAsioDriver = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
strcpy(info->errorMessage, "No ASIO Driver Error");
|
||||||
|
theAsioDriver->getDriverName(info->name);
|
||||||
|
info->driverVersion = theAsioDriver->getDriverVersion();
|
||||||
|
return ASE_OK;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
info->driverVersion = 0;
|
||||||
|
strcpy(info->name, "No ASIO Driver");
|
||||||
|
if(theAsioDriver) // must be loaded!
|
||||||
|
{
|
||||||
|
if(!theAsioDriver->init(info->sysRef))
|
||||||
|
{
|
||||||
|
theAsioDriver->getErrorMessage(info->errorMessage);
|
||||||
|
theAsioDriver = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(info->errorMessage, "No ASIO Driver Error");
|
||||||
|
theAsioDriver->getDriverName(info->name);
|
||||||
|
info->driverVersion = theAsioDriver->getDriverVersion();
|
||||||
|
return ASE_OK;
|
||||||
|
}
|
||||||
|
return ASE_NotPresent;
|
||||||
|
|
||||||
|
#endif // !MAC
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOExit(void)
|
||||||
|
{
|
||||||
|
if(theAsioDriver)
|
||||||
|
{
|
||||||
|
#if WINDOWS
|
||||||
|
asioDrivers->removeCurrentDriver();
|
||||||
|
#else
|
||||||
|
delete theAsioDriver;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
theAsioDriver = 0;
|
||||||
|
return ASE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOStart(void)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOStop(void)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetChannels(long *numInputChannels, long *numOutputChannels)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
*numInputChannels = *numOutputChannels = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->getChannels(numInputChannels, numOutputChannels);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetLatencies(long *inputLatency, long *outputLatency)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
*inputLatency = *outputLatency = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->getLatencies(inputLatency, outputLatency);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
*minSize = *maxSize = *preferredSize = *granularity = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->getBufferSize(minSize, maxSize, preferredSize, granularity);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOCanSampleRate(ASIOSampleRate sampleRate)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->canSampleRate(sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetSampleRate(ASIOSampleRate *currentRate)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->getSampleRate(currentRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOSetSampleRate(ASIOSampleRate sampleRate)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->setSampleRate(sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetClockSources(ASIOClockSource *clocks, long *numSources)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
*numSources = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->getClockSources(clocks, numSources);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOSetClockSource(long reference)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->setClockSource(reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->getSamplePosition(sPos, tStamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOGetChannelInfo(ASIOChannelInfo *info)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
info->channelGroup = -1;
|
||||||
|
info->type = ASIOSTInt16MSB;
|
||||||
|
strcpy(info->name, "None");
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->getChannelInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOCreateBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
|
||||||
|
long bufferSize, ASIOCallbacks *callbacks)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
{
|
||||||
|
ASIOBufferInfo *info = bufferInfos;
|
||||||
|
for(long i = 0; i < numChannels; i++, info++)
|
||||||
|
info->buffers[0] = info->buffers[1] = 0;
|
||||||
|
return ASE_NotPresent;
|
||||||
|
}
|
||||||
|
return theAsioDriver->createBuffers(bufferInfos, numChannels, bufferSize, callbacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIODisposeBuffers(void)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->disposeBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOControlPanel(void)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->controlPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOFuture(long selector, void *opt)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->future(selector, opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError ASIOOutputReady(void)
|
||||||
|
{
|
||||||
|
if(!theAsioDriver)
|
||||||
|
return ASE_NotPresent;
|
||||||
|
return theAsioDriver->outputReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MAC
|
||||||
|
} // extern "C"
|
||||||
|
#pragma export off
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
1054
rtaudio/include/asio.h
Normal file
1054
rtaudio/include/asio.h
Normal file
File diff suppressed because it is too large
Load Diff
186
rtaudio/include/asiodrivers.cpp
Normal file
186
rtaudio/include/asiodrivers.cpp
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include "asiodrivers.h"
|
||||||
|
|
||||||
|
AsioDrivers* asioDrivers = 0;
|
||||||
|
|
||||||
|
bool loadAsioDriver(char *name);
|
||||||
|
|
||||||
|
bool loadAsioDriver(char *name)
|
||||||
|
{
|
||||||
|
if(!asioDrivers)
|
||||||
|
asioDrivers = new AsioDrivers();
|
||||||
|
if(asioDrivers)
|
||||||
|
return asioDrivers->loadDriver(name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if MAC
|
||||||
|
|
||||||
|
bool resolveASIO(unsigned long aconnID);
|
||||||
|
|
||||||
|
AsioDrivers::AsioDrivers() : CodeFragments("ASIO Drivers", 'AsDr', 'Asio')
|
||||||
|
{
|
||||||
|
connID = -1;
|
||||||
|
curIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsioDrivers::~AsioDrivers()
|
||||||
|
{
|
||||||
|
removeCurrentDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::getCurrentDriverName(char *name)
|
||||||
|
{
|
||||||
|
if(curIndex >= 0)
|
||||||
|
return getName(curIndex, name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
|
||||||
|
{
|
||||||
|
for(long i = 0; i < getNumFragments() && i < maxDrivers; i++)
|
||||||
|
getName(i, names[i]);
|
||||||
|
return getNumFragments() < maxDrivers ? getNumFragments() : maxDrivers;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::loadDriver(char *name)
|
||||||
|
{
|
||||||
|
char dname[64];
|
||||||
|
unsigned long newID;
|
||||||
|
|
||||||
|
for(long i = 0; i < getNumFragments(); i++)
|
||||||
|
{
|
||||||
|
if(getName(i, dname) && !strcmp(name, dname))
|
||||||
|
{
|
||||||
|
if(newInstance(i, &newID))
|
||||||
|
{
|
||||||
|
if(resolveASIO(newID))
|
||||||
|
{
|
||||||
|
if(connID != -1)
|
||||||
|
removeInstance(curIndex, connID);
|
||||||
|
curIndex = i;
|
||||||
|
connID = newID;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsioDrivers::removeCurrentDriver()
|
||||||
|
{
|
||||||
|
if(connID != -1)
|
||||||
|
removeInstance(curIndex, connID);
|
||||||
|
connID = -1;
|
||||||
|
curIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#elif WINDOWS
|
||||||
|
|
||||||
|
#include "iasiodrv.h"
|
||||||
|
|
||||||
|
extern IASIO* theAsioDriver;
|
||||||
|
|
||||||
|
AsioDrivers::AsioDrivers() : AsioDriverList()
|
||||||
|
{
|
||||||
|
curIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsioDrivers::~AsioDrivers()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::getCurrentDriverName(char *name)
|
||||||
|
{
|
||||||
|
if(curIndex >= 0)
|
||||||
|
return asioGetDriverName(curIndex, name, 32) == 0 ? true : false;
|
||||||
|
name[0] = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
|
||||||
|
{
|
||||||
|
for(long i = 0; i < asioGetNumDev() && i < maxDrivers; i++)
|
||||||
|
asioGetDriverName(i, names[i], 32);
|
||||||
|
return asioGetNumDev() < maxDrivers ? asioGetNumDev() : maxDrivers;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::loadDriver(char *name)
|
||||||
|
{
|
||||||
|
char dname[64];
|
||||||
|
char curName[64];
|
||||||
|
|
||||||
|
for(long i = 0; i < asioGetNumDev(); i++)
|
||||||
|
{
|
||||||
|
if(!asioGetDriverName(i, dname, 32) && !strcmp(name, dname))
|
||||||
|
{
|
||||||
|
curName[0] = 0;
|
||||||
|
getCurrentDriverName(curName); // in case we fail...
|
||||||
|
removeCurrentDriver();
|
||||||
|
|
||||||
|
if(!asioOpenDriver(i, (void **)&theAsioDriver))
|
||||||
|
{
|
||||||
|
curIndex = i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theAsioDriver = 0;
|
||||||
|
if(curName[0] && strcmp(dname, curName))
|
||||||
|
loadDriver(curName); // try restore
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsioDrivers::removeCurrentDriver()
|
||||||
|
{
|
||||||
|
if(curIndex != -1)
|
||||||
|
asioCloseDriver(curIndex);
|
||||||
|
curIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif SGI || BEOS
|
||||||
|
|
||||||
|
#include "asiolist.h"
|
||||||
|
|
||||||
|
AsioDrivers::AsioDrivers()
|
||||||
|
: AsioDriverList()
|
||||||
|
{
|
||||||
|
curIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsioDrivers::~AsioDrivers()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::getCurrentDriverName(char *name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long AsioDrivers::getDriverNames(char **names, long maxDrivers)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AsioDrivers::loadDriver(char *name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsioDrivers::removeCurrentDriver()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error implement me
|
||||||
|
#endif
|
||||||
41
rtaudio/include/asiodrivers.h
Normal file
41
rtaudio/include/asiodrivers.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef __AsioDrivers__
|
||||||
|
#define __AsioDrivers__
|
||||||
|
|
||||||
|
#include "ginclude.h"
|
||||||
|
|
||||||
|
#if MAC
|
||||||
|
#include "CodeFragments.hpp"
|
||||||
|
|
||||||
|
class AsioDrivers : public CodeFragments
|
||||||
|
|
||||||
|
#elif WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#include "asiolist.h"
|
||||||
|
|
||||||
|
class AsioDrivers : public AsioDriverList
|
||||||
|
|
||||||
|
#elif SGI || BEOS
|
||||||
|
#include "asiolist.h"
|
||||||
|
|
||||||
|
class AsioDrivers : public AsioDriverList
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error implement me
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AsioDrivers();
|
||||||
|
~AsioDrivers();
|
||||||
|
|
||||||
|
bool getCurrentDriverName(char *name);
|
||||||
|
long getDriverNames(char **names, long maxDrivers);
|
||||||
|
bool loadDriver(char *name);
|
||||||
|
void removeCurrentDriver();
|
||||||
|
long getCurrentDriverIndex() {return curIndex;}
|
||||||
|
protected:
|
||||||
|
unsigned long connID;
|
||||||
|
long curIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
76
rtaudio/include/asiodrvr.h
Normal file
76
rtaudio/include/asiodrvr.h
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
Steinberg Audio Stream I/O API
|
||||||
|
(c) 1996, Steinberg Soft- und Hardware GmbH
|
||||||
|
charlie (May 1996)
|
||||||
|
|
||||||
|
asiodrvr.h
|
||||||
|
c++ superclass to implement asio functionality. from this,
|
||||||
|
you can derive whatever required
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _asiodrvr_
|
||||||
|
#define _asiodrvr_
|
||||||
|
|
||||||
|
// cpu and os system we are running on
|
||||||
|
#include "asiosys.h"
|
||||||
|
// basic "C" interface
|
||||||
|
#include "asio.h"
|
||||||
|
|
||||||
|
class AsioDriver;
|
||||||
|
extern AsioDriver *getDriver(); // for generic constructor
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#include "combase.h"
|
||||||
|
#include "iasiodrv.h"
|
||||||
|
class AsioDriver : public IASIO ,public CUnknown
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AsioDriver(LPUNKNOWN pUnk, HRESULT *phr);
|
||||||
|
|
||||||
|
DECLARE_IUNKNOWN
|
||||||
|
// Factory method
|
||||||
|
static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
|
||||||
|
// IUnknown
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
class AsioDriver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AsioDriver();
|
||||||
|
#endif
|
||||||
|
virtual ~AsioDriver();
|
||||||
|
|
||||||
|
virtual ASIOBool init(void* sysRef);
|
||||||
|
virtual void getDriverName(char *name); // max 32 bytes incl. terminating zero
|
||||||
|
virtual long getDriverVersion();
|
||||||
|
virtual void getErrorMessage(char *string); // max 124 bytes incl.
|
||||||
|
|
||||||
|
virtual ASIOError start();
|
||||||
|
virtual ASIOError stop();
|
||||||
|
|
||||||
|
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels);
|
||||||
|
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency);
|
||||||
|
virtual ASIOError getBufferSize(long *minSize, long *maxSize,
|
||||||
|
long *preferredSize, long *granularity);
|
||||||
|
|
||||||
|
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate);
|
||||||
|
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate);
|
||||||
|
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate);
|
||||||
|
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources);
|
||||||
|
virtual ASIOError setClockSource(long reference);
|
||||||
|
|
||||||
|
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp);
|
||||||
|
virtual ASIOError getChannelInfo(ASIOChannelInfo *info);
|
||||||
|
|
||||||
|
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
|
||||||
|
long bufferSize, ASIOCallbacks *callbacks);
|
||||||
|
virtual ASIOError disposeBuffers();
|
||||||
|
|
||||||
|
virtual ASIOError controlPanel();
|
||||||
|
virtual ASIOError future(long selector, void *opt);
|
||||||
|
virtual ASIOError outputReady();
|
||||||
|
};
|
||||||
|
#endif
|
||||||
268
rtaudio/include/asiolist.cpp
Normal file
268
rtaudio/include/asiolist.cpp
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
#include "iasiodrv.h"
|
||||||
|
#include "asiolist.h"
|
||||||
|
|
||||||
|
#define ASIODRV_DESC "description"
|
||||||
|
#define INPROC_SERVER "InprocServer32"
|
||||||
|
#define ASIO_PATH "software\\asio"
|
||||||
|
#define COM_CLSID "clsid"
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// Local Functions
|
||||||
|
// ******************************************************************
|
||||||
|
static LONG findDrvPath (char *clsidstr,char *dllpath,int dllpathsize)
|
||||||
|
{
|
||||||
|
HKEY hkEnum,hksub,hkpath;
|
||||||
|
char databuf[512];
|
||||||
|
LONG cr,rc = -1;
|
||||||
|
DWORD datatype,datasize;
|
||||||
|
DWORD index;
|
||||||
|
OFSTRUCT ofs;
|
||||||
|
HFILE hfile;
|
||||||
|
BOOL found = FALSE;
|
||||||
|
|
||||||
|
CharLowerBuff(clsidstr,strlen(clsidstr));
|
||||||
|
if ((cr = RegOpenKey(HKEY_CLASSES_ROOT,COM_CLSID,&hkEnum)) == ERROR_SUCCESS) {
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (cr == ERROR_SUCCESS && !found) {
|
||||||
|
cr = RegEnumKey(hkEnum,index++,(LPTSTR)databuf,512);
|
||||||
|
if (cr == ERROR_SUCCESS) {
|
||||||
|
CharLowerBuff(databuf,strlen(databuf));
|
||||||
|
if (!(strcmp(databuf,clsidstr))) {
|
||||||
|
if ((cr = RegOpenKeyEx(hkEnum,(LPCTSTR)databuf,0,KEY_READ,&hksub)) == ERROR_SUCCESS) {
|
||||||
|
if ((cr = RegOpenKeyEx(hksub,(LPCTSTR)INPROC_SERVER,0,KEY_READ,&hkpath)) == ERROR_SUCCESS) {
|
||||||
|
datatype = REG_SZ; datasize = (DWORD)dllpathsize;
|
||||||
|
cr = RegQueryValueEx(hkpath,0,0,&datatype,(LPBYTE)dllpath,&datasize);
|
||||||
|
if (cr == ERROR_SUCCESS) {
|
||||||
|
memset(&ofs,0,sizeof(OFSTRUCT));
|
||||||
|
ofs.cBytes = sizeof(OFSTRUCT);
|
||||||
|
hfile = OpenFile(dllpath,&ofs,OF_EXIST);
|
||||||
|
if (hfile) rc = 0;
|
||||||
|
}
|
||||||
|
RegCloseKey(hkpath);
|
||||||
|
}
|
||||||
|
RegCloseKey(hksub);
|
||||||
|
}
|
||||||
|
found = TRUE; // break out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegCloseKey(hkEnum);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static LPASIODRVSTRUCT newDrvStruct (HKEY hkey,char *keyname,int drvID,LPASIODRVSTRUCT lpdrv)
|
||||||
|
{
|
||||||
|
HKEY hksub;
|
||||||
|
char databuf[256];
|
||||||
|
char dllpath[MAXPATHLEN];
|
||||||
|
WORD wData[100];
|
||||||
|
CLSID clsid;
|
||||||
|
DWORD datatype,datasize;
|
||||||
|
LONG cr,rc;
|
||||||
|
|
||||||
|
if (!lpdrv) {
|
||||||
|
if ((cr = RegOpenKeyEx(hkey,(LPCTSTR)keyname,0,KEY_READ,&hksub)) == ERROR_SUCCESS) {
|
||||||
|
|
||||||
|
datatype = REG_SZ; datasize = 256;
|
||||||
|
cr = RegQueryValueEx(hksub,COM_CLSID,0,&datatype,(LPBYTE)databuf,&datasize);
|
||||||
|
if (cr == ERROR_SUCCESS) {
|
||||||
|
rc = findDrvPath (databuf,dllpath,MAXPATHLEN);
|
||||||
|
if (rc == 0) {
|
||||||
|
lpdrv = new ASIODRVSTRUCT[1];
|
||||||
|
if (lpdrv) {
|
||||||
|
memset(lpdrv,0,sizeof(ASIODRVSTRUCT));
|
||||||
|
lpdrv->drvID = drvID;
|
||||||
|
MultiByteToWideChar(CP_ACP,0,(LPCSTR)databuf,-1,(LPWSTR)wData,100);
|
||||||
|
if ((cr = CLSIDFromString((LPOLESTR)wData,(LPCLSID)&clsid)) == S_OK) {
|
||||||
|
memcpy(&lpdrv->clsid,&clsid,sizeof(CLSID));
|
||||||
|
}
|
||||||
|
|
||||||
|
datatype = REG_SZ; datasize = 256;
|
||||||
|
cr = RegQueryValueEx(hksub,ASIODRV_DESC,0,&datatype,(LPBYTE)databuf,&datasize);
|
||||||
|
if (cr == ERROR_SUCCESS) {
|
||||||
|
strcpy(lpdrv->drvname,databuf);
|
||||||
|
}
|
||||||
|
else strcpy(lpdrv->drvname,keyname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RegCloseKey(hksub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else lpdrv->next = newDrvStruct(hkey,keyname,drvID+1,lpdrv->next);
|
||||||
|
|
||||||
|
return lpdrv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deleteDrvStruct (LPASIODRVSTRUCT lpdrv)
|
||||||
|
{
|
||||||
|
IASIO *iasio;
|
||||||
|
|
||||||
|
if (lpdrv != 0) {
|
||||||
|
deleteDrvStruct(lpdrv->next);
|
||||||
|
if (lpdrv->asiodrv) {
|
||||||
|
iasio = (IASIO *)lpdrv->asiodrv;
|
||||||
|
iasio->Release();
|
||||||
|
}
|
||||||
|
delete lpdrv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static LPASIODRVSTRUCT getDrvStruct (int drvID,LPASIODRVSTRUCT lpdrv)
|
||||||
|
{
|
||||||
|
while (lpdrv) {
|
||||||
|
if (lpdrv->drvID == drvID) return lpdrv;
|
||||||
|
lpdrv = lpdrv->next;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// ******************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// AsioDriverList
|
||||||
|
// ******************************************************************
|
||||||
|
AsioDriverList::AsioDriverList ()
|
||||||
|
{
|
||||||
|
HKEY hkEnum = 0;
|
||||||
|
char keyname[MAXDRVNAMELEN];
|
||||||
|
LPASIODRVSTRUCT pdl;
|
||||||
|
LONG cr;
|
||||||
|
DWORD index = 0;
|
||||||
|
BOOL fin = FALSE;
|
||||||
|
|
||||||
|
numdrv = 0;
|
||||||
|
lpdrvlist = 0;
|
||||||
|
|
||||||
|
cr = RegOpenKey(HKEY_LOCAL_MACHINE,ASIO_PATH,&hkEnum);
|
||||||
|
while (cr == ERROR_SUCCESS) {
|
||||||
|
if ((cr = RegEnumKey(hkEnum,index++,(LPTSTR)keyname,MAXDRVNAMELEN))== ERROR_SUCCESS) {
|
||||||
|
lpdrvlist = newDrvStruct (hkEnum,keyname,0,lpdrvlist);
|
||||||
|
}
|
||||||
|
else fin = TRUE;
|
||||||
|
}
|
||||||
|
if (hkEnum) RegCloseKey(hkEnum);
|
||||||
|
|
||||||
|
pdl = lpdrvlist;
|
||||||
|
while (pdl) {
|
||||||
|
numdrv++;
|
||||||
|
pdl = pdl->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numdrv) CoInitialize(0); // initialize COM
|
||||||
|
}
|
||||||
|
|
||||||
|
AsioDriverList::~AsioDriverList ()
|
||||||
|
{
|
||||||
|
if (numdrv) {
|
||||||
|
deleteDrvStruct(lpdrvlist);
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioGetNumDev (VOID)
|
||||||
|
{
|
||||||
|
return (LONG)numdrv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioOpenDriver (int drvID,LPVOID *asiodrv)
|
||||||
|
{
|
||||||
|
LPASIODRVSTRUCT lpdrv = 0;
|
||||||
|
long rc;
|
||||||
|
|
||||||
|
if (!asiodrv) return DRVERR_INVALID_PARAM;
|
||||||
|
|
||||||
|
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
|
||||||
|
if (!lpdrv->asiodrv) {
|
||||||
|
rc = CoCreateInstance(lpdrv->clsid,0,CLSCTX_INPROC_SERVER,lpdrv->clsid,asiodrv);
|
||||||
|
if (rc == S_OK) {
|
||||||
|
lpdrv->asiodrv = *asiodrv;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// else if (rc == REGDB_E_CLASSNOTREG)
|
||||||
|
// strcpy (info->messageText, "Driver not registered in the Registration Database!");
|
||||||
|
}
|
||||||
|
else rc = DRVERR_DEVICE_ALREADY_OPEN;
|
||||||
|
}
|
||||||
|
else rc = DRVERR_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioCloseDriver (int drvID)
|
||||||
|
{
|
||||||
|
LPASIODRVSTRUCT lpdrv = 0;
|
||||||
|
IASIO *iasio;
|
||||||
|
|
||||||
|
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
|
||||||
|
if (lpdrv->asiodrv) {
|
||||||
|
iasio = (IASIO *)lpdrv->asiodrv;
|
||||||
|
iasio->Release();
|
||||||
|
lpdrv->asiodrv = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioGetDriverName (int drvID,char *drvname,int drvnamesize)
|
||||||
|
{
|
||||||
|
LPASIODRVSTRUCT lpdrv = 0;
|
||||||
|
|
||||||
|
if (!drvname) return DRVERR_INVALID_PARAM;
|
||||||
|
|
||||||
|
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
|
||||||
|
if (strlen(lpdrv->drvname) < (unsigned int)drvnamesize) {
|
||||||
|
strcpy(drvname,lpdrv->drvname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memcpy(drvname,lpdrv->drvname,drvnamesize-4);
|
||||||
|
drvname[drvnamesize-4] = '.';
|
||||||
|
drvname[drvnamesize-3] = '.';
|
||||||
|
drvname[drvnamesize-2] = '.';
|
||||||
|
drvname[drvnamesize-1] = 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return DRVERR_DEVICE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioGetDriverPath (int drvID,char *dllpath,int dllpathsize)
|
||||||
|
{
|
||||||
|
LPASIODRVSTRUCT lpdrv = 0;
|
||||||
|
|
||||||
|
if (!dllpath) return DRVERR_INVALID_PARAM;
|
||||||
|
|
||||||
|
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
|
||||||
|
if (strlen(lpdrv->dllpath) < (unsigned int)dllpathsize) {
|
||||||
|
strcpy(dllpath,lpdrv->dllpath);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dllpath[0] = 0;
|
||||||
|
return DRVERR_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
return DRVERR_DEVICE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG AsioDriverList::asioGetDriverCLSID (int drvID,CLSID *clsid)
|
||||||
|
{
|
||||||
|
LPASIODRVSTRUCT lpdrv = 0;
|
||||||
|
|
||||||
|
if (!clsid) return DRVERR_INVALID_PARAM;
|
||||||
|
|
||||||
|
if ((lpdrv = getDrvStruct(drvID,lpdrvlist)) != 0) {
|
||||||
|
memcpy(clsid,&lpdrv->clsid,sizeof(CLSID));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return DRVERR_DEVICE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
46
rtaudio/include/asiolist.h
Normal file
46
rtaudio/include/asiolist.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef __asiolist__
|
||||||
|
#define __asiolist__
|
||||||
|
|
||||||
|
#define DRVERR -5000
|
||||||
|
#define DRVERR_INVALID_PARAM DRVERR-1
|
||||||
|
#define DRVERR_DEVICE_ALREADY_OPEN DRVERR-2
|
||||||
|
#define DRVERR_DEVICE_NOT_FOUND DRVERR-3
|
||||||
|
|
||||||
|
#define MAXPATHLEN 512
|
||||||
|
#define MAXDRVNAMELEN 128
|
||||||
|
|
||||||
|
struct asiodrvstruct
|
||||||
|
{
|
||||||
|
int drvID;
|
||||||
|
CLSID clsid;
|
||||||
|
char dllpath[MAXPATHLEN];
|
||||||
|
char drvname[MAXDRVNAMELEN];
|
||||||
|
LPVOID asiodrv;
|
||||||
|
struct asiodrvstruct *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct asiodrvstruct ASIODRVSTRUCT;
|
||||||
|
typedef ASIODRVSTRUCT *LPASIODRVSTRUCT;
|
||||||
|
|
||||||
|
class AsioDriverList {
|
||||||
|
public:
|
||||||
|
AsioDriverList();
|
||||||
|
~AsioDriverList();
|
||||||
|
|
||||||
|
LONG asioOpenDriver (int,VOID **);
|
||||||
|
LONG asioCloseDriver (int);
|
||||||
|
|
||||||
|
// nice to have
|
||||||
|
LONG asioGetNumDev (VOID);
|
||||||
|
LONG asioGetDriverName (int,char *,int);
|
||||||
|
LONG asioGetDriverPath (int,char *,int);
|
||||||
|
LONG asioGetDriverCLSID (int,CLSID *);
|
||||||
|
|
||||||
|
// or use directly access
|
||||||
|
LPASIODRVSTRUCT lpdrvlist;
|
||||||
|
int numdrv;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef class AsioDriverList *LPASIODRIVERLIST;
|
||||||
|
|
||||||
|
#endif
|
||||||
82
rtaudio/include/asiosys.h
Normal file
82
rtaudio/include/asiosys.h
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#ifndef __asiosys__
|
||||||
|
#define __asiosys__
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#undef MAC
|
||||||
|
#define PPC 0
|
||||||
|
#define WINDOWS 1
|
||||||
|
#define SGI 0
|
||||||
|
#define SUN 0
|
||||||
|
#define LINUX 0
|
||||||
|
#define BEOS 0
|
||||||
|
|
||||||
|
#define NATIVE_INT64 0
|
||||||
|
#define IEEE754_64FLOAT 1
|
||||||
|
|
||||||
|
#elif BEOS
|
||||||
|
#define MAC 0
|
||||||
|
#define PPC 0
|
||||||
|
#define WINDOWS 0
|
||||||
|
#define PC 0
|
||||||
|
#define SGI 0
|
||||||
|
#define SUN 0
|
||||||
|
#define LINUX 0
|
||||||
|
|
||||||
|
#define NATIVE_INT64 0
|
||||||
|
#define IEEE754_64FLOAT 1
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
void DEBUGGERMESSAGE(char *string);
|
||||||
|
#else
|
||||||
|
#define DEBUGGERMESSAGE(a)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif SGI
|
||||||
|
#define MAC 0
|
||||||
|
#define PPC 0
|
||||||
|
#define WINDOWS 0
|
||||||
|
#define PC 0
|
||||||
|
#define SUN 0
|
||||||
|
#define LINUX 0
|
||||||
|
#define BEOS 0
|
||||||
|
|
||||||
|
#define NATIVE_INT64 0
|
||||||
|
#define IEEE754_64FLOAT 1
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
void DEBUGGERMESSAGE(char *string);
|
||||||
|
#else
|
||||||
|
#define DEBUGGERMESSAGE(a)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // MAC
|
||||||
|
|
||||||
|
#define MAC 1
|
||||||
|
#define PPC 1
|
||||||
|
#define WINDOWS 0
|
||||||
|
#define PC 0
|
||||||
|
#define SGI 0
|
||||||
|
#define SUN 0
|
||||||
|
#define LINUX 0
|
||||||
|
#define BEOS 0
|
||||||
|
|
||||||
|
#define NATIVE_INT64 0
|
||||||
|
#define IEEE754_64FLOAT 1
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
void DEBUGGERMESSAGE(char *string);
|
||||||
|
#else
|
||||||
|
#define DEBUGGERMESSAGE(a)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
2369
rtaudio/include/dsound.h
Normal file
2369
rtaudio/include/dsound.h
Normal file
File diff suppressed because it is too large
Load Diff
38
rtaudio/include/ginclude.h
Normal file
38
rtaudio/include/ginclude.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef __gInclude__
|
||||||
|
#define __gInclude__
|
||||||
|
|
||||||
|
#if SGI
|
||||||
|
#undef BEOS
|
||||||
|
#undef MAC
|
||||||
|
#undef WINDOWS
|
||||||
|
//
|
||||||
|
#define ASIO_BIG_ENDIAN 1
|
||||||
|
#define ASIO_CPU_MIPS 1
|
||||||
|
#elif defined WIN32
|
||||||
|
#undef BEOS
|
||||||
|
#undef MAC
|
||||||
|
#undef SGI
|
||||||
|
#define WINDOWS 1
|
||||||
|
#define ASIO_LITTLE_ENDIAN 1
|
||||||
|
#define ASIO_CPU_X86 1
|
||||||
|
#elif BEOS
|
||||||
|
#undef MAC
|
||||||
|
#undef SGI
|
||||||
|
#undef WINDOWS
|
||||||
|
#define ASIO_LITTLE_ENDIAN 1
|
||||||
|
#define ASIO_CPU_X86 1
|
||||||
|
//
|
||||||
|
#else
|
||||||
|
#define MAC 1
|
||||||
|
#undef BEOS
|
||||||
|
#undef WINDOWS
|
||||||
|
#undef SGI
|
||||||
|
#define ASIO_BIG_ENDIAN 1
|
||||||
|
#define ASIO_CPU_PPC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// always
|
||||||
|
#define NATIVE_INT64 0
|
||||||
|
#define IEEE754_64FLOAT 1
|
||||||
|
|
||||||
|
#endif // __gInclude__
|
||||||
37
rtaudio/include/iasiodrv.h
Normal file
37
rtaudio/include/iasiodrv.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include "asiosys.h"
|
||||||
|
#include "asio.h"
|
||||||
|
|
||||||
|
/* Forward Declarations */
|
||||||
|
|
||||||
|
#ifndef __ASIODRIVER_FWD_DEFINED__
|
||||||
|
#define __ASIODRIVER_FWD_DEFINED__
|
||||||
|
typedef interface IASIO IASIO;
|
||||||
|
#endif /* __ASIODRIVER_FWD_DEFINED__ */
|
||||||
|
|
||||||
|
interface IASIO : public IUnknown
|
||||||
|
{
|
||||||
|
|
||||||
|
virtual ASIOBool init(void *sysHandle) = 0;
|
||||||
|
virtual void getDriverName(char *name) = 0;
|
||||||
|
virtual long getDriverVersion() = 0;
|
||||||
|
virtual void getErrorMessage(char *string) = 0;
|
||||||
|
virtual ASIOError start() = 0;
|
||||||
|
virtual ASIOError stop() = 0;
|
||||||
|
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0;
|
||||||
|
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) = 0;
|
||||||
|
virtual ASIOError getBufferSize(long *minSize, long *maxSize,
|
||||||
|
long *preferredSize, long *granularity) = 0;
|
||||||
|
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) = 0;
|
||||||
|
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) = 0;
|
||||||
|
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) = 0;
|
||||||
|
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) = 0;
|
||||||
|
virtual ASIOError setClockSource(long reference) = 0;
|
||||||
|
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0;
|
||||||
|
virtual ASIOError getChannelInfo(ASIOChannelInfo *info) = 0;
|
||||||
|
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels,
|
||||||
|
long bufferSize, ASIOCallbacks *callbacks) = 0;
|
||||||
|
virtual ASIOError disposeBuffers() = 0;
|
||||||
|
virtual ASIOError controlPanel() = 0;
|
||||||
|
virtual ASIOError future(long selector,void *opt) = 0;
|
||||||
|
virtual ASIOError outputReady() = 0;
|
||||||
|
};
|
||||||
563
rtaudio/include/iasiothiscallresolver.cpp
Normal file
563
rtaudio/include/iasiothiscallresolver.cpp
Normal file
@ -0,0 +1,563 @@
|
|||||||
|
/*
|
||||||
|
IASIOThiscallResolver.cpp see the comments in iasiothiscallresolver.h for
|
||||||
|
the top level description - this comment describes the technical details of
|
||||||
|
the implementation.
|
||||||
|
|
||||||
|
The latest version of this file is available from:
|
||||||
|
http://www.audiomulch.com/~rossb/code/calliasio
|
||||||
|
|
||||||
|
please email comments to Ross Bencina <rossb@audiomulch.com>
|
||||||
|
|
||||||
|
BACKGROUND
|
||||||
|
|
||||||
|
The IASIO interface declared in the Steinberg ASIO 2 SDK declares
|
||||||
|
functions with no explicit calling convention. This causes MSVC++ to default
|
||||||
|
to using the thiscall convention, which is a proprietary convention not
|
||||||
|
implemented by some non-microsoft compilers - notably borland BCC,
|
||||||
|
C++Builder, and gcc. MSVC++ is the defacto standard compiler used by
|
||||||
|
Steinberg. As a result of this situation, the ASIO sdk will compile with
|
||||||
|
any compiler, however attempting to execute the compiled code will cause a
|
||||||
|
crash due to different default calling conventions on non-Microsoft
|
||||||
|
compilers.
|
||||||
|
|
||||||
|
IASIOThiscallResolver solves the problem by providing an adapter class that
|
||||||
|
delegates to the IASIO interface using the correct calling convention
|
||||||
|
(thiscall). Due to the lack of support for thiscall in the Borland and GCC
|
||||||
|
compilers, the calls have been implemented in assembly language.
|
||||||
|
|
||||||
|
A number of macros are defined for thiscall function calls with different
|
||||||
|
numbers of parameters, with and without return values - it may be possible
|
||||||
|
to modify the format of these macros to make them work with other inline
|
||||||
|
assemblers.
|
||||||
|
|
||||||
|
|
||||||
|
THISCALL DEFINITION
|
||||||
|
|
||||||
|
A number of definitions of the thiscall calling convention are floating
|
||||||
|
around the internet. The following definition has been validated against
|
||||||
|
output from the MSVC++ compiler:
|
||||||
|
|
||||||
|
For non-vararg functions, thiscall works as follows: the object (this)
|
||||||
|
pointer is passed in ECX. All arguments are passed on the stack in
|
||||||
|
right to left order. The return value is placed in EAX. The callee
|
||||||
|
clears the passed arguments from the stack.
|
||||||
|
|
||||||
|
|
||||||
|
FINDING FUNCTION POINTERS FROM AN IASIO POINTER
|
||||||
|
|
||||||
|
The first field of a COM object is a pointer to its vtble. Thus a pointer
|
||||||
|
to an object implementing the IASIO interface also points to a pointer to
|
||||||
|
that object's vtbl. The vtble is a table of function pointers for all of
|
||||||
|
the virtual functions exposed by the implemented interfaces.
|
||||||
|
|
||||||
|
If we consider a variable declared as a pointer to IASO:
|
||||||
|
|
||||||
|
IASIO *theAsioDriver
|
||||||
|
|
||||||
|
theAsioDriver points to:
|
||||||
|
|
||||||
|
object implementing IASIO
|
||||||
|
{
|
||||||
|
IASIOvtbl *vtbl
|
||||||
|
other data
|
||||||
|
}
|
||||||
|
|
||||||
|
in other words, theAsioDriver points to a pointer to an IASIOvtbl
|
||||||
|
|
||||||
|
vtbl points to a table of function pointers:
|
||||||
|
|
||||||
|
IASIOvtbl ( interface IASIO : public IUnknown )
|
||||||
|
{
|
||||||
|
(IUnknown functions)
|
||||||
|
0 virtual HRESULT STDMETHODCALLTYPE (*QueryInterface)(REFIID riid, void **ppv) = 0;
|
||||||
|
4 virtual ULONG STDMETHODCALLTYPE (*AddRef)() = 0;
|
||||||
|
8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0;
|
||||||
|
|
||||||
|
(IASIO functions)
|
||||||
|
12 virtual ASIOBool (*init)(void *sysHandle) = 0;
|
||||||
|
16 virtual void (*getDriverName)(char *name) = 0;
|
||||||
|
20 virtual long (*getDriverVersion)() = 0;
|
||||||
|
24 virtual void (*getErrorMessage)(char *string) = 0;
|
||||||
|
28 virtual ASIOError (*start)() = 0;
|
||||||
|
32 virtual ASIOError (*stop)() = 0;
|
||||||
|
36 virtual ASIOError (*getChannels)(long *numInputChannels, long *numOutputChannels) = 0;
|
||||||
|
40 virtual ASIOError (*getLatencies)(long *inputLatency, long *outputLatency) = 0;
|
||||||
|
44 virtual ASIOError (*getBufferSize)(long *minSize, long *maxSize,
|
||||||
|
long *preferredSize, long *granularity) = 0;
|
||||||
|
48 virtual ASIOError (*canSampleRate)(ASIOSampleRate sampleRate) = 0;
|
||||||
|
52 virtual ASIOError (*getSampleRate)(ASIOSampleRate *sampleRate) = 0;
|
||||||
|
56 virtual ASIOError (*setSampleRate)(ASIOSampleRate sampleRate) = 0;
|
||||||
|
60 virtual ASIOError (*getClockSources)(ASIOClockSource *clocks, long *numSources) = 0;
|
||||||
|
64 virtual ASIOError (*setClockSource)(long reference) = 0;
|
||||||
|
68 virtual ASIOError (*getSamplePosition)(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0;
|
||||||
|
72 virtual ASIOError (*getChannelInfo)(ASIOChannelInfo *info) = 0;
|
||||||
|
76 virtual ASIOError (*createBuffers)(ASIOBufferInfo *bufferInfos, long numChannels,
|
||||||
|
long bufferSize, ASIOCallbacks *callbacks) = 0;
|
||||||
|
80 virtual ASIOError (*disposeBuffers)() = 0;
|
||||||
|
84 virtual ASIOError (*controlPanel)() = 0;
|
||||||
|
88 virtual ASIOError (*future)(long selector,void *opt) = 0;
|
||||||
|
92 virtual ASIOError (*outputReady)() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
The numbers in the left column show the byte offset of each function ptr
|
||||||
|
from the beginning of the vtbl. These numbers are used in the code below
|
||||||
|
to select different functions.
|
||||||
|
|
||||||
|
In order to find the address of a particular function, theAsioDriver
|
||||||
|
must first be dereferenced to find the value of the vtbl pointer:
|
||||||
|
|
||||||
|
mov eax, theAsioDriver
|
||||||
|
mov edx, [theAsioDriver] // edx now points to vtbl[0]
|
||||||
|
|
||||||
|
Then an offset must be added to the vtbl pointer to select a
|
||||||
|
particular function, for example vtbl+44 points to the slot containing
|
||||||
|
a pointer to the getBufferSize function.
|
||||||
|
|
||||||
|
Finally vtbl+x must be dereferenced to obtain the value of the function
|
||||||
|
pointer stored in that address:
|
||||||
|
|
||||||
|
call [edx+44] // call the function pointed to by
|
||||||
|
// the value in the getBufferSize field of the vtbl
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
|
||||||
|
Martin Fay's OpenASIO DLL at http://www.martinfay.com solves the same
|
||||||
|
problem by providing a new COM interface which wraps IASIO with an
|
||||||
|
interface that uses portable calling conventions. OpenASIO must be compiled
|
||||||
|
with MSVC, and requires that you ship the OpenASIO DLL with your
|
||||||
|
application.
|
||||||
|
|
||||||
|
|
||||||
|
ACKNOWLEDGEMENTS
|
||||||
|
|
||||||
|
Ross Bencina: worked out the thiscall details above, wrote the original
|
||||||
|
Borland asm macros, and a patch for asio.cpp (which is no longer needed).
|
||||||
|
Thanks to Martin Fay for introducing me to the issues discussed here,
|
||||||
|
and to Rene G. Ceballos for assisting with asm dumps from MSVC++.
|
||||||
|
|
||||||
|
Antti Silvast: converted the original calliasio to work with gcc and NASM
|
||||||
|
by implementing the asm code in a separate file.
|
||||||
|
|
||||||
|
Fraser Adams: modified the original calliasio containing the Borland inline
|
||||||
|
asm to add inline asm for gcc i.e. Intel syntax for Borland and AT&T syntax
|
||||||
|
for gcc. This seems a neater approach for gcc than to have a separate .asm
|
||||||
|
file and it means that we only need one version of the thiscall patch.
|
||||||
|
|
||||||
|
Fraser Adams: rewrote the original calliasio patch in the form of the
|
||||||
|
IASIOThiscallResolver class in order to avoid modifications to files from
|
||||||
|
the Steinberg SDK, which may have had potential licence issues.
|
||||||
|
|
||||||
|
Andrew Baldwin: contributed fixes for compatibility problems with more
|
||||||
|
recent versions of the gcc assembler.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// We only need IASIOThiscallResolver at all if we are on Win32. For other
|
||||||
|
// platforms we simply bypass the IASIOThiscallResolver definition to allow us
|
||||||
|
// to be safely #include'd whatever the platform to keep client code portable
|
||||||
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||||
|
|
||||||
|
|
||||||
|
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver
|
||||||
|
// is not used.
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
|
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
// We have a mechanism in iasiothiscallresolver.h to ensure that asio.h is
|
||||||
|
// #include'd before it in client code, we do NOT want to do this test here.
|
||||||
|
#define iasiothiscallresolver_sourcefile 1
|
||||||
|
#include "iasiothiscallresolver.h"
|
||||||
|
#undef iasiothiscallresolver_sourcefile
|
||||||
|
|
||||||
|
// iasiothiscallresolver.h redefines ASIOInit for clients, but we don't want
|
||||||
|
// this macro defined in this translation unit.
|
||||||
|
#undef ASIOInit
|
||||||
|
|
||||||
|
|
||||||
|
// theAsioDriver is a global pointer to the current IASIO instance which the
|
||||||
|
// ASIO SDK uses to perform all actions on the IASIO interface. We substitute
|
||||||
|
// our own forwarding interface into this pointer.
|
||||||
|
extern IASIO* theAsioDriver;
|
||||||
|
|
||||||
|
|
||||||
|
// The following macros define the inline assembler for BORLAND first then gcc
|
||||||
|
|
||||||
|
#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__)
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_0( resultName, thisPtr, funcOffset )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
__asm { \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
mov resultName, eax ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
__asm { \
|
||||||
|
mov eax, param1 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
__asm { \
|
||||||
|
mov eax, param1 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
mov resultName, eax ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
void *doubleParamPtr_ (¶m1); \
|
||||||
|
__asm { \
|
||||||
|
mov eax, doubleParamPtr_ ; \
|
||||||
|
push [eax+4] ; \
|
||||||
|
push [eax] ; \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
mov resultName, eax ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
__asm { \
|
||||||
|
mov eax, param2 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov eax, param1 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
mov resultName, eax ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\
|
||||||
|
void *this_ = (thisPtr); \
|
||||||
|
__asm { \
|
||||||
|
mov eax, param4 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov eax, param3 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov eax, param2 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov eax, param1 ; \
|
||||||
|
push eax ; \
|
||||||
|
mov ecx, this_ ; \
|
||||||
|
mov eax, [ecx] ; \
|
||||||
|
call [eax+funcOffset] ; \
|
||||||
|
mov resultName, eax ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_0( resultName, thisPtr, funcOffset ) \
|
||||||
|
__asm__ __volatile__ ("movl (%1), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx)\n\t" \
|
||||||
|
:"=a"(resultName) /* Output Operands */ \
|
||||||
|
:"c"(thisPtr) /* Input Operands */ \
|
||||||
|
); \
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 ) \
|
||||||
|
__asm__ __volatile__ ("pushl %0\n\t" \
|
||||||
|
"movl (%1), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx)\n\t" \
|
||||||
|
: /* Output Operands */ \
|
||||||
|
:"r"(param1), /* Input Operands */ \
|
||||||
|
"c"(thisPtr) \
|
||||||
|
); \
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 ) \
|
||||||
|
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||||
|
"movl (%2), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx)\n\t" \
|
||||||
|
:"=a"(resultName) /* Output Operands */ \
|
||||||
|
:"r"(param1), /* Input Operands */ \
|
||||||
|
"c"(thisPtr) \
|
||||||
|
); \
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \
|
||||||
|
__asm__ __volatile__ ("pushl 4(%1)\n\t" \
|
||||||
|
"pushl (%1)\n\t" \
|
||||||
|
"movl (%2), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx);\n\t" \
|
||||||
|
:"=a"(resultName) /* Output Operands */ \
|
||||||
|
:"a"(¶m1), /* Input Operands */ \
|
||||||
|
/* Note: Using "r" above instead of "a" fails */ \
|
||||||
|
/* when using GCC 3.3.3, and maybe later versions*/\
|
||||||
|
"c"(thisPtr) \
|
||||||
|
); \
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \
|
||||||
|
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||||
|
"pushl %2\n\t" \
|
||||||
|
"movl (%3), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx)\n\t" \
|
||||||
|
:"=a"(resultName) /* Output Operands */ \
|
||||||
|
:"r"(param2), /* Input Operands */ \
|
||||||
|
"r"(param1), \
|
||||||
|
"c"(thisPtr) \
|
||||||
|
); \
|
||||||
|
|
||||||
|
|
||||||
|
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\
|
||||||
|
__asm__ __volatile__ ("pushl %1\n\t" \
|
||||||
|
"pushl %2\n\t" \
|
||||||
|
"pushl %3\n\t" \
|
||||||
|
"pushl %4\n\t" \
|
||||||
|
"movl (%5), %%edx\n\t" \
|
||||||
|
"call *"#funcOffset"(%%edx)\n\t" \
|
||||||
|
:"=a"(resultName) /* Output Operands */ \
|
||||||
|
:"r"(param4), /* Input Operands */ \
|
||||||
|
"r"(param3), \
|
||||||
|
"r"(param2), \
|
||||||
|
"r"(param1), \
|
||||||
|
"c"(thisPtr) \
|
||||||
|
); \
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Our static singleton instance.
|
||||||
|
IASIOThiscallResolver IASIOThiscallResolver::instance;
|
||||||
|
|
||||||
|
// Constructor called to initialize static Singleton instance above. Note that
|
||||||
|
// it is important not to clear that_ incase it has already been set by the call
|
||||||
|
// to placement new in ASIOInit().
|
||||||
|
IASIOThiscallResolver::IASIOThiscallResolver()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor called from ASIOInit() below
|
||||||
|
IASIOThiscallResolver::IASIOThiscallResolver(IASIO* that)
|
||||||
|
: that_( that )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement IUnknown methods as assert(false). IASIOThiscallResolver is not
|
||||||
|
// really a COM object, just a wrapper which will work with the ASIO SDK.
|
||||||
|
// If you wanted to use ASIO without the SDK you might want to implement COM
|
||||||
|
// aggregation in these methods.
|
||||||
|
HRESULT STDMETHODCALLTYPE IASIOThiscallResolver::QueryInterface(REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
(void)riid; // suppress unused variable warning
|
||||||
|
|
||||||
|
assert( false ); // this function should never be called by the ASIO SDK.
|
||||||
|
|
||||||
|
*ppv = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE IASIOThiscallResolver::AddRef()
|
||||||
|
{
|
||||||
|
assert( false ); // this function should never be called by the ASIO SDK.
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE IASIOThiscallResolver::Release()
|
||||||
|
{
|
||||||
|
assert( false ); // this function should never be called by the ASIO SDK.
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Implement the IASIO interface methods by performing the vptr manipulation
|
||||||
|
// described above then delegating to the real implementation.
|
||||||
|
ASIOBool IASIOThiscallResolver::init(void *sysHandle)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1( result, that_, 12, sysHandle );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IASIOThiscallResolver::getDriverName(char *name)
|
||||||
|
{
|
||||||
|
CALL_VOID_THISCALL_1( that_, 16, name );
|
||||||
|
}
|
||||||
|
|
||||||
|
long IASIOThiscallResolver::getDriverVersion()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 20 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IASIOThiscallResolver::getErrorMessage(char *string)
|
||||||
|
{
|
||||||
|
CALL_VOID_THISCALL_1( that_, 24, string );
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::start()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 28 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::stop()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 32 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getChannels(long *numInputChannels, long *numOutputChannels)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_2( result, that_, 36, numInputChannels, numOutputChannels );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getLatencies(long *inputLatency, long *outputLatency)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_2( result, that_, 40, inputLatency, outputLatency );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getBufferSize(long *minSize, long *maxSize,
|
||||||
|
long *preferredSize, long *granularity)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_4( result, that_, 44, minSize, maxSize, preferredSize, granularity );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::canSampleRate(ASIOSampleRate sampleRate)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1_DOUBLE( result, that_, 48, sampleRate );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getSampleRate(ASIOSampleRate *sampleRate)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1( result, that_, 52, sampleRate );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::setSampleRate(ASIOSampleRate sampleRate)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1_DOUBLE( result, that_, 56, sampleRate );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getClockSources(ASIOClockSource *clocks, long *numSources)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_2( result, that_, 60, clocks, numSources );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::setClockSource(long reference)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1( result, that_, 64, reference );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_2( result, that_, 68, sPos, tStamp );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::getChannelInfo(ASIOChannelInfo *info)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_1( result, that_, 72, info );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::createBuffers(ASIOBufferInfo *bufferInfos,
|
||||||
|
long numChannels, long bufferSize, ASIOCallbacks *callbacks)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_4( result, that_, 76, bufferInfos, numChannels, bufferSize, callbacks );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::disposeBuffers()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 80 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::controlPanel()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 84 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::future(long selector,void *opt)
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_2( result, that_, 88, selector, opt );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASIOError IASIOThiscallResolver::outputReady()
|
||||||
|
{
|
||||||
|
ASIOBool result;
|
||||||
|
CALL_THISCALL_0( result, that_, 92 );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Implement our substitute ASIOInit() method
|
||||||
|
ASIOError IASIOThiscallResolver::ASIOInit(ASIODriverInfo *info)
|
||||||
|
{
|
||||||
|
// To ensure that our instance's vptr is correctly constructed, even if
|
||||||
|
// ASIOInit is called prior to main(), we explicitly call its constructor
|
||||||
|
// (potentially over the top of an existing instance). Note that this is
|
||||||
|
// pretty ugly, and is only safe because IASIOThiscallResolver has no
|
||||||
|
// destructor and contains no objects with destructors.
|
||||||
|
new((void*)&instance) IASIOThiscallResolver( theAsioDriver );
|
||||||
|
|
||||||
|
// Interpose between ASIO client code and the real driver.
|
||||||
|
theAsioDriver = &instance;
|
||||||
|
|
||||||
|
// Note that we never need to switch theAsioDriver back to point to the
|
||||||
|
// real driver because theAsioDriver is reset to zero in ASIOExit().
|
||||||
|
|
||||||
|
// Delegate to the real ASIOInit
|
||||||
|
return ::ASIOInit(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !defined(_MSC_VER) */
|
||||||
|
|
||||||
|
#endif /* Win32 */
|
||||||
|
|
||||||
201
rtaudio/include/iasiothiscallresolver.h
Normal file
201
rtaudio/include/iasiothiscallresolver.h
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
// ****************************************************************************
|
||||||
|
//
|
||||||
|
// Changed: I have modified this file slightly (includes) to work with
|
||||||
|
// RtAudio. RtAudio.cpp must include this file after asio.h.
|
||||||
|
//
|
||||||
|
// File: IASIOThiscallResolver.h
|
||||||
|
// Description: The IASIOThiscallResolver class implements the IASIO
|
||||||
|
// interface and acts as a proxy to the real IASIO interface by
|
||||||
|
// calling through its vptr table using the thiscall calling
|
||||||
|
// convention. To put it another way, we interpose
|
||||||
|
// IASIOThiscallResolver between ASIO SDK code and the driver.
|
||||||
|
// This is necessary because most non-Microsoft compilers don't
|
||||||
|
// implement the thiscall calling convention used by IASIO.
|
||||||
|
//
|
||||||
|
// iasiothiscallresolver.cpp contains the background of this
|
||||||
|
// problem plus a technical description of the vptr
|
||||||
|
// manipulations.
|
||||||
|
//
|
||||||
|
// In order to use this mechanism one simply has to add
|
||||||
|
// iasiothiscallresolver.cpp to the list of files to compile
|
||||||
|
// and #include <iasiothiscallresolver.h>
|
||||||
|
//
|
||||||
|
// Note that this #include must come after the other ASIO SDK
|
||||||
|
// #includes, for example:
|
||||||
|
//
|
||||||
|
// #include <windows.h>
|
||||||
|
// #include <asiosys.h>
|
||||||
|
// #include <asio.h>
|
||||||
|
// #include <asiodrivers.h>
|
||||||
|
// #include <iasiothiscallresolver.h>
|
||||||
|
//
|
||||||
|
// Actually the important thing is to #include
|
||||||
|
// <iasiothiscallresolver.h> after <asio.h>. We have
|
||||||
|
// incorporated a test to enforce this ordering.
|
||||||
|
//
|
||||||
|
// The code transparently takes care of the interposition by
|
||||||
|
// using macro substitution to intercept calls to ASIOInit()
|
||||||
|
// and ASIOExit(). We save the original ASIO global
|
||||||
|
// "theAsioDriver" in our "that" variable, and then set
|
||||||
|
// "theAsioDriver" to equal our IASIOThiscallResolver instance.
|
||||||
|
//
|
||||||
|
// Whilst this method of resolving the thiscall problem requires
|
||||||
|
// the addition of #include <iasiothiscallresolver.h> to client
|
||||||
|
// code it has the advantage that it does not break the terms
|
||||||
|
// of the ASIO licence by publishing it. We are NOT modifying
|
||||||
|
// any Steinberg code here, we are merely implementing the IASIO
|
||||||
|
// interface in the same way that we would need to do if we
|
||||||
|
// wished to provide an open source ASIO driver.
|
||||||
|
//
|
||||||
|
// For compilation with MinGW -lole32 needs to be added to the
|
||||||
|
// linker options. For BORLAND, linking with Import32.lib is
|
||||||
|
// sufficient.
|
||||||
|
//
|
||||||
|
// The dependencies are with: CoInitialize, CoUninitialize,
|
||||||
|
// CoCreateInstance, CLSIDFromString - used by asiolist.cpp
|
||||||
|
// and are required on Windows whether ThiscallResolver is used
|
||||||
|
// or not.
|
||||||
|
//
|
||||||
|
// Searching for the above strings in the root library path
|
||||||
|
// of your compiler should enable the correct libraries to be
|
||||||
|
// identified if they aren't immediately obvious.
|
||||||
|
//
|
||||||
|
// Note that the current implementation of IASIOThiscallResolver
|
||||||
|
// is not COM compliant - it does not correctly implement the
|
||||||
|
// IUnknown interface. Implementing it is not necessary because
|
||||||
|
// it is not called by parts of the ASIO SDK which call through
|
||||||
|
// theAsioDriver ptr. The IUnknown methods are implemented as
|
||||||
|
// assert(false) to ensure that the code fails if they are
|
||||||
|
// ever called.
|
||||||
|
// Restrictions: None. Public Domain & Open Source distribute freely
|
||||||
|
// You may use IASIOThiscallResolver commercially as well as
|
||||||
|
// privately.
|
||||||
|
// You the user assume the responsibility for the use of the
|
||||||
|
// files, binary or text, and there is no guarantee or warranty,
|
||||||
|
// expressed or implied, including but not limited to the
|
||||||
|
// implied warranties of merchantability and fitness for a
|
||||||
|
// particular purpose. You assume all responsibility and agree
|
||||||
|
// to hold no entity, copyright holder or distributors liable
|
||||||
|
// for any loss of data or inaccurate representations of data
|
||||||
|
// as a result of using IASIOThiscallResolver.
|
||||||
|
// Version: 1.4 Added separate macro CALL_THISCALL_1_DOUBLE from
|
||||||
|
// Andrew Baldwin, and volatile for whole gcc asm blocks,
|
||||||
|
// both for compatibility with newer gcc versions. Cleaned up
|
||||||
|
// Borland asm to use one less register.
|
||||||
|
// 1.3 Switched to including assert.h for better compatibility.
|
||||||
|
// Wrapped entire .h and .cpp contents with a check for
|
||||||
|
// _MSC_VER to provide better compatibility with MS compilers.
|
||||||
|
// Changed Singleton implementation to use static instance
|
||||||
|
// instead of freestore allocated instance. Removed ASIOExit
|
||||||
|
// macro as it is no longer needed.
|
||||||
|
// 1.2 Removed semicolons from ASIOInit and ASIOExit macros to
|
||||||
|
// allow them to be embedded in expressions (if statements).
|
||||||
|
// Cleaned up some comments. Removed combase.c dependency (it
|
||||||
|
// doesn't compile with BCB anyway) by stubbing IUnknown.
|
||||||
|
// 1.1 Incorporated comments from Ross Bencina including things
|
||||||
|
// such as changing name from ThiscallResolver to
|
||||||
|
// IASIOThiscallResolver, tidying up the constructor, fixing
|
||||||
|
// a bug in IASIOThiscallResolver::ASIOExit() and improving
|
||||||
|
// portability through the use of conditional compilation
|
||||||
|
// 1.0 Initial working version.
|
||||||
|
// Created: 6/09/2003
|
||||||
|
// Authors: Fraser Adams
|
||||||
|
// Ross Bencina
|
||||||
|
// Rene G. Ceballos
|
||||||
|
// Martin Fay
|
||||||
|
// Antti Silvast
|
||||||
|
// Andrew Baldwin
|
||||||
|
//
|
||||||
|
// ****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef included_iasiothiscallresolver_h
|
||||||
|
#define included_iasiothiscallresolver_h
|
||||||
|
|
||||||
|
// We only need IASIOThiscallResolver at all if we are on Win32. For other
|
||||||
|
// platforms we simply bypass the IASIOThiscallResolver definition to allow us
|
||||||
|
// to be safely #include'd whatever the platform to keep client code portable
|
||||||
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||||
|
|
||||||
|
|
||||||
|
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver
|
||||||
|
// is not used.
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
|
|
||||||
|
|
||||||
|
// The following is in order to ensure that this header is only included after
|
||||||
|
// the other ASIO headers (except for the case of iasiothiscallresolver.cpp).
|
||||||
|
// We need to do this because IASIOThiscallResolver works by eclipsing the
|
||||||
|
// original definition of ASIOInit() with a macro (see below).
|
||||||
|
#if !defined(iasiothiscallresolver_sourcefile)
|
||||||
|
#if !defined(__ASIO_H)
|
||||||
|
#error iasiothiscallresolver.h must be included AFTER asio.h
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "iasiodrv.h" /* From ASIO SDK */
|
||||||
|
|
||||||
|
|
||||||
|
class IASIOThiscallResolver : public IASIO {
|
||||||
|
private:
|
||||||
|
IASIO* that_; // Points to the real IASIO
|
||||||
|
|
||||||
|
static IASIOThiscallResolver instance; // Singleton instance
|
||||||
|
|
||||||
|
// Constructors - declared private so construction is limited to
|
||||||
|
// our Singleton instance
|
||||||
|
IASIOThiscallResolver();
|
||||||
|
IASIOThiscallResolver(IASIO* that);
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Methods from the IUnknown interface. We don't fully implement IUnknown
|
||||||
|
// because the ASIO SDK never calls these methods through theAsioDriver ptr.
|
||||||
|
// These methods are implemented as assert(false).
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv);
|
||||||
|
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||||
|
virtual ULONG STDMETHODCALLTYPE Release();
|
||||||
|
|
||||||
|
// Methods from the IASIO interface, implemented as forwarning calls to that.
|
||||||
|
virtual ASIOBool init(void *sysHandle);
|
||||||
|
virtual void getDriverName(char *name);
|
||||||
|
virtual long getDriverVersion();
|
||||||
|
virtual void getErrorMessage(char *string);
|
||||||
|
virtual ASIOError start();
|
||||||
|
virtual ASIOError stop();
|
||||||
|
virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels);
|
||||||
|
virtual ASIOError getLatencies(long *inputLatency, long *outputLatency);
|
||||||
|
virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity);
|
||||||
|
virtual ASIOError canSampleRate(ASIOSampleRate sampleRate);
|
||||||
|
virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate);
|
||||||
|
virtual ASIOError setSampleRate(ASIOSampleRate sampleRate);
|
||||||
|
virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources);
|
||||||
|
virtual ASIOError setClockSource(long reference);
|
||||||
|
virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp);
|
||||||
|
virtual ASIOError getChannelInfo(ASIOChannelInfo *info);
|
||||||
|
virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, long bufferSize, ASIOCallbacks *callbacks);
|
||||||
|
virtual ASIOError disposeBuffers();
|
||||||
|
virtual ASIOError controlPanel();
|
||||||
|
virtual ASIOError future(long selector,void *opt);
|
||||||
|
virtual ASIOError outputReady();
|
||||||
|
|
||||||
|
// Class method, see ASIOInit() macro below.
|
||||||
|
static ASIOError ASIOInit(ASIODriverInfo *info); // Delegates to ::ASIOInit
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Replace calls to ASIOInit with our interposing version.
|
||||||
|
// This macro enables us to perform thiscall resolution simply by #including
|
||||||
|
// <iasiothiscallresolver.h> after the asio #includes (this file _must_ be
|
||||||
|
// included _after_ the asio #includes)
|
||||||
|
|
||||||
|
#define ASIOInit(name) IASIOThiscallResolver::ASIOInit((name))
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* !defined(_MSC_VER) */
|
||||||
|
|
||||||
|
#endif /* Win32 */
|
||||||
|
|
||||||
|
#endif /* included_iasiothiscallresolver_h */
|
||||||
|
|
||||||
|
|
||||||
2061
rtaudio/include/soundcard.h
Normal file
2061
rtaudio/include/soundcard.h
Normal file
File diff suppressed because it is too large
Load Diff
61
rtaudio/readme
Normal file
61
rtaudio/readme
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
RtAudio - a set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound and ASIO) operating systems.
|
||||||
|
|
||||||
|
By Gary P. Scavone, 2001-2008.
|
||||||
|
|
||||||
|
This distribution of RtAudio contains the following:
|
||||||
|
|
||||||
|
doc: RtAudio documentation (see doc/html/index.html)
|
||||||
|
tests: example RtAudio programs
|
||||||
|
asio: header and source files necessary for ASIO compilation
|
||||||
|
tests/Windows: Visual C++ .net test program workspace and projects
|
||||||
|
|
||||||
|
OVERVIEW:
|
||||||
|
|
||||||
|
RtAudio is a set of C++ classes that provide a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, JACK, and OSS), Macintosh OS X, SGI, and Windows (DirectSound and ASIO) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following objectives:
|
||||||
|
|
||||||
|
- object-oriented C++ design
|
||||||
|
- simple, common API across all supported platforms
|
||||||
|
- only one source and two header files for easy inclusion in programming projects
|
||||||
|
- allow simultaneous multi-api support
|
||||||
|
- support dynamic connection of devices
|
||||||
|
- provide extensive audio device parameter control
|
||||||
|
- allow audio device capability probing
|
||||||
|
- automatic internal conversion for data format, channel number compensation, (de)interleaving, and byte-swapping
|
||||||
|
|
||||||
|
RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the \ref apinotes section for information specific to each of the supported audio APIs.
|
||||||
|
|
||||||
|
FURTHER READING:
|
||||||
|
|
||||||
|
For complete documentation on RtAudio, see the doc directory of the distribution or surf to http://www.music.mcgill.ca/~gary/rtaudio/.
|
||||||
|
|
||||||
|
|
||||||
|
LEGAL AND ETHICAL:
|
||||||
|
|
||||||
|
The RtAudio license is similar to the MIT License.
|
||||||
|
|
||||||
|
RtAudio: a set of realtime audio i/o C++ classes
|
||||||
|
Copyright (c) 2001-2008 Gary P. Scavone
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation files
|
||||||
|
(the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
Any person wishing to distribute modifications to the Software is
|
||||||
|
asked to send the modifications to the original developer so that
|
||||||
|
they can be incorporated into the canonical version. This is,
|
||||||
|
however, not a binding provision of this license.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||||
|
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||||
|
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
BIN
sample.ogg
Normal file
BIN
sample.ogg
Normal file
Binary file not shown.
33
scale.lua
Normal file
33
scale.lua
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
-- function creating a sine wave sample:
|
||||||
|
function sampleSine(freq, duration, sampleRate)
|
||||||
|
local data = { }
|
||||||
|
for i = 1,duration*sampleRate do
|
||||||
|
data[i] = math.sin( (i*freq/sampleRate)*math.pi*2)
|
||||||
|
end
|
||||||
|
return proAudio.sampleFromMemory(data, sampleRate)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- plays a sample shifted by a number of halftones for a definable period of time
|
||||||
|
function playNote(sample, pitch, duration, volumeL, volumeR, disparity)
|
||||||
|
local scale = 2^(pitch/12)
|
||||||
|
local sound = proAudio.soundLoop(sample, volumeL, volumeR, disparity, scale)
|
||||||
|
proAudio.sleep(duration)
|
||||||
|
proAudio.soundStop(sound)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- create an audio device using default parameters and exit in case of errors
|
||||||
|
require("proAudioRt")
|
||||||
|
if not proAudio.create() then os.exit(1) end
|
||||||
|
|
||||||
|
-- generate a sample:
|
||||||
|
local sample = sampleSine(440, 0.5, 88200)
|
||||||
|
|
||||||
|
-- play scale (a major):
|
||||||
|
local duration = 0.5
|
||||||
|
for i,note in ipairs({ 0, 2, 4, 5, 7, 9, 11, 12 }) do
|
||||||
|
playNote(sample, note, duration)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cleanup
|
||||||
|
proAudio.destroy()
|
||||||
5349
stb_vorbis.c
Normal file
5349
stb_vorbis.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user