My first test using Mandriva Linux and FreeBasic.code1.bas
'Simple code example using
'FreeBasic = http://www.freebasic.net
'Bass for Linux = http://www.un4seen.com/
#include once "bass.bi"
screenres 512, 418
Dim chan As QWord
Dim argv As String
Dim chanLength As QWord
Dim mpos As QWord
dim kbin As String
argv = "./test.mp3"
If( BASS_GetVersion( ) < MAKELONG(2,2) ) Then
Print "Error: BASS version 2.2 or above required"
'Sleep
End 1
End If
If( BASS_Init( -1, 44100, 0, 0, 0 ) = 0 ) Then
Print "Error: BASS_Init failed"
Sleep
End 0
End If
chan = BASS_StreamCreateFile( FALSE, argv, 0, 0, BASS_SAMPLE_LOOP)
If chan = 0 Then
Print "Error: BASS Stream Load failed"
Sleep
BASS_Free
End 1
End If
chanLength = BASS_ChannelGetLength(chan,BASS_POS_BYTE)
BASS_ChannelPlay( chan, FALSE )
While BASS_ChannelIsActive (chan) = 1
Locate 1,1
Print "Press button 9 for exit."
Locate 2, 1
Print "Length: " & chanLength
Locate 3, 1
mpos = BASS_ChannelGetPosition(chan, BASS_POS_BYTE)
Print "Pos...: "; mpos
kbin = inkey
Select Case kbin
case "9"
goto EndEx
End Select
Wend
EndEx:
BASS_ChannelStop( chan )
BASS_StreamFree( chan )
BASS_Stop
BASS_Free
'FreeBasic = http://www.freebasic.net
'Bass for Linux = http://www.un4seen.com/
#include once "bass.bi"
screenres 512, 418
Dim chan As QWord
Dim argv As String
Dim chanLength As QWord
Dim mpos As QWord
dim kbin As String
argv = "./test.mp3"
If( BASS_GetVersion( ) < MAKELONG(2,2) ) Then
Print "Error: BASS version 2.2 or above required"
'Sleep
End 1
End If
If( BASS_Init( -1, 44100, 0, 0, 0 ) = 0 ) Then
Print "Error: BASS_Init failed"
Sleep
End 0
End If
chan = BASS_StreamCreateFile( FALSE, argv, 0, 0, BASS_SAMPLE_LOOP)
If chan = 0 Then
Print "Error: BASS Stream Load failed"
Sleep
BASS_Free
End 1
End If
chanLength = BASS_ChannelGetLength(chan,BASS_POS_BYTE)
BASS_ChannelPlay( chan, FALSE )
While BASS_ChannelIsActive (chan) = 1
Locate 1,1
Print "Press button 9 for exit."
Locate 2, 1
Print "Length: " & chanLength
Locate 3, 1
mpos = BASS_ChannelGetPosition(chan, BASS_POS_BYTE)
Print "Pos...: "; mpos
kbin = inkey
Select Case kbin
case "9"
goto EndEx
End Select
Wend
EndEx:
BASS_ChannelStop( chan )
BASS_StreamFree( chan )
BASS_Stop
BASS_Free
bass.bi
#inclib "bass"
#ifdef __FB_WIN32__
# include once "win/wtypes.bi"
#else
'type BYTE as ubyte
type WORD as ushort
type DWORD as uinteger
type BOOL as integer
#define TRUE 1
#define FALSE 0
#define MAKELONG(a,b) cint( cushort(a) or (cuint(cushort(b)) shl 16) )
#endif '' __FB_WIN32__
type QWORD as ulongint
type HMUSIC as DWORD
type HSAMPLE as DWORD
type HCHANNEL as DWORD
type HSTREAM as DWORD
type HRECORD as DWORD
type HSYNC as DWORD
type HDSP as DWORD
type HFX as DWORD
type HPLUGIN as DWORD
#define BASS_SAMPLE_LOOP 4 'looped
#define BASS_POS_BYTE 0 'byte position
#ifdef __FB_WIN32__
declare function BASS_Init alias "BASS_Init" (byval device as integer, byval freq as DWORD, byval flags as DWORD, byval win as HWND, byval dsguid as GUID ptr) as BOOL
#else
declare function BASS_Init alias "BASS_Init" (byval device as integer, byval freq as DWORD, byval flags as DWORD, byval win as any ptr, byval dsguid as any ptr) as BOOL
#EndIf
declare function BASS_Start alias "BASS_Start" () as BOOL
declare function BASS_Stop alias "BASS_Stop" () as BOOL
declare function BASS_SetDevice alias "BASS_SetDevice" (byval device as DWORD) as BOOL
declare function BASS_GetDevice alias "BASS_GetDevice" () as DWORD
declare function BASS_Free alias "BASS_Free" () as BOOL
declare function BASS_GetVersion alias "BASS_GetVersion" () as Dword
declare function BASS_StreamCreateFile alias "BASS_StreamCreateFile" (byval mem as BOOL, byval file as zstring ptr, byval offset as QWORD, byval length as QWORD, byval flags as DWORD) as HSTREAM
declare function BASS_StreamFree alias "BASS_StreamFree" (byval handle as HSTREAM) as BOOL
declare function BASS_ChannelPlay alias "BASS_ChannelPlay" (byval handle as DWORD, byval restart as BOOL) as BOOL
declare function BASS_ChannelStop alias "BASS_ChannelStop" (byval handle as DWORD) as BOOL
declare function BASS_ChannelGetLength alias "BASS_ChannelGetLength" (byval handle as DWORD,byval mode as DWORD) as QWORD
declare function BASS_ChannelSetPosition alias "BASS_ChannelSetPosition" (byval handle as DWORD,byval pos as QWORD,byval mode as DWORD) as BOOL
declare function BASS_ChannelGetPosition alias "BASS_ChannelGetPosition" (byval handle as DWORD,byval mode as DWORD) as QWORD
declare function BASS_ChannelIsActive alias "BASS_ChannelIsActive" (byval handle as DWORD) as DWORD
'double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
'QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos);
'DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device);
'BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info);
'const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags);
'DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask);
'BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length);
'BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock);
'BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);
'BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value);
'BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value);
'BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time);
'BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib);
'BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol);
'BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol);
'BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel);
'BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
'QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode);
'BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode);
'QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode);
'DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
'DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
'HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user);
'BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
'HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority);
'BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
'BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
'BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);
'HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority);
'BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);
declare function BASS_MusicLoad alias "BASS_MusicLoad" (byval mem as BOOL, byval file as zstring ptr, byval offset as DWORD, byval length as DWORD, byval flags as DWORD, byval freq as DWORD) as HMUSIC
#ifdef __FB_WIN32__
# include once "win/wtypes.bi"
#else
'type BYTE as ubyte
type WORD as ushort
type DWORD as uinteger
type BOOL as integer
#define TRUE 1
#define FALSE 0
#define MAKELONG(a,b) cint( cushort(a) or (cuint(cushort(b)) shl 16) )
#endif '' __FB_WIN32__
type QWORD as ulongint
type HMUSIC as DWORD
type HSAMPLE as DWORD
type HCHANNEL as DWORD
type HSTREAM as DWORD
type HRECORD as DWORD
type HSYNC as DWORD
type HDSP as DWORD
type HFX as DWORD
type HPLUGIN as DWORD
#define BASS_SAMPLE_LOOP 4 'looped
#define BASS_POS_BYTE 0 'byte position
#ifdef __FB_WIN32__
declare function BASS_Init alias "BASS_Init" (byval device as integer, byval freq as DWORD, byval flags as DWORD, byval win as HWND, byval dsguid as GUID ptr) as BOOL
#else
declare function BASS_Init alias "BASS_Init" (byval device as integer, byval freq as DWORD, byval flags as DWORD, byval win as any ptr, byval dsguid as any ptr) as BOOL
#EndIf
declare function BASS_Start alias "BASS_Start" () as BOOL
declare function BASS_Stop alias "BASS_Stop" () as BOOL
declare function BASS_SetDevice alias "BASS_SetDevice" (byval device as DWORD) as BOOL
declare function BASS_GetDevice alias "BASS_GetDevice" () as DWORD
declare function BASS_Free alias "BASS_Free" () as BOOL
declare function BASS_GetVersion alias "BASS_GetVersion" () as Dword
declare function BASS_StreamCreateFile alias "BASS_StreamCreateFile" (byval mem as BOOL, byval file as zstring ptr, byval offset as QWORD, byval length as QWORD, byval flags as DWORD) as HSTREAM
declare function BASS_StreamFree alias "BASS_StreamFree" (byval handle as HSTREAM) as BOOL
declare function BASS_ChannelPlay alias "BASS_ChannelPlay" (byval handle as DWORD, byval restart as BOOL) as BOOL
declare function BASS_ChannelStop alias "BASS_ChannelStop" (byval handle as DWORD) as BOOL
declare function BASS_ChannelGetLength alias "BASS_ChannelGetLength" (byval handle as DWORD,byval mode as DWORD) as QWORD
declare function BASS_ChannelSetPosition alias "BASS_ChannelSetPosition" (byval handle as DWORD,byval pos as QWORD,byval mode as DWORD) as BOOL
declare function BASS_ChannelGetPosition alias "BASS_ChannelGetPosition" (byval handle as DWORD,byval mode as DWORD) as QWORD
declare function BASS_ChannelIsActive alias "BASS_ChannelIsActive" (byval handle as DWORD) as DWORD
'double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
'QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos);
'DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device);
'BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info);
'const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags);
'DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask);
'BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length);
'BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock);
'BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);
'BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
'BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value);
'BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value);
'BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time);
'BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib);
'BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol);
'BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol);
'BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel);
'BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
'QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode);
'BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode);
'QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode);
'DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
'DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
'HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user);
'BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
'HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority);
'BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
'BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
'BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);
'HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority);
'BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);
declare function BASS_MusicLoad alias "BASS_MusicLoad" (byval mem as BOOL, byval file as zstring ptr, byval offset as DWORD, byval length as DWORD, byval flags as DWORD, byval freq as DWORD) as HMUSIC
Next example using Grafic GTK
VU
CPU
POSITION
and more

Reply
Quote



Please help me. I still didn't get to play two audio files with StreamProc. 