Add @volume - system volume mixer

git-svn-id: svn://kolibrios.org@5432 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eAndrew 2015-02-19 22:54:33 +00:00
parent af4baf7b6c
commit 33659545f7
11 changed files with 558 additions and 53 deletions

View File

@ -235,6 +235,7 @@ if tup.getconfig('NO_FASM') ~= 'full' then
tup.append_table(img_files, {
{"KERNEL.MNT", "../kernel/trunk/kernel.mnt"},
{"@MENU", PROGS .. "/system/menu/trunk/menu"},
{"@VOLUME", PROGS .. "/media/volume/volume"},
{"@PANEL", PROGS .. "/system/panel/trunk/@PANEL"},
{"@DOCKY", PROGS .. "/system/docky/trunk/docky"},
{"@OPEN", PROGS .. "/system/open/open"},

View File

@ -4,13 +4,14 @@
# If delay is negative, wait for termination of the spawned process. Otherwise, simply wait
#
#/SYS/CROPFLAT "XS800 YS480" 1 # set limits of screen
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/LOADDRV "COMMOUSE" 1 # serial mouse driver
#/SYS/DEVELOP/BOARD "" 1 # Load DEBUG board
#/SYS/refrscrn "" 1 # Refresh screen
/SYS/LOADDRV "RDC" 1 # videodriver for RDC M2010/M2012
/SYS/NETWORK/NETCFG A 1 #
/SYS/NETWORK/ZEROCONF "" 1 # Network configuration
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/@VOLUME "" 1 # Start volume daemon
/SYS/@PANEL "" 1 # Start panel
/SYS/@DOCKY "" 1 # Start docky
/SYS/SETUP BOOT 1 # Load device settings
@ -19,4 +20,4 @@
/SYS/@SS ASSM 1 # Screensaver
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
### Hello, ASM World! ###
### Hello, ASM World! ###

View File

@ -11,6 +11,7 @@
/SYS/NETWORK/NETCFG A 1 #
/SYS/NETWORK/ZEROCONF "" 1 # Network configuration
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/@VOLUME "" 1 # Start volume daemon
/SYS/@PANEL "" 1 # Start panel
/SYS/@DOCKY "" 1 # Start docky
/SYS/SETUP BOOT 1 # Load device settings
@ -19,4 +20,4 @@
/SYS/@SS ASSM 1 # Screensaver
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
### Hello, ASM World! ###
### Hello, ASM World! ###

View File

@ -11,6 +11,7 @@
/SYS/NETWORK/NETCFG A 1 #
/SYS/NETWORK/ZEROCONF "" 1 # Network configuration
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/@VOLUME "" 1 # Start volume daemon
/SYS/@PANEL "" 1 # Start panel
/SYS/@DOCKY "" 1 # Start docky
/SYS/SETUP BOOT 1 # Load device settings
@ -19,4 +20,4 @@
/SYS/@SS ASSM 1 # Screensaver
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
### Hello, ASM World! ###
### Hello, ASM World! ###

View File

@ -11,6 +11,7 @@
/SYS/NETWORK/NETCFG A 1 #
/SYS/NETWORK/ZEROCONF "" 1 # Network configuration
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/@VOLUME "" 1 # Start volume daemon
/SYS/@PANEL "" 1 # Start panel
/SYS/@DOCKY "" 1 # Start docky
/SYS/SETUP BOOT 1 # Load device settings
@ -19,4 +20,4 @@
/SYS/@SS ASSM 1 # Screensaver
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
### Hello, ASM World! ###
### Hello, ASM World! ###

View File

@ -11,6 +11,7 @@
/SYS/NETWORK/NETCFG A 1 #
/SYS/NETWORK/ZEROCONF "" 1 # Network configuration
/SYS/MEDIA/PALITRA "H 007DCEDF 003C427F" 1 # SET BG
/SYS/@VOLUME "" 1 # Start volume daemon
/SYS/@PANEL "" 1 # Start panel
/SYS/@DOCKY "" 1 # Start docky
/SYS/SETUP BOOT 1 # Load device settings
@ -19,4 +20,4 @@
/SYS/@SS ASSM 1 # Screensaver
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
### Hello, ASM World! ###
### Hello, ASM World! ###

View File

@ -0,0 +1,2 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("volume.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "volume")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

View File

@ -0,0 +1,47 @@
macro cmpe a, b, c
{
cmp a, b
je c
}
macro cmpne a, b, c
{
cmp a, b
jne c
}
macro cmpg a, b, c
{
cmp a, b
jg c
}
macro cmpl a, b, c
{
cmp a, b
jl c
}
macro cmpnl a, b, c
{
cmp a, b
jnl c
}
macro cmpng a, b, c
{
cmp a, b
jng c
}
macro cmpge a, b, c
{
cmp a, b
jge c
}
macro cmple a, b, c
{
cmp a, b
jle c
}

View File

@ -0,0 +1,450 @@
WIN_SIZE equ 120
TIMER equ 60
use32
org 0
db 'MENUET01'
dd 1, @entry, @end, @memory, @stack, @params, 0
include "../../macros.inc"
include "../../proc32.inc"
include "../../dll.inc"
; include "../../debug.inc"
include "macros.inc"
;=====================================================================
@entry:
mcall 68, 11
mcall 68, 22, shm_name, 512, 5
mov [shm], eax
mcall 9, buffer, -1
mov esi, dword[buffer + 30]
mov edi, eax
@@:
mcall 9, buffer, edi
cmpe dword[buffer + 30], esi, .next
cmpe dword[buffer + 10], dword "@Vol", @open_1
cmpe dword[buffer + 10], dword "@VOL", @open_1
cmpe dword[buffer + 10], dword "@vol", @open_1
.next:
dec edi
jnz @b
mov eax, [shm]
mov [eax], dword 0
mcall 40, 10b
mcall 66, 1, 1
;mcall 66, 4, 16, 0x110
mcall 66, 4, 77, 0x110
mcall 66, 4, 75, 0x110
mcall 66, 4, 80, 0x110
stdcall dll.Load, @imports
stdcall dword[img.decode], icons, icons.size, 0
mov dword[image.data], eax
stdcall dword[img.to_rgb], dword[image.data], image
stdcall dword[img.destroy], dword[image.data]
; load driver
mcall 68, 16, snd_driver.name
mov [snd_driver], eax
cmpe eax, 0, exit
@update:
mcall 23, 5
cmpe al, EV_KEY, @key
mov eax, [shm]
cmpne [eax], dword 0, @open_2
jmp @update
@open_1:
mov ebx, 1
cmpne [@params], byte '+', @f
mov ebx, 2
@@:
cmpne [@params], byte '-', @f
mov ebx, 3
@@:
cmpne [@params], byte 'm', @f
mov ebx, 4
@@:
cmpne [@params], byte 's', @f
mov ebx, 5
@@:
mov eax, [shm]
mov [eax], ebx
jmp @exit
@open_2:
mov eax, [shm]
mov ebx, [eax]
mov [command], ebx
mov [eax], dword 0
cmpne [win.pid], dword 0, @update
mcall 51, 1, _entry, _stack
jmp @update
@key:
mcall 2
;cmpe ah, 16, @exit
mov edx, [shm]
cmpne ah, 77, @f
.cm_1:
cmpne [win.pid], 0, .else_1
mov [edx], dword 2
jmp @open_2
.else_1:
mov [command], 2
@@:
cmpne ah, 75, @f
.cm_2:
cmpne [win.pid], 0, .else_2
mov [edx], dword 3
jmp @open_2
.else_2:
mov [command], 3
@@:
cmpne ah, 80, @f
.cm_3:
mov [edx], dword 4
jmp @open_2
@@:
jmp @update
@exit:
mcall -1
;=====================================================================
_entry:
mcall 40, 100111b
mcall 9, buffer, -1
mov ecx, eax
mov edx, dword [buffer + 30]
mov [win.pid], edx
mcall 14
movzx ebx, ax
shr eax, 17
shr ebx, 1
sub eax, WIN_SIZE / 2
sub ebx, WIN_SIZE / 2
mov [win.x], eax
mov [win.y], ebx
mcall 70, is_load
cmpe eax, 0, @f
mov dword[volume], 5
@@:
mov dword[timer], TIMER
jmp set_sound
;----------------------------
_update:
mcall 23, 5
cmpe al, EV_REDRAW, _redraw
cmpe al, EV_KEY, _key
cmpe al, EV_BUTTON, _button
cmpe al, EV_MOUSE, _mouse
cmpne [command], 2, @f
mov [mute], 0
cmpe [volume], dword 10, @f
inc dword[volume]
jmp .apply
@@:
cmpne [command], 3, @f
mov [mute], 0
cmpe [volume], dword 0, @f
dec dword[volume]
jmp .apply
@@:
cmpne [command], 4, @f
mov [mute], 1
jmp .apply
@@:
cmpne [command], 5, @f
mov [mute], 0
jmp .apply
.apply:
mov [command], 0
jmp set_sound
@@:
mcall 18, 7
mov ecx, eax
mcall 9, buffer
mov eax, dword[buffer + 30]
cmpne [win.pid], eax, exit
dec dword[timer]
jnz _update
;----------------------------
exit:
mov [win.pid], 0
mcall 70, is_save
mcall -1
;----------------------------
_button:
mcall 17
cmpe ah, 1, exit
cmpe ah, 3, toggle_mute
jmp _update
;----------------------------
_key:
mcall 2
cmpe ah, 027, exit
cmpe ah, 176, dec_volume ; <-
cmpe ah, 183, dec_volume ; PgDown
cmpe ah, 179, inc_volume ; ->
cmpe ah, 184, inc_volume ; PgUp
cmpe ah, 178, unmute_volume ; ^
cmpe ah, 180, unmute_volume ; Home
cmpe ah, 177, mute_volume ; v
cmpe ah, 181, mute_volume ; End
jmp _update
;----------------------------
_mouse:
mcall 37, 7
cmpe eax, 0, _update
mov esi, eax
mcall 37, 1
movzx ebx, ax
shr eax, 16
cmpg eax, WIN_SIZE, _update
cmpg ebx, WIN_SIZE, _update
cmpe si, 1, dec_volume
jne inc_volume
;----------------------------
dec_volume:
cmpe dword[volume], 0, _update
dec dword[volume]
jmp unmute_volume
inc_volume:
cmpe dword[volume], 10, _update
inc dword[volume]
unmute_volume:
mov [mute], 0
jmp @f
toggle_mute:
mov eax, 1
sub eax, [mute]
mov [mute], eax
jmp @f
mute_volume:
mov [mute], 1
set_sound:
@@:
mov [snd_driver.command], 6
mov [snd_driver.inputsz], 4
mov [snd_driver.output], 0
mov [snd_driver.outputsz], 0
mov [snd_driver.input], buffer
mov edi, 10
cmpe [mute], 1, .set_sound
sub edi, [volume]
.set_sound:
imul edi, 479
neg edi
mov dword[buffer], edi
mcall 68, 17, snd_driver
mov dword[timer], TIMER
call draw_icon
call draw_bar
jmp _update
;----------------------------
_redraw:
call draw_window
call draw_icon
call draw_bar
jmp _update
;----------------------------
draw_window:
mcall 0, <[win.x], WIN_SIZE + 1>, <[win.y], WIN_SIZE + 1>, 0x61000000
mcall 13, <0, WIN_SIZE>, <1, WIN_SIZE - 2>, 0x3D3D3D
mcall , <1, WIN_SIZE - 2>, <0, 1>
mcall , , <WIN_SIZE - 1, 1>
mcall 8, <0, WIN_SIZE>, <0, WIN_SIZE>, 0x60000002
mcall , <20, 80>, <22, 60>, 0x60000003
ret
;----------------------------
draw_icon:
mcall 7, image, <30, 45>, <31, 30>
cmpe dword[mute], 0, @f
mov ebx, 30 * 45 * 3 * 5 + image
jmp .draw
@@:
cmpne dword[volume], 0, @f
mov ebx, 30 * 45 * 3 * 1 + image
jmp .draw
@@:
cmpge dword[volume], 5, @f
mov ebx, 30 * 45 * 3 * 2 + image
jmp .draw
@@:
cmpge dword[volume], 9, @f
mov ebx, 30 * 45 * 3 * 3 + image
jmp .draw
@@:
mov ebx, 30 * 45 * 3 * 4 + image
.draw:
mcall , , , <61, 30>
ret
;----------------------------
draw_bar:
;; draw shadow
mov eax, 13
mov ebx, 11 shl 16 + 9
mov ecx, 100 shl 16 + 1
mov edx, 0x252525
mov esi, 10
@@:
cmpe esi, 0, @f
mcall
add ebx, 10 shl 16
dec esi
jmp @b
@@:
;; draw active
mov ebx, 11 shl 16 + 9
mov ecx, 96 shl 16 + 4
mov edx, 0xE5E5E5
mov esi, [volume]
@@:
cmpe esi, 0, @f
mcall
add ebx, 10 shl 16
dec esi
jmp @b
@@:
;; draw inactive
mov ebx, 11 shl 16 + 9
mov edx, 0x737373
mov esi, 10
sub esi, [volume]
imul edi, [volume], 10
shl edi, 16
add ebx, edi
@@:
cmpe esi, 0, @f
mcall
add ebx, 10 shl 16
dec esi
jmp @b
@@:
ret
;----------------------------
@imports:
library img, "libimg.obj"
import img, \
img.init, "lib_init", \
img.to_rgb, "img_to_rgb2", \
img.decode, "img_decode", \
img.destroy, "img_destroy"
;----------------------------
volume_dat db "/sys/settings/volume.dat", 0
is_save:
dd 2
dd 0
dd 0
dd 8
dd volume
db 0
dd volume_dat
is_load:
dd 0
dd 0
dd 0
dd 8
dd volume
db 0
dd volume_dat
icons file "icon.png"
.size = $-icons
snd_driver.name:
db "SOUND", 0
shm_name db "volume-man", 0
@end:
;=====================================================================
win:
.x rd 1
.y rd 1
.pid rd 1
image rb 45 * 30 * 6 * 3
.data rd 1
shm rd 1
volume rd 1
timer rd 1
mute rd 1
command rd 1
buffer rb 1024
snd_driver rd 1
.command rd 1
.input rd 1
.inputsz rd 1
.output rd 1
.outputsz rd 1
;=====================================================================
rb 2048
_stack:
rb 2048
@stack:
@params rb 256
@memory:

View File

@ -52,7 +52,7 @@
; Win+D (restore/clear desktop), Win+R (start RUN application).
; Using the library LibINI to set the parameters.
; New style of panel. Start application Menu with boot options.
; two versions of the location of the panel -
; two versions of the location of the panel -
; the bottom of the desktop and on top of the desktop.
;------------------------------------------------------------------------------
; last update: 31/03/2012
@ -107,7 +107,7 @@ handle_key:
mov [active_process],eax
mcall 2
; dps "panel key: "
; dph eax
; newline
@ -166,23 +166,23 @@ end if
cmp al, 88 ; Ctrl+Alt+F12
jz start_end_application
cmp al, 91 ; RWin DOWN
jz set_win_key_flag
cmp al, 92 ; LWin DOWN
jz set_win_key_flag
cmp al, 219 ; RWin UP
jz cut_win_key_flag ;start_menu_application
cmp al, 220 ; LWin UP
jz cut_win_key_flag ;start_menu_application
cmp al, 62 ; Alt+F4
cmp al, 62 ; Alt+F4
jz kill_active_application
cmp al, 205
@ -193,13 +193,13 @@ end if
cmp al, 69 ; Alt+Shift+NumLock
jz start_mousemul_application
cmp al, 19 ; Win+R
jz start_run_application
cmp al, 32 ; Win+D
jz minimize_all_windows
cmp al, 55 ; PrintScreen DOWN
jz start_PrintScreen_application
;--------------------------------------
@ -207,7 +207,7 @@ align 4
prod:
; cmp eax,0x20000
; je start_menu_application
; cmp eax,0x40000
; je start_menu_application
@ -312,7 +312,7 @@ start_run_application:
align 4
@@:
mov [start_menu_flag],1
mov esi,run_name
call algorithm_anti_duplication
test eax,eax
@ -375,7 +375,7 @@ align 4
jnz @r
add esi,2
mov edx,esi
mov edi,1
;--------------------------------------
align 4
@ -391,7 +391,7 @@ align 4
; and eax,not 20202020h
; cmp eax,'SCRS'
; jz @f
; mov eax,[ebx+14]
; and eax,not 20202020h
; cmp eax,'HOOT'
@ -619,13 +619,13 @@ exit:
START:
mcall 68,11
mcall 66,1,1
mcall 9,process_info_buffer,-1
mov ecx,[ebx+30] ; PID
mcall 18,21
mov [my_active_slot],eax ; WINDOW SLOT
load_libraries l_libs_start,end_l_libs
test eax,eax
@ -634,15 +634,15 @@ load_libraries l_libs_start,end_l_libs
call Get_ini
mcall 48,1,[button_style]
mcall 66,4,0,2 ; LShift+RShift
mcall 66,,,11h ; Ctrl+Shift
mcall 66,,88,110h ; Alt+Ctrl+F12
; mcall 66,,75 ; Alt+Ctrl+ArrowLeft DOWN
mcall 66,,203 ; Alt+Ctrl+ArrowLeft UP
; mcall 66,,203 ; Alt+Ctrl+ArrowLeft UP
; mcall 66,,77 ; Alt+Ctrl+ArrowRight DOWN
mcall 66,,205 ; Alt+Ctrl+ArrowRight UP
; mcall 66,,205 ; Alt+Ctrl+ArrowRight UP
mcall 66,,91,0h ; RWin DOWN
mcall 66,,92 ; LWin DOWN
mcall 66,,219 ; RWin UP
@ -735,7 +735,7 @@ align 4
align 4
@@:
mcall 23,20
push eax
mcall 18,7
cmp [my_active_slot],eax
@ -746,7 +746,7 @@ align 4
align 4
@@:
pop eax
cmp eax,1 ; redraw ?
jz red
@ -760,7 +760,7 @@ align 4
align 4
@@:
pop eax
cmp eax,2
jnz @f
call handle_key
@ -802,7 +802,7 @@ align 4
mov edx, eax
;--------------------------------------
align 4
.selected:
.selected:
mcall 48,6
ret
;------------------------------------------------------------------------------
@ -860,7 +860,7 @@ button:
shl ecx,2
mov ecx,[app_list+ecx]
mcall 9,process_info_buffer
test [ebx+70],dword 10b ; window is minimized to panel
@ -882,7 +882,7 @@ align 4
align 4
.task_switching:
mcall 68,1
jmp still
jmp still
;------------------------------------------------------------------------------
align 4
right_mouse:
@ -941,10 +941,10 @@ no_activate:
;--------------------------------------
align 4
clean_desktop_1:
call clean_desktop
call clean_desktop
jmp still
;--------------------------------------
align 4
align 4
noselect:
mov ebx, exec_fileinfo
cmp ah,byte 2 ; start calendar
@ -955,7 +955,7 @@ noselect:
test eax,eax
jz @f
mcall 18,2,edi
mcall 18,2,edi
jmp still
;--------------------------------------
align 4
@ -965,7 +965,7 @@ align 4
mcall 70
jmp still
;--------------------------------------
align 4
align 4
noid15:
cmp ah,16
jne noid16
@ -977,7 +977,7 @@ noid15:
call draw_flag ; language
jmp still
;--------------------------------------
align 4
align 4
noid16:
; cmp ah,17
; jne noid17
@ -987,7 +987,7 @@ noid16:
; mcall 70
; jmp still
;--------------------------------------
;align 4
;align 4
; noid17:
cmp ah,18
jne noid18
@ -1000,14 +1000,14 @@ noid16:
mcall 18,2,edi
jmp still
;--------------------------------------
align 4
align 4
@@:
mov ebx, exec_fileinfo
mov dword [ebx+21], sysmeter_name
mcall 70
jmp still
;--------------------------------------
align 4
align 4
noid18:
; cmp ah,19 ; speaker
; jne noid19
@ -1016,7 +1016,7 @@ noid18:
; mcall 15,3
; jmp red
;--------------------------------------
;align 4
;align 4
;noid19:
; cmp ah,20 ; start system setup
; jnz noid20
@ -1026,7 +1026,7 @@ noid18:
; mcall 70
; jmp still
;--------------------------------------
;align 4
;align 4
;noid20:
cmp ah,21
jnz noid21
@ -1036,7 +1036,7 @@ noid18:
inc [page_list]
jmp red
;--------------------------------------
align 4
align 4
noid21:
cmp ah,22
jnz still
@ -1054,7 +1054,7 @@ restore_desktop:
mov ecx, 2
mov edx, 2
;--------------------------------------
align 4
align 4
@@:
mcall 18, 22
inc edx
@ -1105,28 +1105,28 @@ align 4
align 4
menu_handler:
mov edi,bootparam
mov eax,[menu_button_x.start]
call conversion_HEX_to_ASCII
mov eax,[menu_button_x.size]
call conversion_HEX_to_ASCII
mov eax,[menu_button_y.start]
call conversion_HEX_to_ASCII
mov eax,[menu_button_y.size]
call conversion_HEX_to_ASCII
mov eax,[height]
call conversion_HEX_to_ASCII
mov eax,[place_attachment]
call conversion_HEX_to_ASCII
xor eax,eax ; terminator for boot parameters string
stosd
mov ebx, exec_fileinfo
mov [ebx+21],dword menu_name
mov [ebx+8],dword bootparam