#include "Precompiled.h" #include "RakiEngine/Data/MemoryBlock/MemoryBlock.h" #include "RakiEngine/Data/Stream/MemoryStream/MemoryStream.h" #include "RakiEngine/Data/Stream/SeekableStreamPart.h" #include "RakiEngine/Data/Stream/AsyncReadStreamer.h" #include "RakiEngine/Data/WaveFile/BinWaveData/BinWaveData.h" #include "RakiEngine/Data/WaveFile/RiffChunkManager.h" #include "RakiEngine/Sounds/Sequencer/Sequencer.h" #include "RakiEngine/Sounds/Sequencer/SineNoteMemBlock.h" #include "RakiEngine/Sounds/StreamBufferInfo.h" #include "RakiEngine/Sounds/SoftwareEngine/StreamSoftwareSound.h" #include "RakiEngine/System/Streaming/StreamingThread.h" #include "RakiEngine/Utils/Calcs.h" #include "RakiTests/Sounds/PCMDataProvider.h" #include "RakiTests/Stream/ReadFileStream.h" #include "RakiEngine/Utils/Calcs.h" #if defined ( RAKI_USING_XAUDIO2 ) #include "RakiEngine/Sounds/_XAudio2/BufferSoundNative.h" #include "RakiEngine/Sounds/_XAudio2/PCMStreamSoundNative.h" #include "RakiEngine/Sounds/_XAudio2/XMA2StreamSoundNative_X360.h" #include "RakiEngine/Specific/_XB360/Specific_X360.h" #include "RakiTests/Sounds/XMA2DataProvider.h" #elif defined ( RAKI_PLATFORM_PS3 ) #include #include "RakiEngine/Sounds/_PS3/BufferSoundNative_PS3.h" #include "RakiEngine/Sounds/_PS3/MP3StreamSoundNative_PS3.h" #include "RakiTests/Sounds/MP3DataProvider.h" #elif defined ( RAKI_PLATFORM_WII ) #include #include "RakiTests/Sounds/ADPCMDataProvider_Wii.h" #include "RakiEngine/Sounds/_Wii/BufferSoundNative_Wii.h" #include "RakiEngine/Sounds/_Wii/ADPCMStreamSoundNative_Wii.h" #include "RakiEngine/Sounds/_Wii/PCMStreamSoundNative_Wii.h" #elif defined ( RAKI_PLATFORM_CAFE ) #include "RakiTests/Sounds/ADPCMDataProvider_Cafe.h" #include "RakiEngine/Sounds/_Cafe/ADPCMStreamSoundNative_Cafe.h" #include "RakiTests/_Cafe/Memory/SimpleHeap_Cafe.h" #endif #if defined ( RAKI_PLATFORM_WIN32 ) #include "RakiTests/_Win32/CoInitializeInitObject.h" #endif // ( RAKI_PLATFORM_WIN32 ) #include "RakiTests/Initializer/TestInitializer.h" #define TESTSTREAMING_WITHOUT_PREFETCHBUFFER namespace raki { extern void SystemAllocator_Initialize(); #if defined ( RAKI_PLATFORM_WII ) || defined ( RAKI_PLATFORM_CAFE ) #define BUFFER_PREFETCH_SIZE 55040 #else #define BUFFER_PREFETCH_SIZE ( 2 * 0x10000 ) //#define BUFFER_PREFETCH_SIZE ( 2 * 0x1000 ) #endif void TestSoundStreaming( const char * _path1, const char * _path2 ); void TestSoundStreaming( const char * _path1, const char * _path2 ) { StreamingThread streamingThread; streamingThread.start(); ReadFileStream fileStream1; ReadFileStream fileStream2; // TestStreamUpdateClient testUpdateClient; bool opened = fileStream1.open( _path1 ); RAKI_ASSERT_WITH_MESSAGE( opened, "Invalid path" ); opened = fileStream2.open( _path2 ); RAKI_ASSERT_WITH_MESSAGE( opened, "Invalid path" ); BinWaveData binWaveData1( MemoryBlock::ms_nativeMemoryType ); BinWaveData binWaveData2( MemoryBlock::ms_nativeMemoryType ); bool readOK = binWaveData1.readOnlyHeader( &fileStream1 ); RAKI_ASSERT( readOK ); readOK = binWaveData2.readOnlyHeader( &fileStream2 ); RAKI_ASSERT( readOK ); SoundStreamDataProvider * dataProvider = NULL; SeekableStreamPart * seekableStreamPart1 = NULL; SeekableStreamPart * seekableStreamPart2 = NULL; AsyncReadStreamer * asyncReader = RAKI_NEW( AsyncReadStreamer ); bool buffersAllocated = false; #if defined ( RAKI_PLATFORM_WIN32 ) #if defined ( RAKI_USING_SOFTWARE_ENGINE ) StreamSoftwareSound pcmStreamSound; #else PCMStreamSoundNative pcmStreamSound; #endif // pcmStreamSound.getStreamBufferInfo()->setStreamUpdateClient( &testUpdateClient ); buffersAllocated = pcmStreamSound.allocateBuffers( BUFFER_PREFETCH_SIZE ); RAKI_ASSERT( buffersAllocated ); #elif defined ( RAKI_PLATFORM_XB360 ) XMA2StreamSoundNative xma2StreamSound; // xma2StreamSound.getStreamBufferInfo()->setStreamUpdateClient( &testUpdateClient ); buffersAllocated = xma2StreamSound.allocateBuffers( BUFFER_PREFETCH_SIZE ); RAKI_ASSERT( buffersAllocated ); #elif defined ( RAKI_PLATFORM_WII ) ADPCMDataProvider * adpcmDataProvider = NULL; ADPCMStreamSoundNative adpcmStreamSound( 2 ); // adpcmStreamSound.getStreamBufferInfo()->setStreamUpdateClient( &testUpdateClient ); buffersAllocated = adpcmStreamSound.allocateBuffers( BUFFER_PREFETCH_SIZE ); RAKI_ASSERT( buffersAllocated ); #elif defined ( RAKI_PLATFORM_CAFE ) ADPCMDataProvider * adpcmDataProvider = NULL; ADPCMStreamSoundNative adpcmStreamSound( 2 ); // pcmStreamSound.getStreamBufferInfo()->setStreamUpdateClient( &testUpdateClient ); buffersAllocated = adpcmStreamSound.allocateBuffers( BUFFER_PREFETCH_SIZE ); RAKI_ASSERT( buffersAllocated ); #elif defined ( RAKI_PLATFORM_PS3 ) MP3StreamSoundNative mp3StreamSound; // mp3StreamSound.getStreamBufferInfo()->setStreamUpdateClient( &testUpdateClient ); buffersAllocated = mp3StreamSound.allocateBuffers( BUFFER_PREFETCH_SIZE ); RAKI_ASSERT( buffersAllocated ); #endif const bool isMusic = false; const bool isLooping = false; SoundParams soundParams( isMusic, isLooping ); WAVEFORMATEX * waveFormat = (WAVEFORMATEX*) binWaveData1.getChunkData( RiffChunkManager::ms_riffTagFmt ); u32 waveFormatSize = binWaveData1.getChunkSize( RiffChunkManager::ms_riffTagFmt ); RAKI_ASSERT( binWaveData1.isStreamed() ); RAKI_ASSERT( binWaveData2.isStreamed() ); u16 formatTag = waveFormat->wFormatTag; switch ( formatTag ) { #if defined ( RAKI_PLATFORM_WII ) case WAVE_FORMAT_ADPCM: { RAKI_ASSERT( waveFormat->nChannels <= 2 ); RAKI_ASSERT( waveFormat->wBitsPerSample <= 16 ); RAKI_ASSERT( waveFormat->nSamplesPerSec <= 48000 ); bool create = adpcmStreamSound.createVoice( &binWaveData1, soundParams ); RAKI_ASSERT( create ); seekableStreamPart1 = RAKI_NEW( SeekableStreamPart )( &fileStream1, binWaveData1.getDataOffset(), binWaveData1.getDataSize() ); asyncReader->allocateBuffers( BUFFER_PREFETCH_SIZE ); u64 prefetchSize = 0; //dataBlock.getSize() > BUFFER_PREFETCH_SIZE ? BUFFER_PREFETCH_SIZE : dataBlock.getSize(); #ifdef TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( NULL, 0, seekableStreamPart1, NULL ); #else // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( dataBlock.getBuffer(), prefetchSize, seekableStreamPart1, NULL ); #endif // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamingThread( &streamingThread ); const u32 nbChannels = binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspR ) ? 2 : 1; adpcmDataProvider = RAKI_NEW( ADPCMDataProvider )( asyncReader, NULL, nbChannels, binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspL ), binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspR ) ); adpcmDataProvider->setNextStream( asyncReader, NULL ); adpcmStreamSound.prepare( adpcmDataProvider ); adpcmStreamSound.updateRouting( true ); adpcmStreamSound.start(); bool isPlaying = adpcmStreamSound.isPlaying(); RAKI_ASSERT( isPlaying ); } break; #endif // RAKI_PLATFORM_WII #if defined ( RAKI_PLATFORM_CAFE ) case WAVE_FORMAT_ADPCM: { RAKI_ASSERT( waveFormat->nChannels <= 2 ); RAKI_ASSERT( waveFormat->wBitsPerSample <= 16 ); RAKI_ASSERT( waveFormat->nSamplesPerSec <= 48000 ); bool create = adpcmStreamSound.createVoice( &binWaveData1, soundParams ); RAKI_ASSERT( create ); seekableStreamPart1 = RAKI_NEW( SeekableStreamPart )( &fileStream1, binWaveData1.getDataOffset(), binWaveData1.getDataSize() ); seekableStreamPart2 = RAKI_NEW( SeekableStreamPart )( &fileStream2, binWaveData2.getDataOffset(), binWaveData2.getDataSize() ); asyncReader->allocateBuffers( BUFFER_PREFETCH_SIZE ); // u64 prefetchSize = dataBlock.getSize() > BUFFER_PREFETCH_SIZE ? BUFFER_PREFETCH_SIZE : dataBlock.getSize(); #ifdef TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( NULL, 0, seekableStreamPart1, NULL ); #else // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( dataBlock.getBuffer(), prefetchSize, seekableStreamPart, (void*)1/*&clientData*/ ); #endif // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamingThread( &streamingThread ); const u32 nbChannels = binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspR ) ? 2 : 1; RAKI_ASSERT( nbChannels == 2 ); // ADPCMStreamSoundNative adpcmStreamSound( 2 ); u32 * debug = (u32*)binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspL ); RAKI_OUTPUT("binWaveData1.getChunkData( dspL ) %.8x %.8x %.8x %.8x", debug[8], debug[9], debug[10], debug[11] ); debug = (u32*)binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspR ); RAKI_OUTPUT("binWaveData1.getChunkData( dspR ) %.8x %.8x %.8x %.8x", debug[8], debug[9], debug[10], debug[11] ); adpcmDataProvider = RAKI_NEW( ADPCMDataProvider )( asyncReader, (void*)1, nbChannels, true, binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspL ), binWaveData1.getChunkData( RiffChunkManager::ms_riffTagDspR ) ); // add second source debug = (u32*)binWaveData2.getChunkData( RiffChunkManager::ms_riffTagDspL ); RAKI_OUTPUT("binWaveData2.getChunkData( dspL ) %.8x %.8x %.8x %.8x", debug[8], debug[9], debug[10], debug[11] ); debug = (u32*)binWaveData2.getChunkData( RiffChunkManager::ms_riffTagDspR ); RAKI_OUTPUT("binWaveData2.getChunkData( dspR ) %.8x %.8x %.8x %.8x", debug[8], debug[9], debug[10], debug[11] ); adpcmDataProvider->setNextStream( seekableStreamPart2, binWaveData2.getChunkData( RiffChunkManager::ms_riffTagDspL ), binWaveData2.getChunkData( RiffChunkManager::ms_riffTagDspR ), (void*)2/*&clientData*/ ); adpcmStreamSound.prepare( adpcmDataProvider ); adpcmStreamSound.updateRouting( true ); adpcmStreamSound.start(); bool isPlaying = adpcmStreamSound.isPlaying(); RAKI_ASSERT( isPlaying ); } break; #endif // RAKI_PLATFORM_CAFE #if defined ( RAKI_PLATFORM_WIN32 ) case WAVE_FORMAT_PCM: { // hello bill... WAVEFORMATEX pcmFormat = { 0 }; RAKI_ASSERT( waveFormatSize <= sizeof( WAVEFORMATEX ) ); memcpy( &pcmFormat, waveFormat, waveFormatSize ); pcmFormat.cbSize = 0; RAKI_ASSERT( pcmFormat.nChannels <= 2 ); RAKI_ASSERT( pcmFormat.wBitsPerSample <= 16 ); RAKI_ASSERT( pcmFormat.nSamplesPerSec <= 48000 ); bool create = pcmStreamSound.createVoice( &binWaveData1, soundParams ); RAKI_ASSERT( create ); seekableStreamPart1 = RAKI_NEW( SeekableStreamPart )( &fileStream1, binWaveData1.getDataOffset(), binWaveData1.getDataSize() ); seekableStreamPart2 = RAKI_NEW( SeekableStreamPart )( &fileStream2, binWaveData2.getDataOffset(), binWaveData2.getDataSize() ); asyncReader->allocateBuffers( BUFFER_PREFETCH_SIZE ); // u64 prefetchSize = dataBlock.getSize() > BUFFER_PREFETCH_SIZE ? BUFFER_PREFETCH_SIZE : dataBlock.getSize(); #ifdef TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( NULL, 0, seekableStreamPart1, NULL ); #else // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( dataBlock.getBuffer(), BUFFER_PREFETCH_SIZE, seekableStreamPart1, NULL ); #endif // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamingThread( &streamingThread ); dataProvider = RAKI_NEW( PCMDataProvider )( asyncReader, (void*)1, (u64) pcmFormat.nBlockAlign, pcmFormat.nChannels, true ); // add second source ( (PCMDataProvider*) dataProvider )->setNextStream( seekableStreamPart2, (void*)2 ); pcmStreamSound.prepare( dataProvider ); pcmStreamSound.updateRouting( true ); pcmStreamSound.start(); bool isPlaying = pcmStreamSound.isPlaying(); RAKI_ASSERT( isPlaying ); } break; #endif // defined ( RAKI_PLATFORM_WIN32 ) #if defined ( RAKI_PLATFORM_XB360 ) case WAVE_FORMAT_XMA2: { RAKI_ASSERT( waveFormatSize >= sizeof( XMA2WAVEFORMATEX ) ); // MS HACK !! XMA2WAVEFORMATEX * xma2waveFormat = (XMA2WAVEFORMATEX *)waveFormat; xma2waveFormat->PlayBegin = xma2waveFormat->LoopBegin; xma2waveFormat->PlayLength = xma2waveFormat->LoopLength; bool create = xma2StreamSound.createVoice( &binWaveData1, soundParams ); RAKI_ASSERT( create ); seekableStreamPart1 = RAKI_NEW( SeekableStreamPart )( &fileStream1, binWaveData1.getDataOffset(), binWaveData1.getDataSize() ); asyncReader->allocateBuffers( BUFFER_PREFETCH_SIZE / 2 ); u64 prefetchSize = 0;//dataBlock.getSize() > BUFFER_PREFETCH_SIZE ? BUFFER_PREFETCH_SIZE : dataBlock.getSize(); #ifdef TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( NULL, 0, seekableStreamPart1, NULL ); #else // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamData( dataBlock.getBuffer(), BUFFER_PREFETCH_SIZE, seekableStreamPart1, NULL ); #endif // TESTSTREAMING_WITHOUT_PREFETCHBUFFER asyncReader->setStreamingThread( &streamingThread ); /* // preload buffers if there is no prefetch buffer for ( int i = 0 ; i < 10 ; ++i ) { asyncReader->update(); Thread::sleep( 50 ); } */ u32 * seekTable = (u32*)binWaveData1.getChunkData( RiffChunkManager::ms_riffTagSeek ); u32 seekTableSize = binWaveData1.getChunkSize( RiffChunkManager::ms_riffTagSeek ); //dataProvider = RAKI_NEW( XMA2DataProvider )( asyncReader, xma2waveFormat, seekTable, seekTableSize, sizeInTicks, sizeInBars, nbBeatsPerBar, xma2waveFormat->wfx.nChannels ); dataProvider = RAKI_NEW( XMA2DataProvider )( asyncReader, xma2waveFormat, seekTable, seekTableSize, 0, 0, 0, xma2waveFormat->wfx.nChannels ); ((XMA2DataProvider*)dataProvider)->setNextStream( seekableStreamPart1, NULL ); xma2StreamSound.prepare( dataProvider ); xma2StreamSound.setDecibelVolume( 0.f ); xma2StreamSound.updateRouting( true ); xma2StreamSound.start(); } break; #endif // ( RAKI_PLATFORM_XB360 ) #if defined ( RAKI_PLATFORM_PS3 ) case WAVE_FORMAT_MPEGLAYER3: { /* void * mp3Data = waveFile.getChunkData( dataChunck ); unsigned int tSize = 0; unsigned int offset = 0; float tTime = 0.f; while(1) { CellMSMP3FrameHeader header; int ret = cellMSMP3GetFrameInfo( mp3Data, &header ); if ( ret == -1 ) { printf("Invalid MP3 header\n"); printf("Offset=0x%x\n",offset); break; } tSize += header.PacketSize; // Update total file size if ((header.ID3==0)&&(header.Tag==0)) tTime+=header.PacketTime; // Update total playing time (in seconds) mp3Data = (void*)( header.PacketSize + (u32)mp3Data ); // Move forward to next packet offset+=header.PacketSize; // ** Display packet information ** // Using the packet size and packet time information, it is possible to build "Seek Tables". // Then, by knowing approximately what time (in seconds) you require to playback from, // you can start playback from the closest data packet by searching for the closest record in the table. if (header.ID3!=0) { printf("Found ID3 Info\n"); printf("Version: %x.%x\n",header.ID3>>8, header.ID3&255); } else if (header.Tag!=0) { printf("Found Tag info\n"); } else { printf("Sync: 0x%x\n",header.Sync); printf("ID: 0x%x\n",header.ID); printf("Layer: 0x%x\n",header.Layer); printf("ProtBit: 0x%x\n",header.ProtBit); printf("BitRate: %d\n",header.BitRate); printf("Frequency: %d\n",header.Frequency); printf("PadBit: 0x%x\n",header.PadBit); printf("PrivBit: 0x%x\n",header.PrivBit); printf("Mode: 0x%x\n",header.Mode); printf("Copy: 0x%x\n",header.Copy); printf("Home: 0x%x\n",header.Home); printf("Emphasis: 0x%x\n",header.Emphesis); printf("Packet Time (secs): %f\n",header.PacketTime); } printf("Packet Size (bytes): 0x%x\n",header.PacketSize); if ( tSize == waveFile.getChunkSize( dataChunck ) ) { printf("MP3 File is valid.\n"); printf("Total Playback Time at %d Hz = (secs): %f\n",header.Frequency,tTime); break; } else if (tSize > waveFile.getChunkSize( dataChunck ) ) { break; } } */ bool create = mp3StreamSound.createVoice( &binWaveData1, soundParams ); RAKI_ASSERT( create ); seekableStreamPart1 = RAKI_NEW( SeekableStreamPart )( &fileStream1, binWaveData1.getDataOffset(), binWaveData1.getDataSize() ); asyncReader->allocateBuffers( BUFFER_PREFETCH_SIZE / 2 ); asyncReader->setStreamData( NULL, 0, seekableStreamPart1, NULL ); asyncReader->setStreamingThread( &streamingThread ); dataProvider = RAKI_NEW( MP3DataProvider )( asyncReader, NULL, waveFormat->nChannels ); ( (MP3DataProvider*) dataProvider )->setNextStream( seekableStreamPart1, NULL ); mp3StreamSound.prepare( dataProvider ); mp3StreamSound.updateRouting( true ); mp3StreamSound.start(); } break; #endif // ( RAKI_PLATFORM_PS3 ) default: RAKI_ASSERT_FALSE; } #define COUNT_LOOP 50 #define COUNT_STOP 20 #define COUNT_START 34 int count = 0; for ( ;; ) { bool isPlaying = false; #ifdef RAKI_PLATFORM_WII VIWaitForRetrace(); #else // RAKI_PLATFORM_WII Thread::sleep( 25 ); #endif // RAKI_PLATFORM_WII #if defined ( RAKI_PLATFORM_WIN32 ) pcmStreamSound.update(); isPlaying |= pcmStreamSound.isPlaying(); #elif defined ( RAKI_PLATFORM_XB360 ) xma2StreamSound.update(); isPlaying |= xma2StreamSound.isPlaying(); #elif defined ( RAKI_PLATFORM_WII ) || defined ( RAKI_PLATFORM_CAFE ) adpcmStreamSound.update(); isPlaying |= adpcmStreamSound.isPlaying(); #elif defined ( RAKI_PLATFORM_PS3 ) mp3StreamSound.update(); isPlaying |= mp3StreamSound.isPlaying(); #endif asyncReader->update( true ); /* if ( ( count % COUNT_LOOP ) == COUNT_STOP ) xma2StreamSound.stop(); if ( ( count % COUNT_LOOP ) == COUNT_START ) xma2StreamSound.play(); */ ++count; if ( !isPlaying ) break; } #if defined ( RAKI_PLATFORM_WIN32 ) pcmStreamSound.stop(); #elif defined ( RAKI_PLATFORM_XB360 ) xma2StreamSound.stop(); #elif defined ( RAKI_PLATFORM_WII ) || defined ( RAKI_PLATFORM_CAFE ) adpcmStreamSound.stop(); #elif defined ( RAKI_PLATFORM_PS3 ) mp3StreamSound.stop(); #endif // XAudio2 doc: Stop is always asynchronous, even if called within a callback Thread::sleep( 5000 ); #if defined ( RAKI_PLATFORM_WIN32 ) pcmStreamSound.destroyVoice(); #elif defined ( RAKI_PLATFORM_XB360 ) xma2StreamSound.destroyVoice(); #elif defined ( RAKI_PLATFORM_WII ) adpcmStreamSound.destroyVoice(); #elif defined ( RAKI_PLATFORM_PS3 ) mp3StreamSound.destroyVoice(); #endif Thread::sleep( 500 ); RAKI_DELETE( asyncReader ); asyncReader = NULL; RAKI_DELETE( seekableStreamPart1 ); seekableStreamPart1 = NULL; if ( seekableStreamPart2 ) RAKI_DELETE( seekableStreamPart2 ); seekableStreamPart2 = NULL; if ( dataProvider ) RAKI_DELETE( dataProvider ); dataProvider = NULL; /* if ( dataProvider2 ) RAKI_DELETE( dataProvider2 ); dataProvider2 = NULL; */ streamingThread.stop(); Thread::sleep( 500 ); } } // namespace raki #if defined ( RAKI_PLATFORM_CAFE ) 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 run_demo (int intArg, void *ptrArg) { raki::SimpleHeap_Cafe::init(); raki::TestInitializer initializer; //const char path[] = "DoubleSweep.wav.cafe"; const char path1[] = "/vol/content/_raki_/Mus_Jun_Cage_Free_04_2M.wav.cafe"; const char path2[] = "/vol/content/_raki_/Mus_Jun_Cage_Free_04_2M.wav.cafe"; //const char path[] = "Mus_lod_poursuite_01_18M_low_stream.wav.cafe"; //const char path1[] = "sine10secHIGH.wav.cafe"; //const char path2[] = "sine10secLOW.wav.cafe"; raki::TestSoundStreaming( path1, path2 ); return 0; } #endif #if defined ( RAKI_USING_XAUDIO2 ) int _tmain( int /*argc*/, _TCHAR* /*argv[]*/ ) #else // RAKI_USING_XAUDIO2 int main( int /*argc*/, char * /*argv[]*/ ) #endif // RAKI_USING_XAUDIO2 { #if defined ( RAKI_PLATFORM_WII ) DVDInit(); VIInit(); raki::SystemAllocator_Initialize(); #elif defined ( RAKI_PLATFORM_WIN32 ) raki::CoInitializeInitObject coInitializeInitObject; #elif defined ( RAKI_PLATFORM_CAFE ) 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; #endif #if !defined ( RAKI_PLATFORM_CAFE ) #if defined ( RAKI_PLATFORM_WIN32 ) const char path1[] = "Y:/JD5/JD/main/extern/Raki/TestData/Mus_Jun_Cage_Free_04_2M.wav.w32pcm"; const char path2[] = "Y:/JD5/JD/main/extern/Raki/TestData/Mus_Jun_Cage_Free_04_2M.wav.w32pcm"; #elif defined ( RAKI_PLATFORM_XB360 ) const char path1[] = "game:\\Mus_Jun_Cage_Free_04_2M.wav.x360"; const char path2[] = "game:\\Mus_Jun_Cage_Free_04_2M.wav.x360"; #elif defined ( RAKI_PLATFORM_PS3 ) const char path1[] = "/app_home/Y:/JD5/JD/main/extern/Raki/TestData/Mus_Jun_Cage_Free_04_2M.wav.ps3"; const char path2[] = "/app_home/Y:/JD5/JD/main/extern/Raki/TestData/Mus_Jun_Cage_Free_04_2M.wav.ps3"; #elif defined ( RAKI_PLATFORM_WII ) const char path1[] = "_raki_/Mus_Jun_Cage_Free_04_2M.wav.wii"; const char path2[] = "_raki_/Mus_Jun_Cage_Free_04_2M.wav.wii"; #endif raki::TestInitializer initializer; raki::TestSoundStreaming( path1, path2 ); return 0; #endif // !defined ( RAKI_PLATFORM_CAFE ) }