22 May '13 - 07:48 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: HMUSIC channel position  (Read 3473 times)
Irrational86
Posts: 960


« on: 6 Aug '03 - 21:42 »
Reply with quoteQuote

Hi, this is my code to get the MOD position 2 seconds before the end of the MOD.
var y: Int64;

y := Trunc(BASS_ChannelBytes2Seconds(ChanHandle, BASS_MusicGetLength(ChanHandle, True))) - 2;

BASS_ChannelSetPosition(ChanHandle, MAKELONG(y, $FFFF));

y := BASS_ChannelGetPosition(ChanHandle);
The value that y gets at the end is 0, why!? I dont understand, first y gets the right time in seconds, then i set it as the position, and i try to assign the new position to y and it returns 0...please help
« Last Edit: 6 Aug '03 - 21:44 by XMinioNX » Logged
podobo
Posts: 59


« Reply #1 on: 6 Aug '03 - 22:24 »
Reply with quoteQuote

I believe I had a similar problem before.. and the solution was to call BASS_MusicPreBuf on the channel right after setting the position.  The new position didn't seem to register until either playback or prebuffering started.

Logged
Irrational86
Posts: 960


« Reply #2 on: 7 Aug '03 - 02:21 »
Reply with quoteQuote

Thanks a lot podobo, the PreBuf function did the work...thank you...


Now this is for Ian. I set a BASS_SYNC_SLIDE and if its a stream, and i call BASS_StreamFree from inside the callback, the program crashes. If its a MOD file, the BASS_MusicFree doesnt crash, but instead it crashes on BASS_Free...Ian, why??
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #3 on: 7 Aug '03 - 12:52 »
Reply with quoteQuote

hmm... there shouldn't be any problem using BASS_StreamFree or BASS_MusicFree within a sync callback (I ran a quick test here, and it was fine). Does it crash every time, and can you provide details (eg. location, registers, callstack) of the crashes?
Logged
Irrational86
Posts: 960


« Reply #4 on: 7 Aug '03 - 22:55 »
Reply with quoteQuote

Ok ummm...it only gives an Access Violation while running under the delphi IDE, if running alone it does not give any errors. Below are links to the screenshots of ASM code and addresses of error, etc...hope you can help...

1. The MessageBox saying the error
2. The code i use inside the SYNC_SLIDE callback
3. A piece of ASM code during the access violation
4. The rest of the ASM code after the violation

PS. Using the method i have commented out (the BeginThread one) it works perfectly fine...
« Last Edit: 7 Aug '03 - 23:07 by XMinioNX » Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #5 on: 8 Aug '03 - 16:40 »
Reply with quoteQuote

Actually, thinking about it... the BASS_SLIDE_SYNC is a sort of "mixtime" sync, so it's not really 100% safe to free the channel in the callback - it'll work fine in some circumstances, but not in others.

I'll send an update to try, with a work-around specifically for slide syncs, allowing the callback to free the channel in all circumstances.
Logged
Irrational86
Posts: 960


« Reply #6 on: 8 Aug '03 - 18:29 »
Reply with quoteQuote

Yup...the update did the trick Ian, thanks a lot.. Wink
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines