AutoHotkey Community

It is currently May 26th, 2012, 1:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 103 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: October 25th, 2008, 12:55 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
[ description ]
BASS for powerful extensible AHK multimedia >:D !

It gives AHK power to play on-the-fly soundfiles, stream, recording, mixing, adding effects using EAX, DX8 etc everything in a tiny 96KB dll.

BASS can be extended with plugins, supporting many sound format. It can load VST and Winamp plugins for effects DSP, read ID3v1, ID3v2.2/3/4,OGG/FLAC, WMA, APE, OFR, MPC, AAC tags etc. And even video playback!

    BASS Streamable built-in (*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;)
    BASS Modules built-in (*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;)

    CD Audio (*.cda;)
    Free Lossless Audio Codec (*.flac;)
    MIDI (*.midi;*.mid;*.mus;*.rmi;*.kar;)
    Windows Media Audio (*.wma;*.wmv;*.wmp;*.asf;)
    AAC (*.aac;*.mp4;*.m4a;*.m4b;*.m4p;)
    WavPack Audio Codec (*.wv;*.wvc;)
    Monkey's Audio (*.ape;)
    MusePack (*.mpc;*.mpp;*.mp+;)
    Dolby Digital (*.ac3;)
    Apple Lossless (*.mp4;*.m4a;*.m4b;*.m4p;)
    Speex (*.spx;*.wav;*.oga;*.ogg;)
    The True Audio (*.tta;)
    OptimFROG (*.ofr;)

    Video (*.avi;*.mkv;*.mp4;*.wmv;*.mpeg;*.mpg;)

*The list refers to the supported fileformats with BASS and its native plugins
**Video supported filetypes are still being listed, also its video codecs handling.
___
[ information ]
- Official WebSite of BASS Lib
- BASS code developer WebSite
___
[ related projects ]
- Trout Player

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


Last edited by k3ph on September 8th, 2011, 4:41 am, edited 22 times in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 25th, 2008, 2:32 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
Looks useful. Thanks for sharing. :)

k3ph wrote:
-BASS Library is _f_huge, it has many features. Currently I've wrapped 25% of it (going to release as revision 1), please wait.

I look forward to to the final version. Keep us informed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2008, 7:16 pm 
Very nice! 8)

Screamer Radio uses the BASS library too...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 2:27 am 
Offline

Joined: January 12th, 2008, 7:45 pm
Posts: 131
(Was this thread deleted or something iirc I replied to this :S)

Hmm, shouldn't there be a way to keep the DLL within the memory at all times, so that you don't have to write it to the HDD?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 2:30 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
Ice_Tea wrote:
(Was this thread deleted or something iirc I replied to this :S)

Hmm, shouldn't there be a way to keep the DLL within the memory at all times, so that you don't have to write it to the HDD?


You are probably confusing this thread with the BASSMOD Library

Yes it would be a nice idea to wrap the DLL, but you don't need to write, just download it once.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 3:30 am 
Offline

Joined: January 12th, 2008, 7:45 pm
Posts: 131
k3ph wrote:
You are probably confusing this thread with the BASSMOD Library

Yes it would be a nice idea to wrap the DLL, but you don't need to write, just download it once.


Oh, lulz, keke. yeah, dw using a external dll isn't such a big deal...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 3:34 am 
Ice_Tea wrote:
k3ph wrote:
You are probably confusing this thread with the BASSMOD Library

Yes it would be a nice idea to wrap the DLL, but you don't need to write, just download it once.


Oh, lulz, keke. yeah, dw using a external dll isn't such a big deal...


what is not big deal? many sound players uses bass as core.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 4:15 am 
Offline

Joined: January 12th, 2008, 7:45 pm
Posts: 131
:( wrote:
what is not big deal? many sound players uses bass as core.


Bah, didn't feel like pressuring him into doing it...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2008, 1:01 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
I'm proud to announce the BASS Library reach production-ready stage. Most of the functions were checked and now AHK developers can enjoy the power of BASS.

Notes: the SVN is current down and more examples coming soon for the non-basic functions test. Stay in BASS tune!

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2008, 9:28 pm 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
i need some help. I'm trying to use bass_aac.dll after BASS_Init()
Code:
dll=bass_aac.dll
BASS_%dll%_Init()

I have tried using only aac and bass_aac as the dll var but it doesn't recognize the stream. what am I doing wrong?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2008, 6:09 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
WankaUSR wrote:
i need some help. I'm trying to use bass_aac.dll after BASS_Init()
Code:
dll=bass_aac.dll
BASS_%dll%_Init()

I have tried using only aac and bass_aac as the dll var but it doesn't recognize the stream. what am I doing wrong?


Please pay attention before posting: in the moment you posted your question, bassaac.ahk wasn't released yet and wasn't supported.

Note you don't need to #include plugin libraries anymore. All you need to do is to call bass.ahk

From example3:
Code:
/*
   BASS Library - Stream GUI (AAC Only) Example
     by k3ph
    
 required files: bass.dll, bass_aac.dll, bass.ahk, bassaac.ahk
 if apple lossless is required, add: bass_alac.dll, bassalac.ahk and dont forget to call BASS_ALAC_Init() and free it with BASS_ALAC_Free()
*/

#NoEnv
#SingleInstance Force
#Persistent
Critical,On

onexit, exit

; include bass :)
#Include bass.ahk

; load bass :)
BASS_Load()

; you can load anything, anytime
BASS_Init(-1,44100,0,0,0)
BASS_AAC_Init()

; gui things
PM_gui = 1
PM_ControlID = own
PM_widthInSegments = 200
PM_height = 100
PM_color = green
PM_bgcolor = gray
PM_xpos = 0
PM_ypos = 0
Add_ProgressMeter(PM_gui, PM_ControlID, PM_widthInSegments, PM_height, PM_color, PM_bgcolor, PM_xpos, PM_ypos)
SetTimer, showstream, 250
gosub visualstream
gosub openstream

; some hotkeys
#IfWinActive Stream GUI
r::gosub reverb
c::gosub chorus
^c::gosub compressor
p::gosub parameq
d::gosub distortion
e::gosub echo
f::gosub flanger
g::gosub gargle
i::gosub i3dl2reverb

o::gosub openstream
!F4::gosub exit
^F4::reload
#IfWinActive
return

reverb:
  ;BASS_FXSetParameters(BASS_FX_DX8_REVERB,0.001)
  BASS_ChannelSetFX(stream,BASS_FX_DX8_REVERB,0)
return

chorus:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_CHORUS,0)
return

compressor:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_COMPRESSOR,0)
return

distortion:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_DISTORTION,0)
return

echo:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_ECHO,0)
return

flanger:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_FLANGER,0)
return

gargle:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_GARGLE,0)
return

i3dl2reverb:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_I3DL2REVERB,0)
return

parameq:
   BASS_ChannelSetFX(stream,BASS_FX_DX8_PARAMEQ,0)
return


openstream:
   BASS_ChannelStop(stream)
   fileselectfile, file, 1, , select a song,(*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aiff;*.aac;*.mp4;*.m4a)
   if file =
       traytip, , please select a file
   else
   bass=bass.dll
   stream:=BASS_StreamCreateFile(false,file,0,0,4)
   BASS_ChannelPlay(stream,0)
return

visualstream:
   Gui, %PM_gui%:+AlwaysOnTop +Owner
   Gui, %PM_gui%:Show, NoActivate, Stream GUI
return

showstream:
     kchannellevel := 10000000*2.5
      channellevel := BASS_ChannelGetLevel( stream )
      if (channellevel = "-1")
         level2progress = 0
     level2progress := abs(channellevel) / kchannellevel
      Update_ProgressMeter(PM_gui, PM_ControlID, level2progress)
return

/*
   zed gecko's gui code

   Add_ProgressMeter adds a "progress-meter" Control to a Gui.
   It can only be used on a Gui with a number (like Gui, 1: or Gui, 99:)but not on a unnumbered Gui.
   The generated control can disply the fluctuation of value in a range from 0 - 100.
   Usage : Add_ProgressMeter(PM_gui, PM_ControlID, PM_widthInSegments, PM_height, PM_color, PM_bgcolor, PM_xpos, PM_ypos)
   PM_gui =  the number of the Gui
   PM_ControlID = the name of the progress meter control. Use the same name with the "Update_ProgressMeter"-function
   PM_widthInSegments = the width of the control in segments. (Each segment is of 2 pixel width)
   PM_height = the height of the control in pixel
   PM_color = the color of the progress-meter
   PM_bgcolor = the background-color of the progress-meter
   PM_xpos = the X-position of the controls top-left corner
   PM_ypos = the Y-position of the controls top-left corner
   (if the X and Y position are both omited or set to 0, the control uses automatic positioning)
*/
Add_ProgressMeter(PM_gui, PM_ControlID, PM_widthInSegments, PM_height, PM_color, PM_bgcolor, PM_xpos = 0, PM_ypos = 0)
{
   global
   PM_segmentspace = 2 ;this is the visible size of on segment in pixel
   PM_segmentsize := (PM_segmentspace + 1)
   PM_widthInSegments += -1
   %PM_ControlID%_Segments := PM_widthInSegments
   if (PM_xpos = 0 AND PM_ypos = 0)
   {
      Gui, %PM_gui%:Add, Progress, v%PM_ControlID%0 w%PM_segmentsize% h%PM_height% c%PM_color% Background%PM_bgcolor% Vertical,
   }
   else
   {
      Gui, %PM_gui%:Add, Progress, v%PM_ControlID%0 w%PM_segmentsize% h%PM_height% x%PM_xpos% y%PM_ypos% c%PM_color% Background%PM_bgcolor% Vertical,
   }

   Loop, %PM_widthInSegments%
   {
      Gui, %PM_gui%:Add, Progress, v%PM_ControlID%%A_Index% w%PM_segmentsize% h%PM_height% xp+%PM_segmentspace% c%PM_color% Background%PM_bgcolor% Vertical,
   }
}

/*
   Update_ProgressMeter puts new contents in the progress-meter control created by Add_ProgressMeter.
   Usage: Update_ProgressMeter(PM_gui, PM_ControlID, PM_NewContent)
   PM_gui =  the number of the Gui the control is located in.
   PM_ControlID = the name of the progress meter control. Use the name that was used in the "Add_ProgressMeter"-function
   PM_NewContent = the new content of the control. it must be a number between 0 and 100.
   the new content will be displayed in the most-right segment.
*/
Update_ProgressMeter(PM_gui, PM_ControlID, PM_NewContent = 0)
{
   PM_oldSegments := %PM_ControlID%_Segments
   Loop, %PM_oldSegments%
   {
      PM_NewSegment := A_Index - 1
      GuiControlGet, PM_Transfervar, %PM_gui%:, %PM_ControlID%%A_Index%
      GuiControl,%PM_gui%:, %PM_ControlID%%PM_NewSegment%, %PM_Transfervar%
   }

   GuiControl,%PM_gui%:, %PM_ControlID%%PM_oldSegments%, %PM_NewContent%
}
return

guiclose1:
guiescape:
guiclose:
goto exit
return

exit:
  ; stops the stream
  BASS_ChannelStop(stream)
 
  ; flushes what was loaded before
  BASS_AAC_Free()
   BASS_Free()
   ExitApp

(note that apple lossless m4a isnt supported by the bass_aac but its supported by bass_alac !)
Enjoy!

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2008, 2:08 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
k3ph, in the comments you've pointed out that BASS_ChannelGetTags returns a series of null-terminated strings for some tag types - however, the script function BASS_ChannelGetTags returns only the first null-terminated string. I suggest adding an optional parameter to override the return type, allowing a script to interpret the result as appropriate. For example,
Code:
BASS_ChannelGetTags(handle,tags,return_type="Str"){
    global
    Return DllCall(BASS_DLLPATH . BASS_DLL . "\BASS_ChannelGetTags", UInt, handle, UInt, tags, return_type)
}

BASS_ChannelGetTags_List(handle,tags,delim){
    ptr := BASS_ChannelGetTags(handle,tags,"Int")
    Loop {
        item := DllCall("MulDiv", Int, ptr, Int, 1, Int, 1, Str)
        if item =
            break
        list .= item delim
        ptr += StrLen(item) + 1
    }
    return SubStr(list,1,-StrLen(delim))
}
Below are examples of usage and output.
Code:
MsgBox % BASS_ChannelGetTags( hStream, BASS_TAG_HTTP )
/*
HTTP/1.0 200 OK
*/

MsgBox % BASS_ChannelGetTags_List( hStream, BASS_TAG_HTTP, "`n" )
/*
HTTP/1.0 200 OK
Content-Type: audio/mpeg
icy-br:192
ice-audio-info: ice-samplerate=44100;ice-bitrate=192;ice-channels=2
icy-br:192
icy-description:This is my server description
icy-genre:Rock
icy-name:This is my server name
icy-private:0
icy-pub:1
icy-url:http://www.oddsock.org
Server: Icecast 2.3.2
Cache-Control: no-cache
icy-metaint:16000
*/


Also a warning about bass.dll callbacks: they are typically called by a worker thread. Even if no other thread is executing script, it is not guaranteed to work correctly. If the callback is too slow or calls a command that checks for messages, the thread may deadlock. Placing Critical N (where the callback will not run for N ms) on the first line of the callback function is a partial solution.

A proper solution would be to use a DLL or machine code to "route" the call to the proper thread.

(I've been helping Skwire with callbacks set via BASS_StreamCreateURL and BASS_ChannelSetSync.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2008, 4:29 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
I was going to ask you about these callbacks but i hadn't time to chat properly with you lately, ive been very busy D:

Thanks very much! I appreciate always your great help!
I still have some questions about callbacks and I hope I can be taught by you.

(Yes, I'm working with Skwire, I'm supporting fully his AHK Amp project :D)

___

Assimilated: BASS_ChannelGetTagsList - by Lexikos

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2008, 10:28 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Found some more problems, this time in BASS_Free:
Code:
BASS_Free(){
   global
   DllCall("FreeLibrary", UInt, BASS_DLLCALL)
   Return DllCall(BASS_DLLPATH . BASS_DLL . "\BASS_Free", UInt, true)
}
Bass.dll should not be freed until after you call BASS_Free. If the DLL is actually freed, any structures, handles, pointers, etc. that BASS_Free uses will be gone.

BASS_Free does not accept any arguments. This was very easy to spot with DllCallDebugger() in use.


I believe the following works correctly:
Code:
BASS_Free(){
    global
   return DllCall(BASS_DLLPATH . BASS_DLL . "\BASS_Free")
         , DllCall("FreeLibrary", UInt, BASS_DLLCALL)
}
(Note the comma trick: FreeLibrary is called last, but the result of BASS_Free is returned.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2008, 6:27 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
i've noticed the unloading bass was very slow. thanks very much for fixing it, your dlcall debugger is awesome :D

i'm currently fixing all malformed functions and going to update it asap

i plan to finish the library asap. currently adding encode, mixing, synth and external plugins functions.

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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, maraskan_user and 15 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