Jump to content
  • Advertisement

Archived

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

Destroyer

Directmusic and Audiopaths

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

Hello, I''m trying to create two seperate audiopaths, one for music, one for sound. That way I can control the volume for each seperately using the SetVolume method on the audiopath. The music audiopath doesn''t work, but as far as I can tell, they''re defined exactly the same, and implimented exactly the same. The only difference is that they''re different audiopaths... Here''s the initialization code
  

if(FAILED(hr = m_pdmpPerformance->CreateStandardAudioPath(DMUS_APATH_DYNAMIC_STEREO, 4, true, &m_pdmapMusicPath)))
	{
		A_Post_Error(TEXT("CreateStandardAudioPath"), hr, (DWORD)__LINE__);
		return hr;
	}

	if(FAILED(hr = m_pdmpPerformance->CreateStandardAudioPath(DMUS_APATH_DYNAMIC_STEREO, 4, true, &m_pdmapSoundPath)))
	{
		A_Post_Error(TEXT("CreateStandardAudioPath"), hr, (DWORD)__LINE__);
		return hr;
	}

  
And here''s the two functions, one for playing sound, the other for music...
  

HRESULT CAudio::hrPlaySound(CSound *Sound, bool fStopsound)
{
	HRESULT hr;
	if(fStopsound)
	{
		if(FAILED(hr = m_pdmpPerformance->PlaySegmentEx(Sound->m_pdmsSound, NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, m_pdmapSoundPath, m_pdmapSoundPath)))
		{
			A_Post_Error(TEXT("PlaySegmentEx"), hr, (DWORD)__LINE__);
			return hr;
		}			
	}
	else
	{
		if(FAILED(hr = m_pdmpPerformance->PlaySegmentEx(Sound->m_pdmsSound, NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, NULL, m_pdmapSoundPath)))
		{
			A_Post_Error(TEXT("PlaySegmentEx"), hr, (DWORD)__LINE__);
			return hr;
		}
	}

	return NOERROR;
}

HRESULT CAudio::hrPlayMusic(CSound *Music, bool fStopmusic)
{
	HRESULT hr;

        if(fStopmusic)
	{
		if(FAILED(hr = m_pdmpPerformance->PlaySegmentEx(Music->m_pdmsSound, NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, m_pdmapMusicPath, m_pdmapMusicPath)))
		{
			A_Post_Error(TEXT("PlaySegmentEx"), hr, (DWORD)__LINE__);
			return hr;
		}
	}
	else
	{
		if(FAILED(hr = m_pdmpPerformance->PlaySegmentEx(Music->m_pdmsSound, NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, NULL, m_pdmapMusicPath)))
		{
			A_Post_Error(TEXT("PlaySegmentEx"), hr, (DWORD)__LINE__);
			return hr;
		}
	}
	return NOERROR;
}

  
This is all cut down, but the main code is there... I pass a CSound* to the hrPlaySound function, it works, if I pass the same CSound* to the hrPlayMusic function, it doesn''t... The order of initialization doesn''t seem to affect the results either... Thanks for your time, Destroyer

Share this post


Link to post
Share on other sites
Advertisement

  • 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!