• Welcome to Theos PowerBasic Museum 2017.

BassBox

Started by Patrice Terrier, October 08, 2007, 10:57:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Emil Weiss

Hi Patrice

Do you have interest make a API for PowerBasic of BAssVis ?
Here is my API in Visual Basic think is ferry simple translate it to PowerBasic.


'mBassVis.BAS
'--------------------------- VB 6.0 Form Module -----------------------------
' BassVis API Module ADD-ON for Bass Audio Library
' Copyright © 2007 BrewIdeas@Emil Weiss, All Rights Reserved
'
' Author(s) of this module: Emil Weiss
'
' Code was written in and formatted for 10pt Courier New
'----------------------------------------------------------------------------

Option Explicit
 
  ' BASS_SONIQUEVIS_CreateVis flags
  Public Const BASS_VIS_NOINIT                       As Integer = 1

  ' BASS_SONIQUEVIS_SetConfig flags
  Public Const BASS_SONIQUEVIS_CONFIG_FFTAMP         As Integer = 1
  Public Const BASS_SONIQUEVIS_CONFIG_FFT_SKIPCOUNT  As Integer = 2  ' Skip count range is from 0 to 3 (because of limited FFT request size)
  Public Const BASS_SONIQUEVIS_CONFIG_WAVE_SKIPCOUNT As Integer = 3  ' Skip count range is from 0 to (...) try it out, whenever Bass crashes or does not return enough sample data
  Public Const BASS_SONIQUEVIS_CONFIG_SLOWFADE       As Integer = 4  ' Dim light colors to less than half, then slowly fade them out

  ' BASS_WINAMP_SetConfig flags
  Public Const BASS_WINAMPVIS_CONFIG_FFTAMP          As Integer = 1

  ' BASS_WMP_SetConfig flags
  Public Const BASS_WMPVIS_CONFIG_FFTAMP             As Integer = 1
 
  ' BASS_VIS_FindPlugin flags
  Public Const BASS_VIS_FIND_RECURSIVE               As Integer = 4

  ' Plugin Kind
  Public Const BASSVISKIND_NONE = 0
  Public Const BASSVISKIND_WINAMP = 1
  Public Const BASSVISKIND_SONIQUE = 2
  Public Const BASSVISKIND_WMP = 3
  Public Const BASSVISKIND_BASSBOX = 4
 
  ' Plugin Parameter
  Public Type BASSVIS_PARAM
     Vishandle       As Long      ' VisHandle
     VisWinhandle    As Long      ' VisWinHandle
     VisGenWinhandle As Long      ' General Vis Window Handle
     Kind            As Long      ' Plugin Kind (BASSVISKIND_NONE, _
                                                 BASSVISKIND_WINAMP, _
                                                 BASSVISKIND_SONIQUE, _
                                                 BASSVISKIND_WMP, _
                                                 BASSVISKIND_BASSBOX, _
                                                 )
  End Type
 
  ' Definition der Typen für die variablen Parameter bei Create bzw. Execute
  Public Type BASSVIS_EXEC
    AMP_SON_BB_Pluginfile As String  ' Dateiname des Plugins für Sonique und Winamp
    AMP_UseOwnW1          As Long    ' Flag für Winamp False =(Render Winamp5 im eigenen Window) 0=aus,1=an
    AMP_UseOwnW2          As Long    ' Flag für Winamp False =(Render Winamp2 im eigenen Window) 0=aus,1=an
    AMP_Moduleindex       As Long    ' Modul-index für Winamp
    SON_PaintHandle       As Long    ' Painthandle für Sonique
    SON_ConfigFile        As String  ' Dateiname der Konfiguration für Sonique
    SON_Flags             As Long    ' Flags für Sonique
    WMP_PluginIndex       As Long    ' Pluginindex für WMP;
    WMP_PresetIndex       As Long    ' Presetindex für WMP
    WMP_SrcVisHandle      As Long    ' ContainerVisHandle für WMP
    BB_ParentHandle       As Long    ' Parent Windowhandle
    BB_Flags              As Long    ' Flags für BassBox selbe wie Sonique
    BB_ShowFPS            As Long    ' Frames pro Sekunde anzeigen
    BB_ShowPrgBar         As Long    ' Progressbar anzeigen
    Width                 As Long    ' Fensterbreite
    Height                As Long    ' Fensterhöhe
    Left                  As Long    ' Top
    Top                   As Long    ' Left
  End Type

  Public Type BASSVIS_INFO
    SongTitle    As String     ' SongTitel ohne Pfad
    Songfile     As String     ' SongFile incl. Pfad (StreamFile)
    pos          As Long       ' StreamPos = 1000*StreamPos
    len          As Long       ' Stream länge
    PlaylistPos  As Long       ' PlaylistPos minimal > 0
    Playlistlen  As Long       ' Playlist länge
    SampleRate   As Long       ' Samplerate default = 44100
    BitRate      As Long       '
    Duration     As Long       '
    Channels     As Long       ' 2
  End Type

  Public Enum BASSVIS_PLAYSTATE
      psError = -1
      psStop = 0
      psPlay = 1
      psIsPlaying = 2
      psPause = 3
      psPrevTitle = 4
      psNextTitle = 5
      psSetPlaylistTitle = 6
      psGetPlaylistTitlePos = 7
      psSetPlaylistPos = 8
      psGetSelectedTitlePos = 9
  End Enum


'Core functions for initalizing BASSVIS and Find Plugins of any kind
Public Declare Function BASSVIS_Init Lib "bass_vis.dll" ( _
    ByVal Kind As Long, _
    ByVal AppHandle As Long, _
    ByVal WinHandle As Long _
) As Boolean


'Core functions for initalizing BASSVIS and Find Plugins of any kind
'delemiter As Byte = 44 .. ASC(",")
'you can send other delemiter for Spliting
Public Declare Function BASSVIS_FindPlugins Lib "bass_vis.dll" ( _
    ByVal Kind As Long, _
    ByVal PluginPath As Any, _
    ByVal Searchflags As Long, _
    Optional ByVal delemiter As Byte = 44 _
) As Long


Public Declare Function BASSVIS_Free Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM _
) As Boolean


Public Declare Function BASSVIS_GetVersion Lib "bass_vis.dll" () As String


Public Declare Sub BASSVIS_ExecutePlugin Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_EXEC, _
    ByRef Base As BASSVIS_PARAM _
)


Public Declare Function BASSVIS_RenderChannel Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal channel As Long _
) As Boolean


Public Declare Function BASSVIS_StartRecord Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    Optional ByVal SampleRate As Long = 44100, _
    Optional ByVal Channels As Long = 2 _
) As Boolean


Public Declare Function BASSVIS_Config Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    Optional ByVal Entry As Long = 0 _
) As Boolean


Public Declare Function BASSVIS_SetInfo Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByRef infos As BASSVIS_INFO _
) As Boolean


Public Declare Function BASSVIS_Resize Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal Left As Long, _
    ByVal Top As Long, _
    ByVal Width As Long, _
    ByVal Height As Long _
) As Boolean


Public Declare Function BASSVIS_SetFullscreen Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal SourceHandle As Long, _
    ByVal DestHandle As Long, _
    ByVal SourceLeft As Long, _
    ByVal SourceTop As Long, _
    ByVal SourceWidth As Long, _
    ByVal SourceHeight As Long, _
    ByVal FullScreenFlag As Boolean, _
    ByVal FullScreeWidth As Long, _
    ByVal FullScreenHeight As Long _
) As Boolean


Public Declare Function BASSVIS_GetModulePresetCount Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal PluginName As Any _
) As Long


Public Declare Function BASSVIS_GetModulePresetName Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal index As Long, _
    ByVal PluginName As Any _
) As Long


Public Declare Function BASSVIS_GetModulePresetNameList Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal PluginName As Any _
) As Long


Public Declare Function BASSVIS_SetModulePreset Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal index As Long _
) As Boolean


Public Declare Function BASSVIS_GetOption Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal options As Long _
) As Long


Public Declare Function BASSVIS_SetOption Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal options As Long, _
    ByVal value As Long _
) As Boolean


Public Declare Function BASSVIS_SetPlayState Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal State As BASSVIS_PLAYSTATE, _
    Optional ByVal value As Long = -1, _
    Optional ByVal Title As Any = "" _
) As Long


Public Declare Function BASSVIS_GetPluginHandle Lib "bass_vis.dll" ( _
    ByVal Kind As Long, _
    ByVal Pluginfile As Any _
) As Long


Public Declare Function BASSVIS_GetPluginName Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM _
) As Long


Public Declare Function BASSVIS_IsFree Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM _
) As Boolean


Public Declare Sub BASSVIS_Quit Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM _
)


Public Declare Sub BASSVIS_SetVisPort Lib "bass_vis.dll" ( _
    ByRef param As BASSVIS_PARAM, _
    ByVal WindowHandle As Long, _
    ByVal ContainerHandle As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal Width As Long, _
    ByVal Height As Long _
)


Public Declare Sub BASSVIS_WINAMP_SetStateCallback Lib "bass_vis.dll" ( _
    ByVal callback As BASSVIS_PLAYSTATE _
)

Public Declare Sub BASSVIS_WINAMP_RemoveCallback Lib "bass_vis.dll" ()


Public Declare Function BASSVIS_SONIQUEVIS_Clicked Lib "bass_vis.dll" ( _
    ByVal handle As Long, _
    ByVal x As Long, _
    ByVal y As Long _
) As Boolean


Public Declare Function BASSVIS_SONIQUEVIS_RenderToDC Lib "bass_vis.dll" ( _
    ByVal Kind As Long, _
    ByVal handle As Long, _
    ByVal channel As Long, _
    ByVal canvas As Long _
) As Long


Public Declare Function BASSVIS_SONIQUEVIS_RenderToDC2 Lib "bass_vis.dll" ( _
    ByVal Kind As Long, _
    ByVal handle As Long, _
    ByVal data As Long, _
    ByVal fft As Long, _
    ByVal canvas As Long, _
    ByVal flags As Long, _
    ByVal pos As Long _
) As Long

' ************** End BASSVIS Interface **************
'*****************************************************


' Windows API Declaration
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" ( _
    ByVal lpString As Long _
) As Long

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    ByRef Destination As Any, _
    ByRef Source As Any, _
    ByVal Length As Long _
)


Public Function VBStrFromAnsiPtr(ByVal lpStr As Long) As String

Dim bStr() As Byte
Dim cChars As Long

    On Error Resume Next
    ' Get the number of characters in the buffer
    cChars = lstrlen(lpStr)
    ' Resize the byte array
    ReDim bStr(0 To cChars - 1) As Byte
    ' Grab the ANSI buffer
    Call CopyMemory(bStr(0), ByVal lpStr, cChars)
    ' Now convert to a VB Unicode string
    VBStrFromAnsiPtr = StrConv(bStr, vbUnicode)

End Function


greets Emil

José Roca


Emil Weiss

Quote from: José Roca on July 19, 2008, 08:19:59 AM

Already done :)

See the second post of this thread: http://www.jose.it-berater.org/smfforum/index.php?topic=1749.0


ahh great only support for BassBox not in the File
i will show how can added it self

thanks for the work

greets Emil

Emil Weiss

#559
i have update it.. and added it to BassVis Archive

ups.. reload it
have forget changed this line

Quote' BassVis 2.4.1.1
' An extension allowing the use of Sonique, Winamp, and Windows Media Player and BassBox visual plugins with BASS.

greets Emil

Patrice Terrier

Emil

This is the old version that i did for XP (ZAP Visual Plugin)
http://www.zapsolution.com/zvpus.htm

But now, i want one working with VISTA (and XP) and the name of it is: BassBox   ;D

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Emil Weiss

#561
Quote from: Patrice Terrier on July 19, 2008, 08:44:57 AM
Emil

This is the old version that i did for XP (ZAP Visual Plugin)
http://www.zapsolution.com/zvpus.htm

But now, i want one working with VISTA (and XP) and the name of it is: BassBox   ;D

...

hmm i have write a bad name ? shame
or you will write a Sample for that named BassBox

i have finish now my OpenGl Plugin for Winamp think show good
greets Emil

Emil Weiss

#562
i hope i can post my problem here

attached 2 picture strip one 12x5 and own 2x255
i search for a way that i can use with my source drawspectrum the palette from 2x255 Bitmap strip

this work only with 12x5

remove old code


i hope anybody can help me
spectrum show as 2.jpg from Spectrum4.bmp

greets Emil

Patrice Terrier

Better to use a ColorLUT.

See in any of my plugin source code how i am using this:


GLOBAL gColor() AS LONG

SUB ColorInit()
    DIM gColor(1 TO 33) AS LONG
    gColor(1)  = RGB(32,32,32)
    gColor(2)  = RGB(0,44,233)
    gColor(3)  = RGB(0,67,210)
    gColor(4)  = RGB(0,89,187)
    gColor(5)  = RGB(0,112,164)
    gColor(6)  = RGB(0,135,142)
    gColor(7)  = RGB(0,159,117)
    gColor(8)  = RGB(0,183,88)
    gColor(9)  = RGB(0,207,58)
    gColor(10) = RGB(0,231,29)
    gColor(11) = RGB(26,234,26)
    gColor(12) = RGB(52,237,23)
    gColor(13) = RGB(79,240,20)
    gColor(14) = RGB(105,243,17)
    gColor(15) = RGB(126,245,14)
    gColor(16) = RGB(147,248,11)
    gColor(17) = RGB(168,250,8)
    gColor(18) = RGB(189,253,5)
    gColor(19) = RGB(210,255,2)
    gColor(20) = RGB(233,255,0)
    gColor(21) = RGB(255,255,0)
    gColor(22) = RGB(255,251,0)
    gColor(23) = RGB(255,235,0)
    gColor(24) = RGB(255,215,0)
    gColor(25) = RGB(255,196,0)
    gColor(26) = RGB(255,176,0)
    gColor(27) = RGB(255,156,0)
    gColor(28) = RGB(253,137,0)
    gColor(29) = RGB(255,117,0)
    gColor(30) = RGB(255,97,0)
    gColor(31) = RGB(255,78,0)
    gColor(32) = RGB(255,58,0)
    gColor(33) = RGB(255,0,0)
END SUB



Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Emil Weiss

ok thanks Patrice

greets Emil

Emil Weiss

Hi patrice

my spectrum show now with this..

my problem
i will not that any bar change to one color .. sample RED
should be full Color like Palette

can you help me ?
work this not with Quads ?

glBegin(GL_QUADS);
for i :=0 to mSpecBars-1 do
begin

      if UsePalette then
      begin
        RGBColor := gColor[i];
        cbR := GetRValue(RGBColor);
        cbG := GetGValue(RGBColor);
        cbB := GetBValue(RGBColor);
        glColor4ub(cbR, cbG, cbB, 0);
      end;
     
x1:=i*d1+d2;
x2:=(i+1)*d1+overdraw;
z2:=-heights[0][i]+z1-2.0*(d1-d2);

h2:=z1-d12d;
h3:=z2+d12d;

glTexCoord2f(0.0,0.0); glVertex3f(-x1,y,z1);
glTexCoord2f(1.0,0.0); glVertex3f(-x2,y,z1);
glTexCoord2f(1.0,0.3); glVertex3f(-x2,y,h2);
glTexCoord2f(0.0,0.3); glVertex3f(-x1,y,h2);

glTexCoord2f(0.0,0.3); glVertex3f(-x1,y,h2);
glTexCoord2f(1.0,0.3); glVertex3f(-x2,y,h2);
glTexCoord2f(1.0,0.7); glVertex3f(-x2,y,h3);
glTexCoord2f(0.0,0.7); glVertex3f(-x1,y,h3);

glTexCoord2f(0.0,0.7); glVertex3f(-x1,y,h3);
glTexCoord2f(1.0,0.7); glVertex3f(-x2,y,h3);
glTexCoord2f(1.0,1.0); glVertex3f(-x2,y,z2);
glTexCoord2f(0.0,1.0); glVertex3f(-x1,y,z2);
      //end;
end;
glEnd();


i hope you understand what i mean ;)

greets Emil

Patrice Terrier

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=236286


glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glBegin(GL_QUADS);
//red color
glColor3f(1.0,0.0,0.0);
glVertex2f(-1.0, 1.0);
glVertex2f(-1.0,-1.0);
//blue color
glColor3f(0.0,0.0,1.0);
glVertex2f(1.0,-1.0);
glVertex2f(1.0, 1.0);
glEnd();
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Emil Weiss

#567
Quote from: Patrice Terrier on July 24, 2008, 11:55:21 PM
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=236286


glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glBegin(GL_QUADS);
//red color
glColor3f(1.0,0.0,0.0);
glVertex2f(-1.0, 1.0);
glVertex2f(-1.0,-1.0);
//blue color
glColor3f(0.0,0.0,1.0);
glVertex2f(1.0,-1.0);
glVertex2f(1.0, 1.0);
glEnd();


this is a simple gradient with 2 Color i use 255 Color Pallete strip from Bitmap
is not the same ;)
thanks ..

greets Emil

Patrice Terrier

then just draw horizontal stacked line of 2 or more pixel using indiviual color, and show them superimpose along the Y axe.

I am using the same technic in BassBox with rectangles, to draw the view meters shown on both side of the oscilloscope.


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#569
BassBox has been updated!

Version from july, 27, 2008 has been added,
it uses the latest Skin Engine and new backgrounds.


This is to celebrate the more than 30000 lurkers of this thread  8)

Added:
The BassBox24.zip is attached to the first post of this thread.

Added:
The ALIEN effect
See the settings on the top left corner
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com