flat assembler
Message board for the users of flat assembler.

Index > Windows > [WinMM, 2005] bad sound buffer

Author
Thread Post new topic Reply to topic
redasmm



Joined: 14 Oct 2005
Posts: 4
redasmm 28 Oct 2005, 16:14
I cant find whats wrong with the code below...

Code:
format pe gui 4.0
include 'win32a.inc'
;;;;;
section '' code readable executable
mov [wav.wFormatTag],1
mov [wav.nChannels],2
mov [wav.nSamplesPerSec],32000
mov [wav.nAvgBytesPerSec],2
mov [wav.nBlockAlign],2
mov [wav.wBitsPerSample],16
mov [wav.cbSize],0
;
invoke CreateFile,fln,$80000000,0,0,3,0,0
invoke ReadFile,eax,spc,sze,0,0
;
invoke waveOutOpen,han,0,wav,0,0,2+$30000
;
mov [hdr.dwBufferLength],12800
mov [hdr2.dwBufferLength],12800
;
invoke GlobalAlloc,0,12800
mov [hdr.lpData],eax
invoke waveOutPrepareHeader,[han],hdr,32
;
invoke GlobalAlloc,0,12800
mov [hdr2.lpData],eax
invoke waveOutPrepareHeader,[han],hdr2,32
;
invoke LoadSPCFile,spc
invoke EmuAPU,[hdrx.lpData],3200,1
;
invoke waveOutWrite,[han],hdr,32
invoke waveOutWrite,[han],hdr2,32
;
invoke MessageBox,0,fln,fln,0
invoke ExitProcess,0
;
proc XXX,hwnd:DWORD,wmsg:DWORD,dwInstance:DWORD,hdrx:WAVEHDR,lparam:DWORD
push ebx esi edi
cmp [wmsg],$3BD
jne @f
invoke EmuAPU,[hdrx.lpData],3200,1
invoke waveOutWrite,[han],hdrx,32
@@:
pop edi esi ebx
ret
endp
;;;;;
section '' import data readable writable
library kernel32,'kernel32',user32,'user32',winmm,'winmm',snesapu,'\snesapu'
include 'apia\kernel32.inc'
include 'apia\user32.inc'
import winmm,waveOutOpen,'waveOutOpen',waveOutWrite,'waveOutWrite',waveOutPrepareHeader,'waveOutPrepareHeader'
import snesapu,LoadSPCFile,'LoadSPCFile',EmuAPU,'EmuAPU'
;;;;;
section '' data readable writable
struc WAVEFORMATEX
{
.wFormatTag dw ?
.nChannels dw ?
.nSamplesPerSec dd ?
.nAvgBytesPerSec dd ?
.nBlockAlign dw ?
.wBitsPerSample dw ?
.cbSize dw ?
}
wav WAVEFORMATEX
struc WAVEHDR
{
.lpData dd ?
.dwBufferLength dd ?
.dwBytesRecorded dd ?
.dwUser dd ?
.dwFlags dd ?
.dwLoops dd ?
.wavehdr_tag dd ?
.reserved dd ?
}
hdr WAVEHDR
hdr2 WAVEHDR
hdrx WAVEHDR
sze dd 66048
fln db 'C:\x.spc',0
spc rb 66048
han dd ?
    


EDIT by DOS386 : enhanced subject, added code tags, moved topic
Post 28 Oct 2005, 16:14
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1150
Location: Russian Federation
comrade 28 Oct 2005, 16:17
maybe this will help


Description:
Download
Filename: waveplay.zip
Filesize: 57.06 KB
Downloaded: 337 Time(s)


_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 28 Oct 2005, 16:17
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Yardman



Joined: 12 Apr 2005
Posts: 244
Location: US
Yardman 10 Jan 2012, 14:26
[ Post removed by author. ]


Last edited by Yardman on 04 Apr 2012, 04:35; edited 1 time in total
Post 10 Jan 2012, 14:26
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 10 Jan 2012, 14:29
Code tags please. And this should be in Windows section
Post 10 Jan 2012, 14:29
View user's profile Send private message Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 10 Jan 2012, 15:17
Yardman wrote:
I was wanting to bring waveplay.asm up-to-date. I am not getting favorable results from the exe in waveplay.zip. Would someone else take a look at this file to see it it works ok for you? Maybe play a wav file with a player that you already have and compare it to playing it with waveplay.exe?
Seems that 'waveplay.exe' works properly, but to listen the same wav file again you have to push 'Stop' button first and then 'Play' (otherwise you won't hear the file again). Rolling Eyes

I can even try to transcribe what that guy is talking in Russian in 'zhirik.wav':

"Ты с кем шутишь, блядь?"

what could be translated to English as

"At whom are you laughing, bitch?"

Hahaha... Laughing
Post 10 Jan 2012, 15:17
View user's profile Send private message Visit poster's website Reply with quote
Yardman



Joined: 12 Apr 2005
Posts: 244
Location: US
Yardman 10 Jan 2012, 15:36
[ Post removed by author. ]


Last edited by Yardman on 04 Apr 2012, 04:35; edited 1 time in total
Post 10 Jan 2012, 15:36
View user's profile Send private message Reply with quote
Yardman



Joined: 12 Apr 2005
Posts: 244
Location: US
Yardman 13 Jan 2012, 00:02
[ Post removed by author. ]
Post 13 Jan 2012, 00:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.