VB.NET Using DirectSound9 (3) Street & Audio

xiaoxiao2021-03-06  43

Keywords: VB.NET DirectX 9 DirectSound AudioVideoPlayback Author: Dong Jun was going to start with 3D Sound, there are many things left out in front, so to add

I hope that the wind is composed to tea to complete Direct3D earlier.

============= or more is nonsense =======================

The previous example is WAV read.

Open Explorer You will find their memory usage.

How much WAV memory is consumed. The music consumption within 4 minutes is about 30m.

Of course, you have to look at the sound quality, this follow-up volume is proportional. If you plan to do a player, not

Game sound (game background music now uses MP3 or other methods that do not require immediate instantity

Implementation) So you can consider using streaming input. Just put New SecondaryBuffer (FileName ...

Change to IO.STREAM class

IO.STREAM cannot directly inherit ....

1 Write a Soundstream, you can, but I am more lazy, don't dry 2 to find ready-made, FILESTREAM

So the original buf = New SecondaryBuffer ("g: /media/wav/rod2.wav", DESC, AD) becomes the current DIM S AS New FileStream ("g: /media/wav/rod2.wav", FileMode .Open "BUF = New SecondaryBuffer (S, DESC, AD)

(In fact, there are still many ways, but the demo of the electronic drum is too long ... Microsoft has not provided

Related code)

After testing, play a 15M program consumption of 38M when you do not use stream

When using stream, consume memory up to 50 M !!!!

I set buffer asynchronous play, also crazy to eat memory.

It seems that FILESTREAM is to be fully installed (slowly study later)

Or in order to save memory, write the SoundStream class yourself.

If you just want to play music, you strongly recommend that you use the Audio class.

This should not be dSOUND, but it's just by the way.

First add the reference to AudioVideoPlayback

Then Importsimports Microsoft.directx.AudiovideOPlayback

It is simply concurrent const fn = "g: /media/wav/ternu_ternu_momiji.wav" DIM AU As New Audio (fn) au.play ()

And only 3M memory, super savings.

Most important, you can also play online.

Dim au as audio Dim u as new system.uri ("mms: //music.comicme.net/free/animemusic/ [m] [Bird companion] [Midori] [美鸟 々] / ED% 20Single% 20-% 20 も も 少 ... も も も 少 ... / 01% 20-% 20 も 少 少 ... も も も 少 ... .wma ") AU = AUDIO.FROMURL (u) au.play ()

I don't know if I should cry or laugh. Microsoft has packaged the managed DirectX, it will

DirectShow and part of DirectSound are put in (Video) with Audio

Just in response to DSHOW with DSOUND & DMUSIC)

It can be learned by code, it is much simple. The problem is that I want to play in D3DSurface

Animation can only find a way ...

==========================================================================================================================================================================

If you intend to play music, then the old man uses Audio class. DSound can only put WAV (I still

Didn't find the way to play other formats. There are only two of the formats, a PCM, a Flaot.

And when playing, the memory demand is large, when doing sound, if the quantity is more, then

Considering the release of regular release. Otherwise, the light sound takes a few hours, and the image is not placed ...

转载请注明原文地址:https://www.9cbs.com/read-55313.html

New Post(0)