How to code multichanel audio playing for DX8?

Started by PabloLuna, February 19, 2008, 21:50:27

Previous topic - Next topic

PabloLuna

I am making a freeware game that would generate missions for orbiter Space Flight Simulator.  Orbiter can be found at www.orbitersim.com Orbiter is free too.

Here you have some other stuff I have made for orbiter
http://www.orbithangar.com/advsearch.php?search=author&text=ar81&OrbVer=default&name=default&author=default&category=default&subcat=default

I am able to initialize and load one sample using DX8 in my game, but I would need multichannel audio to make a decent audio for this game.  I am coding in VB5.  Any help would be appreciated.

This is how my game looks in this early stage of development.

Splash screen


Navigation computer
http://img522.imageshack.us/img522/1412/spaceorbinomics02ev7.jpg

Credits section
http://img522.imageshack.us/img522/752/spaceorbinomics01qw0.jpg

Sam_Zen

Hmm.. This looks like an advertisement / promotion. But maybe unintentionally, because of the pictures being too big.
So what the exact question here is, stays quite unclear to me.

DX8 ? Is that the Yamaha synth or something else ?

Check Toby Newman's PDF about Software-Based Audio Signal Processing

Multichannel audio (afaik, probably more) can be in WAV, OGG or FLAC format.
Combining lots of mono-channels into a multichannel WAV can be done with MultiWave by Nicolas Fournel.
0.618033988

LPChip

I think he simply means DirectX 8.

As for coding, this forum is about making music only. We have a few developers here which mostly are C++ devs for our OpenMPT project. I doubt that they'll be able to help you with a VB5 question.

I do have some VB5 experience, but never tried DirectX myself. I did used music in my projects but that was using bass.dll (They do offer a VB5 example so you can look up the code)

Your best luck though, is by asking it on a coding forum.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

PabloLuna

Advertisement?
Well, it is going to be freeware.  So there is no money gain.  Also, it is not my first freeware, as you can see from my links.

Since it was a music forum with people who knew about sound, I figured out that someone could tell me how to do this.

Those pics are big, because I always loved quality in arts, just like you might like to listen high quality music files.  It also shows that it is not just a spammer who says "hey, I want you to gimme all you know" without showing that there is some serious work behind it.

Arts are mine, sounds are mine too.
And since I am unable to access my email because of technical problems I had to reregister.
LPChip may remember me as Alpharomeo81, or ar81.

I have been away for a long time, but we always come back to our roots.  Right now I am enjoying the experience of being a developer in my spare time.

Thanks to the Modplug community I had my first music presentation at a Star Show.  http://www.freewebs.com/earth-oddyssey/
I learned about digital music here at Modplug.  I also made a tutorial on how to make music using Modplug Tracker for beginners http://www.orbithangar.com/searchid.php?ID=2741

And also I had a 2 month workshop at Colegio Internacional SEK where I taught Modplug Tracker to primary school kids.  I discovered that music "for kids"is completely different than music "by kids".  Music made by kids is absolutely disonant, even if they learn how not to make it disonant.  It sounds a bit like experimental music, and you end up seeing some natural talent, without the mental restrictions and prejudice of adults.  Kids are more interested about experimenting with sound, instead of making a classic masterpiece for the eternity.  For them, Modplug is about playing with sound, not really a music dev, with lots of theory in it.

Given that, I had to cancel my idea of teaching them about how to do counterpoint.  I did not want them to get bored with theory.

PabloLuna

Regarding DX, I found the answer...

http://msdn2.microsoft.com/en-us/library/bb219704(VS.85).aspx

QuoteDirectSound Playback Objects
The following objects are used in playing sounds:

Object  / Number / Purpose / Main interfaces
Device / One in each application / Manages the device and creates sound buffers. / IDirectSound8
Secondary buffer / One for each sound / Manages a static or streaming sound and plays it into the primary buffer. / IDirectSoundBuffer8, IDirectSound3DBuffer8, IDirectSoundNotify8
/ Primary buffer One in each application / Mixes and plays sounds from secondary buffers, and controls global 3D parameters. /IDirectSoundBuffer, IDirectSound3DListener8
Effect Zero or more for each secondary buffer / Transforms the sound in a secondary buffer. / Interface for the particular effect, such as IDirectSoundFXChorus8

The first step in implementing DirectSound in an application is to create a device object, which represents the rendering device. This object is then used to create buffers.

Note    DirectSound is based on the Component Object Model (COM). However, you do not have to initialize COM explicitly, by calling CoInitialize or CoInitializeEx, unless you are using effect DMOs.

Secondary buffers are created and managed by the application. DirectSound automatically creates and manages the primary buffer, and an application can play sounds without obtaining an interface to this object. However, in order to obtain the IDirectSound3DListener8 interface, the application must explicitly create a primary buffer object.

When sounds in secondary buffers are played, DirectSound mixes them in the primary buffer and sends them to the rendering device. Only the available processing time limits the number of buffers that DirectSound can mix.

Note    Under the Windows driver model (WDM), mixing is done by the kernel mixer, and the primary buffer does not actually contain any data. For more information, see DirectSound Driver Models.

A short sound can be loaded into a secondary buffer in its entirety and played at any time by a simple method call. Longer sounds have to be streamed. An application can ascertain when it is time to stream more data into the buffer either by polling the position of the play cursor or by requesting notification when the play cursor reaches certain points.

Secondary buffers can contain effects such as chorus and echo. They can also have 3D control capabilities. Global 3D parameters are controlled by the IDirectSound3DListener8 interface on the primary buffer.

Looks like now I need to learn about how to create secondary buffers...

LPChip

Yeah, I still remember you.

In fact, I already had the feeling it was you. :)
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Sam_Zen

2 PabloLuna
I withdraw my cynical approach about advertisement etc. immediately.

You obviously also pay attention to the educational areas, so maybe it's worthwhile to put the link to your tutorial in the TechDoc forum.
These are very interesting notes about teaching primary school kids. Indeed it's primary about playing with and controlling sounds.
And, as you say, fortunately, they're still able to do so. Although the age-border has been going down, when they become a 'consumer'.

Btw. if you're interested in the bass.dll library mentioned by LPChip, you can find it here.

Btw2. My complaint about the size of the bitmaps had mainly just a practical reason :
it widens the browser-page, so I have to scroll to the right, to check everything.
And I don't think, with the right graphic procedures, that you will loose much quality when resizing them to 75 %.
0.618033988

PabloLuna

Solved the scrolling problem...

I can't post there in the tech docs.  only moderators are allowed.  So I think someone could post it there.

Sam_Zen

Sorry, forgot about that. So it's done. (in the tutorial Sticky).
Although I have some slight comment about this 'Untitled document'.
- It's not build up in a broad sense, but has quite a narrow target. Making something for Orbiter.
- A seperate converter to MP3 is not necessary, MPT can export in that format.
- Lots of other media-players can produce a playlist file, not only the bulky Winamp.

Again, if you need to program multichannel things, you'd better focus on the opensource ones like OGG.
And MPT is capable of saving each selected pattern-channel as seperate WAV files.
And they keep the exact same byte-length, which is quite important of course.
0.618033988

PabloLuna

When I posted the tutorial I uploaded it in a site that is dedicated to Orbiter, so if i did not want it to be put down I had to add such a title.

Basically Orbiter reads MP3 files, so if you reached the point of making MP3, you are already done with Modplug Tracker.  The rest is to add it to Orbiter.

So I do not see a problem, except for the title.
I have seen that MP3 that is generated by the old MPT, has very low quality, so that's why I advise to convert to WAV.

I only would remark that Soundengine freeware is not available in english anymore, so Audacity seems the tool of choice.

Sam_Zen

I don't see any problems either.
And I certainly will always convert to WAV.
JetAudio basic also has an audio-converter aboard.
0.618033988

PabloLuna

The girl from the picture belongs to a Software called Daz Studio www.daz3d.com which is freeware.  If I am correct, there is Victoria 3 which is free, and there is also a bundle with some free stuff there.

To me it is a great posable human being for drawing, and also for 3D renders.  I modelled the gloves and the boots, hair belongs to Kozaburo (freeware too but downloaded elsewhere) and the logo and text was added by image compositing.