Jump to content
  • Advertisement
Sign in to follow this  
zfathya

IDirectSoundBuffer8::GetFrequency()

This topic is 4872 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

Hi, I have a bug in execution when I try to get frequency through the IDirectSoundBuffer interface, I need the two interfaces IDirectSoundBuffer8 and IDirectSound3DBuffer, here after my setup function : class C3DSound{ public: HRESULT Setup(WCHAR *pwsFileName, IDirectMusicPerformance8 *pPerformance, IDirectMusicLoader8 *pLoader); private: // the performance this sound is associated with IDirectMusicPerformance8* m_pPerformance; // the loader to laod this sound wtih IDirectMusicLoader8* m_pLoader; // the segment for this sound IDirectMusicSegment8* m_pSegment; // segment state IDirectMusicSegmentState8 *m_pSegmentState; // the 3d audiopath for this sound IDirectMusicAudioPath8* m_p3DAudioPath; // the sound buffer for this sound - used to position sound in 3d space IDirectSound3DBuffer8* m_pDSB; IDirectSoundBuffer8* pDSB; // the listener for this sound // IDirectSound3DListener8* m_pListener; C3DSoundListener* m_pListener; } // sets up a sound HRESULT C3DSound::Setup(WCHAR *pwsFileName, IDirectMusicPerformance8* pPerformance, IDirectMusicLoader8* pLoader){ HRESULT hr; m_pPerformance = pPerformance; m_pLoader = pLoader; // load the soundfile if( FAILED( hr = m_pLoader->LoadObjectFromFile( CLSID_DirectMusicSegment, IID_IDirectMusicSegment8, pwsFileName, (LPVOID*) &m_pSegment ) ) ) return hr; // Download the segment's instruments to the synthesizer if (FAILED(hr = m_pSegment->Download( m_pPerformance ))) return hr; // by default don't repeat soundss if (FAILED(hr = m_pSegment->SetRepeats( 0 ))) return hr; // Create the 3D audiopath with a 3d buffer. // We can then play this segment through this audiopath (and hence the buffer) // and alter its 3D parameters. if (FAILED(hr = m_pPerformance->CreateStandardAudioPath( DMUS_APATH_DYNAMIC_3D, 64, TRUE, &m_p3DAudioPath ))) return hr; // Get the IDirectSound3DBuffer8 from the 3D audiopath if (FAILED(hr = m_p3DAudioPath->GetObjectInPath( DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, 0, GUID_NULL, 0, IID_IDirectSound3DBuffer, (LPVOID*) &m_pDSB ))) return hr; // get the listener from the 3d audiopath if (FAILED(hr=m_p3DAudioPath->GetObjectInPath(0, DMUS_PATH_PRIMARY_BUFFER, 0, GUID_All_Objects, 0, IID_IDirectSound3DListener, (void **)&(m_pListener->m_Listener)))) return hr; DWORD dwBuffer = 0; if (FAILED(hr=m_p3DAudioPath->GetObjectInPath( DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, dwBuffer, GUID_NULL, 0, IID_IDirectSoundBuffer8, (void**) &pDSB))) return hr; return S_OK; } and it is buguing when I try to get frequency by this code : LPDWORD pdwFrequency ; pDSB->GetFrequency(pdwFrequency ); I will be thankful if you can help me Fathya

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!