Subversion Repositories Kolibri OS

Rev

Rev 368 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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