Archived

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

#rror

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

hmm, I am not sure.

the 2 sound cards shouldn't be an issue, as long as you use the default sound card with setting up dmusic.

The only thing I can see is this..

Here is my code in the order I init it, and i never had those probs.

See if this perchance works ? The only differenct is changing from 64 t0 128, and I init audio BEFORE I create the loader.

Perhaps this is causing the "Already init.." errors?

CoCreateInstance(CLSID_DirectMusicPerformance,NULL,CLSCTX_INPROC,
IID_IDirectMusicPerformance8,(void**)&DMPerf);



if(FAILED(DMPerf->InitAudio(NULL,NULL,hWnd,DMUS_APATH_SHARED_STEREOPLUSREVERB,
128,DMUS_AUDIOF_ALL,NULL)))
return E_FAIL;



CoCreateInstance(CLSID_DirectMusicLoader,NULL,CLSCTX_INPROC,
IID_IDirectMusicLoader8,(void**)&DMLoader);


EDIT: See the difference? I create the performer before I init audio, then I create the loader.

I am pretty sure this is your issue!





[edited by - RhoneRanger on November 28, 2003 11:35:54 PM]

Share this post


Link to post
Share on other sites
I know these are warnings, but that is why the compiler is bitching (I assume).

My sound sounds great! No distortion or bad things happening.

Remember though, you need to create a different "buffer" for each sound. You can''t (or shouldn''t) play 2 sounds on the same buffer.

Also make sure you only select one of your cards for rendering sound. It is a possiblility that both are being played at the same time, making it sound delayed, echoed or distorted.

Share this post


Link to post
Share on other sites
Sorry, Phoneranger, my post was meant for designlord.
I'm simply pointing out that these are warnings and not errors because in one of my own programs that uses DirectMusic, I get the same warnings, yet the sound plays perfect when the app is compiled in release mode. It appears the noise in debug mode is simply due to the latency of the overflow of debug output. Also in other DirectX interfaces, some warnings are common and can be safely ignored, as they were meant more for the DirectX dev team than for you.

[edited by - Mastaba on November 28, 2003 12:40:29 AM]

Share this post


Link to post
Share on other sites
Is there any particular reason you need to play the first sound in the primary buffer? I play all mine only in secondary buffer and playback is fine, even 16 overlapping sounds.

Share this post


Link to post
Share on other sites
@ Mastaba

The primary buffer is the one that runs continous.
All seconday buffers play at a specific place, or in otherwords they set a start time to copy data to the primary.


The primary SHOULD BE the only one that is playing.

Share this post


Link to post
Share on other sites
PhoneRanger, I have no issues using DirectMusic the way I do. I know the primary buffer is the only one that actually plays, that's not the issue. The issue is he can't get overlapping sounds to work right. Which I have no problem with, when I only designate the segments to be played as secondary segments. It makes perfect sense to me. If you force something to be played as the primary segment, then it would obviously control how any secondary segments are played. If your primary segment doesn't contain any control information, then DirectMusic has to fallback on some kind of default control. Which for your typical .wav files is less than desireable. But if you only have secondary segments playing, then DirectMusic mixes them nicely into the primary buffer.

I'll simply suggest that designlord should stop using the primary segment if he wants overlapping sounds. Creating additional audiopaths or performances is overkill. Though additional audiopaths can be useful for other reasons.

Playing a wave based .sgt file may make it easier to use wave sounds as primary segments without them interfering with the secondary segments. Though, I haven't been bothered enough to try loading DirectMusic Producer to see if that's the case.



[edited by - Mastaba on November 29, 2003 5:52:46 PM]

Share this post


Link to post
Share on other sites
In fact, here is the actual code I use to play all of my segments, flawlessly.


void SoundManager::PlayCore(DWORD snd_id, IDirectMusicAudioPath8* pAudiopath)
{
m_performance->PlaySegmentEx(m_segments[--snd_id], NULL, NULL, DMUS_SEGF_DEFAULT | DMUS_SEGF_SECONDARY, 0, NULL, NULL, pAudiopath}
}


I simply use additional audiopaths if I need to control the volume of sounds independently of others. Though normally, pAudiopath is NULL in my example.


[edited by - Mastaba on November 29, 2003 9:35:04 PM]

Share this post


Link to post
Share on other sites
One more thing designlord, in your sample MP3 that you posted, what was it supposed to sound like if it were to play correctly? What I hear in the sample sounds weird, but I can't tell what was the desired effect compared to what you got in the mp3. Perhaps also posting the source sounds you are using can help me figure out what is happening. Though the more I listen to it, it sort of sounds like the sounds are playing multiple times very rapidly. Like you are playing multiple secondary segments extremely rapidly, producing a kind of extreme reverb effect.

[edited by - Mastaba on November 29, 2003 9:33:39 PM]

Share this post


Link to post
Share on other sites
You need to setup a notification event through the performance interface. The SDK contains a fairly step by step walkthrough of how to do this.

[edited by - Mastaba on November 30, 2003 1:11:11 PM]

Share this post


Link to post
Share on other sites