[RESOLVED] PDK Sound Service Instance -> Play() Function

Clifton Crane
Lockheed Martin
Posts: 988
Joined: Tue Sep 25, 2012 2:34 pm

Re: PDK Sound Service Instance -> Play() Function

Postby Clifton Crane » Mon Dec 17, 2018 8:43 pm

Hi Jim,

Storing the reference counted pointer in your own class should be fine. If your class is the sole owner of the ISoundInstance, you'll just want to make sure it has a ref-count of one throughout its lifetime so that is properly released when your class is destroyed.
Clifton Crane
Prepar3D® Software Engineer

BenBaron
Posts: 71
Joined: Fri Jan 16, 2015 7:51 am

Re: PDK Sound Service Instance -> Play() Function

Postby BenBaron » Tue Dec 18, 2018 2:26 pm

Hi guys,

now, I am seeing the following problem: I am trying to play a 3D sound just once, when a certain condition is met. The sound is created as CreateSoundInstance(bLooping = false) and all HRESULTS return S_OK. I checked with the debugger that Play() is indeed called only once in my code on the sound instance, but the sound loops audible, anyways. This is while IsLooping() on the SoundInstance returns false.

Is anyone able to confirm this behaviour or has an idea where I might be making a mistake?

All the best,

Benny

Clifton Crane
Lockheed Martin
Posts: 988
Joined: Tue Sep 25, 2012 2:34 pm

Re: PDK Sound Service Instance -> Play() Function

Postby Clifton Crane » Tue Dec 18, 2018 5:01 pm

Hi Benny,

Do you see the same behavior if the sound is not created as 3D?
Clifton Crane
Prepar3D® Software Engineer

BenBaron
Posts: 71
Joined: Fri Jan 16, 2015 7:51 am

Re: PDK Sound Service Instance -> Play() Function

Postby BenBaron » Tue Dec 18, 2018 9:43 pm

Hi Benny,

Do you see the same behavior if the sound is not created as 3D?
Hi Clifton,

indeed, changing b3D to 'false' it is only played once. So it seems to have something to do with the 3D mode. What might this be?

Greets,

Benny

Clifton Crane
Lockheed Martin
Posts: 988
Joined: Tue Sep 25, 2012 2:34 pm

Re: PDK Sound Service Instance -> Play() Function

Postby Clifton Crane » Tue Dec 18, 2018 10:30 pm

Hello,

What SOUND_GROUP are you using? Its possible that 3D sound may not work for SOUND_GROUP_VOICE.
Clifton Crane
Prepar3D® Software Engineer

flyboy7798
Posts: 31
Joined: Thu Jul 20, 2017 7:15 pm

Re: PDK Sound Service Instance -> Play() Function

Postby flyboy7798 » Tue Dec 18, 2018 11:05 pm

Clifton,

Thanks got it.

V/R
Jim

BenBaron
Posts: 71
Joined: Fri Jan 16, 2015 7:51 am

Re: PDK Sound Service Instance -> Play() Function

Postby BenBaron » Wed Dec 19, 2018 9:38 am

Clifton,

no, I am using SOUND_GROUP::SOUND_GROUP_ENVIRONMENT. I'm gonna wrap up some code without error checking and mabye you can spot a mistake:

Code: Select all

CComPtr<P3D::ISoundInstanceV440> soundInstance = nullptr;

Code: Select all

PDKSoundService->CreateSoundInstance(this->name.c_str(), SOUND_GROUP::SOUND_GROUP_ENVIRONMENT, VIEW_POINT::VIEW_POINT_ALL, false, true, true, (void**)&soundInstance);
with this->name being a wstring with an absolute path to a .wav file

Code: Select all

soundInstance->SetMinVolume(0.0);

Code: Select all

soundInstance->SetMaxVolume(10000.0);

Code: Select all

soundInstance->SetPitch(1.0f);

Code: Select all

soundInstance->SetPosition(position)
with position being a valid world coordinate P3DDXYZ

Code: Select all

soundInstance->SetCockpitAttenuation(0.0);

Code: Select all

soundInstance->SetFullScaleDistance(100.0f);

Code: Select all

soundInstance->Play();
Thanks in advance.

All the best, Benny

Clifton Crane
Lockheed Martin
Posts: 988
Joined: Tue Sep 25, 2012 2:34 pm

Re: PDK Sound Service Instance -> Play() Function

Postby Clifton Crane » Thu Jan 24, 2019 9:12 pm

Hello,

We were able to reproduce the issue where 3D one-shot sounds would continue to loop. This will be resolved in the next release. Return type will be corrected as well (i.e. IsPlaying() will return S_FALSE without having to call Play() first).

Thanks!
Clifton Crane
Prepar3D® Software Engineer

BenBaron
Posts: 71
Joined: Fri Jan 16, 2015 7:51 am

Re: PDK Sound Service Instance -> Play() Function

Postby BenBaron » Fri Jan 25, 2019 5:14 pm

Thanks for the information, Clifton.

Nice to know I can stop trying to figure this one out.

All the best,

Benny

BenBaron
Posts: 71
Joined: Fri Jan 16, 2015 7:51 am

Re: PDK Sound Service Instance -> Play() Function

Postby BenBaron » Mon Apr 15, 2019 4:19 pm

Hi guys,

it is now working on my side with 4.5. Thanks for the fix.

All the best,

Benny


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 4 guests