News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Not sure how to use bintodb

Started by Magnum, September 09, 2010, 02:15:26 AM

Previous topic - Next topic

Magnum

I am confused as to how to use the bintodb utility.
I want to embed a wav file and play it.


.DATA

; C:\Backup\klaxon.wav is 7279 bytes long

klaxon db 82,73,70,70,103,28,0,0,87,65,86,69,102,109,116,32
db 16,0,0,0,1,0,1,0,64,31,0,0,64,31,0,0
db 1,0,8,0,100,97,116,97,67,28,0,0,131,129,122,122
db 130,134,135,124,119,125,140,139,129,111,119,135,140,139,120,112
db 124,135,140,127,116,116,125,139,146,130,111,116,138,147,133,115
db 114,129,135,134,126,119,125,132,140,134,113,113,126,143,146,129
db 110,110,137,153,130,108,118,137,144,127,119,119,126,134,134,140
db 118,107,123,149,150,121,108,122,143,143,123,108,120,130,144,140
db 123,120,123,130,133,128,112,107,132,153,146,128,120,126,133,135
db 121,120,122,128,135,130,122,126,132,134,121,119,120,125,138,139
db 129,130,134,131,130,122,122,126,128,124,127,127,135,134,122,127
db 123,115,122,140,151,128,121,124,130,133,120,127,120,127,134,134

.CODE

%Date       db " &@Date" ; Compile date

start:

invoke PlaySound, ADDR klaxon, NULL, SND_FILENAME or SND_ASYNC

Have a great day,
                         Andy

ecube

you include that into your programs .data section, then you can write it back to a file when you want with WriteFile, it's a way of embedding a file in masm. Ml.exe will compile REAL slow though on big ones, is a bug. In the above example its just playing the embedded file directly instead of writing it out again.

hutch--

Magnum,

That technique works OK but there is a better way with a single file and you have no speed problems at all. Try out either FDA or the GUI version of FDA to make the file into an object module, link it into your app and use the include file that it creates to know the call address and the length of the data.

I use it for the masm32 installation among many other things, just convert the file and link it into your app.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sinsi

You could also include the wave file as a resource, PlaySound will play from a resource ID.
Light travels faster than sound, that's why some people seem bright until you hear them.