Skip to main content
gamedev.net
🔒 Locked

#rror

Started by designlord Nov 28, 2003 at 9:17 PM 11 replies 550+ views
Original Post
designlord
designlord
<#rror> [Edited by - designlord on November 7, 2004 11:48:10 AM]
"Nothing you can't spell will ever work." - Will Rogers
RhoneRanger
RhoneRanger
debug level 5 is just plain annoying. Switch to 3 and see if it does the same.

If so, then there is a problem in the InitAudio function.
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
RhoneRanger
RhoneRanger
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]
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
Mastaba
Mastaba
Does your sound still sound bad when the application is run with a release build?
Mastaba
Mastaba
Also, those are WARNINGS, not ERRORS.
RhoneRanger
RhoneRanger
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.
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
Mastaba
Mastaba
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]
Mastaba
Mastaba
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.
RhoneRanger
RhoneRanger
@ 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.
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
Mastaba
Mastaba
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]
Mastaba
Mastaba
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]
Mastaba
Mastaba
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]
Mastaba
Mastaba
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]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.