PDA

View Full Version : Using OpenAL for sound in OpenGL problem


kennyurge
04-13-2006, 08:54 AM
Hi..me again~
I'm using OpenAL to adding sound into my program...but wonder how to do this....because if I'm using glut, then I can simply init the alutInit(&argc, argv) ;
in the main function just like other glutInit....but my program..is using windows programming to do the openGL....i not familiar with windows programming and now while learning doing this project...so I wonder where should I init the OpenAL in this case?

Plus...is there any possibility to use glutMouseFunc in windows programming?

Shame on me...always ask simple questions~hope u all wont mind~haha:blush:

thanks~

monjardin
04-13-2006, 11:04 AM
Are you using the Win32 API, MFC, Windows Forms, etc?
A Windows GUI application has a WinMain function that is similar to a regular main entry point. With MFC, the InitInstance of you application class would be a good place. I'm not as familiar with Windows Forms.

kennyurge
04-13-2006, 11:25 AM
Are you using the Win32 API, MFC, Windows Forms, etc?
A Windows GUI application has a WinMain function that is similar to a regular main entry point. With MFC, the InitInstance of you application class would be a good place. I'm not as familiar with Windows Forms.

Im using Win32!!! And yes...it contains the WinMain..but the question is...the alutInit needs 2 params (argc and argv)....i can't find this in WinMain...
What should I do for this?

int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State
{
MSG msg; // Windows Message Structure
BOOL done=FALSE; // Bool Variable To Exit Loop

// Ask The User Which Screen Mode They Prefer
if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
{
fullscreen=FALSE; // Windowed Mode
}
.......
......
......}


Thanks for helping.......:happy:

monjardin
04-13-2006, 11:42 AM
lpCmdLine is the command line string without the module name. Use GetCommandLine to get the whole thing and parse your variables out of that.

Reedbeta
04-13-2006, 11:42 AM
You can also set both parameters to NULL if you don't care about letting AL do command line processing.

monjardin
04-13-2006, 11:45 AM
LOL. That would be a simple solution. I haven't used ALUT.

kennyurge
04-14-2006, 01:28 AM
You can also set both parameters to NULL if you don't care about letting AL do command line processing.


do u mean for the mouse function we also can use glutMouseFunc in WinMain there as long as we include the library needed?

kennyurge
04-14-2006, 05:37 AM
lpCmdLine is the command line string without the module name. Use GetCommandLine to get the whole thing and parse your variables out of that.


I still not really understand ur way in doin this...can u explain more further?
or maybe some example coding please~:worthy:

kennyurge
04-14-2006, 05:40 AM
You can also set both parameters to NULL if you don't care about letting AL do command line processing.


I tried ur way...when compile and run there is no error but it will make the pc hang(OMG!) I wonder whether loading in a sound file is too big and heavy computational load till the program will improper shut down and need to send report to microsoft. Or maybe because of setting the params to NULL?

monjardin
04-14-2006, 10:20 AM
Read this stuff:
http://en.wikipedia.org/wiki/Command_line_interface
http://cplus.about.com/library/weekly/aa042902d.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/winmain.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/getcommandline.asp?frame=true
http://www.google.com/