[directmusic] DMO on DirectSound primary buffer

  • From: Abhijit Patait <abhijit_patait@xxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Sun, 20 Jun 2004 22:56:29 -0700 (PDT)

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...
 
-Abhijit
 

Abhijit Patait <abhijit_patait@xxxxxxxxx> 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=3D/library/en-us/direct=
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) :-)
=20
-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.=3D3D20

-----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=3D3D3D/library/en-us/di=
r
e=3D
c
t=3D3D
x
9_c/directX/htm/idirectmusicsynthsinkinterface.asp?frame=3D3D3Dtrue

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.=3D3D20

-----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.
=3D3D20
Any pointers will be greatly useful.
=3D3D20
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


=3D3D09
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.





=09
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!





---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.



                
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!


Other related posts: