flat assembler
Message board for the users of flat assembler.

Index > Windows > newbie question: mp3 play not working ? :(

Author
Thread Post new topic Reply to topic
Basic2



Joined: 10 Aug 2006
Posts: 6
Basic2
Hi' ive try make a VERY simple start of a mp3 player but its just crash. I know it wont play but i need to get it to load the file first, I use mciSendString.

Code:
include 'win32ax.inc'
.data
title   db "playing",0
msg     db "Stop music press on Ok",0
.code
  start:
        invoke sendMciString,'load "D:\all\mp3\2fast.mp3" alias media',0,0
        invoke MessageBox,0,title,msg,MB_OK
  ender:
        invoke  ExitProcess,0
.end start

library winmp3,'winmm.dll'

import winmp3,sendMciString,'mciSendString'               
    


Regardz
Post 10 Aug 2006, 00:33
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
the winmm.dll doesn't seem get imported in ur code.
Post 10 Aug 2006, 02:42
View user's profile Send private message Visit poster's website Reply with quote
Basic2



Joined: 10 Aug 2006
Posts: 6
Basic2
i just found out useing a DLL viewer that theres only mciSendStringA and mciSendStringW Damn win32.hlp file didnt show it.
but i try with both still crash Sad
Post 10 Aug 2006, 03:10
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
mciSendString has four parameters:
mciSendString(lpszCommand,lpszReturnString,cchReturn,hwndCallback).


Description:
Download
Filename: mciplay.zip
Filesize: 1.11 KB
Downloaded: 58 Time(s)

Post 10 Aug 2006, 04:52
View user's profile Send private message Reply with quote
Basic2



Joined: 10 Aug 2006
Posts: 6
Basic2
Code:
include 'win32ax.inc'
.data
title   db "playing",0
msg     db "Stop music press on Ok",0
.code
  start:
        invoke mciSendString,'load "D:\all\mp3\2fast.mp3" alias media',0,0,0
        invoke MessageBox,0,title,msg,MB_OK
  ender:
        invoke  ExitProcess,0
.end start

library winmp3,'winmm.dll'
import winmp3,mciSendString,'mciSendStringW'
;import winmp3,mciSendString,'mciSendStringA'  ; Crash too Sad            
    


Still Crashes Sad
i dont get why, maybe a bug ?
i know second parm can be a pointer to a buffer maybe thats whats wrong?
Post 10 Aug 2006, 05:08
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
vbVeryBeginner is right, "library" macro seems to be imposible to use it twice.
Post 10 Aug 2006, 05:11
View user's profile Send private message Reply with quote
Basic2



Joined: 10 Aug 2006
Posts: 6
Basic2
Can i get example on how it work?
thanks
Post 10 Aug 2006, 05:27
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
SFeLi
You're not importing winmm! All imports must be placed into imports table. It can be defined as:
Code:
data import
;imports table here
end data

;or as section
section '.idata' import data readable writeable
;imports table here
    

win32ax.inc defines standard imports table with no winmm imports when you use .end macro.

Code:
        include 'win32ax.inc'
        entry   start
.data
title   db "playing",0
msg     db "Stop music press on Ok",0
.code
  start:
        invoke mciSendString,'load "D:\all\mp3\2fast.mp3" alias media',0,0,0
        invoke MessageBox,0,title,msg,MB_OK
  ender:
        invoke  ExitProcess,0
;.end start  ;Adds default imports table.

        data    import
        library kernel32,'KERNEL32.DLL',\
                user32,'USER32.DLL',\
                winmm,'WINMM.DLL'
        include 'apia/kernel32.inc'
        include 'apia/user32.inc'
        import  winmm,\
                mciSendString,'mciSendStringA'
        end     data
    
Post 10 Aug 2006, 05:33
View user's profile Send private message Reply with quote
Basic2



Joined: 10 Aug 2006
Posts: 6
Basic2
Sweet thanks SFeLi Very Happy


Code:
        include 'win32ax.inc'
                entry start
.data
title   db "playing",0
msg     db "Stop music press on Ok",0
.code
  start:
        invoke mciSendString,'open "D:\all\mp3\2fast.mp3" alias media',0,0,0
        invoke mciSendString,'play media',0,0,0
        invoke MessageBox,0,title,msg,MB_OK
  ender:
        invoke  ExitProcess,0
;.end start  ;Adds default imports table.

        data    import
        library kernel32,'KERNEL32.DLL',\
                user32,'USER32.DLL',\
                winmm,'WINMM.DLL'
        include 'apia/kernel32.inc'
        include 'apia/user32.inc'
        import  winmm,\
                mciSendString,'mciSendStringA'
        end     data                                                      
    

now working proberly, i'ma make some more on it Smile

Regardz
Post 10 Aug 2006, 05:53
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.