Jump to content

Bass udf simple functions, i got lost


careca
 Share

Recommended Posts

Hey ppl, sound udf seemed buggy, some files wouldn't play, so i decided to switch to bass udf, so far i can play, pause, and stop playback of all sound files i need, problem is that i can't get the playback position and total length, nor the seek function, it's getting even harder because i didn't integrate the library in scite... so i don't get help, syntax help that is.

Searched around the forum, and couldn't find anything useful, is there some place i can check the basic functions and how they are implemented?

greetz.

EDIT:

what i tried to do, that didn't work..

$File is the file playing

$Slider1 is the slider

$SliderL = _BASS_ChannelGetLength($File, $BASS_POS_BYTE)
    $SliderP = _BASS_ChannelGetPosition($File, $BASS_POS_BYTE)
    $SliderC = $SliderP / $SliderL * '100'
    GUICtrlSetData($InfoT, _BASS_ChannelGetPosition($File, $BASS_POS_BYTE) & "" & _BASS_ChannelGetLength($File, $BASS_POS_BYTE))
    GUICtrlSetData($Slider1, $SliderC)
Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Seems like i got it almost working, problem was the handle, but now i got miliseconds, and have to convert these to hour,min,sec.

Anyone has a snippet on this?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

You can get the position of where the playing song is by using something like this, modify to your needs

Local $SetTime1 = _BASS_ChannelGetPosition($File, $BASS_POS_BYTE)
Local $Length = $iSetTime
$Pos = _BASS_ChannelBytes2Seconds($File, $SetTime1)
$Minutes = Int($Counter / 60)
$iSeconds = Int((($Counter / 60) - $Minutes) * 60)
If $iSeconds <> $iSeconds1 Then
    GUICtrlSetData($Slider1, " " & $Counter)
    $iSeconds1 = $iSeconds
EndIf

The return from _BASS_ChannelGetPosition is in bytes, not seconds or milliseconds. You need to convert the bytes returned into seconds with the second function above, then convert the seconds into minutes/seconds etc.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hi, yeah, that comes a bit too late, but thanks, maybe you can help with my next problem...seek.

the bar moves, and i got the time rolling, what would be the direction to go?

What i've done:

$Pos = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) ;$PosB)
$Lenght = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) ;$LenghtB)
;$InfoV = GUICtrlRead($Info)
$SliderC = $Pos / $Lenght * '100'
GUICtrlSetData($Slider1, $SliderC)
If $Play = 1 Then
If $Pos = $Lenght Then
NextFile()
EndIf
EndIf

;=============================================================================

$ConvP = _BASS_ChannelBytes2Seconds($MusicHandle, $Pos)
$ConvL = _BASS_ChannelBytes2Seconds($MusicHandle, $Lenght)

;=============================================================================

$pHour = Int($ConvP / 3600)
$pMin = Int(($ConvP - $pHour * 3600) / 60)
$pSec = $ConvP - $pHour * 3600 - $pMin * 60

$lHour = Int($ConvL / 3600)
$lMin = Int(($ConvL - $lHour * 3600) / 60)
$lSec = $ConvL - $lHour * 3600 - $lMin * 60

GUICtrlSetData($InfoT, StringFormat('%02d:%02d:%02d', $pHour, $pMin, $pSec) & "" & StringFormat('%02d:%02d:%02d', $lHour, $lMin, $lSec))
Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Look at _Bass_ChannelSetPosition, once you move to a new position, you have to figure out what that equals in minutes and seconds, convert it to seconds, then convert that to bytes with _BASS_ChannelSeconds2Bytes.

BTW, unless you have some REALLY long songs, you'll never need the hours portion.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you, this pointed me in the right direction! :)

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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