Subversion Repositories Kolibri OS

Rev

Rev 168 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 168 Rev 378
Line 65... Line 65...
65
 
65
 
Line 66... Line 66...
66
        xor eax, eax
66
        xor eax, eax
67
        stdcall codec_write, dword CODEC_AUX_VOL
67
        stdcall codec_write, dword CODEC_AUX_VOL
Line 68... Line 68...
68
 
68
 
69
        mov eax, 0x1010
69
        mov eax, 0x0B0B
Line 70... Line 70...
70
        stdcall codec_write, dword CODEC_MASTER_VOL_REG
70
        stdcall codec_write, dword CODEC_MASTER_VOL_REG
71
 
71
 
Line 96... Line 96...
96
.init_error:
96
.init_error:
Line 97... Line 97...
97
 
97
 
98
	xor    eax, eax 			  ; exit with error
98
	xor    eax, eax 			  ; exit with error
99
	ret
-
 
100
 
99
	ret
Line 101... Line -...
101
endp
-
 
102
 
-
 
Line 103... Line 100...
103
align 4
100
endp
-
 
101
 
-
 
102
 
104
proc set_master_vol stdcall, vol:dword
103
; param
105
 
104
;  eax= volume  -10000 - 0 for both channels
106
	   mov ebx, 63
105
 
107
	   mov ecx, 20644
106
align 4
108
	   mov eax, [vol]
107
set_master_vol:
-
 
108
           cmp eax, 0
109
	   cmp eax, 90
109
           jl @F
-
 
110
           xor eax, eax
110
	   jna @f
111
           jmp .set
-
 
112
@@:
-
 
113
           cmp eax, -9450
111
	   mov eax, 90
114
           jg .set
112
@@:
115
           mov eax, -9450     ;clamp into 6 bits
113
	   mul ecx
116
.set:
114
	   shr eax, 15
117
           cdq
115
	   sub ebx, eax
118
           mov ebx, -150
-
 
119
           idiv ebx
116
	   mov ah, bl
120
           mov ah, al
117
	   mov al, bl
-
 
Line 118... Line 121...
118
	   stdcall codec_write, dword CODEC_MASTER_VOL_REG
121
	   stdcall codec_write, dword CODEC_MASTER_VOL_REG
119
	   ret
122
           xor eax, eax
Line 120... Line 123...
120
endp
123
	   ret
121
 
124
 
122
align 4
-
 
123
proc get_master_vol stdcall, pvol:dword
-
 
124
 
-
 
125
	   stdcall codec_read, dword CODEC_MASTER_VOL_REG
-
 
126
	   and eax, 0x3F
-
 
127
	   mov ebx, 63
125
align 4
128
	   mov ecx, 20644
-
 
129
 
-
 
130
	   xchg eax, ebx
126
proc get_master_vol stdcall, pvol:dword
131
	   sub eax, ebx
127
 
-
 
128
	   stdcall codec_read, dword CODEC_MASTER_VOL_REG
132
	   shl eax, 15
129
	   and eax, 0x3F
133
	   xor edx, edx
130
           imul eax, -150
Line 134... Line 131...
134
	   div ecx
131
           mov ebx, [pvol]
135
           mov ebx, [pvol]
132
           mov [ebx], eax