### Author Topic: BASS 2.4 beta  (Read 129270 times)

#### firemen

• Posts: 151
##### Re: BASS 2.4 beta
« Reply #50 on: 16 Jan '08 - 22:33 »
i : bass_info;
....

BASS_GetInfo(i);

i.minbuf  shows = 195100188 !  although must be maksimum 5000
do I understand correctly?

#### Gamo

• Posts: 97
##### Re: BASS 2.4 beta
« Reply #51 on: 17 Jan '08 - 03:41 »

Where are you getting the "bpm" and "ppqn" values from, and is "BTime" floating-point or integer?

Btw, how far apart are BASSMIDI and your calculation?

BTime is float.

bpm I use follow code

CrrTempo = BASS_MIDI_StreamGetEvent(BASS_FX_TempoGetSource(chan), 0, MIDI_EVENT_TEMPO)
bpm = 60000000 / CrrTempo

and ppqn I get from the MIDI file by using this code

Open FileName For Binary As #1
TxtString = Space(LOF(1))
Get #1, , TxtString
Close #1

Dim isLyric As Boolean
isLyric = False
MidiType = Val("&H" & Hex(Asc(Mid(TxtString, 9, 1))) & Hex(Asc(Mid(TxtString, 10, 1))))
NrTracks = Val("&H" & Hex(Asc(Mid(TxtString, 11, 1))) & Hex(Asc(Mid(TxtString, 12, 1))))

k = InStr(1, TxtString, Chr(&HFF) & Chr(&H51))
If k <> 0 Then
n1 = Hex(Asc(Mid(TxtString, k + 3, 1)))
n2 = Hex(Asc(Mid(TxtString, k + 4, 1)))
n3 = Hex(Asc(Mid(TxtString, k + 5, 1)))
If Len(n1) = 1 Then n1 = "0" & n1
If Len(n2) = 1 Then n2 = "0" & n2
If Len(n3) = 1 Then n3 = "0" & n3
t1 = Hex(Asc(Mid(TxtString, 13, 1)))
t2 = Hex(Asc(Mid(TxtString, 14, 1)))
If Len(t1) = 1 Then t1 = "0" & t1
If Len(t2) = 1 Then t2 = "0" & t2
Timebase = CDec("&H" & t1 & t2) / 4
Resolution = CDec("&H" & t1 & t2)
bpm = Format(60000000 / CDec("&H" & n1 & n2 & n3), "0.00")
Quarter = (ppqn / Timebase) / 4000
End If

Here is the example of your tick and my tick. It not constant.
Your tick                           My tick
820                                  1963.647
1702                                 4294.664
2637                                 6764.91
4005                                10359.372
4702                                12187.555

Ian may be I miss understand. The value that I calculate is MIDI delta time.
How can I convert from tick position to delta time?
« Last Edit: 17 Jan '08 - 14:39 by Gamo »

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #52 on: 17 Jan '08 - 17:37 »
i : bass_info;
....

BASS_GetInfo(i);

i.minbuf  shows = 195100188 !  although must be maksimum 5000
do I understand correctly?

That's strange. Is the BASS_GetInfo call succeeding, ie. returning TRUE? If so, are the other BASS_INFO members ok?

bpm I use follow code

CrrTempo = BASS_MIDI_StreamGetEvent(BASS_FX_TempoGetSource(chan), 0, MIDI_EVENT_TEMPO)
bpm = 60000000 / CrrTempo

When are you doing that, eg. before playback or mid-playback? If before, that will just be the default tempo (120). Also note that your calculation will be inaccurate if there are tempo changes after the start (tick 0), as the "bpm" won't apply for the entire file.

Ian may be I miss understand. The value that I calculate is MIDI delta time.
How can I convert from tick position to delta time?

I think "delta time" and "tick" are probably the same thing here

#### Rescator

• Guest
##### Re: BASS 2.4 beta
« Reply #53 on: 17 Jan '08 - 18:12 »
I always thought that the delta was the difference between two points.
So in the case of ticks (ticks per second right?) then the delta would be depending on what the points used are.

If you use every single tick then delta and tick would be the same.

But if you use every 10th tick (lets assume 1000 ticks per second) then the delta would be 100.
Not exactly unlike how you'd do FPS counting in games.

In the case of 1000 ticks per second using a API function like timeGetTime()
it is best advised to do something like.

last=timeGetTime()
//do stuff here, our delta lies here
current=timeGetTime()
last=current

then do:
delta=current-last //need to subtract this way to handle possible wrapping of the time ticks.

Note: This is a general example, I've never messed with MIDI so this may not be applicable to that.

PS! The accuracy of timeGetTime() can be improved, down to a theoretical 1ms, see API documentation, but you may need not do this as I think BASS.dll actually set this itself? But setting it multiple times isn't a issue as the lowest (best) value will be used by the system in case multiple applications sets it.

EDIT: Oh BTW! You can change that /1000 to *0.001 for a small speed increase (float multiply is faster than division), also, depending on your compiler that whole line may or may not be done as float, so please be aware of float rounding errors, especially if you use single precision float and you start getting large decimals (if you get thousands before the floating point you really should consider using double floats (64bit float) instead.
« Last Edit: 17 Jan '08 - 18:23 by Rescator »

#### firemen

• Posts: 151
##### Re: BASS 2.4 beta
« Reply #54 on: 17 Jan '08 - 18:25 »
If BASS_Init(-1, 44100, 0, handle, nil) = false then application.Terminate;

BASS_GetInfo(i)

return = true

i.flags = 3935
i.hwsize = 0
i.hwfree = 0
i.freesam = 31
i.free3d = 31
i.minrate = 8000
i.maxrate = 192000
i.minbuf = 4294967295
i.dsver = 9
i.latency = 4294967295
i.initflags = 0
i.speakers = 8
i.freq = 0

a sound reproduces as though normally..

#### Rescator

• Guest
##### Re: BASS 2.4 beta
« Reply #55 on: 17 Jan '08 - 18:33 »
4294967295 = Hex \$FFFFFFFF = -1 (if signed 32bit integer)

"minbuf The minimum buffer length (rounded up to the nearest millisecond) recommended for use (with the BASS_CONFIG_BUFFER config option). Requires that BASS_DEVICE_LATENCY was used when BASS_Init was called "
"latency The delay (rounded up to the nearest millisecond) for playback of HSTREAM/HMUSIC channels to start and be heard. Requires that BASS_DEVICE_LATENCY was used when BASS_Init was called."

If you where wondering about those "huge" values
Try using those flags and they should look more normal.

#### GingerMagician42

• Guest
##### Error on BASS beta - BASS_ChannelSlideAttributes
« Reply #56 on: 21 Jan '08 - 11:07 »
When I try to compile under 2.4 I get an error sayng that the procedure entry point BASS_ChannelSlideAttributes could not be located. Help file states BASS_ChannelSlideAttribute, so I changed this - Undeclared Identifier. Any Ideas ?

#### Ian @ un4seen

• Posts: 21529
##### Re: Error on BASS beta - BASS_ChannelSlideAttributes
« Reply #57 on: 21 Jan '08 - 15:01 »
Which API are you using, and have you upgraded that (not just the DLL) to the 2.4 version?

#### Gamo

• Posts: 97
##### Re: BASS 2.4 beta
« Reply #58 on: 22 Jan '08 - 03:23 »
Hi Ian,
I try using the API BASS_MIDI_FontGetPreset on drum channel. It not return drum name but return the instrument name like "acoustic piano".

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta WavPack
« Reply #59 on: 22 Jan '08 - 10:56 »
Hi Ian,

Spotted a small syntax error in Basswv.bas the code originally was:

Code: [Select]
`Declare Function BASS_WV_StreamCreateFile64 Lib "bass_wv.dll" Alias "BASS_WV_StreamCreateFile" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal lengthhigh As Long, ByVal flags As Long) As LongDeclare Function BASS_WV_StreamCreateFileUser Lib "bass_wv.dll" (ByVal system As Long, ByVal flags As Long, ByVal procs As Long, ByVal user As Long) As Long `

But as the actual dll name is basswv.dll it should be:

Code: [Select]
`Declare Function BASS_WV_StreamCreateFile64 Lib "basswv.dll" Alias "BASS_WV_StreamCreateFile" (ByVal mem As Long, ByVal file As Any, ByVal offset As Long, ByVal offsethigh As Long, ByVal length As Long, ByVal lengthhigh As Long, ByVal flags As Long) As LongDeclare Function BASS_WV_StreamCreateFileUser Lib "basswv.dll" (ByVal system As Long, ByVal flags As Long, ByVal procs As Long, ByVal user As Long) As Long`
All the best - Steve.

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #60 on: 22 Jan '08 - 16:23 »
I try using the API BASS_MIDI_FontGetPreset on drum channel. It not return drum name but return the instrument name like "acoustic piano".

BASS_MIDI_FontGetPreset deals with banks and presets, rather than channels. The drum bank is 128 (I'll add a note in the docs).

Spotted a small syntax error in Basswv.bas

Oops! A correction is up now.

#### sail2000

• Posts: 42
##### Re: BASS 2.4 beta
« Reply #61 on: 24 Jan '08 - 07:04 »
hi Ian:
when i compile Dynamic_Bass.pas in my project, found afew error in unit Dynamic_Bass.pas, i had fixed it but it still not work...
i had senda email with the unit Dynamic_Bass.pas, to you.
the error is application cannot load the bass.dll
sorry my pool english!
Greets
sail2000

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #62 on: 24 Jan '08 - 15:15 »
Thanks for the Delphi dynamic API update. Regarding the load error, at what point is the Load_BASSDLL function failing, eg. does it not find the DLL or does it not find a function in the DLL?

#### sail2000

• Posts: 42
##### Re: BASS 2.4 beta
« Reply #63 on: 25 Jan '08 - 03:28 »
hi, Ian:
when i delete that two lines in Dynamic_Bass.pas, Application is work fine...
Code: [Select]
`//        (@BASS_ChannelSet3DAttributes = nil) or//        (@BASS_ChannelGet3DAttributes = nil) or`
my means is afew errors in the functions:
Code: [Select]
`function BASS_ChannelSet3DAttributes(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; stdcall; external bassdll;function BASS_ChannelGet3DAttributes(handle: DWORD; var mode: DWORD; var min, max: FLOAT; var iangle, oangle, outvol: DWORD): BOOL; stdcall; external bassdll;`then, i make a delphi project to see all functions in BASS.DLL,

actually, function BASS_ChannelGet3DAttributes and BASS_ChannelSet3DAttributes not found in BASS.DLL!!
« Last Edit: 25 Jan '08 - 08:24 by sail2000 »

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #64 on: 25 Jan '08 - 15:24 »
actually, function BASS_ChannelGet3DAttributes and BASS_ChannelSet3DAttributes not found in BASS.DLL!!

Oops! That was left from when I was looking into incorporating the 3D attributes into the new attribute stuff. An update is up now, with those 2 functions back in.

#### HunterOfDeath

• Posts: 28
##### Re: BASS 2.4 beta
« Reply #65 on: 25 Jan '08 - 17:08 »
Ian can you take a look at the bassmix delphi unit, there are some strange errors, I think they can be fixed very fast ?!
At the beginning there are missing some ";", and also at the finish some strange additional words are added :-| , just take a look at this screen shot !
« Last Edit: 25 Jan '08 - 17:14 by HunterOfDeath »

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta
« Reply #66 on: 26 Jan '08 - 23:52 »
Ian,

As you know, I have been testing with great success 2.4 on my main machine, Win XP Pro SP2. However, today I've had the time to try it on my Studio Machine which still runs ME. Although I copied the entire folder from one machine to the other and the programme ran fine, I could not get a handle from StreamCreateFile.
Bass initialised OK and reported the SoundCard correctly, but no handle when I tried to load a file.

The Studio machine has also got the same programme, in another folder, using the Bass 2.3.0.3 files and this works fine.

I realise that this OS is so old, but I thought you might like to know.

Steve.

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #67 on: 27 Jan '08 - 14:26 »
Ian can you take a look at the bassmix delphi unit, there are some strange errors, I think they can be fixed very fast ?!
At the beginning there are missing some ";", and also at the finish some strange additional words are added :-| , just take a look at this screen shot !

Oops! A corrected Delphi API is up now.

As you know, I have been testing with great success 2.4 on my main machine, Win XP Pro SP2. However, today I've had the time to try it on my Studio Machine which still runs ME. Although I copied the entire folder from one machine to the other and the programme ran fine, I could not get a handle from StreamCreateFile.
Bass initialised OK and reported the SoundCard correctly, but no handle when I tried to load a file.

The Studio machine has also got the same programme, in another folder, using the Bass 2.3.0.3 files and this works fine.

Strange. What's the error code (BASS_ErrorGetCode) from the BASS_StreamCreateFile failure? Also, does the problem affect all file formats?

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta
« Reply #68 on: 28 Jan '08 - 18:27 »
The Error Code is 41 and I also made sure that the Path in strptr(Path) was valid and accurate.

It is looking for an MP3 and at this moment I have no other formats on the machine.

Steve.

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #69 on: 29 Jan '08 - 14:20 »
Error code 41 (BASS_ERROR_FILEFORM) means that BASS could not recognise the file format. Please post your BASS_StreamCreateFile call and upload one of the troublesome files to have a look at here...

ftp.un4seen.com/incoming/

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta
« Reply #70 on: 29 Jan '08 - 20:30 »
Hi Ian,

Here is my call using 2.4.

Code: [Select]
`StreamHandle = BASS_StreamCreateFile(BASSFALSE, StrPtr(path\$), 0, 0, BASS_STREAM_DECODE Or BASS_STREAM_PRESCAN)`
I have not uploaded any files because on the same M.E. machine my programme using 2.3.0.3 and this syntax

Code: [Select]
`StreamHandle = BASS_StreamCreateFile(BASSFALSE, path\$, 0, 0, BASS_STREAM_DECODE Or BASS_STREAM_PRESCAN)`
works perfectly. I simple took my 2.3 programme and modified it's structures to work with 2.4, which, on my XP machine, it does. Incidentally my XP machine has the same MP3's on it! The code up to the above calls is identical in each case and the same code is used to initialise Bass.

Code: [Select]
`If BASS_Init(1, 44100, 0, Me.hwnd, 0) = BASSFALSE Then        MsgBox "Can't initialize digital sound system", vbCritical, "Music Master"        Unload Me    End If`
I hope you find this all helpful.

Steve.

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta
« Reply #71 on: 29 Jan '08 - 21:56 »
OK, I've managed to put more time into this. Further to the above, I have taken your BassTest programme and found files of Wav and Mp3. On my XP machine they both play fine, on the ME machine your programme reports error 41 when I try to load either.

Kind Regards - Steve.

#### Ian @ un4seen

• Posts: 21529
##### Re: BASS 2.4 beta
« Reply #72 on: 30 Jan '08 - 13:56 »
That is very strange. The only explanation I can think of is the "no sound" device is being used, and after the BASS_StreamCreateFile call fails (BASS_ERROR_NOTAVAIL), you try BASS_MusicLoad (as several of the examples do), resulting in BASS_ERROR_FILEFORM. But as you're initializing device 1 (not 0), I guess that's not it. I think I'll have to send you a debug version to find out what's going on there.

#### Steve Grant

• Posts: 166
##### Re: BASS 2.4 beta
« Reply #73 on: 30 Jan '08 - 21:22 »
Please do, I think you have my email address as part of the registration process.

Steve.