Jump to content

BASS Function Library (Sound and Music Functions)


BrettF
 Share

Recommended Posts

Great! I recommend to rename _PtrStringRead to __BASS_PtrStringRead :P So there are no errorrs, if another UDF incudes those function, too :(

*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

Great! I recommend to rename _PtrStringRead to __BASS_PtrStringRead :P So there are no errorrs, if another UDF incudes those function, too :(

Was the header info for those functions correct? I basically made it up from what I understood about it... :idea:
Link to comment
Share on other sites

Was the header info for those functions correct? I basically made it up from what I understood about it... :(

Well, most ist correct :P Here the corrected headers:

; #INTERNAL# ====================================================================================================================
; Name...........: _PtrStringLen
; Description ...: Retrieves the lenth of a string in a PTR.
; Syntax.........: _PtrStringLen($ptr, $IsUniCode = False)
; Parameters ....:  -   $ptr                   -  Pointer to the string
;                   -   [Optional] $IsUniCode  -  True = Unicode, False (Default) = ANSI 
; Return values .: Success   -   Returns length of string ( can be 0 as well )
;                  Failure   -   Returns -1 and sets @ERROR
;                                   @error will be set to 1
; Author ........: Prog@ndy
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
; ===============================================================================================================================

; #INTERNAL# ====================================================================================================================
; Name...........: _PtrStringRead
; Description ...: Reads a string from a pointer
; Syntax.........: _PtrStringRead($ptr, $IsUniCode = False, $StringLen = -1)
; Parameters ....:  -   $ptr        -  Pointer to the string
;                   -   $IsUniCode  -  [Optional] True = Unicode, False (Default) = ANSI
;                   -   $StringLen  -  [Optional] Length of the String
; Return values .: Success  -  Returns the read string (can be empty)
;                  Failure  -  Returns "" (empty String) and sets @ERROR
;                                   @error will be set to 1
; Author ........: Prog@ndy
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
; ===============================================================================================================================
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

Link to comment
Share on other sites

Thanks mate. Edited on my copy. Not too much difference so will upload when someone does the inevitable and finds where I've missed something... :P

_BASS_ChannelBytes2Seconds()... "uint65" ???

_BASS_ChannelGetPosition()... change return type from "uint64" to "udword"

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Link to comment
Share on other sites

_BASS_ChannelBytes2Seconds()... "uint65" ???

_BASS_ChannelGetPosition()... change return type from "uint64" to "udword"

This is confusing me, cause it never works for me (setting position.) I have something working, but its not updating the position?

EDIT: Worked it out! Will update bass.au3 soon, and add another example of getting and setting the position!

Edited by BrettF
Link to comment
Share on other sites

Made a mistake. How does this go for you?

Example

;Get Recording Device Information.
#include <Bass.au3>
#include <BassConstants.au3>
#include <Array.au3>
$bass_dll = DllOpen("BASS.dll")

$return = _BASS_RecordGetDeviceInfo($bass_dll, 0)
_ArrayDisplay ($return)

Function

; #FUNCTION# ====================================================================================================

================
; Name...........: _BASS_RecordGetDeviceInfo
; Description ...: Retrieves information on a recording device.
; Syntax.........: _BASS_RecordGetDeviceInfo($bass_dll, $device)
; Parameters ....:  -   $bass_dll   -   Handle to opened Bass.dll
;                   -   $device     -   The device to get the information of... 0 = first.
; Return values .: Success    - Returns an array containg the device info.
;                                   - [0] = Name
;                                       - Description of the device.
;                                   - [1] = Driver
;                                       - driver The filename of the driver...
;                                          NULL = no driver ("no sound" device). On systems that can use both VxD and WDM
;                                          drivers (Windows Me/98SE), this will reveal which type of driver is being used.
;                                          Further information can be obtained from the file using the GetFileVersionInfo
;                                          Win32 API function.
;                                   - [2] = Flags
;                                       - The device's current status... a combination of these flags.
;                                           - BASS_DEVICE_ENABLED
;                                               - The device is enabled. It will not be possible to initialize the
;                                                 device if this flag is not present.
;                                           - $BASS_DEVICE_DEFAULT
;                                               - The device is the system default.
;                                           - $BASS_DEVICE_INIT
;                                               - The device is initialized, ie. BASS_Init or BASS_RecordInit has been called.
;                 Failure     - Returns 0 and sets @ERROR to error returned by _BASS_ErrorGetCode()
;                                   @error will be set to-
;                                       - $BASS_ERROR_DX
;                                           - A sufficient version of DirectX is not installed.
;                                       - $BASS_ERROR_DEVICE
;                                           - device is invalid.

; Author ........: Brett Francis (BrettF)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
; ====================================================================================================

===========================
Func _BASS_RecordGetDeviceInfo($bass_dll, $device)
    Local $aRet[3]
    $sRet = DllStructCreate($BASS_DEVICEINFO)
    $BASS_ret_ = DllCall($bass_dll, "int", "BASS_RecordGetDeviceInfo", "dword", $device, "ptr", DllStructGetPtr($sRet))
    $error = _BASS_ErrorGetCode($bass_dll)
    If $error <> 0 Then
        Return SetError($error, "", 0)
    Else
        $rest = DllStructCreate ("char[255]", DllStructGetData($sRet, 1))
        $aRet[0] = DllStructGetData ($rest, 1)
        $rest = DllStructCreate ("char[255]", DllStructGetData($sRet, 2))
        $aRet[1] = DllStructGetData ($rest, 1)
        $aRet[2] = DllStructGetData($sRet, 3)
        Return SetError(0, "", $aRet)
    EndIf
EndFunc  ;==>_BASS_RecordGetDeviceInfo

Cheers,

Brett

Link to comment
Share on other sites

Thanks!

First post will be updated soon when I get round to it... I might make a new example based around Monoceres' work on visualisations. They really do rock!

Cheers,

Brett

Link to comment
Share on other sites

Hi

I´ve tried to write an UDF for bassenc.dll

bassenc.dll is used to write audiodata to disk, send to an encoder (lame.exe...) or stream to an icecast or shoutcast-server.

bassenc.rar

there are 2 examples (simple wav/mp3 recording scripts) included:

example_callback.au3

example_no_callback.au3

why?

because there are problems...

if you use _BASS_RecordStart without a CallBack then you´ve to call _BASS_ChannelGetLevel at least once in the specified $BASS_CONFIG_REC_BUFFER-time otherwise no data is sent to the encoder!?!

This example is stable, but if you are moving the GUI during encoding, no _BASS_ChannelGetLevel is called and the recordingfile has dropouts.

_BASS_RecordStart with a CallBack sends all recorded data to the encoder, but the callback procedure crashes the script after a while!

can this be fixed?

I hope you understand my bad english :mellow:

Eukalyptus

by the way:

I found 3 bugs:

line 218: "_BASS_SetConfig"

________^ underscore

line 1092: " BASS_Get3DFactors"

_________^ space

_BASS_RecordStart: if you don´t use a callback ("") then error @ DllCallBackRegister

Link to comment
Share on other sites

Hi

I´ve tried to write an UDF for bassenc.dll

bassenc.dll is used to write audiodata to disk, send to an encoder (lame.exe...) or stream to an icecast or shoutcast-server.

bassenc.rar

there are 2 examples (simple wav/mp3 recording scripts) included:

example_callback.au3

example_no_callback.au3

why?

because there are problems...

if you use _BASS_RecordStart without a CallBack then you´ve to call _BASS_ChannelGetLevel at least once in the specified $BASS_CONFIG_REC_BUFFER-time otherwise no data is sent to the encoder!?!

This example is stable, but if you are moving the GUI during encoding, no _BASS_ChannelGetLevel is called and the recordingfile has dropouts.

_BASS_RecordStart with a CallBack sends all recorded data to the encoder, but the callback procedure crashes the script after a while!

can this be fixed?

I hope you understand my bad english :(

Eukalyptus

by the way:

I found 3 bugs:

line 218: "_BASS_SetConfig"

________^ underscore

line 1092: " BASS_Get3DFactors"

_________^ space

_BASS_RecordStart: if you don´t use a callback ("") then error @ DllCallBackRegister

I will take a look at the BASSENC, but I'm confused about the first 2 bugs... Number 3 makes sense :)

EDIT

Nice work on BASSENC! It looks nice and works very well. I've started to get BASS_Video in the works as well. I'd say it might be easier to use an ADLIB loop? See how that goes. Its nice to see people expanding on the original UDF to start to utilise the many other BASS_*.dll's. Nice work! :mellow:

Cheers,

Brett

Edited by BrettF
Link to comment
Share on other sites

...but I'm confused about the first 2 bugs... Number 3 makes sense :mellow:

wrong dll-function names:

DllCall($bass_dll, "int", "_BASS_SetConfig"...

the functionname in bass.dll is "BASS_SetConfig" without the first underscore. (copy & paste *g*)

---

Because of the crashing callback, I wrote a dll in freepascal some time ago, including the basic functions I need to record audio.

Do you think that it´s possible to write a dll with the function _Bass_RecordStart incl. callback and do all the other things in AutoIt?

The problem is, that the dll and AutoIt have to use the same instance/handle of bass.dll !?

c.u.

E

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...