Subversion Repositories Kolibri OS

Rev

Rev 374 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 374 Rev 376
Line 3... Line 3...
3
include "snd.inc"
3
include "snd.inc"
4
include "proc32.inc"
4
include "proc32.inc"
Line 5... Line 5...
5
 
5
 
Line 6... Line 6...
6
section '.text' align 16 code readable executable
6
section '.text' align 16 code readable executable
7
 
7
 
8
public _InitSound@0
8
public _InitSound@4
Line 9... Line 9...
9
public _CreateBuffer@8
9
public _CreateBuffer@12
10
public _DestroyBuffer@4
-
 
11
 
-
 
12
align 4
-
 
13
proc _InitSound@0
-
 
14
           locals
-
 
15
             handle     dd ?
10
public _DestroyBuffer@4
16
             io_code    dd ?
-
 
17
             input      dd ?
-
 
18
             inp_size   dd ?
-
 
Line 19... Line 11...
19
             output     dd ?
11
 
20
             out_size   dd ?
12
align 4
-
 
13
_InitSound@4:       ;p_ver:dword
21
           endl
14
 
22
 
15
           push ebx
23
           push ebx
16
           push ecx
24
           push ecx
17
 
25
           mov eax, 68
18
           mov eax, 68
26
           mov ebx, 16
19
           mov ebx, 16
27
           mov ecx, szInfinity
20
           mov ecx, szInfinity
28
           int 0x40
21
           int 0x40
29
           mov [hSound], eax
22
           mov [hSound], eax
30
           test eax, eax
23
           test eax, eax
31
           jz .fail
24
           jz .fail
32
           
25
 
33
           mov eax, 68
26
           mov eax, 68
34
           mov ebx, 16
27
           mov ebx, 16
35
           mov ecx, szSound
28
           mov ecx, szSound
36
           int 0x40
29
           int 0x40
Line 37... Line 30...
37
           mov [hrdwSound], eax
30
           mov [hrdwSound], eax
38
           
31
 
39
           mov eax, [hSound]
32
           lea eax, [esp+12]   ;p_ver
40
           xor ebx, ebx
33
           xor ebx, ebx
41
 
34
 
42
           mov [handle], eax
35
           push 4              ;.out_size
43
           mov [io_code], SRV_GETVERSION
36
           push eax            ;.output
44
           mov [input], ebx
37
           push ebx            ;.inp_size
45
           mov [inp_size], ebx
38
           push ebx            ;.input
46
           mov [output], ebx
39
           push SRV_GETVERSION ;.code
47
           mov [out_size], ebx
40
           push [hSound]       ;.handle
-
 
41
 
-
 
42
           mov eax, 68
-
 
43
           mov ebx, 17
-
 
44
           mov ecx, esp        ;[handle]
48
           
45
           int 0x40
49
           mov eax, 68
-
 
50
           mov ebx, 17
46
           add esp, 24
51
           lea ecx, [handle]
47
           pop ecx  
52
           int 0x40
48
           pop ebx
53
.fail:     
49
           ret 4
54
 
-
 
Line 55... Line 50...
55
.done:
50
.fail:
56
           pop ecx  
51
           or eax, -1 
57
           pop ebx
-
 
58
           ret
-
 
59
endp
-
 
60
 
-
 
61
 
-
 
62
align 4
-
 
63
proc _CreateBuffer@8 stdcall, format:dword, size:dword
-
 
64
           locals
-
 
Line 65... Line 52...
65
             handle     dd ?
52
           pop ecx  
66
             io_code    dd ?
53
           pop ebx
67
             input      dd ?
54
           ret 4
68
             inp_size   dd ?
55
 
69
             output     dd ?
-
 
70
             out_size   dd ?
56
 
71
           endl
57
align 4
72
 
58
_CreateBuffer@12:   ;format:dword,size:dword,p_str:dword
73
           push ebx
59
 
74
           push ecx
60
           push ebx
75
           mov eax, [hSound]
61
           push ecx
76
           lea ebx, [format]
62
           lea eax, [esp+20]   ;p_str
77
           xor ecx, ecx
63
           lea ebx, [esp+12]   ;format
78
 
64
 
79
           mov [handle], eax
65
           push 4              ;.out_size
80
           mov [io_code], SND_CREATE_BUFF
66
           push eax            ;.output
81
           mov [input], ebx
67
           push 8              ;.inp_size
-
 
68
           push ebx            ;.input
82
           mov [inp_size], 4
69
           push SND_CREATE_BUFF;.code
83
           mov [output], ecx
70
           push [hSound]       ;.handle
84
           mov [out_size], ecx
71
 
85
           
-
 
Line 86... Line 72...
86
           mov eax, 68
72
           mov eax, 68
87
           mov ebx, 17
73
           mov ebx, 17
88
           lea ecx, [handle]
-
 
89
           int 0x40
-
 
90
           pop ecx
-
 
91
           pop ebx
-
 
92
           ret
-
 
93
endp
-
 
94
 
-
 
95
align 4
-
 
Line 96... Line 74...
96
proc _DestroyBuffer@4 stdcall, str:dword
74
           mov ecx, esp
97
           locals
75
           int 0x40
98
             handle     dd ?
76
           add esp, 24       ;io_cintrol 
99
             io_code    dd ?
77
           pop ecx
100
             input      dd ?
78
           pop ebx
101
             inp_size   dd ?
-
 
102
             output     dd ?
79
           ret 12
103
             out_size   dd ?
80
 
104
           endl
81
align 4
105
 
82
_DestroyBuffer@4:     ;str:dword
106
           push ebx
83
 
107
           push ecx
84
           push ebx
108
           
85
           push ecx
Line 109... Line 86...
109
           mov eax, [hSound]
86
 
110
           lea ebx, [str]
87
           xor eax, eax
111
           xor ecx, ecx
88
           lea ebx, [esp+12]   ;[stream]
112
 
89
 
-
 
90
           push eax            ;.out_size
113
           mov [handle], eax
91
           push eax            ;.output
114
           mov [io_code], SND_DESTROY_BUFF
92
           push 4              ;.inp_size
115
           mov [input], ebx
93
           push ebx            ;.input
116
           mov [inp_size], 4
94
           push SND_DESTROY_BUFF;.code
Line 117... Line 95...
117
           mov [output], ecx
95
           push [hSound]       ;.handle
Line 118... Line 96...
118
           mov [out_size], ecx
96
 
119
 
97
           mov eax, 68