visual c dll prob

1>c:\dev\ruby\use_dll\use_dll\use_dll.cpp(10): error C2664: ‘FreeLibrary’ : cannot convert parameter 1 from ‘const wchar_t [10]‘ to ‘HMODULE’
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

meant “FreeLibrary wants to take the output from a LoadLibrary call, not a string!”

visual studio unable to register dll

So, you build your suh-weet dll using visual studio (express 2010 in my case),

looks like

STDAPI DllRegisterServer()

{

return 0;

}

go to register it, and get…

The module “smalld.dll” was loaded but the entry-point DllRegisterServer was not found.

Make sure that “smalld.dll” is a valid DLL or OCX file and then try again.

but you try and make it anything but WINAPI and you get:

: ‘BOOL DllRegisterServer(void)’ : overloaded function differs only by return type from ‘HRESULT DllRegisterServer(void)’

Well turns out that in my case, the problem was *not* that symbols weren’t being exported, it was that my method “DllRegisterServer” was in a .cpp file, not a .c one.

fix: write it like:

extern “C” __declspec(dllexport) HANDLE DllRegisterServer()
{
return 0;
}

gah.

ref: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/ad2fe436-f871-4cd8-89e0-657240775ef5

how to compile directsound using visual studio 2010 express

Unfortunately it’s a bit painful.

Anyway install visual studio c++ express 2010

install microsoft sdk “latest”

open D:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses using it, build.

Now open your other “real” project, and you have to add those baseclasses include/lib to your project (for me it was like this:)

add D:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses to the *beginning* of your (right click on project) -> properties -> VC++ Directories -> Include directories.

add D:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\Debug to your Library directories. This one can go at the end or the beginning.

visual studio woe

1>LINK : fatal error LNK1104: cannot open file ‘..\..\BaseClasses\Debug\strmbasd.lib’

meant “you probably need to leave the samples folders where they are since apparently they’re hard coded” or edit your link “inputs” and change the link to strmbasd.lib to not be a relative path anymore.

open source virtual audio cable clues/thoughts/musings

I might have to build one eventually… and I did! http://betterlogic.com/roger/2010/08/open-source-audio-sniffergrabber-for-windows-7vista/

free and open source, works for vista+ (has notes for how to set it up for XP, good enough for now).

NB: you may not need one, if you can setup your computer to record what it outputs

http://betterlogic.com/roger/?p=3073

Some clues for the rest of us who want to program one manually on our own:

http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/e725bb7c-607c-410a-a495-9c92987a34c4

http://msdn.microsoft.com/en-us/library/dd316551(VS.85).aspx

Also http://www.totalrecorder.com/tr_drivers.htm said that “windows vista can only use directshow devices” or something so it better be directshow.

http://msdn.microsoft.com/en-us/library/dd316551(VS.85).aspx

I want a directshow source filter (audio)?

http://tmhare.mvps.org/downloads.htm “wmv source”

http://ac3filter.net/ (maybe bid for them to do it?)

 

how to setup your sound system to record “what you hear”

Windows XP

turns out to not be too trivial…

To turn it on, right click on the “speaker” in the system try (or run sndvol32), “Open Volume Properties” (or run sndvol32.exe — same effect).

Now select recording devices by going to options [menu] => properties -> radio button select “recording”, make sure wave out is checked, hit ok.

Now make sure the check box under “wave out” is selected.  Now selecting your sound card’s “input” should actually be it’s output.  Your default recording device will be “what you hear”

Select your “audio card’s name” in VLC to record.

Vista/windows 7:

A driver I made for it: open-source-audio-sniffergrabber-for-windows-7vista just use that (easy!)  The README describes how to manually do the above in Vista+ too but I’d just use the device.

How to use VLC as a free open source alternative to playon.tv

Basically setup your VLC to stream your desktop + audio, here:

http://betterlogic.com/roger/?p=3058

If this works, then now let’s try it on the console.

To access it from your console, browse to that url (the 1.2.3.4 one) and, with luck, it might play. Note that different consoles have different input capabilities, so you may have to tweak it a bit, but it should play.  So you should probably tweak the “Transcoding settings” (wrench button) so that it outputs in something compatible with your console device.

You could also use this similarly to play existing media files on your computer (just stream those files instead of streaming capture devices).

how to use VLC to stream your desktop live (windows) with audio (or stream a DVD)

Turns out that you can…I think so anyway.

Basically you setup VLC to stream from your desktop+audio.

Sound easy? It does take a few steps to get setup.  I should make it easy and market it :)

To stream desktop (skip below for DVD):

VLC by default comes with a “screen input” option, to capture the desktop.  Unfortunately it appears there’s a bug and currently it cannot use that option to capture along with audio (it is video only).

So we will have to use an alternative input, called DirectShow.  With Directshow, you can choose your video and your audio input device separately, and they do work together out of the box.

So first go and download a direct show screen capture input filter: http://betterlogic.com/roger/?p=3059

Next setup your sound card to be able to “capture” wave out.  If it is not there as an option then you may find some helpful notes here: http://betterlogic.com/roger/?p=3073

Now open VLC, choose Media [menu] -> Streaming -> Capture Device tab -> Set video device name as “screen capture” (may need to hit “refresh list” button first), and set audio device name as whatever device is capturing your wave out (probably your default sound card name, maybe something else).

Now to click on “stream” at the bottom.

To stream a DVD:

Go to Media [menu] -> Streaming -> Disc (make sure right drive is listed), hit Stream. (You may want to click “No DVD menus” and/or select a specific title.

Now for both:

Click on “Destinations”, change destination to http, click add, change url to “/go.mpg”

Now you’ll want to stream it using mp3 audio output, so click the wrench to edit the output options -> audio codec tab -> change it to mp3, hit save. (to be specific, you’ll be using the predefined “Video – H.264 + AAC (MP4)” setting, but with its audio changed to “mp3″). Note also that this eats up a fair amount of CPU since it is transcoding to H.264

Now hit “Stream”

It should now say “streaming” on the bottom.

Now to test your stream, let’s watch the stream by viewing it within another VLC instance (as client this time).

open up another instance of VLC, and open up that very stream, like

Media [menu] -> Open Network Stream -> type in http://localhost:8080/go.mpg

If this works, you are half way there.

Now let’s discover our more public IP address:

First find out your IP by running the “ipconfig” program.  Open the “run” box by hitting windows + r key, now type in “cmd /c ipconfig && pause”

Looks for a line like “IP Address …… 1.2.3.4″ (your IP address if the 1.2.3.4). (in vista it will say IPv4 Address).

now open it with a new instance of VLC, like

Media [menu] -> Open Network Stream -> type in http://1.2.3.4:8080/go.mpg (replace 1.2.3.4 with your IP Address).

And you’re live.  At least you could theoretically go to other computers on your local network and they can see that stream of your  ”screen share” your desktop and audio now.

If you wanted to watch it live from “anywhere on the internet” you’d probably have to setup appropriate port forwarding, which is a topic for another day.

Comments welcome.

Also note that if you just need “point to point” streaming, you can also use ffmpeg for the streaming, which tends to be faster and more reliable in my experience.