flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > 'com_invoke' macro

Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Hello,

I've got this MASM program and a "com_invoke" macro is used in important parts for calling DirectSound API as you can notice.

It is used like that:
Code:
com_invoke IDirectSound, SetCooperativeLevel, pDS, hWnd, DSSCL_NORMAL
...
com_invoke IDirectSound, CreateSoundBuffer, pDS, ADDR desc, ADDR pDSB, 0
...
com_invoke IDirectSoundBuffer, Stop, pDSB
    


According to some comments, it seems to be a "macro to call COM functions given a struct of function ptr's."

So, does anyone know what this "com_invoke" macro MAY really do, because it's not very helpful like that?

thanks in advance for your replies.
Post 23 Apr 2007, 06:13
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
see "INCLUDE/COM32" in FASM directory
Post 23 Apr 2007, 08:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
ManOfSteel,

Attached is a RadASM project using DirectSound to record from an iMic USB sound card, write to a .wav file, and then play back the recorded sound from the DirectSound buffer. It just records 8 seconds, but should show you how things work. It uses an include file from a package madmatt provided, link is inlcuded. Thanks madmatt!!!

If I get time, I plan to modify the program to record continuously and then as the sound is recorded, convert to mp3 using LAME.

hth,

farrier


Description:
Download
Filename: DSRecord.zip
Filesize: 5.47 KB
Downloaded: 121 Time(s)


_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 24 Apr 2007, 09:15
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
vid,
thanks, I didn't even know such thing existed in FASM. I guess I'll have to re-read the manual.

farrier,
thanks for sharing. I'll check it out as soon as I can.
Why did you say it was for recording from a "iMic USB sound card"? Does it work for other cards?
Post 26 Apr 2007, 09:51
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
ManOfSteel,

The code I included let me choose the iMic as the Capture device on my notebook system, which has no Line-In. Otherwise, the default sound card is used. If you use my code "as-is", it should use your default device.

Also, change the size of the capture buffer size as follows:
Code:
    mov     [dscbd.dwBufferBytes], 1764000          ;= WaveEx.nAvgBytesPerSec * 10
    


I found an occasional problem trying to record 8 "sleep" seconds of data in an 8 second buffer. Sometimes, it "slept" to long, and recorded too much.

hth,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 26 Apr 2007, 16:56
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Hello,
and thanks again.
Could you upload the DirectX include files that are needed for audio processing (those you have in "\Program Files\fasm\include\directx\")? I can't find them anywhere.
Do they also contain the interfaces identifiers (or whatever they are called?)
Post 27 Apr 2007, 07:54
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
ManOfSteel,

The link to madmatt's DirectX includes is in this source code, on the same lines where the .inc file is "included"

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 27 Apr 2007, 13:48
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
oops, sorry, there are so many tabs before the link that it was off-screen and I missed it. Embarassed
Post 28 Apr 2007, 07:40
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
Here is part 2 of my project:

This one again records 8 seconds of sound using DirectSound, then writes that data to a .wav file, then converts the raw data into an MP3 file using LAME. I used the lame_enc.dll file obtained from:

http://rarewares.org/mp3.html

Main LAME site:

www.mp3dev.org

Seems to work pretty well. After I play with the quality settings, I plan to do continuous recording with DirectSound, and then continuous recording and streaming conversion to MP3

Fun so far!

farrier


Description:
Download
Filename: DSRecConv.zip
Filesize: 9.98 KB
Downloaded: 116 Time(s)


_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 28 Apr 2007, 08:03
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
Very nice. Keep up with the good work!
Post 29 Apr 2007, 05:37
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
Here is the next version, will record continuously to a wav file from a default--or in my case an external USB sound card--until a user set--in .inc file--number of milliseconds expires. Next step, acquire PCM data and immediately convert this stream to an mp3 file, bypassing .wav file entirely.

farrier


Description:
Download
Filename: DSRecCont.zip
Filesize: 7.31 KB
Downloaded: 109 Time(s)


_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 09 May 2007, 01:11
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel
It's getting very good. Thanks for sharing. If it was just a little more user friendly (record/play control buttons and the like) you would be competing with some commercial recording utilities.
And by the way, I like the icon!
Post 13 May 2007, 17:32
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
hm... "enum" - is macro?

"ENUM DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW,\
..."

in dsound.inc

where I can find enum macro?
Post 13 May 2007, 20:54
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 14 May 2007, 16:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.