Jump to content

  • Log In with Google      Sign In   
  • Create Account

Tank202

Member Since 03 Jun 2011
Offline Last Active Private

Topics I've Started

Compute shader values

17 August 2014 - 09:59 AM

Hello,

 

I wanted to know how to return compute shader results back to CPU so that I can use it for application logics level computations. I have running compute shader on DirectX11 but I don't know how to convert results from unordered access view to my base structure on CPU. How do I do that?


Direct2D custom effects - Element not found

11 May 2014 - 10:57 AM

Hello there,

 

I'm trying to run my shader in direct2d. I've written very similar code to this but when I try to run it, the program stops and my error reporting code displays message that 'element not found'(HRESULT Error string).

 

The difficulty is that no error reporting inside shader wrapper implementation is possible so I cant myself track whats causing it to crash... I need some experienced folks explain me whats happening wrong there.

 

I really need to get this done so if you need, ask for information, source, etc... I will provide everything.


XAudio2 and OggVorbis file library

15 April 2014 - 01:40 PM

Hello there,

 

I'm trying to play audio from *.ogg format. However I'm having a bit of problem as XAudio2 won't create source voice for me. One woulp probably say that I am probably not filling whole WAVEFORMATEX structure, but I do. So I have no idea why creating source voice function fails.

 

If you have any thoughts about that I would be really happy to hear them.

 

Here is the code of my whole program code:

#include <fstream>
#include <iostream>
#include <xaudio2.h>
#include <vorbis\codec.h>
#include <vorbis\vorbisfile.h>

#pragma comment(lib, "xaudio2.lib")
#pragma comment(lib, "libvorbisfile.lib")

using namespace std;

int main()
{
	//Ogg vorbis file//                          <---- This is the booring part of the program you can skip this code
	OggVorbis_File file;
	vorbis_info* fileInfo;
	vorbis_comment* fileComment;
	int* bitstream = 0;

	ov_fopen("1.ogg", &file);
	fileInfo = ov_info(&file, -1);
	fileComment = ov_comment(&file, -1);

	char* buf = new char[2048];

	ov_read(&file, buf, 2048, 0, 2, 1, bitstream);

	cout << "BitTrack - " << file.bittrack << "\nCurrent link - " << file.current_link << "\nCurrent serial number - " << file.current_serialno
		<< "\nData offsets - " << file.dataoffsets << "\nEng - " << file.end << "\nLinks - " << file.links << "\nOffset - " << file.offset
		<< "\nPCM Lengths - " << file.pcmlengths << "\nPCM Offset - " << file.pcm_offset << "\nReady state - " << file.ready_state
		<< "\nSamptrack - " << file.samptrack << "\nSeekable - " << file.seekable << "\nSerial numbers - " << file.serialnos;

	cout << "\n\nBitrate lower - " << fileInfo->bitrate_lower << "\nBitrate nominal - " << fileInfo->bitrate_nominal
		<< "\nBitrate upper - " << fileInfo->bitrate_upper << "\nBitrate window - " << fileInfo->bitrate_window
		<< "\nChannels - " << fileInfo->channels << "\nRate - " << fileInfo->rate << "\nVersion - " << fileInfo->version;

	ofstream out("sound.txt");
	for(ogg_int64_t i = 0; i < 2048; i++)
	{
		out << buf[i];
	}
	out.close();

	//XAudio2//                                             <---- The place where the problematic code begins
	IXAudio2* engine;
	IXAudio2MasteringVoice* master;
	IXAudio2SourceVoice* source;
	WAVEFORMATEX wf;
	XAUDIO2_BUFFER buffer;

	ZeroMemory(&wf, sizeof(WAVEFORMATEX));//          <---- As you can see I initialize and fill whole struct
	wf.wFormatTag = WAVE_FORMAT_PCM;
	wf.wBitsPerSample = file.bittrack;
	wf.nAvgBytesPerSec = fileInfo->bitrate_nominal;//          <---- This bitrate is 4 times lower that *.wav
	wf.nChannels = fileInfo->channels;
	wf.nSamplesPerSec = fileInfo->rate;
	wf.nBlockAlign = (file.bittrack * fileInfo->channels) / 8;

	ZeroMemory(&buffer, sizeof(XAUDIO2_BUFFER));
	buffer.AudioBytes = file.end;
	buffer.pAudioData = (BYTE*)buf;
	buffer.Flags = XAUDIO2_END_OF_STREAM;

	XAudio2Create(&engine);
	engine->CreateMasteringVoice(&master);
	engine->CreateSourceVoice(&source, &wf);//        <---- Probably this is the place where the error occurs

	source->SubmitSourceBuffer(&buffer);// <---- Access violation happens here as source == 0(not initialized)
	source->Start();

	system("pause");
	return 0;
}

By the way checking the HRESULT says that engine->CreateSourceVoice(bla, bla, bla) is invalid... Invalid XAudio2 API call or arguments.


direct2D custom effects

06 April 2014 - 10:09 AM

Hello there,

 

I have a problem. I need my engine(that is written on top of direct2D) to support custom shaders. But as always microsoft samples are very scarce and impossible to understand. I've tried writting my own custom shader program, also tried to modify their only sample, but nothing worked..

 

That damned sample:

http://code.msdn.microsoft.com/windowsapps/Direct2D-custom-image-7a1f2cb5/view/SourceCode#content

 

Has anyone used custom shaders in Direct2D and if Yes, could you provide me some samples on the matter? I would be very grateful.


Is there any software to check what is blocking connection ?

31 March 2014 - 12:23 PM

Hello there,

 

For 2 months I've been trying sfml, enet and other various networking libraries. But none of the mentioned networking programming tools(enet, SFML...) would work for me. I've tried shutting my firewall with open ports for both UDP and TCP connection, but nothing worked. I also tried several computers when trying this but with no success.

I've been running PRECOMPILED samples that came with SDKs so they should be robust and stable. 

 

So Is there any software that can show what is blocking my pc from connecting to other PCs? 

PS. I have no router. When using local host all programs work perfectly. Games like CSS, ArmA 2, Fallen Earth can connect to their servers...

 

Well any suggestions would be appreciated. :D


PARTNERS