BASS and MASM user

Started by LordAdef,

LordAdef

Hi everyone,

I've been around for a while but only now I am really learning this incredible library!

I've updated the .inc file and it's already working.

I will need a lot of help from you guys, so please excuse me if I ask too many questions.

I am currently studying one of the masm examples (Spectrum). I will be adding some extra functionalities to the this example. In the future, if the developer so wants, I will be happy to be included in the distribution (some masm examples don't work, I'll fix them)


Alex

Ian @ un4seen

It has been a while since the MASM stuff was last updated, so I have now put an updated BASS.INC file for BASS 2.4.17 in the MASM package. Please re-download to get that (and let me know if you see any problems). Any updated/fixed examples would be much appreciated. If possible, please have them do the same thing as the C examples of the same name for consistency.

LordAdef

Quote from: Ian @ un4seenIt has been a while since the MASM stuff was last updated, so I have now put an updated BASS.INC file for BASS 2.4.17 in the MASM package. Please re-download to get that (and let me know if you see any problems).

Hi Ian,
I had already manually updated the .inc based on the 2.4.17 bass.h. Up to now, no issues, but I will re-download and check yours.
For your information, there are two structure members with name conflict, I changed the 'name' members to 'aname'(just for now):

BASS_DEVICEINFO struct
        aname    DWORD   ?       ; description  <--
        driver   DWORD   ?       ; driver
        flags    DWORD   ?
BASS_DEVICEINFO ends

BASS_PLUGINFORM struct
        ctype    DWORD   ?      ; channel type
        aname    DWORD   ?      ; format description   <--
        exts     DWORD   ?      ; file extension filter (*.ext1;*.ext2;etc...)
BASS_PLUGINFORM ends

Quote from: Ian @ un4seenAny updated/fixed examples would be much appreciated. If possible, please have them do the same thing as the C examples of the same name for consistency.

Sure, I am going to check all the current ones and keep consistency. I'll keep you posted.

Ian @ un4seen

Quote from: LordAdefFor your information, there are two structure members with name conflict, I changed the 'name' members to 'aname'(just for now):

BASS_DEVICEINFO struct
        aname    DWORD  ?      ; description  <--
        driver  DWORD  ?      ; driver
        flags    DWORD  ?
BASS_DEVICEINFO ends

BASS_PLUGINFORM struct
        ctype    DWORD  ?      ; channel type
        aname    DWORD  ?      ; format description  <--
        exts    DWORD  ?      ; file extension filter (*.ext1;*.ext2;etc...)
BASS_PLUGINFORM ends

Thanks. I've changed them to "name_" now (update on the BASS page), to keep them easily recognisable in the documentation. Let me know if that's problematic.


LordAdef

Hi, I will keep my posts in this thread so I wont thrash the forum.

Is BASS_MIXER_PAUSE and BASS_MIXER_CHAN_PAUSE deprecated? They are not in the include files. Is there an alternative other than setting the volume to 0.0?

They are still in the documentation file

Ian @ un4seen

Which include files are you looking at? BASS_MIXER_PAUSE and BASS_MIXER_CHAN_PAUSE flags are both still valid and have the same value. BASS_MIXER_PAUSE was the original flag name, but it and the other mixer source flags were renamed to make it clearer which flags can be used with BASS_Mixer_StreamAddChannel(Ex) and which with BASS_Mixer_StreamCreate.

LordAdef

#7
Hi Ian!
I assume I have the latest. This below is what I have in the include file (the initial portion of it):

ps: Ian, I just checked the bassmix c .h file. The masm .inc is missing a bunch of things.



; =====================================
; bassmix.inc - MASM32 BASSmix support
; =====================================
; Compatible with BASSmix.dll v2.4.x
; Use with BASS.dll (required)
; =====================================

; ==== Constants ====

BASS_MIXER_END            equ 010000h   ; end stream when no more sources
BASS_MIXER_NONSTOP        equ 020000h   ; don't stall when no data
BASS_MIXER_RESUME         equ 01000h    ; resume source when mixer restarts
BASS_MIXER_POSEX          equ 02000h    ; precise position sync (BASS_Mixer_ChannelSetPosition)
BASS_MIXER_LIMIT          equ 040000h   ; limit mixer output to +/-1.0 (used with BASS_Mixer_StreamCreate)
BASS_MIXER_MATRIX         equ 100000h   ; matrix mixing enabled (allows BASS_Mixer_ChannelSetMatrix)

Ian @ un4seen

Where did you get that BASSMIX.INC file from and what's the date of it? I don't actually remember there being MASM support for BASSmix (or indeed any of the add-ons) officially available on the BASS webpage, so I guess it was created privately by another user.

The BASS_MIXER_PAUSE flag has been in BASSmix since the first release, so it should be present in even a very old header/include file. In any case, please see the current BASSMIX.H file for the latest stuff and copy what you need.

LordAdef

great question! I will let you know, but looks like I will convert it myself, since I am already using BASSmix in my code

LordAdef

I converted the BASSmix .h into .inc.

It built, at least ;D If you double check it and it's alright, now we have a MASM .inc to share.
I will be converting all the necessary .h files as I go, and share with you.
Alex

I don't know how to attach it, so I'm pasting it below:
comment ~
    BASSmix 2.4 C/C++ header file
    Copyright (c) 2005-2022 Un4seen Developments Ltd.

    See the BASSMIX.CHM file for more detailed documentation
~

BASS_CONFIG_MIXER_BUFFER      equ 10601h
BASS_CONFIG_MIXER_POSEX      equ 10602h
BASS_CONFIG_SPLIT_BUFFER      equ 10610h

BASS_MIXER_RESUME            equ 1000h
BASS_MIXER_POSEX              equ 2000h
BASS_MIXER_NOSPEAKER          equ 4000h
BASS_MIXER_QUEUE              equ 8000h
BASS_MIXER_END                equ 10000h
BASS_MIXER_NONSTOP            equ 20000h

BASS_MIXER_CHAN_ABSOLUTE      equ 1000h
BASS_MIXER_CHAN_BUFFER        equ 2000h
BASS_MIXER_CHAN_LIMIT        equ 4000h
BASS_MIXER_CHAN_MATRIX        equ 10000h
BASS_MIXER_CHAN_PAUSE        equ 20000h
BASS_MIXER_CHAN_DOWNMIX      equ 400000h
BASS_MIXER_CHAN_NORAMPIN      equ 800000h

BASS_MIXER_BUFFER            equ BASS_MIXER_CHAN_BUFFER
BASS_MIXER_LIMIT              equ BASS_MIXER_CHAN_LIMIT
BASS_MIXER_MATRIX            equ BASS_MIXER_CHAN_MATRIX
BASS_MIXER_PAUSE              equ BASS_MIXER_CHAN_PAUSE
BASS_MIXER_DOWNMIX            equ BASS_MIXER_CHAN_DOWNMIX
BASS_MIXER_NORAMPIN          equ BASS_MIXER_CHAN_NORAMPIN

BASS_ATTRIB_MIXER_LATENCY    equ 15000h
BASS_ATTRIB_MIXER_THREADS    equ 15001h
BASS_ATTRIB_MIXER_VOL        equ 15002h

BASS_ACTIVE_WAITING          equ 5
BASS_ACTIVE_QUEUED            equ 6

BASS_SPLIT_SLAVE              equ 1000h
BASS_SPLIT_POS                equ 2000h

BASS_ATTRIB_SPLIT_ASYNCBUFFER equ 15010h
BASS_ATTRIB_SPLIT_ASYNCPERIOD equ 15011h

BASS_MIXER_ENV_FREQ          equ 1
BASS_MIXER_ENV_VOL            equ 2
BASS_MIXER_ENV_PAN            equ 3
BASS_MIXER_ENV_LOOP          equ 10000h
BASS_MIXER_ENV_REMOVE        equ 20000h

BASS_SYNC_MIXER_ENVELOPE      equ 10200h
BASS_SYNC_MIXER_ENVELOPE_NODE equ 10201h
BASS_SYNC_MIXER_QUEUE        equ 10202h

BASS_POS_MIXER_RESET          equ 10000h
BASS_POS_MIXER_DELAY          equ 5

BASS_CTYPE_STREAM_MIXER      equ 10800h
BASS_CTYPE_STREAM_SPLIT      equ 10801h

; Structure: BASS_MIXER_NODE
BASS_MIXER_NODE struct
    pos  QWORD ?
    value REAL4 ?
BASS_MIXER_NODE ends

; Prototypes (stdcall)
BASS_Mixer_GetVersion          PROTO STDCALL
BASS_Mixer_StreamCreate        PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Mixer_StreamAddChannel    PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Mixer_StreamAddChannelEx  PROTO STDCALL :DWORD, :DWORD, :DWORD, :QWORD, :QWORD
BASS_Mixer_StreamGetChannels  PROTO STDCALL :DWORD, :DWORD, :DWORD

BASS_Mixer_ChannelGetMixer    PROTO STDCALL :DWORD
BASS_Mixer_ChannelIsActive    PROTO STDCALL :DWORD
BASS_Mixer_ChannelFlags        PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Mixer_ChannelRemove      PROTO STDCALL :DWORD
BASS_Mixer_ChannelSetPosition  PROTO STDCALL :DWORD, :QWORD, :DWORD
BASS_Mixer_ChannelGetPosition  PROTO STDCALL :DWORD, :DWORD
BASS_Mixer_ChannelGetPositionEx PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Mixer_ChannelGetLevel    PROTO STDCALL :DWORD
BASS_Mixer_ChannelGetLevelEx  PROTO STDCALL :DWORD, :DWORD, :REAL4, :DWORD
BASS_Mixer_ChannelGetData      PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Mixer_ChannelSetSync      PROTO STDCALL :DWORD, :DWORD, :QWORD, :DWORD, :DWORD
BASS_Mixer_ChannelRemoveSync  PROTO STDCALL :DWORD, :DWORD
BASS_Mixer_ChannelSetMatrix    PROTO STDCALL :DWORD, :DWORD
BASS_Mixer_ChannelSetMatrixEx  PROTO STDCALL :DWORD, :DWORD, :REAL4
BASS_Mixer_ChannelGetMatrix    PROTO STDCALL :DWORD, :DWORD
BASS_Mixer_ChannelSetEnvelope  PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
BASS_Mixer_ChannelSetEnvelopePos PROTO STDCALL :DWORD, :DWORD, :QWORD
BASS_Mixer_ChannelGetEnvelopePos PROTO STDCALL :DWORD, :DWORD, :DWORD

BASS_Split_StreamCreate        PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Split_StreamGetSource    PROTO STDCALL :DWORD
BASS_Split_StreamGetSplits    PROTO STDCALL :DWORD, :DWORD, :DWORD
BASS_Split_StreamReset        PROTO STDCALL :DWORD
BASS_Split_StreamResetEx      PROTO STDCALL :DWORD, :DWORD
BASS_Split_StreamGetAvailable  PROTO STDCALL :DWORD

LordAdef

Hi Ian,

I've got a stream channel that goes into a BASSmix stream. This is my 'track'. The BASSmix 'track' stream goes into my Master MIx Out, which is the sum of my tracks.

my Master BAssmix:

mov hMasterMix, rv (BASS_Mixer_StreamCreate, SAMPLE_RATE, 2, BASS_MIXER_END)

my track BASSmix connects to Master mix output:

inv BASS_Mixer_StreamAddChannel, hMasterMix, [esi].TRACK.mixer, BASS_MIXER_RESUME ;(or BASS_MIXER_CHAN_PAUSE ??)

this channel stream goes to BASSmix track:

mcm tchannel.streamHandle, rv(BASS_StreamCreateFile, FALSE, addr path, 0, 0, BASS_STREAM_DECODE or BASS_MIXER_CHAN_BUFFER)

All is good and I've got 8 tracks playing.

Now, I've got a timer calling a function that updates level meters:

    ...
    mov eax, session.track[esi * 4]
    inv BASS_ChannelGetLevel, [eax].TRACK.mixer             ;access the BASSmix if the track..
    ; inv BASS_Mixer_ChannelGetLevel, [eax].TRACK.mixer     ;access the BASSmix if the track..
    ...


inv inv BASS_ChannelGetLevel, [eax].TRACK.mixer : is affecting the sound. Audio crackling and channels playing at higher speed. (error code 0)

inv BASS_Mixer_ChannelGetLevel, [eax].TRACK.mixer  retrieves me no data, (error code 37)


Could help me here?
many thanks in advance.
Alex

Ian @ un4seen

BASS_Mixer_ChannelGetLevel is the correct function to use there (using BASS_ChannelGetLevel will take data away from the mixer), but the BASS_MIXER_CHAN_BUFFER flag needs to be moved from the BASS_StreamCreateFile call to the BASS_Mixer_StreamAddChannel call. And BASS_MIXER_RESUME should be moved to the BASS_Mixer_StreamCreate call. BASS_Mixer_StreamCreate takes BASS_MIXER_xxx flags, and BASS_Mixer_StreamAddChannel takes BASS_MIXER_CHAN_xxx flags.

Btw, here's a tool that you may find useful for converting C/C++ headers for MASM:

    www.japheth.de/h2incX.html

The output file will probably need some editing, but it should still save some effort :)

LordAdef

Quote from: Ian @ un4seenBASS_Mixer_ChannelGetLevel is the correct function to use there (using BASS_ChannelGetLevel will take data away from the mixer), but the BASS_MIXER_CHAN_BUFFER flag needs to be moved from the BASS_StreamCreateFile call to the BASS_Mixer_StreamAddChannel call. And BASS_MIXER_RESUME should be moved to the BASS_Mixer_StreamCreate call. BASS_Mixer_StreamCreate takes BASS_MIXER_xxx flags, and BASS_Mixer_StreamAddChannel takes BASS_MIXER_CHAN_xxx flags.

Thanks Ian! I am still getting used to the Bass enviroment. Great library!
I am sorry if I make too much questions.


Quote from: Ian @ un4seenBtw, here's a tool that you may find useful for converting C/C++ headers for MASM:

    www.japheth.de/h2incX.html

The output file will probably need some editing, but it should still save some effort :)

I know japheth from our MASM forum, he is a great programmer. I do have h2incX and in fact I use the UASM Assembly, not MASM. UASM comes from JWasm (J for Japheth), and both are dialects of MASM, but better.


But in fact.....  I used the Window's Copilot AI to translate the .h.  And it worked!!!  I wouldn't place the STDCALL in the PROTOs, but it doesn't hurt.