Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > MS Technologies ( ASP, VB, C#, .NET )

Reply
 
LinkBack Thread Tools Display Modes
Old 06-27-2005, 10:43 AM   #1 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
How should I use streams and fill DirectSound Streaming buffer?

I don't get it!

How should I use the streams? I must fill buffer using the streams, but I don't know how to use it.

Please help me!

Thanks
Burgos is offline   Reply With Quote
Old 06-27-2005, 12:11 PM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
Windows uses PCM buffers in both MM and DirectSound.
Depending on how you've setup a stream buffer the callback must use those settings, for example 44.1khz, 16bit, stereo and a buffersize of xxx bytes.
You could also use pass-thru to send a digital stream like ac3 or dts.

Since the system is pretty versatile but still limited you should provide more details on what you want achieve, especialy since MM and Directsound do have buffer limitations.
DJMaze is offline   Reply With Quote
Old 06-28-2005, 05:28 AM   #3 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
Thank you for your response.

I want to fill stream with MP3 and aply real-time DirectSound effects.

Thanks
Burgos is offline   Reply With Quote
Old 06-28-2005, 07:27 AM   #4 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
You need:

- mp3 decoder
- DirectX SDK

Do you have them?
DJMaze is offline   Reply With Quote
Old 06-28-2005, 07:19 PM   #5 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
Yes, I have it.
Burgos is offline   Reply With Quote
Old 06-30-2005, 07:14 AM   #6 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
Can you give me more informations, please?

Thanks in advance.
Burgos is offline   Reply With Quote
Old 06-30-2005, 03:33 PM   #7 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
I could give you a full blown directsound example but you won't learn from that.
What i like to know is:

- did you try the SDK examples?
- do you know the difference between hardware and software channels?
- the difference between 3D and 2D audio handling
- 8, 16 or 24bit
- 44.1, 48 or 96 kHz
- which mpeg decoder do you use?
- what code did you already build to use the mpeg decoder?
- show us the code
DJMaze is offline   Reply With Quote
Old 07-01-2005, 04:14 AM   #8 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
I know how to play Wavs, but I don't know how to decode mp3 (so no code ) and fill buffer with that.

That is the problem.

There is no SDK example on this.

mpeg decoder: mpglib, from the mpg123 project

Thanks
Burgos is offline   Reply With Quote
Old 07-01-2005, 08:16 AM   #9 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
mpglib decodes the mp3 to wav for you.

You just have to write a pcm buffer to store the decoded mp3 in.
Then checkout the DirectX SDK examples how to use callback functions to send a part of your pcm buffer to the DirectSound api.

mpglib decodes mp3's based on their type like 8bit 22kHz mono or 16bit 44.1kHz stereo.
You must convert the 8bit 22kHz mono to 16bit 44kHz stereo or recreate the directsound object to switch pcm output format.
Since you already know how to play wavs (pcm) this should be familiar, it's all about PCM

The DirectX SDK has PCM examples and mpglib just decodes the mp3 to PCM.

So write a unit that communicates with mpglib first and then the directsound unit.

mpglib -> buffer -> callback -> directsound

Just try one step at a time and if you can't get it working post the code that you are trying to get working and we can help
DJMaze is offline   Reply With Quote
Old 07-01-2005, 09:04 AM   #10 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
Thanks a lot!
Burgos is offline   Reply With Quote
Old 07-02-2005, 10:27 AM   #11 (permalink)
Burgos
Registered User
 
Join Date: Jun 2005
Posts: 7
Burgos is on a distinguished road
Problem again

So, now I am decoding mp3 and writting it to disk (later I will use it as DS buffer)

Source code is here: http://www.wellness-centar.com/source.zip

You will see what error it is producing.

Thanks in advance.

PS: Have you some code on this, just to see how did you worked out this?
Burgos is offline   Reply With Quote
Old 07-14-2005, 09:08 AM   #12 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
I can't see errors because i don't have Visual C# .NET

I'm a C and C++ programmer so i have no clue about your errors other then i can read your script.
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 06:47 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting