completehasem.blogg.se

Desmume xaudio2create
Desmume xaudio2create












The debug printouts show that the source voice seems to be queuing the buffers and the samplesplayed count is increasing as expected. (Yes I'm aware this leaks memory, but at the moment my main concern is getting any sound output at all). As you can see I'm trying to generate a simple 2600Hz test tone, but at best all I have been able to get are some short clicks. The function also generates 1 second of data each call. The timer is handled in a separate thread from where the XAudio2 library is initialized (the ASIO run thread). This function is on a boost asio timer that ensures it's called once per second.

desmume xaudio2create

OutputDebugStringA(debugstream.str().c_str()) G_sourceVoice->Start(0, XAUDIO2_COMMIT_NOW) ĭebugstream << "PTR: " << buff << " Q: " << state.BuffersQueued << " S: " << state.SamplesPlayed << " SC: " << sampleCount << " V: " << volume << " GV: " << gvolume << std::endl OutputDebugStringA("Failed on submit source buffer!!! D:\n") Timer.async_wait(boost::bind(streamNextChunk, _1, boost::ref(timer))) įor(size_t i = 0 i SubmitSourceBuffer(&xAudioBuff))) Timer.expires_from_now(boost::posix_time::milliseconds(1000)) Void streamNextChunk(const boost::system::error_code& error, boost::asio::deadline_timer & timer)ĬoInitializeEx(NULL, COINIT_MULTITHREADED) Here's where I'm feeding the source voice: I've also tried this with signed 16-bit PCM instead of IEEE float to no avail. MessageBox(NULL, L"Failed to create source voice!", L"sadface", MB_OK) Wfx.nAvgBytesPerSec = 44100 * sizeof(float) ĭebugstream CreateSourceVoice(&g_sourceVoice, (WAVEFORMATEX*)&wfx))) MessageBox(NULL, L"Failed to create mastering voice!", L"Sadface", MB_OK) If(FAILED(g_xAudioEngine->CreateMasteringVoice(&g_masterVoice, XAUDIO2_DEFAULT_CHANNELS,(UINT32) SAMPLERATE, 0,0,NULL))) MessageBox(NULL, L"Failed on XAudio2Create", L"Sadface", MB_OK) If(FAILED(XAudio2Create(&g_xAudioEngine))) If(FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) I just have one source voice and a master voice, and I'm submitting buffers to the source voice periodically.

#Desmume xaudio2create code

I've implemented the code according to a few tutorials I've seen, and it's fairly simple. Unfortunately at best all I've gotten are a handful of clicks, and so I was wondering if someone could provide a little help. Hi all, I've been trying to get some streaming code working with XAudio2.












Desmume xaudio2create