Author Topic: Music?  (Read 2304 times)

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
Music?
« on: 2008-Mar-17 »
Hi Folks,

i have a little Sample for you. Thanks to Schranzor for the Bass.dll

Code: (glbasic) [Select]
http://www.zshare.net/download/90923188e7d3bd/EDIT:// now with runtimes in Setup file

here an actual Screenshot



and the Source (2 versions ago)

Code: (glbasic) [Select]
// --------------------------------- //
// Project: Musik-Player
// Start: Monday, March 10, 2008
// IDE Version: 5.194
AUTOPAUSE FALSE

GLOBAL GUI_WINDOW = 0
GLOBAL GUI_DIALOG = 1

GLOBAL GUI_BOX_VERTICAL = 1
GLOBAL GUI_BOX_HORIZONTAL = 0
GLOBAL GUI_BOX_BOXONLY = 1

GLOBAL GUI_PROGRESS_LEFT_TO_RIGHT
GLOBAL GUI_PROGRESS_RIGHT_TO_LEFT
GLOBAL GUI_PROGRESS_BOTTOM_TO_TOP
GLOBAL GUI_PROGRESS_TOP_TO_BOTTOM

GLOBAL Volume = 50
GLOBAL done = 0

GLOBAL Songhandle
GLOBAL Pause = FALSE

hwnd = GetHwnd()
HideGLBWindow(hwnd)
GuiInit()
BASS_Init(-1,44100,0)

window = GuiCreateWindow("Music-Player",320,50,GUI_WINDOW,TRUE)
 GuiEventConnect(window,"delete_event")

btnplay = GuiCreateButton("Play",TRUE)
 GuiEventConnect(btnplay,"clicked")

btnstop = GuiCreateButton("Stop",TRUE)
 GuiEventConnect(btnstop,"clicked")

btnopen = GuiCreateButton("Open",TRUE)
 GuiEventConnect(btnopen,"clicked")

btnplus = GuiCreateButton("  +  ",TRUE)
 GuiEventConnect(btnplus,"clicked")

btnminus = GuiCreateButton("  -  ",TRUE)
 GuiEventConnect(btnminus,"clicked")

lbltime = GuiCreateLabel("",TRUE)

lblpos = GuiCreateLabel("",TRUE)

lbltitle = GuiCreateLabel("",TRUE)
 GuiSetLabelText(lbltitle,BASS_GetDeviceDescription$(BASS_GetDevice()))

table = GuiCreateTable(2,5,TRUE,TRUE)
 GuiAddContainer(window,table)
 GuiTableAttach(table,btnplay,0,1,0,1)
 GuiTableAttach(table,btnstop,1,2,0,1)
 GuiTableAttach(table,btnopen,2,3,0,1)
 GuiTableAttach(table,btnminus,3,4,0,1)
 GuiTableAttach(table,btnplus,4,5,0,1)
 GuiTableAttach(table,lblpos,0,1,1,2)
 GuiTableAttach(table,lbltitle,1,4,1,2)
 GuiTableAttach(table,lbltime,4,5,1,2)
GuiMain()
GuiEnd()

CALLBACK FUNCTION EVENTS: WIDGET,EVENT,DATA$
SELECT WIDGET
CASE window
GuiEnd()
BASS_End(chan)
END
CASE btnplay
IF Songhandle
chan = BASS_SampleGetChannel(Songhandle,FALSE)
Play = BASS_ChannelPlay(chan,FALSE)
StartThread()
ENDIF
CASE btnstop
BASS_ChannelStop(chan)
done = 1
CASE btnminus
Volume = Volume - 5
IF Volume < 0 THEN Volume = 0
BASS_SetVolume(Volume)
CASE btnplus
Volume = Volume + 5
IF Volume > 100 THEN Volume = 100
BASS_SetVolume(Volume)
CASE btnopen
IF chan THEN BASS_ChannelStop(chan)
done = 1
file$ = FILEREQUEST$(TRUE,"Musik|*.mp3|*.wav|*.ogg|*.mpeg|*.*")
HideGLBWindow(hwnd)
Songhandle = BASS_SampleLoad(FALSE,file$,0,0,1,BASS_SAMPLE_LOOP)
ENDSELECT
RETURN TRUE
ENDFUNCTION
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC