📄 player.asm
字号:
; #########################################################################
; Simple BASS Player in MASM32
; by TBD
;
; MASM32 package (c) Steve 'Hutch' Hutchesson http://www.movsd.com
; BASS engine (c) Un4seen Developments http://www.un4seen.com/
;
; History
; 1.1 (05.Jun.2oo2) - added VU meter
; added song name in status
; 1.0 (22.Mar.2oo2) - first version
; #########################################################################
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
; include files
; ~~~~~~~~~~~~~
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\Comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\winmm.inc
include ..\bass.inc
; libraries
; ~~~~~~~~~
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\Comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\winmm.lib
includelib ..\..\c\bass.lib
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD
GetFileName PROTO :DWORD,:DWORD,:DWORD
Do_Status PROTO :DWORD
RegisterWinClass PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
MsgLoop PROTO
Main PROTO
Level PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Do_ToolBar PROTO :DWORD
SetBmpColor PROTO :DWORD
wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>
;=============
; Local macros
;=============
szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
m2m MACRO M1, M2
push M2
pop M1
ENDM
return MACRO arg
mov eax, arg
ret
ENDM
DisplayMenu MACRO handl, IDnum
invoke LoadMenu,hInstance,IDnum
invoke SetMenu,handl,eax
ENDM
DisplayWindow MACRO handl, ShowStyle
invoke ShowWindow,handl, ShowStyle
invoke UpdateWindow,handl
ENDM
; ---------------------------
; macros for creating toolbar
; ---------------------------
TBextraData MACRO
mov tbb.fsState, TBSTATE_ENABLED
mov tbb.dwData, 0
mov tbb.iString, 0
ENDM
; ------------------------------
TBbutton MACRO bID, cID, bStyle
mov tbb.iBitmap, bID ;; button ID number
mov tbb.idCommand, cID ;; command ID number
mov tbb.fsStyle, bStyle
invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb
ENDM
; ------------------------------
TBblank MACRO
mov tbb.iBitmap, 0
mov tbb.idCommand, 0
mov tbb.fsStyle, TBSTYLE_SEP
invoke SendMessage,hToolBar,TB_ADDBUTTONS,1,ADDR tbb
ENDM
; ------------------------------
Create_Tool_Bar MACRO Wd, Ht
szText tbClass,"ToolbarWindow32"
invoke CreateWindowEx,0,
ADDR tbClass,
ADDR tbClass,
WS_CHILD or WS_VISIBLE or TBSTYLE_FLAT,
0,0,500,20,
hWin,NULL,
hInstance,NULL
mov hToolBar, eax
invoke SendMessage,hToolBar,TB_BUTTONSTRUCTSIZE,sizeof TBBUTTON,0
; ---------------------------------------
; Put width & height of bitmap into DWORD
; ---------------------------------------
mov ecx,Wd ;; loword = bitmap Width
mov eax,Ht ;; hiword = bitmap Height
shl eax,16
mov ax, cx
mov bSize, eax
invoke SendMessage,hToolBar,TB_SETBITMAPSIZE,0,bSize
invoke SetBmpColor,hTbBmp
mov hTbBmp,eax
mov tbab.hInst, 0
m2m tbab.nID, hTbBmp
invoke SendMessage,hToolBar,TB_ADDBITMAP,12,ADDR tbab
invoke SendMessage,hToolBar,TB_SETBUTTONSIZE,0,bSize
ENDM
; --------------------------------------------
; equates to use directly in the message loop
; --------------------------------------------
m_hWnd equ <msg.hwnd>
m_Msg equ <msg.message>
m_wParam equ <msg.wParam>
m_lParam equ <msg.lParam>
.data?
hInstance dd ?
CommandLine dd ?
hCursor dd ?
hWnd dd ?
ModHandle dd ?
ModName dd ?
MusicFile dd ?
hStatus dd ?
hTbBmp dd ?
hToolBar dd ?
SurroundOn dd ?
timer dd ?
hWinLevel dd ?
specdc dd ?
specbmp dd ?
specbuf dd ?
VIS_WIDTH = 84
VIS_HEIGHT = 9
ofn OPENFILENAME <> ; structure
bmp BITMAPINFO <>
.code
; #########################################################################
start:
invoke InitCommonControls
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke LoadCursor,NULL,IDC_ARROW
mov hCursor, eax
call Main
invoke ExitProcess,eax
; data
szClassName db "BASS_Player",0
szDisplayName db "Simple BASS Player",0
szAboutText db "BASSPlayer",13,10,"Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -