Subversion Repositories Kolibri OS

Rev

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

Rev 431 Rev 465
Line 8... Line 8...
8
;   (C) copyright Serge 2006
8
;   (C) copyright Serge 2006
9
;   email: infinity_sound@mail.ru
9
;   email: infinity_sound@mail.ru
Line 10... Line 10...
10
 
10
 
Line -... Line 11...
-
 
11
format MS COFF
-
 
12
 
-
 
13
API_VERSION    equ   0x01000100
-
 
14
SOUND_VERSION  equ   API_VERSION
11
format MS COFF
15
 
12
 
16
 
13
include 'proc32.inc'
17
include 'proc32.inc'
Line 14... Line 18...
14
include 'main.inc'
18
include 'main.inc'
Line 20... Line 24...
20
;USE_SSE          equ 0
24
;USE_SSE          equ 0
Line 21... Line 25...
21
 
25
 
Line 22... Line 26...
22
DEBUG             equ 1
26
DEBUG             equ 1
23
 
27
 
24
 
28
 
-
 
29
OS_BASE           equ 0x80000000
Line 25... Line 30...
25
OS_BASE           equ 0
30
SLOT_BASE         equ (OS_BASE+0x0080000)
26
new_app_base      equ 0x80000000
31
TASK_COUNT        equ (OS_BASE+0x0003004)
Line 27... Line 32...
27
SLOT_BASE         equ OS_BASE+0x0080000
32
CURRENT_TASK      equ (OS_BASE+0x0003000)
Line 157... Line 162...
157
           mov eax, [edi+io_code]
162
           mov eax, [edi+io_code]
Line 158... Line 163...
158
 
163
 
159
           cmp eax, SRV_GETVERSION
164
           cmp eax, SRV_GETVERSION
160
           jne @F
165
           jne @F
-
 
166
           mov eax, [edi+output]
-
 
167
           cmp [edi+out_size], 4
161
           mov eax, [edi+output]
168
           jne .fail
162
           mov eax, [eax]
169
           mov eax, [eax]
163
           mov [eax+new_app_base], dword SOUND_VERSION
170
           mov [eax], dword SOUND_VERSION
164
           xor eax, eax
171
           xor eax, eax
165
           ret
172
           ret
166
@@:
173
@@:
167
           cmp eax, SND_CREATE_BUFF
174
           cmp eax, SND_CREATE_BUFF
Line 170... Line 177...
170
           push edi
177
           push edi
171
           stdcall CreateBuffer,[ebx],[ebx+4]
178
           stdcall CreateBuffer,[ebx],[ebx+4]
172
           pop edi
179
           pop edi
173
           mov ecx, [edi+output]
180
           mov ecx, [edi+output]
174
           mov ecx, [ecx]
181
           mov ecx, [ecx]
175
           mov [ecx+new_app_base], ebx
182
           mov [ecx], ebx
176
           ret
183
           ret
177
@@:
184
@@:
178
           mov ebx, [edi+input]
185
           mov ebx, [edi+input]
179
           mov edx, [ebx]
186
           mov edx, [ebx]
Line 199... Line 206...
199
           jne @F
206
           jne @F
Line 200... Line 207...
200
 
207
 
201
           movzx eax, word [edx+STREAM.format]
208
           movzx eax, word [edx+STREAM.format]
202
           mov ecx, [edi+output]
209
           mov ecx, [edi+output]
203
           mov ecx, [ecx]
210
           mov ecx, [ecx]
204
           mov [ecx+new_app_base], eax
211
           mov [ecx], eax
205
           xor eax, eax
212
           xor eax, eax
206
           ret
213
           ret
207
@@:
214
@@:
208
           cmp eax, SND_RESET
215
           cmp eax, SND_RESET
Line 220... Line 227...
220
           push edi
227
           push edi
221
           stdcall GetBufferPos, [ebx]
228
           stdcall GetBufferPos, [ebx]
222
           pop edi
229
           pop edi
223
           mov ecx, [edi+output]
230
           mov ecx, [edi+output]
224
           mov ecx, [ecx]
231
           mov ecx, [ecx]
225
           mov [ecx+new_app_base], ebx
232
           mov [ecx], ebx
226
           ret
233
           ret
227
@@:
234
@@:
228
           cmp eax, SND_SETBUFF
235
           cmp eax, SND_SETBUFF
229
           jne @F
236
           jne @F
230
           mov eax, [ebx+4]
237
           mov eax, [ebx+4]
231
           add eax, new_app_base
-
 
232
           stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12]
238
           stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12]
233
           ret
239
           ret
234
@@:
240
@@:
235
           cmp eax, SND_SETVOLUME
241
           cmp eax, SND_SETVOLUME
236
           jne @F
242
           jne @F
Line 241... Line 247...
241
           jne @F
247
           jne @F
Line 242... Line 248...
242
 
248
 
243
           mov eax, [edi+output]
249
           mov eax, [edi+output]
244
           mov ecx, [eax]
250
           mov ecx, [eax]
245
           mov eax, [eax+4]
-
 
246
           add ecx, new_app_base
-
 
247
           add eax, new_app_base
251
           mov eax, [eax+4]
248
           stdcall GetBufferVol,[ebx],ecx,eax
252
           stdcall GetBufferVol,[ebx],ecx,eax
249
           ret
253
           ret
250
@@:
254
@@:
251
           cmp eax, SND_SETPAN
255
           cmp eax, SND_SETPAN
Line 256... Line 260...
256
           cmp eax, SND_GETPAN
260
           cmp eax, SND_GETPAN
257
           jne @F
261
           jne @F
258
           mov eax, [edx+STREAM.pan]
262
           mov eax, [edx+STREAM.pan]
259
           mov ebx, [edi+output]
263
           mov ebx, [edi+output]
260
           mov ebx, [ebx]
264
           mov ebx, [ebx]
261
           mov [ebx+new_app_base], eax
265
           mov [ebx], eax
262
           xor eax, eax
266
           xor eax, eax
263
           ret
267
           ret
264
@@:
268
@@:
265
           cmp eax, SND_OUT
269
           cmp eax, SND_OUT
266
           jne @F
270
           jne @F
Line 267... Line 271...
267
 
271
 
268
           mov eax, [ebx+4]
-
 
269
           add eax, new_app_base
272
           mov eax, [ebx+4]
270
           stdcall wave_out, [ebx],eax,[ebx+8]
273
           stdcall wave_out, [ebx],eax,[ebx+8]
271
           ret
274
           ret
272
@@:
275
@@:
273
           cmp eax, SND_PLAY
276
           cmp eax, SND_PLAY
Line 285... Line 288...
285
           cmp eax, SND_GETBUFFSIZE
288
           cmp eax, SND_GETBUFFSIZE
286
           jne @F
289
           jne @F
287
           mov eax, [edx+STREAM.in_size]
290
           mov eax, [edx+STREAM.in_size]
288
           mov ecx, [edi+output]
291
           mov ecx, [edi+output]
289
           mov ecx, [ecx]
292
           mov ecx, [ecx]
290
           mov [ecx+new_app_base], eax
293
           mov [ecx], eax
291
           xor eax, eax
294
           xor eax, eax
292
           ret
295
           ret
293
@@:
296
@@:
294
.fail:
297
.fail:
295
           or eax, -1
298
           or eax, -1
Line 301... Line 304...
301
restore   input
304
restore   input
302
restore   inp_size
305
restore   inp_size
303
restore   output
306
restore   output
304
restore   out_size
307
restore   out_size
Line 305... Line -...
305
 
-
 
306
TASK_COUNT    equ 0x0003004
-
 
307
CURRENT_TASK  equ 0x0003000
-
 
308
 
-
 
309
 
308
 
310
align 4
309
align 4
311
proc CreateBuffer stdcall, format:dword, size:dword
310
proc CreateBuffer stdcall, format:dword, size:dword
312
           locals
311
           locals
313
             str         dd ?
312
             str         dd ?
Line 375... Line 374...
375
           test [format], PCM_STATIC
374
           test [format], PCM_STATIC
376
           jnz .static
375
           jnz .static
Line 377... Line 376...
377
 
376
 
Line 378... Line 377...
378
; ring and waveout
377
; ring and waveout
379
 
378
 
380
           mov eax, 0x10000
379
           mov ebx, 0x10000
Line 381... Line 380...
381
           test [format], PCM_RING
380
           test [format], PCM_RING
382
           jz .waveout
381
           jz .waveout
383
 
382
 
384
           mov eax, [eax+STREAM.r_size]
383
           mov ebx, [eax+STREAM.r_size]
385
           add eax, 4095
384
           add ebx, 4095
386
           and eax, -4096
385
           and ebx, -4096
387
           add eax, eax
386
           add ebx, ebx
388
.waveout:
387
.waveout:
389
           mov [ring_size], eax
388
           mov [ring_size], ebx
Line 390... Line 389...
390
           mov ebx, eax
389
           mov eax, ebx
391
           shr ebx, 12
390
           shr ebx, 12
Line 646... Line 645...
646
 
645
 
647
           mov esi,[src]
646
           mov esi,[src]
648
           test esi, esi
647
           test esi, esi
Line 649... Line 648...
649
           jz .fail
648
           jz .fail
650
 
649
 
Line 651... Line 650...
651
           cmp esi, new_app_base
650
           cmp esi, OS_BASE
Line 652... Line 651...
652
           jb .fail
651
           ja .fail
653
 
652
 
Line 1250... Line 1249...
1250
vol_max       dd 0x00000000,0x00000000
1249
vol_max       dd 0x00000000,0x00000000
1251
vol_min       dd 0x0000D8F0,0x0000D8F0
1250
vol_min       dd 0x0000D8F0,0x0000D8F0
1252
pan_max       dd 0x00002710,0x00002710
1251
pan_max       dd 0x00002710,0x00002710
Line 1253... Line 1252...
1253
 
1252
 
1254
;stream_map    dd 0xFFFF       ; 16
1253
;stream_map    dd 0xFFFF       ; 16
Line 1255... Line 1254...
1255
version       dd (4 shl 16) or (SOUND_VERSION and 0xFFFF)
1254
version       dd (5 shl 16) or (SOUND_VERSION and 0xFFFF)
1256
 
1255
 
Line 1257... Line 1256...
1257
szInfinity    db 'INFINITY',0
1256
szInfinity    db 'INFINITY',0
Line 1282... Line 1281...
1282
 
1281
 
1283
mix_2_core    rd 1
1282
mix_2_core    rd 1
1284
mix_3_core    rd 1
1283
mix_3_core    rd 1
Line -... Line 1284...
-
 
1284
mix_4_core    rd 1
-
 
1285
-
 
1286
-
 
1287
-
 
1288