You need to call GetObjectInPath(..., IID_IDirectSoundBuffer8, ...) on every IDirectMusicSegmentState8 belonging to each performance and iterate through all sink-in buffers (the DMUS_PATH_BUFFER stage). I think that will catch both segments using their own audiopath and segments using the performance's default audiopath. Of course, be sure to check that your DMO isn't already in the buffer as you'll likely end up looking at the same audiopath more than once. -james P.s. In order to catch all audio from segments you start, you'll need to pre-create and pre-modify audiopaths that are custom to a segment, as audio may be rendered before you get access to the IDirectMusicSegmentState8 object (when the call to PlaySegment[Ex] returns). Also, you'll need to turn off the DMUS_SEGF_USE_AUDIOPATH flag in the segment's default resolution flags. Calling PlaySegmentEx with the DMUS_SEGF_DEFAULT flag where the segment internally has the DMUS_SEGF_USE_AUDIOPATH flag set will cause the performance to create a new audiopath and ignore the one passed to PlaySegmentEx. P.p.s You still won't be able to catch segments that are triggered by segment trigger tracks or scripts, but you'll at least get everything from all the segments you start with PlaySegmentEx. This posting is provided "AS IS" with no warranties, and confers no rights.=20 -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Abhijit Patait Sent: Monday, June 21, 2004 11:58 AM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Re: DMO on DirectSound primary buffer=20 James =20 Thanks for your response. One question still remains unanswered. =20 Let's say that I write an external component to mix WAV data exported by DMOs in each of the performances. How and where do I insert the WAV writing DMO in each performance? In other words, how do I obtain the IDirectSoundBuffer8 interface for each performance on which to call SetFX(...)? As I said, each of my performances can have multiple audiopaths. Can I just call GetObjectInPath(..., IID_IDirectSoundBuffer8, ...) on one of the audiopaths belonging to the performance? I think this will return the buffer for that particular audio path, not the one after mixing of all audiopaths. =20 Thanks Abhijit James Dooley <jdooley@xxxxxxxxxxxxx> wrote: On any current machine and OS, the "primary buffer" you want to use doesn't actually exist - the mixing of the DirectSound buffers is done either on the soundcard itself or down at the bottom of the Windows audio stack in the kernel. In both cases, the only way to get back the "final mix" is through support on the soundcard for either a digital or analog loopback connection. Since you're using multiple performances, the only way I can think of to get what you want is to have all your WAV writing DMOs send their data to some external component that mixes them all together and writes out a single WAV file. Note that synchronizing the inputs from two different performances may not be possible to do with sample-accurate precision, but it should be possible to do it "close enough" for you to not notice. To make the performance run at something other than 22050 Hz, modify the values in the DMUS_AUDIOPARAMS structure you pass to IDirectMusicPerformance8::InitAudio (see http://msdn.microsoft.com/library/default.asp?url=3D3D/library/en-us/dire= c t=3D x 9_c/directX/htm/idirectmusicperformance8initaudio.asp). -james P.s. If you only have one performance and are using your own pre-authored audiopaths exclusively, you could simplify the mixing by creating a shared "mix-in" buffer that contains your WAV writing DMO, and insert a Send effect at the end of every other buffer that sends to this shared "mix-in" buffer. Note that if you don't set the volume of either all the sending buffers or the shared "mix-in" buffer to silence, you will hear everything played with twice the amplitude (once from all the sending buffers, and once from the shared "mix-in" buffer). Oh, and this all has to be done in DirectMusic Producer's audiopath editor beforehand, as you can't programmatically insert Send effects. This posting is provided "AS IS" with no warranties, and confers no rights.=3D20 -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Abhijit Patait Sent: Sunday, June 20, 2004 10:56 PM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] DMO on DirectSound primary buffer=3D20 Conitinuing on my question of exporting the audio from DirectMusic as a WAV file, I have been successful in creating a DMO that can save the sound as a WAV file. However (there it comes) there are a last few kinks that I need to work out. My application contains multiple performances (actually 2 performances) with each performance possibly containing multiple audiopaths. Since I want to save the final audio output (whatever comes out of the speakers) to a WAV file, I assume that I will need to set the DMO (which writes to the WAV file) on the primary buffer. This is where I am running into trouble. The IDirectSoundBuffer8::SetFX method (to activate the DMO) is available only for IDirectSoundBuffer8, and primary buffers do not support IDirectSoundBuffer8 (they only support IDirectSoundBuffer). Is there any way to solve this problem? My application seems to be playing sounds at 22050 Hz sampling frequency. Is there any way to change it to 44100 Hz (or something else)? Thank you in advance... =3D20 -Abhijit =3D20 Abhijit Patait wrote: James Thank you for valuable hint (looking at the DMO AppWizard - I didn't know it existed :-). I had looked at the Gargle DMO code, but could not understand most of it. After reading your suggestion, I generated a sample application using DMO AppWIzard, and realized that most of the code is generated by the wizard. It does not seem to be very complicated to write a DMO. I will try it. Thanks again Abhijit James Dooley wrote: Writing a DMO isn't as hard as you think - especially with the audio DMO wizard that ships in the DirectX SDK (which unfortunately only works on VC 6.0). See: http://msdn.microsoft.com/library/default.asp?url=3D3D3D/library/en-us/di= r e=3D c t=3D3D x 9_c/directX/htm/audioeffectdmowizard.asp Alternatively, you could start with the Gargle DMO sample, also in the DX9 SDK (in C++\DirectShow\DMO\GargleDMO). -james This posting is provided "AS IS" with no warranties, and confers no rights. -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Abhijit Patait Sent: Thursday, June 17, 2004 2:44 PM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Re: Exporting Audio using DirectMusic API Thanks for your answers. Looks like I will dig deeper into writing the DMO myself (which seems to be a big task due to sharp learning curve on DirectShow). Per James' suggestion, I have also written an email to directx@xxxxxxxxxxxxx and requested them to publish the interface for the FileOutput DMO (even though I have very little hope from that avenue) :-) =3D3D20 -Abhijit James Dooley wrote: No - there is currently no published API for that DMO. However, you can always email directx@xxxxxxxxxxxxx ask ask them to publish the interface for it. -james This posting is provided "AS IS" with no warranties, and confers no rights.=3D3D3D3D20 -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Scott Morgan Sent: Wednesday, June 16, 2004 11:09 AM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Re: Exporting Audio using DirectMusic API What about the file output DMO that shows up in Producer? Can he use that? -Scott Morgan http://morganstudios.com -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx]On Behalf Of James Dooley Sent: Tuesday, June 15, 2004 5:02 PM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Re: Exporting Audio using DirectMusic API You are correct that this is not a trivial task. I can think of two ways to do this: 1) Using DirectMusic 8 or 9 interfaces, create a DMO that writes the data it sees to a WAV file (or passes it on to another component that writes the WAV file). Then, either author a custom audiopath using your DMO in DirectMusic Producer, or use IDirectSoundBuffer8::SetFX to put your DMO in a DirectSound buffer directly. 2) Initialize the performance with IDirectMusicPerformance::Init() to use the DirectMusic 7.0 synthesizer and enable use of the IDirectMusicSynthSink interface. See http://msdn.microsoft.com/library/default.asp?url=3D3D3D3D3D/library/en-u= s /=3D d i=3D3D r e=3D3D3D c t=3D3D3D3D x 9_c/directX/htm/idirectmusicsynthsinkinterface.asp?frame=3D3D3D3D3Dtrue Note that the comment "To capture output from the later version of the synthesizer, you must implement a DMO on the primary buffer" is wrong. The primary buffer isn't used with WDM devices, so you need to implement a DMO on every buffer in your audiopath (or implement your DMO on a mixin buffer, have every other buffer send to that one mixin buffer, and mute all the other buffers). -james This posting is provided "AS IS" with no warranties, and confers no rights.=3D3D3D3D20 -----Original Message----- From: directmusic-bounce@xxxxxxxxxxxxx [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Abhijit Patait Sent: Tuesday, June 15, 2004 4:44 PM To: directmusic@xxxxxxxxxxxxx Subject: [directmusic] Re: Exporting Audio using DirectMusic API Since I haven't received any response on this, I assume that this is not a trivial task. However, has someone on this group done anything similar before (may be without using DirectX/DirectMusic)? If so, what should I look for? I wandered (literally) through the DirectX documentation on MSDN and elsewhere but could not find any useful information. All I can guess is I have to use DirectSound, IDirectSoundBuffer8, IDrectMusicSynth or some combination of the above. =3D3D3D3D20 Any pointers will be greatly useful. =3D3D3D3D20 Thank you Abhijit Abhijit Patait wrote: With a lot of help from people on this list, I have finally gotten my little sequencer application to make sounds as I want it to, using custom DLS instruments. My next objective is to export the audio as a WAV file from my sequencer application. I can easily create a MIDI file. But is there an API to access the samples generated by the synthesizer and save them as WAV file (especially since the instruments I am using are from custom DLS)? Thanks again for you help. Abhijit --------------------------------- Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger =3D3D3D3D09 --------------------------------- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. =3D3D09 --------------------------------- Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! --------------------------------- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. =3D09 --------------------------------- Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! =09 --------------------------------- Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!