flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Roman
Any body try use in fasm or masm libzplay.dll for playing OGG\MP3 files ?
I search simple examples. |
|||
![]() |
|
Roman
I try import from libzplay.dll function CreateZPlay.
But Windows 7 crash when i Call CreateZPlay. My program 32 bit. |
|||
![]() |
|
vivik
Post your libzplay.dll program here, I'll look into it.
Sorry for the delay. |
|||
![]() |
|
DimonSoft
Let me guess it’s a data alignment related problem.
|
|||
![]() |
|
Roman
vivik
Oh ! Sorry. I am forget my topic.
|
|||||||||||
![]() |
|
Roman
in code use simple.
Code: library libzplay, 'libzplay.dll' import libzplay,\ CreateZPlay,'zplay_CreateZPlay' Call CreateZPlay |
|||
![]() |
|
vivik
Please post the whole fasm program. Something I can compile.
hm, http://libzplay.sourceforge.net/CSTYLEINTERFACE.html |
|||
![]() |
|
Roman
You example work fine for me !
Interesting. Last edited by Roman on 17 Feb 2019, 13:40; edited 1 time in total |
|||
![]() |
|
Roman
Fasm 1.73 this code crash on Call CreateZPlay
Code: format PE GUI 4.0 entry start include 'c:\fasm\include\Win32a.inc' section '.data' data readable writeable _caption db 'Win32 assembly program',0 _message db 'Hello World!',0 _error db 'Error load mp3',0 zplay dd 0 section '.text' code readable executable start: call CreateZPlay mov [zplay],eax test eax,eax jnz @f push 0 push _caption push _error push 0 call [MessageBox] @@: push 0 push _caption push _message push 0 call [MessageBox] push 0 call [ExitProcess] section '.idata' import data readable writeable library kernel32, 'KERNEL32.DLL',\ user32, 'USER32.DLL',\ msvcrt, 'MSVCRT.DLL',\ libzplay, 'libzplay.dll' include 'c:\fasm\include/vapia/kernel32.inc' include 'c:\fasm\include/vapia/user32.inc' import libzplay,\ CreateZPlay,'zplay_CreateZPlay' |
|||
![]() |
|
revolution
You need brackets "call [CreateZPlay]"
|
|||
![]() |
|
Roman
F..ck !
I completely out my mind ![]() I forgot Invoke and Call differ |
|||
![]() |
|
DimonSoft
I really wonder what’s the purpose of avoiding invoke/cinvoke/stdcall/etc. macros. I could see some reasoning behind avoiding struct macro which is quite difficult to understand but procXX.inc macros (especially invoke/stdcall/etc.) are very simple, so the point of not using things you don’t understand doesn’t work here. So, why write tons of pushes instead of focusing on the task?
|
|||
![]() |
|
Roman
Yes ! Now work and play sound !
|
|||
![]() |
|
Roman
This code work fine. With exe put 1.mp3 file.
Code: format PE GUI 4.0 entry start include 'c:\fasm\include\Win32a.inc' include "c:\fasm\include\encoding\win1251.inc" ;codirovka ansi 1251 include 'c:\fasm\include\equates\kernel32.inc' include 'c:\fasm\include\equates\gdi32.inc' include 'c:\fasm\include\equates\user32.inc' ;interface get from class ZPlay interface hrum,\ SetSettings,\ GetSettings ,\ GetVersion ,\ GetError ,\ GetErrorW,\ GetFileFormat,\ GetFileFormatW,\ EnumerateWaveOut,\ GetWaveOutInfo,\ GetWaveOutInfoW,\ SetWaveOutDevice,\ OpenFile,\ OpenFileW ,\ AddFile ,\ AddFileW ,\ OpenStream ,\ PushDataToStream ,\ IsStreamDataFree ,\ GetDynamicStreamLoad ,\ GetStreamInfo ,\ GetStreamInfoW ,\ Close ,\ Play,\ PlayLoop,\ Seek ,\ ReverseMode ,\ Stop ,\ Pause ,\ Resume ,\ GetPosition,\ SetMasterVolume ,\ SetPlayerVolume,\ GetMasterVolume ,\ GetPlayerVolume,\ GetBitrate,\ GetStatus ,\ MixChannels ,\ GetVUData ,\ SlideVolume ,\ EnableEqualizer,\ SetEqualizerPoints ,\ GetEqualizerPoints,\ SetEqualizerParam ,\ GetEqualizerParam ,\ SetEqualizerPreampGain ,\ GetEqualizerPreampGain ,\ SetEqualizerBandGain,\ GetEqualizerBandGain,\ LoadID3 ,\ LoadID3W ,\ LoadFileID3 ,\ LoadFileID3W,\ EnableEcho ,\ SetEchoParam ,\ GetEchoParam ,\ SetCallbackFunc,\ SetRate,\ GetRate ,\ SetPitch ,\ GetPitch,\ SetTempo ,\ GetTempo ,\ StereoCut,\ Release ,\ DetectBPM,\ DetectFileBPM,\ DetectFileBPMW ,\ GetFFTData ,\ DrawFFTGraphOnHDC ,\ DrawFFTGraphOnHWND ,\ SetFFTGraphParam ,\ GetFFTGraphParam section '.data' data readable writeable _caption db 'Win32 assembly program',0 _message db 'Hello World!',0 _error db 'Error load mp3',0 pName db '1.mp3',0 Auto dd 850 dup (0) zplay hrum section '.text' code readable executable start: call [CreateZPlay] test eax,eax jz Exit mov [zplay],eax ; player->OpenFile("test.mp3", sfAutodetect) cominvk zplay,OpenFile,pName,1 ;1000 = autodetect(mp3\ogg\wav) test eax,eax ;eax=1 ok jnz @f invoke MessageBox,0,_error,_caption,0 jmp Exit @@: cominvk zplay,GetStreamInfo,Auto cinvoke sprintf,Auto,"Length: %02u:%02u:%02u:%03u",\ dword [Auto+12],dword [Auto+16],dword [Auto+20],dword [Auto+24] invoke MessageBox,0,Auto,_caption,0 @@: cominvk zplay,Play ;jmp @b cinvoke sprintf,Auto,'%u ',eax invoke MessageBox,0,Auto,_caption,0 cominvk zplay,Release Exit: invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32, 'KERNEL32.DLL',\ user32, 'USER32.DLL',\ msvcrt, 'MSVCRT.DLL',\ libzplay, 'libzplay.dll' include 'c:\fasm\include/vapia/kernel32.inc' include 'c:\fasm\include/vapia/user32.inc' import msvcrt,\ sprintf,'sprintf' import libzplay,\ CreateZPlay,'zplay_CreateZPlay' |
|||
![]() |
|
vivik
I tried to compile the program above me, and my fasm can't find this file: fasm\include/vapia/kernel32.inc
what is this "vapia" folder? I don't have this. I want to be able to play an mp3 file in a loop, wonder if this library is capable of that. Like, play file up to 30 seconds, then loop back to 2 seconds, and keep playing in the loop. btw, I'm sure you can do this: Code: import libzplay,\ CreateZPlay,'CreateZPlay' instead of this: Code: import libzplay,\ CreateZPlay,'zplay_CreateZPlay' they both point to the same function. Didn't check it though, but my ollydbg/x64dbg said so. |
|||
![]() |
|
DimonSoft
vivik wrote: I tried to compile the program above me, and my fasm can't find this file: fasm\include/vapia/kernel32.inc IIRC, MadMatt’s pack contained something like that. |
|||
![]() |
|
Roman
In fasm API.
Just write Code: include "fasm\include/api/kernel32.inc" include "fasm\include/api/user32.inc" In kernel32.inc file(like usual): Code: import kernel32,\ AddAtomA,'AddAtomA',\ AddAtomW,'AddAtomW',\ AddConsoleAliasA,'AddConsoleAliasA',\ AddConsoleAliasW,'AddConsoleAliasW',\ AllocConsole,'AllocConsole',\ AreFileApisANSI,'AreFileApisANSI',\ Vivik use PlayLoop. This function more difficult then Play(); http://libzplay.sourceforge.net/libZPlayCpp__ZPlay__PlayLoop@TTimeFormat@TStreamTime__@TTimeFormat@TStreamTime__@unsigned_int@unsigned_int.html http://libzplay.sourceforge.net/ZPLAYINTERFACE.html |
|||
![]() |
|
vivik
still doesn't compile, but now there's a different error.
Code: format PE GUI 4.0 entry start include 'c:\path\fasm\include\Win32a.inc' include 'c:\path\fasm\include\encoding\win1251.inc' ;codirovka ansi 1251 include 'c:\path\fasm\include\equates\kernel32.inc' include 'c:\path\fasm\include\equates\gdi32.inc' include 'c:\path\fasm\include\equates\user32.inc' ;interface get from class ZPlay interface hrum,\ SetSettings,\ GetSettings ,\ GetVersion ,\ GetError ,\ GetErrorW,\ GetFileFormat,\ GetFileFormatW,\ EnumerateWaveOut,\ GetWaveOutInfo,\ GetWaveOutInfoW,\ SetWaveOutDevice,\ OpenFile,\ OpenFileW ,\ AddFile ,\ AddFileW ,\ OpenStream ,\ PushDataToStream ,\ IsStreamDataFree ,\ GetDynamicStreamLoad ,\ GetStreamInfo ,\ GetStreamInfoW ,\ Close ,\ Play,\ PlayLoop,\ Seek ,\ ReverseMode ,\ Stop ,\ Pause ,\ Resume ,\ GetPosition,\ SetMasterVolume ,\ SetPlayerVolume,\ GetMasterVolume ,\ GetPlayerVolume,\ GetBitrate,\ GetStatus ,\ MixChannels ,\ GetVUData ,\ SlideVolume ,\ EnableEqualizer,\ SetEqualizerPoints ,\ GetEqualizerPoints,\ SetEqualizerParam ,\ GetEqualizerParam ,\ SetEqualizerPreampGain ,\ GetEqualizerPreampGain ,\ SetEqualizerBandGain,\ GetEqualizerBandGain,\ LoadID3 ,\ LoadID3W ,\ LoadFileID3 ,\ LoadFileID3W,\ EnableEcho ,\ SetEchoParam ,\ GetEchoParam ,\ SetCallbackFunc,\ SetRate,\ GetRate ,\ SetPitch ,\ GetPitch,\ SetTempo ,\ GetTempo ,\ StereoCut,\ Release ,\ DetectBPM,\ DetectFileBPM,\ DetectFileBPMW ,\ GetFFTData ,\ DrawFFTGraphOnHDC ,\ DrawFFTGraphOnHWND ,\ SetFFTGraphParam ,\ GetFFTGraphParam section '.data' data readable writeable _caption db 'Win32 assembly program',0 _message db 'Hello World!',0 _error db 'Error load mp3',0 pName db 's.wav',0 Auto dd 850 dup (0) zplay hrum section '.text' code readable executable start: call [CreateZPlay] test eax,eax jz Exit mov [zplay],eax ; player->OpenFile("test.mp3", sfAutodetect) cominvk zplay,OpenFile,pName,1 ;1000 = autodetect(mp3\ogg\wav) test eax,eax ;eax=1 ok jnz @f invoke MessageBox,0,_error,_caption,0 jmp Exit @@: cominvk zplay,GetStreamInfo,Auto cinvoke sprintf,Auto,"Length: %02u:%02u:%02u:%03u",\ dword [Auto+12],dword [Auto+16],dword [Auto+20],dword [Auto+24] invoke MessageBox,0,Auto,_caption,0 @@: cominvk zplay,Play ;jmp @b cinvoke sprintf,Auto,'%u ',eax invoke MessageBox,0,Auto,_caption,0 cominvk zplay,Release Exit: invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32, 'KERNEL32.DLL',\ user32, 'USER32.DLL',\ msvcrt, 'MSVCRT.DLL',\ libzplay, 'libzplay.dll' include 'c:\path\fasm\include/api/kernel32.inc' include 'c:\path\fasm\include/api/user32.inc' import msvcrt,\ sprintf,'sprintf' import libzplay,\ CreateZPlay,'zplay_CreateZPlay' Code: Error: symbol already defined. struct SYSTEM_INFO wProcessorArchitecture dw ? wReserved dw ? dwPageSize dd ? lpMinimumApplicationAddress dd ? lpMaximumApplicationAddress dd ? dwActiveProcessorMask dd ? dwNumberOfProcessors dd ? dwProcessorType dd ? dwAllocationGranularity dd ? wProcessorLevel dw ? wProcessorRevision dw ? ends C:\path\fasm\INCLUDE\EQUATES\KERNEL32.INC |
|||
![]() |
|
Roman
Vivik
I compile my code fine. I not get this error. I use Fasm 1.73 I found SYSTEM_INFO in fasm\INCLUDE\EQUATES\Kernel64.inc but not in fasm\INCLUDE\EQUATES\Kernel32.inc Last edited by Roman on 20 Feb 2019, 16:00; edited 1 time in total |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.