Subversion Repositories Kolibri OS

Rev

Rev 293 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;   This file is part of the Infinity sound library.
  3. ;   (C) copyright Serge 2006
  4. ;   email: infinity_sound@mail.ru
  5. ;
  6. ;   This program is free software; you can redistribute it and/or modify
  7. ;   it under the terms of the GNU General Public License as published by
  8. ;   the Free Software Foundation; either version 2 of the License, or
  9. ;   (at your option) any later version.
  10. ;
  11. ;   This program is distributed in the hope that it will be useful,
  12. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;   GNU General Public License for more details.
  15.  
  16. format MS COFF
  17.  
  18. include 'proc32.inc'
  19. include 'main.inc'
  20. include 'imports.inc'
  21.  
  22. FORCE_MMX        equ 0  ;set to 1 to force use mmx or
  23. FORCE_MMX_128    equ 0  ;integer sse2 extensions
  24.                         ;and reduce driver size
  25. ;USE_SSE         equ 0
  26.  
  27. DEBUG            equ 1
  28.  
  29. EVENT_NOTIFY     equ 0x00000200
  30.  
  31. OS_BASE          equ 0
  32. new_app_base     equ 0x60400000
  33. PROC_BASE        equ OS_BASE+0x0080000
  34.  
  35. CAPS_SSE2        equ 26
  36. PG_SW            equ 0x003
  37.  
  38.  
  39. public START
  40. public service_proc
  41. public version
  42.  
  43. SND_CREATE_BUFF     equ 2
  44. SND_PLAY            equ 3
  45. SND_STOP            equ 4
  46. SND_SETBUFF         equ 5
  47. SND_DESTROY_BUFF    equ 6
  48.  
  49. DEV_PLAY            equ 1
  50. DEV_STOP            equ 2
  51. DEV_CALLBACK        equ 3
  52.  
  53. struc IOCTL
  54. {  .handle           dd ?
  55.    .io_code          dd ?
  56.    .input            dd ?
  57.    .inp_size         dd ?
  58.    .output           dd ?
  59.    .out_size         dd ?
  60. }
  61.  
  62. virtual at 0
  63.   IOCTL IOCTL
  64. end virtual
  65.  
  66. section '.flat' code readable align 16
  67.  
  68. proc START stdcall, state:dword
  69.  
  70.            cmp [state], 1
  71.            jne .exit
  72.  
  73.            stdcall GetService, szSound
  74.            test eax, eax
  75.            jz .fail
  76.            mov [hSound], eax
  77.  
  78.            stdcall KernelAlloc, 16*512
  79.            test eax, eax
  80.            jz .out_of_mem
  81.            mov [mix_buff], eax
  82.  
  83.            mov eax, str.fd-FD_OFFSET
  84.            mov [str.fd], eax
  85.            mov [str.bk], eax
  86.  
  87. if FORCE_MMX
  88.  if FORCE_MMX_128
  89.   display 'Use only FORCE_MMX or FORCE_MMX_128 not both together',13,10
  90.   stop
  91.  end if
  92.            mov [mix_2_core], mmx_mix_2
  93.            mov [mix_3_core], mmx_mix_3
  94.            mov [mix_4_core], mmx_mix_4
  95. end if
  96.  
  97. if FORCE_MMX_128
  98.  if FORCE_MMX
  99.   display 'Use only FORCE_MMX or FORCE_MMX_128 not both together',13,10
  100.   stop
  101.  end if
  102.            mov [mix_2_core], mmx128_mix_2
  103.            mov [mix_3_core], mmx128_mix_3
  104.            mov [mix_4_core], mmx128_mix_4
  105. end if
  106.  
  107. if ~(FORCE_MMX or FORCE_MMX_128)  ;autodetect
  108.            mov eax, 1
  109.            cpuid
  110.            bt edx, CAPS_SSE2
  111.            jc .mmx128
  112.                                            ;old 64-bit mmx
  113.            mov [mix_2_core], mmx_mix_2
  114.            mov [mix_3_core], mmx_mix_3
  115.            mov [mix_4_core], mmx_mix_4
  116.            jmp @F
  117. .mmx128:                                   ;128-bit integer sse2 extensions
  118.            mov [mix_2_core], mmx128_mix_2
  119.            mov [mix_3_core], mmx128_mix_3
  120.            mov [mix_4_core], mmx128_mix_4
  121. @@:
  122. end if
  123.            stdcall set_handler, [hSound], new_mix
  124.            stdcall RegService, szInfinity, service_proc
  125.            ret
  126. .fail:
  127.      if DEBUG
  128.            mov esi, msgFail
  129.            call SysMsgBoardStr
  130.      end if
  131. .exit:
  132.            xor eax, eax
  133.            ret
  134.  
  135. .out_of_mem:
  136.      if DEBUG
  137.            mov esi, msgMem
  138.            call SysMsgBoardStr
  139.      end if
  140.            xor eax, eax
  141.            ret
  142. endp
  143.  
  144. handle     equ  IOCTL.handle
  145. io_code    equ  IOCTL.io_code
  146. input      equ  IOCTL.input
  147. inp_size   equ  IOCTL.inp_size
  148. output     equ  IOCTL.output
  149. out_size   equ  IOCTL.out_size
  150.  
  151. align 4
  152. proc service_proc stdcall, ioctl:dword
  153.  
  154.            mov edi, [ioctl]
  155.            mov eax, [edi+io_code]
  156.  
  157.            cmp eax, SND_CREATE_BUFF
  158.            jne @F
  159.            mov ebx, [edi+input]
  160.            stdcall CreateBuffer,[ebx]
  161.            ret
  162. @@:
  163.            cmp eax, SND_PLAY
  164.            jne @F
  165.  
  166.            mov ebx, [edi+input]
  167.            stdcall play_buffer, [ebx]
  168.            ret
  169. @@:
  170.            cmp eax, SND_STOP
  171.            jne @F
  172.  
  173. ;       if DEBUG
  174. ;          mov esi, msgStop
  175. ;          call   [SysMsgBoardStr]
  176. ;       end if
  177.  
  178.            mov ebx, [edi+input]
  179.            stdcall stop_buffer, [ebx]
  180.            ret
  181. @@:
  182.            cmp eax, SND_SETBUFF
  183.            jne @F
  184.  
  185.            mov ebx, [edi+input]
  186.            mov eax, [ebx+4]
  187.            add eax, new_app_base
  188.            stdcall set_buffer, [ebx],eax,[ebx+8],[ebx+12]
  189.            ret
  190. @@:
  191.            cmp eax, SND_DESTROY_BUFF
  192.            jne @F
  193.  
  194.            mov eax, [edi+input]
  195.            mov eax, [eax]
  196.            call DestroyBuffer    ;eax
  197.            ret
  198. @@:
  199.            xor eax, eax
  200.            ret
  201. endp
  202.  
  203. restore   handle
  204. restore   io_code
  205. restore   input
  206. restore   inp_size
  207. restore   output
  208. restore   out_size
  209.  
  210. TASK_COUNT    equ 0x0003004
  211. CURRENT_TASK  equ 0x0003000
  212.  
  213. align 4
  214. proc CreateBuffer stdcall, format:dword
  215.            locals
  216.              str dd ?
  217.            endl
  218.  
  219.            mov ebx, [CURRENT_TASK]      ;hack: direct accsess
  220.            shl ebx, 5                   ;to kernel data
  221.            mov ebx, [0x3000+ebx+4]
  222.            mov eax, STREAM_SIZE
  223.  
  224.            call CreateObject
  225.            test eax, eax
  226.            jz .fail
  227.            mov [str], eax
  228.  
  229.            mov [eax+STREAM.magic], 'WAVE'
  230.            mov [eax+STREAM.destroy], DestroyBuffer.destroy
  231.            mov [eax+STREAM.size], STREAM_SIZE
  232.  
  233.            pushf
  234.            cli
  235.            mov ebx, str.fd-FD_OFFSET
  236.            mov edx, [ebx+STREAM.str_fd]
  237.            mov [eax+STREAM.str_fd], edx
  238.            mov [eax+STREAM.str_bk], ebx
  239.            mov [ebx+STREAM.str_fd], eax
  240.            mov [edx+STREAM.str_bk], eax
  241.            popf
  242.  
  243.            stdcall KernelAlloc, dword 72*1024
  244.  
  245.            mov edi, [str]
  246.            mov [edi+STREAM.base], eax
  247.            add eax, 0x1000
  248.            mov [edi+STREAM.seg_0], eax
  249.            mov [edi+STREAM.curr_seg], eax
  250.            mov [edi+STREAM.notify_off1], eax
  251.            add eax, 0x8000
  252.            mov [edi+STREAM.lim_0], eax
  253.            add eax, 0x1000
  254.            mov [edi+STREAM.seg_1], eax
  255.            mov [edi+STREAM.notify_off2], eax
  256.            add eax, 0x8000
  257.            mov [edi+STREAM.limit], eax
  258.            mov [edi+STREAM.lim_1], eax
  259.  
  260. ; create ring buffer
  261.  
  262.            stdcall AllocKernelSpace, dword 128*1024
  263.  
  264.            mov edi, [str]
  265.            mov [edi+STREAM.work_buff], eax
  266.            mov [edi+STREAM.work_read], eax
  267.            mov [edi+STREAM.work_write], eax
  268.            mov [edi+STREAM.work_count], 0
  269.            add eax, 64*1024
  270.            mov [edi+STREAM.work_top], eax
  271.  
  272.            stdcall AllocPages, dword 64/4
  273.            mov edi, [str]
  274.            mov ebx, [edi+STREAM.work_buff]
  275.            mov ecx, 16
  276.            or eax, PG_SW
  277.            push eax
  278.            push ebx
  279.            call CommitPages ;eax, ebx, ecx
  280.            mov ecx, 16
  281.            pop ebx
  282.            pop eax
  283.            add ebx, 64*1024
  284.            call CommitPages    ;double mapped
  285.  
  286.            mov edi, [str]
  287.            mov eax, [format]
  288.            mov [edi+STREAM.format], eax
  289.            mov [edi+STREAM.flags], SND_STOP
  290.  
  291.            xor ebx, ebx
  292.            cmp eax, 19
  293.            jb @f
  294.            mov ebx, 0x80808080
  295. @@:
  296.            mov [edi+STREAM.r_silence], ebx
  297.  
  298.            shl eax, 4
  299.            mov ebx, [resampler_params+eax]
  300.            mov ecx, [resampler_params+eax+4]
  301.            mov edx, [resampler_params+eax+8]
  302.  
  303.            mov [edi+STREAM.r_size],ebx
  304.            mov [edi+STREAM.r_end], ecx
  305.            mov [edi+STREAM.r_dt],  edx
  306.  
  307.            mov ebx, [resampler_params+eax+12]
  308.            mov [edi+STREAM.resample], ebx
  309.  
  310.            mov edx, [edi+STREAM.base]
  311.            lea eax, [edx+0x9000]
  312.            call GetPgAddr  ;eax
  313.            call FreePage   ;eax
  314.  
  315.            mov eax, edx
  316.            lea ebx, [edx+0x9000]
  317.            call GetPgAddr  ;eax
  318.            stdcall MapPage, ebx, eax, dword 3
  319.  
  320.            mov edi, [edi+STREAM.base]
  321.            mov ecx, (72*1024)/4
  322.            xor eax, eax
  323.            cld
  324.            rep stosd
  325.  
  326.            mov edi, [str]
  327.            mov edi, [edi+STREAM.work_buff]
  328.            mov ecx, (64*1024)/4
  329.            rep stosd
  330.  
  331.            mov eax, [str]
  332.            ret
  333. .fail:
  334.            xor eax, eax
  335.            ret
  336. endp
  337.  
  338. if 0
  339. align 4
  340. pid_to_slot:
  341.  
  342.            push   ebx
  343.            push   ecx
  344.            mov    ebx,[TASK_COUNT]
  345.            shl    ebx,5
  346.            mov    ecx,2*32
  347. .loop:
  348.            cmp    byte [CURRENT_TASK+ecx+0xa],9
  349.            jz     .endloop              ;skip empty slots
  350.            cmp    [CURRENT_TASK+ecx+0x4],eax ;check PID
  351.            jz     .pid_found
  352. .endloop:
  353.            add    ecx,32
  354.            cmp    ecx,ebx
  355.            jle    .loop
  356.            pop    ecx
  357.            pop    ebx
  358.            xor    eax,eax
  359.            ret
  360.  
  361. .pid_found:
  362.            shr    ecx,5
  363.            mov    eax,ecx
  364.            pop    ecx
  365.            pop    ebx
  366.            ret
  367.  
  368. end if
  369.  
  370. ;param
  371. ; eax= buffer handle
  372.  
  373. align 4
  374. DestroyBuffer:
  375.            .handle  equ esp       ;local
  376.  
  377.            cmp [eax+STREAM.magic], 'WAVE'
  378.            jne .fail
  379.  
  380.            cmp [eax+STREAM.size], STREAM_SIZE
  381.            jne .fail
  382. .destroy:
  383.            push eax
  384.  
  385.            pushf
  386.            cli
  387.            mov ebx, [eax+STREAM.str_fd]
  388.            mov ecx, [eax+STREAM.str_bk]
  389.            mov [ebx+STREAM.str_bk], ecx
  390.            mov [ecx+STREAM.str_fd], ebx
  391.            popf
  392.  
  393.            stdcall KernelFree, [eax+STREAM.base]
  394.            mov eax, [.handle]
  395.            stdcall KernelFree, [eax+STREAM.work_buff]
  396.  
  397.            pop eax               ;restore stack
  398.            call DestroyObject    ;eax
  399. .fail:
  400.            ret
  401.  
  402. align 4
  403. proc play_buffer stdcall, str:dword
  404.  
  405.            mov ebx, [str]
  406.            cmp [ebx+STREAM.magic], 'WAVE'
  407.            jne .fail
  408.  
  409.            cmp [ebx+STREAM.size], STREAM_SIZE
  410.            jne .fail
  411.  
  412.            mov edi,[ebx+STREAM.work_buff]
  413.            mov [ebx+STREAM.work_read], edi
  414.            mov [ebx+STREAM.work_write], edi
  415.            mov [ebx+STREAM.work_count], 0
  416.  
  417.            mov edx, [ebx+STREAM.base]
  418.            add edx, 0x1000
  419.            mov [ebx+STREAM.seg_0], edx
  420.            mov [ebx+STREAM.curr_seg], edx
  421.            add edx, 0x8000
  422.            mov [ebx+STREAM.lim_0], edx
  423.            add edx, 0x1000
  424.            mov [ebx+STREAM.seg_1], edx
  425.            add edx, 0x8000
  426.            mov [ebx+STREAM.lim_1], edx
  427.  
  428.            mov edx, [ebx+STREAM.seg_0]
  429.            mov ecx, -128
  430.            mov eax, [ebx+STREAM.r_silence]
  431. @@:
  432.            mov [edx+ecx], eax
  433.            add ecx, 4
  434.            jnz @B
  435.  
  436.            stdcall [ebx+STREAM.resample], edi, edx,\
  437.            [ebx+STREAM.r_dt],[ebx+STREAM.r_size],[ebx+STREAM.r_end]
  438.  
  439.            mov ebx, [str]
  440.  
  441.            add [ebx+STREAM.work_count], eax
  442.            add [ebx+STREAM.work_write], eax
  443.  
  444.            mov edx, [ebx+STREAM.r_size]
  445.            add [ebx+STREAM.curr_seg], edx
  446.  
  447.            mov [ebx+STREAM.flags], SND_PLAY
  448.  
  449.            mov eax, [ebx+STREAM.r_silence]
  450.            mov edi, [ebx+STREAM.work_write]
  451.            mov ecx, [ebx+STREAM.work_top]
  452.            sub ecx, edi
  453.            shr ecx, 2
  454.            cld
  455.            rep stosd
  456.  
  457.            stdcall  dev_play, [hSound]
  458.            xor eax, eax
  459.            inc eax
  460.            ret
  461. .fail:
  462.            xor eax, eax
  463.            ret
  464. endp
  465.  
  466. align 4
  467. proc stop_buffer stdcall, str:dword
  468.  
  469.            mov edi, [str]
  470.  
  471.            cmp [edi+STREAM.magic], 'WAVE'
  472.            jne .fail
  473.  
  474.            cmp [edi+STREAM.size], STREAM_SIZE
  475.            jne .fail
  476.  
  477.            mov [edi+STREAM.flags], SND_STOP
  478.  
  479. ;           stdcall [ServiceHandler], [hSound], dword DEV_STOP, 0
  480.  
  481.            xor eax, eax
  482.            inc eax
  483.            ret
  484. .fail:
  485.            xor eax, eax
  486.            ret
  487. endp
  488.  
  489. align 4
  490. proc set_buffer stdcall, str:dword,src:dword,offs:dword,size:dword
  491.  
  492.            mov edx, [str]
  493.            test edx, edx
  494.            jz .fail
  495.  
  496.            cmp [edx+STREAM.magic], 'WAVE'
  497.            jne .fail
  498.  
  499.            cmp [edx+STREAM.size], STREAM_SIZE
  500.            jne .fail
  501.  
  502.            mov esi,[src]
  503.            test esi, esi
  504.            jz .fail
  505.  
  506.            cmp esi, new_app_base
  507.            jb .fail
  508.  
  509.            mov edi, [offs]
  510.            mov ecx, 0x8000
  511.  
  512.            sub ecx, edi
  513.            jbe .seg_1
  514.  
  515.            sub [size], ecx
  516.            jb .fail
  517.  
  518.            add edi, [edx+STREAM.base]
  519.            add edi, 0x1000
  520.            shr ecx, 2
  521.            cld
  522.            rep movsd
  523.            jmp @F
  524. .seg_1:
  525.            add edi, [edx+STREAM.base]
  526.            add edi, 0x1000
  527. @@:
  528.            add edi, 0x1000
  529.            mov ecx, [size]
  530.            test ecx, ecx
  531.            jz .done
  532.            cmp ecx, 0x8000
  533.            ja .fail
  534.  
  535.            shr ecx, 2
  536.            rep movsd
  537. .done:
  538.            xor eax, eax
  539.            inc eax
  540.            ret
  541. .fail:
  542.            xor eax, eax
  543.            ret
  544. endp
  545.  
  546. align 4
  547. prepare_playlist:
  548.  
  549.            xor edx, edx
  550.            mov [play_count], edx
  551.            mov esi, str.fd-FD_OFFSET
  552.            mov edi, [esi+STREAM.str_fd]
  553. @@:
  554.            cmp edi, esi
  555.            je .done
  556.  
  557.            cmp [edi+STREAM.magic], 'WAVE'
  558.            jne .next
  559.  
  560.            cmp [edi+STREAM.size], STREAM_SIZE
  561.            jne .next
  562.  
  563.            cmp [edi+STREAM.flags], SND_PLAY;
  564.            jne .next
  565.            cmp [edi+STREAM.work_count], 16384
  566.            jb .next
  567.  
  568.            mov [play_list+edx], edi
  569.            inc [play_count]
  570.            add edx, 4
  571. .next:
  572.            mov edi, [edi+STREAM.str_fd]
  573.            jmp @B
  574. .done:
  575.            ret
  576.  
  577. align 4
  578. proc set_handler stdcall, hsrv:dword, handler_proc:dword
  579.            locals
  580.              handler    dd ?
  581.              io_code    dd ?
  582.              input      dd ?
  583.              inp_size   dd ?
  584.              output     dd ?
  585.              out_size   dd ?
  586.              val        dd ?
  587.            endl
  588.  
  589.            mov eax, [hsrv]
  590.            lea ecx, [handler_proc]
  591.            xor ebx, ebx
  592.  
  593.            mov [handler], eax
  594.            mov [io_code], DEV_CALLBACK
  595.            mov [input], ecx
  596.            mov [inp_size], 4
  597.            mov [output], ebx
  598.            mov [out_size], 0
  599.  
  600.            lea eax, [handler]
  601.            stdcall ServiceHandler, eax
  602.            ret
  603. endp
  604.  
  605. align 4
  606. proc dev_play stdcall, hsrv:dword
  607.            locals
  608.              handle     dd ?
  609.              io_code    dd ?
  610.              input      dd ?
  611.              inp_size   dd ?
  612.              output     dd ?
  613.              out_size   dd ?
  614.              val        dd ?
  615.            endl
  616.  
  617.            mov eax, [hsrv]
  618.            xor ebx, ebx
  619.  
  620.            mov [handle], eax
  621.            mov [io_code], DEV_PLAY
  622.            mov [input], ebx
  623.            mov [inp_size], ebx
  624.            mov [output], ebx
  625.            mov [out_size], ebx
  626.  
  627.            lea eax, [handle]
  628.            stdcall ServiceHandler, eax
  629.            ret
  630. endp
  631.  
  632. include 'mixer.asm'
  633. include 'mix_mmx.inc'
  634. include 'mix_sse2.inc'
  635.  
  636. ;if USE_SSE
  637. ; include 'mix_sse.inc'
  638. ;end if
  639.  
  640. align 16
  641. resampler_params:
  642.      ;r_size    r_end   r_dt   resampler_func
  643.      dd 0,0,0,0                                  ; 0  PCM_ALL
  644.      dd 16384,          0,     0, copy_stream    ; 1  PCM_2_16_48
  645.      dd 16384,          0,     0, m16_stereo     ; 2  PCM_1_16_48
  646.  
  647.      dd 16384, 0x08000000, 30109, resample_2     ; 3  PCM_2_16_44
  648.      dd  8192, 0x08000000, 30109, resample_1     ; 4  PCM_1_16_44
  649.  
  650.      dd 16384, 0x08000000, 21846, resample_2     ; 5  PCM_2_16_32
  651.      dd  8192, 0x08000000, 21846, resample_1     ; 6  PCM_1_16_32
  652.  
  653.      dd 16384, 0x08000000, 16384, resample_2     ; 7  PCM_2_16_24
  654.      dd  8192, 0x08000000, 16384, resample_1     ; 8  PCM_1_16_24
  655.  
  656.      dd  8192, 0x04000000, 15052, resample_2     ; 9  PCM_2_16_22
  657.      dd  4096, 0x04000000, 15052, resample_1     ;10  PCM_1_16_22
  658.  
  659.      dd  8192, 0x04000000, 10923, resample_2     ;11  PCM_2_16_16
  660.      dd  4096, 0x04000000, 10923, resample_1     ;12  PCM_1_16_16
  661.  
  662.      dd  8192, 0x04000000,  8192, resample_2     ;13  PCM_2_16_12
  663.      dd  4096, 0x04000000,  8192, resample_1     ;14  PCM_1_16_12
  664.  
  665.      dd  4096, 0x02000000,  7527, resample_2     ;15  PCM_2_16_11
  666.      dd  2048, 0x02000000,  7527, resample_1     ;16  PCM_1_16_11
  667.  
  668.      dd  4096, 0x02000000,  5462, resample_2     ;17  PCM_2_16_8
  669.      dd  2048, 0x02000000,  5462, resample_1     ;18  PCM_1_16_8
  670.  
  671.      dd 16384,          0,     0, s8_stereo      ;19  PCM_2_8_48
  672.      dd  8192,          0,     0, m8_stereo      ;20  PCM_1_8_48
  673.  
  674.      dd  8192, 0x08000000, 30109, resample_28    ;21  PCM_2_8_44
  675.      dd  4096, 0x08000000, 30109, resample_18    ;22  PCM_1_8_44
  676.  
  677.      dd  8192, 0x08000000, 21846, resample_28    ;23  PCM_2_8_32
  678.      dd  4096, 0x08000000, 21846, resample_18    ;24  PCM_1_8_32
  679.  
  680.      dd  8192, 0x08000000, 16384, resample_28    ;25  PCM_2_8_24
  681.      dd  4096, 0x08000000, 16384, resample_18    ;26  PCM_1_8_24
  682.  
  683.      dd  4096, 0x04000000, 15052, resample_28    ;27  PCM_2_8_22
  684.      dd  2048, 0x04000000, 15052, resample_18    ;28  PCM_1_8_22
  685.  
  686.      dd  4096, 0x04000000, 10923, resample_28    ;29  PCM_2_8_16
  687.      dd  2048, 0x04000000, 10923, resample_18    ;30  PCM_1_8_16
  688.  
  689.      dd  4096, 0x04000000,  8192, resample_28    ;31  PCM_2_8_12
  690.      dd  2048, 0x04000000,  8192, resample_18    ;32  PCM_1_8_12
  691.  
  692.      dd  2048, 0x02000000,  7527, resample_28    ;33  PCM_2_8_11
  693.      dd  1024, 0x02000000,  7527, resample_18    ;34  PCM_1_8_11
  694.  
  695.      dd  2048, 0x02000000,  5462, resample_28    ;35  PCM_2_8_8
  696.      dd  1024, 0x02000000,  5462, resample_18    ;36  PCM_1_8_8
  697.  
  698. m7            dw 0x8000,0x8000,0x8000,0x8000
  699. mm80          dq 0x8080808080808080
  700. mm_mask       dq 0xFF00FF00FF00FF00
  701.  
  702. ;stream_map    dd 0xFFFF       ; 16
  703. version       dd 0x00030004
  704.  
  705. szInfinity    db 'INFINITY',0
  706. szSound       db 'SOUND',0
  707.  
  708. if DEBUG
  709. msgFail       db 'Sound service not loaded',13,10,0
  710. msgPlay       db 'Play buffer',13,10,0
  711. msgStop       db 'Stop',13,10,0
  712. msgUser       db 'User callback',13,10,0
  713. msgMem        db 'Not enough memory',13,10,0
  714. msgDestroy    db 'Destroy sound buffer', 13,10,0
  715. end if
  716.  
  717. section '.data' data readable writable align 16
  718.  
  719. play_list     rd 16
  720. mix_input     rd 16
  721. play_count    rd 1
  722. hSound        rd 1
  723. mix_buff      rd 1
  724. mix_buff_map  rd 1
  725. str.fd        rd 1
  726. str.bk        rd 1
  727.  
  728. mix_2_core    rd 1
  729. mix_3_core    rd 1
  730. mix_4_core    rd 1
  731.  
  732.