Jump to content

npmod32.dll


xAx
 Share

Recommended Posts

  • 2 weeks later...

Any basic samples or tests?

That's not what we do here. You already said you don't know how to use DllCall(). Time to learn. Work with the examples in the help file, and search the forum for more examples using the DLL functions. Open the WinAPI.au3 UDF file and look at how all those DLL calls are done.

When you get stuck, post a short piece of code demonstrating what you are working with and ask a specific AutoIt question.

If you just want someone to write it for you, see the Rent-A-Coder link in my sig.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

There is a tutorial for DLLCall, just search. But not all things you will need here are explained.

So one example with some techniques to use here. I hope, most things you will need are included and you understand the comments :)

$ghNPMOD32dll = DLLOpen("npmod32.dll")


; LPVOID   WINAPI      ModPlug_Create    (UINT argc, LPSTR argn[], LPSTR argv[])
; ->ptr   (->stdcall)   (Function Name)   ->uint      -> str-array        ->str-array
Func _ModPlug_Create($argc, $argn, $argv)
    ; Author: Prog@ndy
    
    ; Ubounds have to be the same and $argc must contain the number of items.
    If $argc <> UBound($argn) Then Return SetError(1,0,0)
    If $argc <> UBound($argv) Then Return SetError(2,0,0)
    
    ; create DLLStructArray for $argn
    Local $stStringArray_argn = DllStructCreate("ptr[" & $argc+1 & "]")
    ; $argn is an Array of strings, wrap them in structs
    For $i = 0 To $argc-1
        $argn[$i] = _CreateStringStruct($argn[$i]) ; just reuse the old array, we don't need the strings anymore
        DllStructSetData($stStringArray_argn, $i+1, DllStructGetPtr($argn[$i])) ; set pointer to struct in "structarray"
    Next
    ; create DLLStructArray for $argv
    Local $stStringArray_argn = DllStructCreate("ptr[" & $argc+1& "]")
    ; $argv is an Array of strings, wrap them in structs
    For $i = 0 To $argc-1
        $argv[$i] = _CreateStringStruct($argv[$i]) ; just reuse the old array, we don't need the strings anymore
        DllStructSetData($stStringArray_argv, $i+1, DllStructGetPtr($argv[$i])) ; set pointer to struct in "structarray"
    Next
    
    
    $aResult = DLLCall($ghNPMOD32dll, "ptr", "ModPlug_Create", "uint", $argc, "ptr", DLLStructGetPtr($stStringArray_argn), "ptr", DLLStructGetPtr($stStringArray_argv))
    If Not @error Then Return SetError(1,0,0)
    Return $aREsult[0]
EndFunc

Func _CreateStringStruct($string)
    ; Author: Prog@ndy
    Local $stStruct = DllStructCreate("char[" & StringLen($string)+1 & "]")
    DllStructSetData($stStruct, 1, $string)
    Return $stStruct
EndFunc

//Edit: oh, i saw that you can replace this quite difficult function by one other wioch should be easier for you to translate when you understood the tutorial and the helpfile.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Btw, you can use also BASSMOD.DLL to play MOD music, IT, XM, MTM, UMX and S3M!

Long time ago I wrote an example script (Little Label Intro) which is using BASSMOD.DLL to play a XM tune.

Here an example to play a XM tune:

Global $bassdll = DllOpen("BASSMOD.dll") , $Init[1]
Global $Chan, $Init, $VolLevel
$Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)

$string= DllStructCreate("char[255]")
DllStructSetData($string, 1, @ScriptDir & "\Chipz\DRAX - Space Whale.xm")


$load = DllCall($bassdll, "int", "BASSMOD_MusicLoad", _
                         "int", 0, _
                         "ptr", DllStructGetPtr($string), _ ;"ptr", $string, _
                         "int", 0, _
                         "int", 0, _
                         "int", 4 + 1024)
;~ $Chan = 0
;~ $Inst = 0
$VolLevel = 100
;$volume = DllCall($bassdll, "int", "BASSMOD_MusicSetVolume", "int", BitOR(BitAND($Chan, 0xFFFF), BitShift($Inst, -16)), "int", $VolLevel)                 
$Volume = DllCall($BASSDLL, "int", "BASSMOD_SetVolume", "int", $VolLevel)
DllCall($bassdll, "int", "BASSMOD_MusicPlay")
;Music flags
;BASS_MUSIC_RAMP = 1 ' normal ramping
;BASS_MUSIC_RAMPS = 2 ' sensitive ramping
;BASS_MUSIC_LOOP = 4 ' loop music
;BASS_MUSIC_FT2MOD = 16 ' play .MOD as FastTracker 2 does
;BASS_MUSIC_PT1MOD = 32 ' play .MOD as ProTracker 1 does
;BASS_MUSIC_POSRESET = 256 ' stop all notes when moving position
;BASS_MUSIC_SURROUND = 512 'surround sound
;BASS_MUSIC_SURROUND2 = 1024 'surround sound (mode 2)
;BASS_MUSIC_STOPBACK = 2048 'stop the music on a backwards jump effect
;BASS_MUSIC_CALCLEN = 8192 'calculate playback length
;BASS_MUSIC_NONINTER = 16384 ' non-interpolated mixing
;BASS_MUSIC_NOSAMPLE = &H400000 ' don't load the samples


While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then OnAutoItExit()
    Sleep(10)
WEnd

Func OnAutoItExit()
    If Not (FileExists("BASSMOD.DLL")) Then
        Exit
    Else
        DllCall($bassdll, "int", "BASSMOD_MusicFree")
        DllClose($bassdll)
    EndIf
    Exit
EndFunc

I hope it will help you!

Also have a look here: http://www.autoitscript.com/forum/index.php?showtopic=79130 or just search for BASSMOD.DLL in this forum :)

UEZ

PS: any information how to play SID tunes?

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thank you guys for your great cooperation with me.

But I am facing a problem with the sample ProgAndy, The Au3Check errors:

C:\Users\Abduljabbar\Desktop\npmod.au3(25,45) : WARNING: $stStringArray_argv: possibly used before declaration.

DllStructSetData($stStringArray_argv,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Abduljabbar\Desktop\npmod.au3(25,45) : ERROR: $stStringArray_argv: undeclared global variable.

DllStructSetData($stStringArray_argv,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Abduljabbar\Desktop\npmod.au3 - 1 error(s), 1 warning(s)

I think it's a stupid question, but can you give me a sample that contains defined variables.

And about the Bassmod,Although the file is existed in the current directory, this message appears:

The "BASSMOD.DLL" not found.

Please place a "BASSMOD.DLL" in the current directory

I don't know what to do.

Edited by xAx
Link to comment
Share on other sites

I didn't meant your example, I meant the original example of http://www.autoitscript.com/forum/index.php?showtopic=79130

In you example there is no problem in the scripting but there is NO sound at all :)

I am using Vista 64bit operating system.

Edited by xAx
Link to comment
Share on other sites

Thank you guys for your great cooperation with me.

But I am facing a problem with the sample ProgAndy, The Au3Check errors:

I think it's a stupid question, but can you give me a sample that contains defined variables.

And about the Bassmod,Although the file is existed in the current directory, this message appears:

I don't know what to do.

... That happens, if you use SciTE Autocomplete for variables.

This:

; create DLLStructArray for $argv
    Local $stStringArray_argn = DllStructCreate("ptr[" & $argc+1& "]")

Should be $stStringArray_argv :

; create DLLStructArray for $argv
    Local $stStringArray_argv = DllStructCreate("ptr[" & $argc+1& "]")
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...