607 lines
25 KiB
C++
607 lines
25 KiB
C++
#include "Precompiled.h"
|
|
|
|
|
|
|
|
#define TESTREVERB_USESREVERB
|
|
#define TESTREVERB_USESFILTER
|
|
|
|
|
|
|
|
#include "RakiTests/Initializer/TestInitializer.h"
|
|
|
|
|
|
#include "RakiEngine/Data/Stream/FileStream.h"
|
|
#include "RakiEngine/Data/Stream/SeekableStreamPart.h"
|
|
#include "RakiEngine/Data/WaveFile/RiffChunkManager.h"
|
|
#include "RakiEngine/Data/WaveFile/BinWaveData/BinWaveData.h"
|
|
#include "RakiEngine/Engine/SoftwareEngine/SoftwareEngine.h"
|
|
#include "RakiEngine/Routing/AuxManager.h"
|
|
#include "RakiEngine/Routing/Reverb.h"
|
|
#include "RakiEngine/Routing/ReverbParams.h"
|
|
#include "RakiEngine/Routing/SoftwareRoutingGroup.h"
|
|
#include "RakiEngine/Sounds/SoftwareEngine/BufferSoftwareSound.h"
|
|
|
|
#if defined ( RAKI_PLATFORM_WIN32 )
|
|
|
|
#include "RakiTests/_Win32/CoInitializeInitObject.h"
|
|
|
|
#endif // ( RAKI_PLATFORM_WIN32 )
|
|
|
|
|
|
#if defined ( RAKI_USING_XAUDIO2 )
|
|
|
|
#include "RakiEngine/Sounds/_XAudio2/BufferSoundNative.h"
|
|
#include "RakiEngine/Routing/_XAudio2/ReverbNative_XAudio2.h"
|
|
|
|
#elif defined ( RAKI_PLATFORM_PS3 )
|
|
|
|
#include <sysutil/sysutil_common.h>
|
|
#include "RakiEngine/Sounds/_PS3/BufferSoundNative_PS3.h"
|
|
|
|
#elif defined ( RAKI_PLATFORM_WII )
|
|
|
|
#include <revolution/vi.h>
|
|
#include <revolution/pad.h>
|
|
|
|
#include "RakiEngine/Sounds/_Wii/BufferSoundNative_Wii.h"
|
|
|
|
#include <revolution/os.h>
|
|
#include <revolution/ax.h>
|
|
#include <revolution/mem.h>
|
|
#include <revolution/ai.h>
|
|
#include <revolution/dvd.h>
|
|
#include <revolution/vi.h>
|
|
|
|
#elif defined ( RAKI_PLATFORM_CAFE )
|
|
|
|
#include "RakiEngine/Sounds/_Cafe/BufferSoundNative_Cafe.h"
|
|
#include "RakiTests/_Cafe/Memory/SimpleHeap_Cafe.h"
|
|
|
|
#elif defined ( RAKI_PLATFORM_ORBIS )
|
|
|
|
size_t sceLibcHeapSize = SCE_LIBC_HEAP_SIZE_EXTENDED_ALLOC_NO_LIMIT;
|
|
unsigned int sceLibcHeapExtendedAlloc = 1;
|
|
|
|
#endif
|
|
|
|
|
|
namespace raki
|
|
{
|
|
|
|
|
|
class StreamBuffer
|
|
{
|
|
public:
|
|
|
|
inline void incRefCount() { m_refCount.incrementAndGetPrevious(); }
|
|
inline void decRefCount() { m_refCount.decrementAndGetPrevious(); }
|
|
inline bool isUsed() const { return m_refCount.get() ? true : false; }
|
|
|
|
|
|
private:
|
|
|
|
Atomic m_refCount;
|
|
|
|
};
|
|
|
|
static bool TestReverb( const char * _path, const bool _isLooping, Reverb * /*_reverb1*/ )
|
|
{
|
|
FileStream * fileStream = Engine::singleton().createReadFileStream();
|
|
|
|
if ( !fileStream )
|
|
return false;
|
|
|
|
bool opened = fileStream->open( _path );
|
|
|
|
if ( !opened )
|
|
{
|
|
RAKI_DELETE( fileStream );
|
|
|
|
return false;
|
|
}
|
|
|
|
#if defined ( RAKI_PLATFORM_WIN32 )
|
|
BinWaveData binWaveData( MemoryBlock::standard );
|
|
#elif defined ( RAKI_PLATFORM_XB360 )
|
|
BinWaveData binWaveData( MemoryBlock::xma2_aligned2048 );
|
|
#elif defined ( RAKI_PLATFORM_PS3 )
|
|
BinWaveData binWaveData( MemoryBlock::ps3_aligned128 );
|
|
#elif defined ( RAKI_PLATFORM_WII )
|
|
BinWaveData binWaveData( MemoryBlock::wii_mem2_aligned32 );
|
|
#elif defined ( RAKI_PLATFORM_CAFE )
|
|
BinWaveData binWaveData( MemoryBlock::cafe_aligned64 );
|
|
#elif defined ( RAKI_PLATFORM_ORBIS )
|
|
BinWaveData binWaveData( MemoryBlock::standard );
|
|
#endif
|
|
|
|
if ( !binWaveData.read( fileStream ) )
|
|
{
|
|
RAKI_DELETE( fileStream );
|
|
|
|
return false;
|
|
}
|
|
|
|
SoftwareRoutingGroup routingGroup;
|
|
routingGroup.setSendToAux( 0, 1.f, 0.f );
|
|
|
|
#ifdef RAKI_USING_SOFTWARE_ENGINE
|
|
BufferSoftwareSound bufferSound;
|
|
#else
|
|
BufferSoundNative bufferSound;
|
|
#endif
|
|
|
|
const bool isMusic = false;
|
|
SoundParams soundParams( isMusic, _isLooping );
|
|
|
|
bufferSound.createVoice( &binWaveData, soundParams );
|
|
bufferSound.setRoutingGroup( &routingGroup );
|
|
|
|
bufferSound.setPitch( 1.5f );
|
|
|
|
#ifdef TESTREVERB_USESFILTER
|
|
FilterParams filterParams( FilterParams::lowPass, 200.f );
|
|
bufferSound.setRoutingFilterParams( filterParams );
|
|
#endif // TESTREVERB_USESFILTER
|
|
|
|
//bufferSound.setPan( 0.2f );
|
|
|
|
bufferSound.updateRouting( true );
|
|
|
|
bufferSound.start();
|
|
|
|
int state = 0;
|
|
float testDuration = 20.f;
|
|
float durationArray[] = { 8.f, 12.f, testDuration };
|
|
|
|
if ( _isLooping )
|
|
{
|
|
f32 timeBeginning = Time::getTime();
|
|
|
|
// wait 5 seconds
|
|
f32 duration = 0.f;
|
|
while ( duration < testDuration )
|
|
{
|
|
#ifdef RAKI_PLATFORM_WII
|
|
VIWaitForRetrace();
|
|
#else // RAKI_PLATFORM_WII
|
|
Thread::sleep( 16 );
|
|
#endif // RAKI_PLATFORM_WII
|
|
|
|
const f32 timeNow = Time::getTime();
|
|
duration = timeNow - timeBeginning;
|
|
/*
|
|
if ( auxManager )
|
|
{
|
|
f32 linearFactor = duration / testDuration;
|
|
if ( linearFactor > 1.f ) linearFactor = 1.f;
|
|
const f32 linearVolume = Volume::getLinearVolumeFromLinearFactor( linearFactor );
|
|
f32 volume1 = Volume::getDecibelVolumeFromLinearVolume( linearVolume );
|
|
f32 volume2 = Volume::getDecibelVolumeFromLinearVolume( Volume::getInvertedLinearVolume( linearVolume ) );
|
|
|
|
auxManager->setRouteToAuxDecibelVolume( &bufferSound, 0, volume1 );
|
|
|
|
if ( auxManager->getNbAux() == 2 )
|
|
auxManager->setRouteToAuxDecibelVolume( &bufferSound, 1, volume2 );
|
|
}
|
|
*/
|
|
#ifdef TESTREVERB_USESREVERB
|
|
|
|
if ( ( duration > durationArray[ state ] ) && ( duration < testDuration ) )
|
|
{
|
|
switch( state )
|
|
{
|
|
case 0:
|
|
{
|
|
|
|
// ReverbBase::Params reverb_params( 0.9f );
|
|
// _reverb1->setParams( &reverb_params );
|
|
Engine::singleton().getAuxManager()->setRouteToAuxDecibelVolume( &bufferSound, 0, 0.f );
|
|
if ( Engine::singleton().getAuxManager()->getAux( 0 ) )
|
|
Engine::singleton().getAuxManager()->setRouteToAuxDecibelVolume( &bufferSound, 1, 0.f );
|
|
}
|
|
break;
|
|
|
|
case 1:
|
|
{
|
|
// ReverbBase::Params reverb_params( 0.7f );
|
|
// _reverb1->setParams( &reverb_params );
|
|
/*
|
|
Engine::singleton().getAuxManager()->setRouteToAuxDecibelVolume( &bufferSound, 0, -100.f );
|
|
if ( Engine::singleton().getAuxManager()->getAux( 0 ) )
|
|
Engine::singleton().getAuxManager()->setRouteToAuxDecibelVolume( &bufferSound, 1, 0.f );
|
|
*/
|
|
}
|
|
break;
|
|
}
|
|
|
|
++state;
|
|
}
|
|
|
|
#endif // TESTREVERB_USESREVERB
|
|
|
|
|
|
/*
|
|
|
|
static f32 lastTimeReverb = timeNow;
|
|
static f32 reverbDuration = 9.f;
|
|
if ( timeNow - lastTimeReverb > reverbDuration )
|
|
{
|
|
bufferSound.setDecibelVolume( -100.f );
|
|
bufferSound.updateRouting( false );
|
|
|
|
static ReverbBase::Params reverb_params( 0.7f );
|
|
RAKI_OUTPUT("reverb_params is on 0x%x", &reverb_params)
|
|
_reverb1->setParams( &reverb_params );
|
|
|
|
bufferSound.setDecibelVolume( 0.f );
|
|
|
|
lastTimeReverb = Time::getTime();
|
|
}
|
|
*/
|
|
bufferSound.updateRouting( false );
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
while( bufferSound.isPlaying() )
|
|
{
|
|
#ifdef RAKI_PLATFORM_WII
|
|
VIWaitForRetrace();
|
|
#else // RAKI_PLATFORM_WII
|
|
Thread::sleep( 16 );
|
|
#endif // RAKI_PLATFORM_WII
|
|
|
|
bufferSound.updateRouting( false );
|
|
}
|
|
}
|
|
|
|
bufferSound.destroyVoice();
|
|
|
|
// wait for destroy on async systems
|
|
while ( !bufferSound.isVoiceDestroyed() )
|
|
Thread::sleep( 5 );
|
|
|
|
RAKI_DELETE( fileStream );
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace raki
|
|
|
|
|
|
|
|
int rakimain()
|
|
{
|
|
|
|
#if defined ( RAKI_PLATFORM_WII )
|
|
DVDInit();
|
|
VIInit();
|
|
|
|
raki::SystemAllocator_Initialize();
|
|
|
|
#elif defined ( RAKI_PLATFORM_CAFE )
|
|
|
|
raki::SimpleHeap_Cafe::init();
|
|
|
|
#elif defined ( RAKI_PLATFORM_WIN32 )
|
|
|
|
raki::CoInitializeInitObject coInitializeInitObject;
|
|
|
|
#endif
|
|
|
|
|
|
raki::TestInitializer initializer;
|
|
|
|
|
|
#if defined ( RAKI_PLATFORM_WIN32 )
|
|
|
|
const char path_funky[] = "../../../../TestData/FunkyLoop.wav.w32adpcm";
|
|
const char path_stereo[] = "../../../../TestData/ShortSquare.wav.w32adpcm";
|
|
const char path_mono[] = "../../../../TestData/ShortSquareMonoPlusSine.wav.w32adpcm";
|
|
|
|
#elif defined ( RAKI_PLATFORM_XB360 )
|
|
|
|
const char path_funky[] = "game:\\FunkyLoop.wav.x360";
|
|
const char path_stereo[] = "game:\\ShortSquare.wav.x360";
|
|
const char path_mono[] = "game:\\ShortSquareMonoPlusSine.wav.x360";
|
|
|
|
#elif defined ( RAKI_PLATFORM_PS3 )
|
|
|
|
const char path_funky[] = "/app_home/Y:/JD5/JD/main/extern/Raki/TestData/FunkyLoop.wav.ps3";
|
|
const char path_stereo[] = "/app_home/Y:/JD5/JD/main/extern/Raki/TestData/ShortSquare.wav.ps3";
|
|
const char path_mono[] = "/app_home/Y:/JD5/JD/main/extern/Raki/TestData/ShortSquareMono.wav.ps3";
|
|
|
|
#elif defined ( RAKI_PLATFORM_WII )
|
|
|
|
const char path_stereo[] = "FunkyLoop.wav.wii";
|
|
const char path_mono[] = "ShortSquareMono.wav.wii";
|
|
|
|
#elif defined ( RAKI_PLATFORM_CAFE )
|
|
|
|
const char path_funky[] = "FunkyLoop.wav.cafe";
|
|
const char path_stereo[] = "ShortSquare.wav.cafe";
|
|
const char path_mono[] = "ShortSquareMonoPlusSine.wav.cafe";
|
|
|
|
#elif defined ( RAKI_PLATFORM_ORBIS )
|
|
|
|
const char path_funky[] = "/hostapp/_raki_/FunkyLoop.wav.orbis";
|
|
const char path_stereo[] = "/hostapp/_raki_/ShortSquare.wav.orbis";
|
|
const char path_mono[] = "/hostapp/_raki_/ShortSquareMonoPlusSine.wav.orbis";
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef TESTREVERB_USESREVERB
|
|
|
|
raki::ReverbParams reverb_params_1;
|
|
|
|
// XAudio2 reverb params
|
|
|
|
reverb_params_1.setXAudio2ReflectionsDelay( 100 ); // [0, 300] in ms
|
|
reverb_params_1.setXAudio2ReverbDelay( 20 ); // [0, 85] in ms
|
|
reverb_params_1.setXAudio2RearDelay( 2 ); // [0, 5] in ms
|
|
reverb_params_1.setXAudio2PositionLeft( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionRight( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionMatrixLeft( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionMatrixRight( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2EarlyDiffusion( 5 ); // [0, 15] no units
|
|
reverb_params_1.setXAudio2LateDiffusion( 5 ); // [0, 15] no units
|
|
reverb_params_1.setXAudio2LowEQGain( 3 ); // [0, 12] no units
|
|
reverb_params_1.setXAudio2LowEQCutoff( 3 ); // [0, 9] no units
|
|
reverb_params_1.setXAudio2HighEQGain( 2 ); // [0, 8] no units
|
|
reverb_params_1.setXAudio2HighEQCutoff( 4 ); // [0, 14] no units
|
|
reverb_params_1.setXAudio2RoomFilterFreq( 200 ); // [20, 20000] in Hz
|
|
reverb_params_1.setXAudio2RoomFilterMain( -10.f ); // [-100, 0] in dB
|
|
reverb_params_1.setXAudio2RoomFilterHF( -10.f ); // [-100, 0] in dB
|
|
reverb_params_1.setXAudio2ReflectionsGain( -10.f ); // [-100, 20] in dB
|
|
reverb_params_1.setXAudio2ReverbGain( -10.f ); // [-100, 20] in dB
|
|
reverb_params_1.setXAudio2DecayTime( 1.f ); // [0.1, inf] in seconds
|
|
reverb_params_1.setXAudio2Density( 10.f ); // [0, 100] (percentage)
|
|
reverb_params_1.setXAudio2RoomSize( 10.f ); // [1, 100] in feet
|
|
reverb_params_1.setXAudio2DisableLateField( true ); // TRUE to disable late field reflections
|
|
|
|
// PS3 reverb params
|
|
reverb_params_1.setPS3Room( -100.f ); // room (main) volume control in mB -10000 to 0 mB ( 100 mB == 1 dB )
|
|
reverb_params_1.setPS3RoomHF( -100.f ); // high frequency content input in mB, at HF_reference -10000 to 0 mB
|
|
reverb_params_1.setPS3DecayTime( 5.f ); // decay time of late reverberation in seconds 0.1 to 20 seconds
|
|
reverb_params_1.setPS3DecayHFRatio( 0.5f ); // ratio of high frequency decay in late reverb 0.1 to 2.0
|
|
reverb_params_1.setPS3Reflections( -100.f ); // volume of early reflections in mB -10000 to 1000 mB
|
|
reverb_params_1.setPS3ReflectionsDelay( 0.1f ); // delay from input signal until first reflection 0.0 to 0.3 seconds
|
|
reverb_params_1.setPS3Reverb( -100.f ); // volume of late reverb in mB -10000 to 2000 mB
|
|
reverb_params_1.setPS3ReverbDelay( 0.05f ); // delay from first reflection until late reverb 0.0 to 0.1 seconds
|
|
reverb_params_1.setPS3Diffusion( 10.f ); // echo density in late reverberation 0 to 100 %
|
|
reverb_params_1.setPS3Density( 10.f ); // modal density in late reverberation 0 to 100 %
|
|
reverb_params_1.setPS3HFReference( 200.f ); // reference frequency for Room_HF and Decay_HF_ratio 20 to 20000 Hertz
|
|
reverb_params_1.setPS3HFReference( -1 ); // channel index to crossfade / mix signal with for stereo -1 == off, 0 to 7 == mix chan
|
|
reverb_params_1.setPS3EarlyReflectionPattern( 0 ); // enum: CELL_MSFX_ROOM1_LEFT = 0, CELL_MSFX_ROOM1_RIGHT, CELL_MSFX_ROOM2_LEFT, CELL_MSFX_ROOM2_RIGHT, CELL_MSFX_ROOM3_LEFT, CELL_MSFX_ROOM3_RIGHT
|
|
reverb_params_1.setPS3LateReverbPattern( 0 ); // enum: CELL_MSFX_ROOM1_LATE_LEFT = 0, CELL_MSFX_ROOM1_LATE_RIGHT
|
|
reverb_params_1.setPS3EarlyReflectionScaler( 10.f ); // scaler 0 -> 100% for early reflections. 0 == single reflection 100 == widely spread reflections
|
|
reverb_params_1.setPS3LFReference( 200.f ); // reference low frequency 20 to 20000 Hertz
|
|
reverb_params_1.setPS3RoomLF( -100.f ); // low frequency content input in mB, at LF_reference -10000 to 0 mB
|
|
|
|
// AX (Wii/WiiU) reverb params
|
|
reverb_params_1.setAXColoration( 0.3f ); // Tunes the coefficients of the all-pass filter. Specify a value as 0.0 <= value <= 1.0. This number is used to simulate the acoustic properties of sound-reflective walls. In general, the smaller this value becomes, the coarser the reverberation density. In the opposite way, as this value increases the reverberation becomes more dense, but waveform interference may cause the high frequencies to stand out.
|
|
reverb_params_1.setAXTime( 0.1f ); // Time until reverb attenuates. Specify a value of 0.0 or greater (units of sec). Specifying 0.01 seconds for time can achieve simulation of an extremely small room. If time is set as 10.0 seconds, the simulation is that of a cathedral or stadium.
|
|
reverb_params_1.setAXDamping( 0.3f ); // Tunes the filter coefficient of the low-pass filter (LPF). Specify a value as 0.0 <= value <= 1.0. As this value approaches 0.0, the signal's low-frequency portion becomes its main content and reverb begins to stand out. In the opposite way, as this value approaches 1.0, the high-frequency portion of the signal is passed with less attenuation, and reverb becomes less noticeable.
|
|
reverb_params_1.setAXPreDelay( 0.1f ); // Time until reverb begins. Specify a value of 0.0 or greater (units of sec). When simulating a large room, specify a large value for preDelay. This increases the distance between the sound source and the sound-reflecting walls.
|
|
reverb_params_1.setAXCrossTalk( 0.3f ); // Sets the amount of interaction between channels. Specify a value as 0.0 <= value <= 1.0. If crosstalk is set to 0.0, the reverberation does not seep into other channels at all, and any interaction among the channels is eliminated. If set to a value larger than 0.0, the reverberation will seep into other channels. - Note: When Dolby Pro Logic II is selected for the output, sounds can seep between channels due to processing by the AX of the output received from the AXFX. This is true even when the value for crosstalk is set to 0 and, as far as the AXFX is concerned, there is no interaction between channels.
|
|
|
|
// XAudio2 reverb params
|
|
|
|
reverb_params_1.setXAudio2ReflectionsDelay( 100 ); // [0, 300] in ms
|
|
reverb_params_1.setXAudio2ReverbDelay( 20 ); // [0, 85] in ms
|
|
reverb_params_1.setXAudio2RearDelay( 2 ); // [0, 5] in ms
|
|
reverb_params_1.setXAudio2PositionLeft( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionRight( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionMatrixLeft( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2PositionMatrixRight( 10 ); // [0, 30] no units
|
|
reverb_params_1.setXAudio2EarlyDiffusion( 5 ); // [0, 15] no units
|
|
reverb_params_1.setXAudio2LateDiffusion( 5 ); // [0, 15] no units
|
|
reverb_params_1.setXAudio2LowEQGain( 3 ); // [0, 12] no units
|
|
reverb_params_1.setXAudio2LowEQCutoff( 3 ); // [0, 9] no units
|
|
reverb_params_1.setXAudio2HighEQGain( 2 ); // [0, 8] no units
|
|
reverb_params_1.setXAudio2HighEQCutoff( 4 ); // [0, 14] no units
|
|
reverb_params_1.setXAudio2RoomFilterFreq( 2000 ); // [20, 20000] in Hz
|
|
reverb_params_1.setXAudio2RoomFilterMain( 0.f ); // [-100, 0] in dB
|
|
reverb_params_1.setXAudio2RoomFilterHF( 0.f ); // [-100, 0] in dB
|
|
reverb_params_1.setXAudio2ReflectionsGain( 10.f ); // [-100, 20] in dB
|
|
reverb_params_1.setXAudio2ReverbGain( 10.f ); // [-100, 20] in dB
|
|
reverb_params_1.setXAudio2DecayTime( 10.f ); // [0.1, inf] in seconds
|
|
reverb_params_1.setXAudio2Density( 100.f ); // [0, 100] (percentage)
|
|
reverb_params_1.setXAudio2RoomSize( 10.f ); // [1, 100] in feet
|
|
reverb_params_1.setXAudio2DisableLateField( true ); // TRUE to disable late field reflections
|
|
|
|
// Orbis reverb params
|
|
|
|
reverb_params_1.setOrbisRoom( -1000.f ); // room (main) volume control in mB -10000 to 0 mB ( 100 mB == 1 dB )
|
|
reverb_params_1.setOrbisRoomHF( -1000.f ); // high frequency content input in mB, at HF_reference -10000 to 0 mB
|
|
reverb_params_1.setOrbisDecayTime( 5.f ); // decay time of late reverberation in seconds 0.1 to 20 seconds
|
|
reverb_params_1.setOrbisDecayHFRatio( 0.5f ); // ratio of high frequency decay in late reverb 0.1 to 2.0
|
|
reverb_params_1.setOrbisReflections( -1000.f ); // volume of early reflections in mB -10000 to 1000 mB
|
|
reverb_params_1.setOrbisReflectionsDelay( 0.1f ); // delay from input signal until first reflection 0.0 to 0.3 seconds
|
|
reverb_params_1.setOrbisReverb( -1000.f ); // volume of late reverb in mB -10000 to 2000 mB
|
|
reverb_params_1.setOrbisReverbDelay( 0.05f ); // delay from first reflection until late reverb 0.0 to 0.1 seconds
|
|
reverb_params_1.setOrbisDiffusion( 10.f ); // echo density in late reverberation 0 to 100 %
|
|
reverb_params_1.setOrbisDensity( 10.f ); // modal density in late reverberation 0 to 100 %
|
|
reverb_params_1.setOrbisHFReference( 200.f ); // reference frequency for Room_HF and Decay_HF_ratio 20 to 20000 Hertz
|
|
reverb_params_1.setOrbisHFReference( -1 ); // channel index to crossfade / mix signal with for stereo -1 == off, 0 to 7 == mix chan
|
|
|
|
// testing with sony params: SCE_NGS2_I3DL2_PRESET_STONECORRIDOR since the above is too low :(
|
|
// #define SCE_NGS2_I3DL2_PRESET_STONECORRIDOR {1.0f, 0.0f, -1000, -237, 0, 2.70f,0.79f, -1214,0.013f, 395,0.020f,100.0f,100.0f,5000.0f, {0,0,0,0,0,0,0,0}}
|
|
reverb_params_1.setOrbisRoom( -1000.f ); // room (main) volume control in mB -10000 to 0 mB ( 100 mB == 1 dB )
|
|
reverb_params_1.setOrbisRoomHF( -237.f ); // high frequency content input in mB, at HF_reference -10000 to 0 mB
|
|
reverb_params_1.setOrbisReflectionPattern( 0 ); // Early reflection Pattern (0~ 2)
|
|
reverb_params_1.setOrbisDecayTime( 2.7f ); // decay time of late reverberation in seconds 0.1 to 20 seconds
|
|
reverb_params_1.setOrbisDecayHFRatio( 0.79f ); // ratio of high frequency decay in late reverb 0.1 to 2.0
|
|
reverb_params_1.setOrbisReflections( -1214 ); // volume of early reflections in mB -10000 to 1000 mB
|
|
reverb_params_1.setOrbisReflectionsDelay( 0.013f ); // delay from input signal until first reflection 0.0 to 0.3 seconds
|
|
reverb_params_1.setOrbisReverb( -395.f ); // volume of late reverb in mB -10000 to 2000 mB
|
|
reverb_params_1.setOrbisReverbDelay( 0.02f ); // delay from first reflection until late reverb 0.0 to 0.1 seconds
|
|
reverb_params_1.setOrbisDiffusion( 100.f ); // echo density in late reverberation 0 to 100 %
|
|
reverb_params_1.setOrbisDensity( 100.f ); // modal density in late reverberation 0 to 100 %
|
|
reverb_params_1.setOrbisHFReference( 5000.f ); // reference frequency for Room_HF and Decay_HF_ratio 20 to 20000 Hertz
|
|
|
|
raki::Reverb reverb1;
|
|
reverb1.create( &reverb_params_1 );
|
|
|
|
raki::Engine::singleton().getAuxManager()->registerAux( &reverb1, 0 );
|
|
|
|
static int count = 100;
|
|
|
|
// while ( count-- )
|
|
{
|
|
|
|
reverb1.setParams( &reverb_params_1, 1.f );
|
|
//reverb2.setParams( &reverb_params_2 );
|
|
|
|
if ( !raki::TestReverb( path_mono, true, &reverb1 ) )
|
|
return -1;
|
|
|
|
if ( !raki::TestReverb( path_stereo, true, &reverb1 ) )
|
|
return -1;
|
|
|
|
if ( !raki::TestReverb( path_funky, true, &reverb1 ) )
|
|
return -1;
|
|
|
|
// if ( !raki::TestReverb( path_mono, true, &reverb1 ) )
|
|
// return -1;
|
|
}
|
|
|
|
|
|
#else
|
|
|
|
if ( !raki::TestReverb( path_mono, true, NULL, NULL ) )
|
|
return -1;
|
|
|
|
if ( !raki::TestReverb( path_stereo, true, NULL, NULL ) )
|
|
return -1;
|
|
|
|
#endif // TESTREVERB_USESREVERB
|
|
|
|
#ifdef RAKI_USING_SOFTWARE_ENGINE
|
|
raki::SoftwareEngine::singleton().disableAudioCallback();
|
|
#endif // RAKI_USING_SOFTWARE_ENGINE
|
|
reverb1.destroy();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined ( RAKI_PLATFORM_CAFE )
|
|
|
|
int run_demo (int /*intArg*/, void */*ptrArg*/)
|
|
{
|
|
return rakimain();
|
|
}
|
|
|
|
u32 running_core;
|
|
u32 main_core;
|
|
u32 first_subcore;
|
|
u32 second_subcore;
|
|
u32 wait_main_core;
|
|
u32 wait_first_subcore;
|
|
u32 wait_second_subcore;
|
|
OSRendezvous rendezvous;
|
|
|
|
void
|
|
SetupCoreIds(void)
|
|
{
|
|
running_core = OSGetCoreId();
|
|
main_core = OSGetMainCoreId();
|
|
|
|
first_subcore = 0;
|
|
second_subcore = 2;
|
|
wait_main_core = OS_WAIT_CORE_MAIN;
|
|
wait_first_subcore = OS_WAIT_CORE_SUB1;
|
|
wait_second_subcore = OS_WAIT_CORE_SUB2;
|
|
|
|
if (main_core == 0)
|
|
{
|
|
first_subcore = 1;
|
|
second_subcore = 2;
|
|
wait_main_core = OS_WAIT_CORE_SUB1;
|
|
wait_first_subcore = OS_WAIT_CORE_MAIN;
|
|
wait_second_subcore = OS_WAIT_CORE_SUB2;
|
|
}
|
|
else
|
|
if (main_core == 2)
|
|
{
|
|
first_subcore = 0;
|
|
second_subcore = 1;
|
|
wait_main_core = OS_WAIT_CORE_SUB2;
|
|
wait_first_subcore = OS_WAIT_CORE_SUB1;
|
|
wait_second_subcore = OS_WAIT_CORE_MAIN;
|
|
}
|
|
}
|
|
|
|
int main( int /*argc*/, char * /*argv[]*/ )
|
|
{
|
|
|
|
u32 gx2InitAttribs[] =
|
|
{
|
|
GX2_INIT_ATTRIB_NULL // terminates the list
|
|
};
|
|
GX2Init(gx2InitAttribs);
|
|
|
|
// launch test on Core 0 if present
|
|
if (OSGetCoreCount() == 3)
|
|
{
|
|
OSThread* defaultThread0;
|
|
|
|
SetupCoreIds();
|
|
|
|
OSReport("Running Core == %d\n", running_core);
|
|
OSReport("OS Main Core == %d\n\n", main_core);
|
|
|
|
OSInitRendezvous(&rendezvous);
|
|
|
|
//
|
|
// Restart default thread on 1st subcore, core0
|
|
//
|
|
|
|
defaultThread0 = OSGetDefaultThread(first_subcore);
|
|
OSRunThread(defaultThread0,
|
|
run_demo,
|
|
0,
|
|
(void*) 0x23232323);
|
|
|
|
OSWaitRendezvous(&rendezvous, wait_first_subcore);
|
|
}
|
|
else
|
|
{
|
|
run_demo(0, NULL);
|
|
}
|
|
|
|
GX2Shutdown();
|
|
|
|
return 0;
|
|
}
|
|
|
|
#elif defined ( RAKI_USING_XAUDIO2 )
|
|
int _tmain(int /*argc*/, _TCHAR* /*argv[]*/)
|
|
{
|
|
rakimain();
|
|
|
|
return 0;
|
|
}
|
|
#elif defined ( RAKI_PLATFORM_ORBIS )
|
|
int main( int /*argc*/, char ** /*argv[]*/ )
|
|
{
|
|
rakimain();
|
|
|
|
return 0;
|
|
}
|
|
#else // RAKI_USING_XAUDIO2
|
|
int main( int /*argc*/, char * /*argv[]*/ )
|
|
{
|
|
rakimain();
|
|
|
|
return 0;
|
|
}
|
|
#endif // RAKI_USING_XAUDIO2
|