コード例 #1
0
Sound3D::Sound3D(ImpFunc * function, bool Attributes, int size, double k)
{
	this->function=function;
		this->Attributes= Attributes;
		this->sSize=size;
		this->k=k;
	  main1();
		LoadALData();
};
コード例 #2
0
ファイル: main.cpp プロジェクト: DiscoTex/hyper-war
int main(int argc, char *argv[])
{
    printf("MindCode's OpenAL Lesson 1: Single Static Source\n\n");
	printf("Controls:\n");
	printf("p) Play\n");
	printf("s) Stop\n");
	printf("h) Hold (pause)\n");
	printf("q) Quit\n\n");

	// Initialize OpenAL and clear the error bit.

	alutInit(NULL, 0);
	alGetError();

	// Load the wav data.

	if(LoadALData() == AL_FALSE)
	{
	    printf("Error loading data.");
		return 0;
	}

	SetListenerValues();

	// Setup an exit procedure.

	atexit(KillALData);

	// Loop.

	ALubyte c = ' ';

	while(c != 'q')
	{
		c = getche();

		switch(c)
		{
			// Pressing 'p' will begin playing the sample.

			case 'p': alSourcePlay(Source); break;

			// Pressing 's' will stop the sample from playing.

			case 's': alSourceStop(Source); break;

			// Pressing 'h' will pause the sample.

			case 'h': alSourcePause(Source); break;
		};

	}

	return 0;
}