LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3d sound example

Jennifer_R,
 
Here is my best attempt at creating a OpenAL library for LabVIEW, a large portion of the functions do come in automatic, unfortunately several key functions do not.
 

The link you provided explains the problem:

"If the function(s) you wish to call contains complex data types, you need to manually use a Call Library Function Node function in LabVIEW to directly call the DLL, defining the prototype within the configuration dialog (if the DLL has been compiled with a Type Library, parameter data and return types will be defined automatically).  Note that if your complex data type is a struct with more than primitive data types (int, double, char), it is easiest to create a wrapper DLL from a C-based language.  Since C/C++ constructs do not always directly correlate to LabVIEW data types, a wrapper DLL can appropriately extract the contents of the complex structure and translate them to primitive terms.  For instance, if you have a struct in C which contains a char * (a string or character array), you can create a wrapper function which LabVIEW will call that takes in a char * type directly, puts that into a structure, and then in turn calls the DLL.  Note that if you have the DLL source code, you can directly modify the DLL so that it takes in a char * instead of the struct.

Note: There is a very helpful example in the Labview Example finder that explains how to handle several different data types to be used with the Call Library Function Node. The example is named Call DLL.vi. Refer to this example when dealing with complex data types such as arrays or strucs. To Find this example go to the LabView Example Finder (Help»Find Examples) and select the Directory Structure radio button. In the directories list, select dll and then data passing then Call Native Code.llb. The Call DLL.vi example is under that directory"
 
Here is the generated repot along with my *.dll library (see attached).
 
Your generated files are installed in the following folder:
C:\Program Files\National Instruments\LabVIEW 8.5\user.lib\OpenAL32

Parsing header file warnings:
No errors/warnings occurred when parsing the header file.

The following errors/warnings occurred when generating the wrapper VIs for this shared library.

VI Not Executable
The VI is not executable because of one of the following reasons:
1. The shared library or a dependent file is not installed. To make the VI executable, you must install the shared library and all support files on the computer on which you run the VI.
2. A required custom control might be empty or cannot be found. To make the VI executable, update the custom control manually.
3. The VI contains a parameter with an unsupported data type. To make the VI executable, you must replace the empty cluster that the wizard generates with a control or indicator that uses supported data types.
    alc Capture Close Device.vi
    alc Capture Samples.vi
    alc Capture Start.vi
    alc Capture Stop.vi
    alc Close Device.vi
    alc Create Context.vi
    alc Destroy Context.vi
    alc Get Contexts Device.vi
    alc Get Enum Value.vi
    alc Get Error.vi
    alc Get Integerv.vi
    alc Get Proc Address.vi
    alc Get String.vi
    alc Is Extension Present.vi
    alc Make Context Current.vi
    alc Process Context.vi
    alc Suspend Context.vi


0 Kudos
Message 11 of 18
(1,325 Views)

Hi SS,

Looking at the library, the custom controls are empty clusters.  The functions listed in the report have those data types as parameters, which is why they will not run.  You will need to add elements to ALCcontext.ctl and ALCDevice.ctl.  You can then drag those custom controls to any front panel and wire them as inputs to the Call Library Function Nodes that need them.  You can also place either control on the front panel, right click and select Change to Indicator.  Then they can be used to display the data returned from the DLL through the Call Library Function Node outputs. 

Jennifer R.
National Instruments
Applications Engineer
Message 12 of 18
(1,297 Views)

Jennifer_R,

I see the custom controls you are talking about.  Unfortunately I have no idea how to add elements or what I would add?  Sorry I just never made custom controls before.

Maybe someone could help me out in this respect.

Regards,

-SS



0 Kudos
Message 13 of 18
(1,285 Views)

Hi SS,

A custom control allows you to specify properties and then use that control on any front panel.  You can also create a type definition when customizing the control. 

In your case, each control is a cluster that is passed to the DLL.  The custom controls need to match the function parameters.  Are ALCdevice and ALCcontext type definitions in the C code?  If they are structs, your LabVIEW custom controls should include the data that is in those structs.  For example, if the struct contains a double and a character, you will want to place numeric and string controls in the cluster.   The example Call DLL.vi mentioned in your post above shows how C data types correspond to LabVIEW data types.

Jennifer R.
National Instruments
Applications Engineer
0 Kudos
Message 14 of 18
(1,259 Views)
Jennifer_R,
 
Thank you for explaining this a different way.  I did find the files that correspond to ALCdevice and ALCcontext, or at least the files I suspect Labview is using.
 
I also decided to include the source provided direct from OpenAL.org if you would like to help, or at least continue to point me in the right direction.
 
I believe they are openal-0.0.8\src\al, alc_device.h, alc_device.c, alc_context.h, and alc_context.h.
 
Regards,
 
-SS
 


0 Kudos
Message 15 of 18
(1,251 Views)

Hi SS,

It looks like information on the elements of ALCdevice and ALCcontext is in openal-0.0.8\src\al_types.h.  The structs include more than just the basic data types, which makes it more difficult to create custom controls.  I will need to go through the code more before I can tell what the equivalent data would be in LabVIEW.

Jennifer R.
National Instruments
Applications Engineer
0 Kudos
Message 16 of 18
(1,215 Views)

Hi SS,

I'm working on the use of OPENAL with LabView.

Did you find some issues or functionnal exemples ?

I'm ready to share any relevant information about that.

Best regards,

Benoît

0 Kudos
Message 17 of 18
(1,002 Views)

Hi Benoît,

 

ShotSimon may or may not be monitoring this thread still since the last post was nearly a year ago.  As far as I know there are still not any examples of using LabVIEW with OpenAL.  You will likely want to use an OpenAL dll with the traditional LabVIEW shared library tools (Call Library Function Node, Import Shared Library Wizard, etc). 

 

 

Jennifer R.
National Instruments
Applications Engineer
0 Kudos
Message 18 of 18
(979 Views)