AutoHotkey Community

It is currently May 27th, 2012, 5:34 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: November 10th, 2009, 3:37 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
thx :D but that didnt help me. :cry:
i am not smart enough. :oops:

i temporarly use soundplay
but that is a no go becous when i go over a menuitem, it plays a mouse over wav and the midi is stopped :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 26th, 2009, 6:54 pm 
Emm.. This is pretty hard to use without any kind of real guide like the other librarys got, maybe someone would familiarize me into the all basic options BASS library has? Like, play/pasy, next, previous, stop, volume, open ...

Please, and sorry for bumping old thread =)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2009, 12:44 am 
Please? =)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2010, 7:43 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
k3ph wrote:
hi there,

sorry I've been very busy and I could not keep up providing that kind of specific support.

please note my website had problems with dns for some months. if you still have problems add the following free dns servers:

googledns:
8.8.8.8
8.8.4.4

opendns:
208.67.222.222
208.67.220.220
208.67.220.222
208.67.222.220


Please take a look in these examples provided in the official library folder: http://www.autohotkey.net/~k3ph/bass/

there are copies of the documentation and the version are self explained.

I will update soon this library with the new updates and probably with a more complete examples.

_________________
                                  [ profile | ahk.net | ahk.talk ]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 9:57 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I happened to look at some random functions in bass.ahk, and noticed some obvious errors. Most obvious was this:
Code:
BASS_Get3DFactors(ByRef distf,ByRef rollf,ByRef doppf){
   global
   Return DllCall(BASS_DLLPATH . BASS_DLL . "\BASS_Get3DFactors", Float, &distf, Float, &rollf, Float, &doppf)
}
Address-of will always return an integer which represents the address of the variable, but Float tells DllCall to pass the value (the address) as a 32-bit floating-point number. This won't work reliably, if at all - and if it works (or if UInt, &var is used in this case), the result will be a binary value, not something directly usable in AHK.

In general,
  • If the function expects float*, DWORD* or similar, check the usage.
    • If it outputs a single value via this parameter, use "Type*" or TypeP, and use ByRef. For instance, the case above should've been FloatP, distf. DllCall copies the value into temporary memory, passes its address and copies back from temporary memory to var afterward. The end result is a value of type Type (Float in this case) converted to a format directly usable in AHK.
    • If it outputs an array of values, use ByRef and UInt, &var. In other words, treat it like a structure.
  • If the function expects a structure (and the caller of your lib is expected to build this structure using VarSetCapacity, NumPut, etc.), use ByRef and UInt, &var.
  • If the function expects char*, check the usage. Strings and binary data may generally be passed/received as Str, var. In those cases, ByRef should be used only if the function is expected to write to the var. In some cases you may want to accept (as an integer value) a pointer to binary data; that is, UInt, var without ByRef.
I suggest adding a download with the most commonly needed files in one package and link in your first post. "Trunk" wasn't the first place I looked, and I'm probably more familiar with subversion terms than most users (which is to say, not very > not at all). Also, I like the fact that bass.ahk works without the various "plugins", because downloading the files one by one would be a bother.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 8:48 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
Hello

Am i doing somthing wrong here :shock: :

Code:
#Include %A_ScriptDir%\Includes   ; Changes the working directory for subsequent #Includes and FileInstalls.
#Include bass.ahk             ; include bass to play audio
BASS_Load()   ; seems ok
MsgBox,% BASS_Init(-1,44100,0,0,0)   ; seems ok
gosub,#l   ;load a file at startup
#l::   ;Win+L = load song and play
   fileselectfile, MediaFile,M,, select a song,(*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aiff;*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.m3u;)(*.m3u)
   IfEqual,MediaFile,,Return ;on cancel Return
   MsgBox,%mediafile%
   BASS_ChannelStop(hMedia)
   MsgBox,% hMedia:=BASS_StreamCreateFile(false,MediaFile,0,0,0)   ; seems to fail
   MsgBox,% BASS_ChannelPlay(hMedia,1)   ;no handle so this one will not work
   return
#q::   ;Win+Q = quit
exitapp
return
#r::   ;Win+R = reload
reload
return

a fue months of not coding an boom, amnesia or something :oops:

_________________
Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2010, 6:58 am 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
emmanuel d wrote:
Hello

Am i doing somthing wrong here :shock: :

Code:
#Include %A_ScriptDir%\Includes   ; Changes the working directory for subsequent #Includes and FileInstalls.
#Include bass.ahk             ; include bass to play audio
BASS_Load()   ; seems ok
MsgBox,% BASS_Init(-1,44100,0,0,0)   ; seems ok
gosub,#l   ;load a file at startup
#l::   ;Win+L = load song and play
   fileselectfile, MediaFile,M,, select a song,(*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aiff;*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.m3u;)(*.m3u)
   IfEqual,MediaFile,,Return ;on cancel Return
   MsgBox,%mediafile%
   BASS_ChannelStop(hMedia)
   MsgBox,% hMedia:=BASS_StreamCreateFile(false,MediaFile,0,0,0)   ; seems to fail
   MsgBox,% BASS_ChannelPlay(hMedia,1)   ;no handle so this one will not work
   return
#q::   ;Win+Q = quit
exitapp
return
#r::   ;Win+R = reload
reload
return

a fue months of not coding an boom, amnesia or something :oops:


Code:
#Include %A_ScriptDir%\Includes   ; Changes the working directory for subsequent #Includes and FileInstalls.
#Include bass.ahk             ; include bass to play audio
BASS_Load()   ; seems ok
MsgBox,% BASS_Init(-1,44100,0,0,0)   ; seems ok
gosub,#l   ;load a file at startup
#l::   ;Win+L = load song and play
   fileselectfile, MediaFile,M,, select a song,(*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aiff;*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.m3u;)(*.m3u)
   IfEqual,MediaFile,,Return ;on cancel Return
   MsgBox,%mediafile%
   BASS_ChannelStop(hMedia)
   MsgBox,% hMedia:=BASS_StreamCreateFile(false,&MediaFile,0,0,0)   ; seems to fail
   MsgBox,% BASS_ChannelPlay(hMedia,1)   ;no handle so this one will not work
   return
#q::   ;Win+Q = quit
exitapp
return
#r::   ;Win+R = reload
reload
return


Change in red.

k3ph:

Also, BASS_FXSetParameters should be passing a pointer to BASS.dll (Like BASS_FXGetParameters does).

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2010, 3:19 am 
Offline

Joined: November 30th, 2010, 7:45 pm
Posts: 3
Location: Gold coast, Australia
Hey there, just a couple of points.
1. Is this code still being worked on?
2. I'm trying to use this with autohotkey_l, unicode 32-bit. the latest version as of a few days ago. However, this function, no matter what I do, doesn't seem to work. Tried both with and without bass_unicode, so, any ideas?

Code:
;Play a given file.
play(file) {
stream := BASS_StreamCreateFile(0, &file, 0, 0, BASS_UNICODE)
if stream {
BASS_ChannelPlay(stream, 1)
BASS_StreamFree(stream)
}
else {
errno := BASS_ErrorGetCode()
msgBox Error playing back file. flop! error: %errno%
}
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2010, 12:14 am 
arfy wrote:
1. Is this code still being worked on?


the development is currently frozen, some updates are required for ahk_l.
currently Skwire is the only user, which i know, is using it actively.

the svn repository is still on but the admin hid the structure, i won't update my ahk.net page soon, im very busy with other projects.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2010, 7:43 am 
Offline

Joined: March 22nd, 2010, 11:05 am
Posts: 44
Hello, I'm not sure if this thread is still alive or not but I will hope someone can help here.

Fixed:I am trying to get pitch to work, which requires loading bass_fx.dll. The problem is that when I load the .dll it gives me error 41, file is not a plugin. I'm not using your wrappers exactly, but my dllcalls are based off of them so they have the same structure.
When I call BASS_ChannelSetAttribute, it gives me error 19, which is Param Illtype. The structure of the call was taken from your wrapper.
Also credit to k3ph and lexi for the code under BASS_StreamCreateChannel and CopyAnsiToUnicode.

Code:
#NoEnv
SetBatchLines -1
OnExit, Exit
#Include bass.ahk
bassfx := A_ScriptDir . "\bass_fx.dll"
BASS_ATTRIB_TEMPO_PITCH := 0x10001
hBassModule := DllCall("LoadLibrary", "str", "bass.dll")
hBassFXModule := DllCall("LoadLibrary", Str, "bass_fx.dll")
DllCall("bass.dll\BASS_PluginLoad", Ustr, &bassfx, Uint, 0)
Error := DllCall("bass.dll\BASS_ErrorGetCode")
;Msgbox % Error
Gui, Add, Text,, Pitch (-60 to 60)
Gui, Add, Edit, vPitch
Gui, Add, Button, gPitch, Set
Gui, Show,, Pitch Test
Return

Pitch:
Gui, Submit, NoHide
hStream := BASS_StreamCreateChannel()
PitchErr := DllCall("bass.dll\BASS_ChannelSetAttribute", Uint, hStream, Uint, BASS_ATTRIB_TEMPO_PITCH, Float, Pitch) ;This part doesn't work
Error := DllCall("bass.dll\BASS_ErrorGetCode")
Msgbox % Error . " " .  PitchErr
DllCall("bass.dll\BASS_ChannelPlay", Uint, hStream, Int, 0)
Error := DllCall("bass.dll\BASS_ErrorGetCode")
Msgbox % Error
Return

BASS_StreamCreateChannel(device=-1,freq=44100,flags=0,win=0,clsid=0) {
   DllCall("bass.dll\BASS_Init", Int, device, Int, freq, Int, flags, UInt, win, UInt, clsid)

   Filter := "BASS Streamable built-in (*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;)|*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;|All files (*.*)|*.*"
   VarSetCapacity(wFilter, StrLen(Filter)*2+2)
   ptr := &wFilter
   Loop, Parse, Filter, |
      ptr += 2 * CopyAnsiToUnicode(A_LoopField, ptr, StrLen(A_LoopField))
   NumPut(0, ptr+0, "short")
   VarSetCapacity(wFile,(nMaxFile:=65535)*2)
   NumPut(0, wFile, "short")
   VarSetCapacity(ofn, 88, 0)
   if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME
      NumPut(76, ofn)
   else
      NumPut(88, ofn)
   NumPut(&wFilter, ofn, 12)
   NumPut(&wFile, ofn, 28)
   NumPut(nMaxFile, ofn, 32)
   NumPut((OFN_HIDEREADONLY:=0x4)|(OFN_EXPLORER:=0x80000), ofn, 52)
   DllCall((A_OSType="WIN32_WINDOWS" ? "unicows" : "comdlg32") . "\GetOpenFileNameW", "uint", &ofn)
   NumGet(ofn, 56, "UShort")
   Return DllCall("bass.dll\BASS_StreamCreateFile", Uint, 0, Uint, &wfile, Uint64, 0, Uint64, 0, Uint, 0x80000000)
}

CopyAnsiToUnicode(Source, DestPtr, Len)
{   ; Not sure how well this works on 9x/ME:
   return DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &Source, "int", Len + 1, "Uint", DestPtr, "int", Len + 1)
}

GuiClose:
Exit:
DllCall("FreeLibrary", "UInt", hBassModule)
DllCall("FreeLibrary", "UInt", hBassFXModule)
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2011, 6:35 pm 
where can i download the libary??


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2011, 7:08 pm 
Try this: http://www.un4seen.com/download.php?bass24


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2011, 7:36 pm 
Thank u!

Is there any help file directly for ahk?
Maybe within some Samples, how to you Play Pause and id3 tags?


thanks dude


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 8th, 2011, 9:05 am 
Offline

Joined: July 2nd, 2010, 5:36 pm
Posts: 17
I'm trying to get the error code from a function to see what's wrong but the BASS_ErrorGetCode() returns 0. Am I doing something wrong?

Code:
BASS_StreamCreateFile(0,"%A_ScriptDir%\apocalyptica.mp3",0,0,0)
x:=BASS_ErrorGetCode()
msgbox ,x="%x%"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2011, 4:57 am 
Hey all!

Can anyone please post an example script of a working midi file basic loader, if possible with a custom soundfont?
I read all the posts on this thread, and placed a copy of the creative soundfont in system32, but it's quite impossible to figure all this out without a few examples (especially when you're new to programming)

Thanks


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, sks, Stigg, Yahoo [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group