Archived

This topic is now archived and is closed to further replies.

C++ and PRSND

This topic is 6363 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I tried adding PRSND interface into EPR .. but linking errors persist. I got the libraries and .dll in place .. // ------------eprsounds.h-------------------- /* * Sounds Interface ** File Name :eprsounds.h * Author :Natraj Kumar B * Created :10th July 2000 * Description :Sounds Interface ================================================================= Change History ================================================================= Date Analyst Description ================================================================= ================================================================= */ #ifndef EPRSOUNDS_H #define EPRSOUNDS_H class EPRSoundInit { public: EPRSoundInit(); EPRSoundInit(PR_DWORD No_Of_Sounds_that_will_be_Loaded); ~EPRSoundInit(); private: }; class EPR3DSound { private: PR_DWORD sound_id; PR_3DSOUND *sound_3d; char *name; public: EPR3DSound(char *name); void Playit(); }; #endif ----------------------eprsounds.cpp--------------------------------------- #include #include #include #include #include #ifdef WIN32 #include #endif #include "eprsounds.h" #ifdef __cplusplus extern "C" { #endif EPRSoundInit::EPRSoundInit() { // ---------- Default Constructor ---------------------- PRSND_Initialize (); /* Will cause program to crash if number of sounds loaded is greater than the value passed to PRSND_AllocSounds */ PRSND_AllocSounds (16); /* open audio device */ PRSND_OpenAudio (AUDIO_DEVICE_MAPPER,AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO,44100); //----- Number of sounds that can be mixed for playback---------------------- // Must equal the number of Channels opened i.e for // // There can be a maximum of 32 sounds that can be mixed at runtime and played back // Each sound that requires to be mixed and played back must have an associated voice // with it. PRSND_InitializeVoices (10); PRSND_SetOrigin(0,0,0); //---------***************************--------------------- } //---------- Overloaded constructor ----------------------- EPRSoundInit::EPRSoundInit(PR_DWORD No_Of_Sounds_that_will_be_Loaded) { PRSND_Initialize (); /* Will cause program to crash if number of sounds loaded is greater than the value passed to PRSND_AllocSounds */ PRSND_AllocSounds (No_Of_Sounds_that_will_be_Loaded); /* open audio device */ PRSND_OpenAudio (AUDIO_DEVICE_MAPPER,AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO,44100); PRSND_InitializeVoices (10); PRSND_SetOrigin(0,0,0); //----------- ******************----------------------------- } // ------------ Destructor --------------------------------------- EPRSoundInit::~EPRSoundInit() { PRSND_CloseVoices (); PRSND_DeleteAllSounds (); PRSND_CloseAudio (); } // -------Implementation of class EPR3DSound -------------- EPR3DSound::EPR3DSound(char *name) { PRGUI_GoStartPath (); //chdir ("Gfx"); //chdir ("sounds"); sound_id = PRSND_LoadSound(name); PRSND_SetLoopStart(sound_id,0); PRSND_SetLoopEnd(sound_id,PRSND_GetLength(sound_id)); PRSND_SetLoopMode(sound_id,0); //------ 3d sound parameters--------------------- sound_3d = PRSND_Alloc3DSound(); // PRSND_Play3DSound (sound_3d, sound_id); PRSND_Set3DSoundVolume (sound_3d,64); PRSND_Set3DSoundVolumeMode (sound_3d, SOUND_3D_VOLUME); PRSND_Set3DSoundVolumeFactor (sound_3d, 2000); PRSND_Set3DSoundPanning (sound_3d, 128); PRSND_Set3DSoundPanningMode (sound_3d, SOUND_3D_PANNING); PRSND_Set3DSoundPanningFactor (sound_3d, 2200); PRSND_Set3DSoundShiftMode (sound_3d, SOUND_DOPPLER_ON); PRSND_Set3DSoundShiftFactor (sound_3d, 0.0005); PRSND_Set3DSoundCoordinate (sound_3d, 0, 0, 0, NULL); PRSND_Set3DSoundShiftSlide (sound_3d, 200); PRSND_Update3DSound (sound_3d); } void EPR3DSound:layit() { PRSND_Play3DSound (sound_3d, sound_id); } #ifdef __cplusplus } #endif eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_SetOrigin eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_InitializeVoices eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_OpenAudio eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_AllocSounds eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Initialize eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_CloseAudio eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_DeleteAllSounds eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_CloseVoices eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Update3DSound eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundShiftSlide eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundCoordinate eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundShiftFactor eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundShiftMode eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundPanningFactor eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundPanningMode eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundPanning eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundVolumeFactor eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundVolumeMode eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Set3DSoundVolume eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Alloc3DSound eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_SetLoopMode eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_SetLoopEnd eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_GetLength eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_SetLoopStart eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_LoadSound eprsounds.obj : error LNK2001: unresolved external symbol _PRSND_Play3DSound Debug/Test.exe : fatal error LNK1120: 26 unresolved externals Error executing link.exe. any suggestions Thanks, Nat

Share this post


Link to post
Share on other sites
Make sure that your are including all the PR headers before yours, I had some weird errors like that to.

Edited by - voodoo on July 12, 2000 1:28:21 AM

Share this post


Link to post
Share on other sites
as you''ll notice from the source files ... I have all PR headers before ...and if I did not have that I would get compiling errors .. It is a problem of the extern "c" call ...I don''t know where to place it so that I escape this problem ..

anyways what are the present additions to the c++ example.. I have added keyboard,mouse and lights to the C++ template .. including the terrain would be the main thing though

Share this post


Link to post
Share on other sites
I see the problem, you have a smiley face embedded in your code! Ok honestly, try commenting out the 'extern "C" {' stuff. Just a hunch. Or put the pr headers within them, sometimes, extern "C" wasn't used in the pr header files (or it just works, I haven't looked).

Edited by - Whirlwind on July 12, 2000 10:09:19 AM

Share this post


Link to post
Share on other sites
Yes, you don''t want to use that extern C in your cpp code. The only place it should be needed are in the include files defining the _PRSND functions and that is because they were compliled with the .c extension. Basically the reason that you need the extern "c" in many of the pr header files is that the linker will not link from function definitions in a cpp file to the c source file. With extern "c" you are telling the linker that the definitions actually relate to c source not cpp source.


Gary

Share this post


Link to post
Share on other sites