The MASM Forum

Miscellaneous => Irvine Book Questions. => Topic started by: DavidB on November 21, 2017, 05:06:26 PM

Title: Bundle and Play XM File As Resource
Post by: DavidB on November 21, 2017, 05:06:26 PM
For a program that I am writing, I want to bundle an XM sound file as a program resource, and play it on a loop as part of the program. I have found several posts online that discuss doing this, but none of them adequately explain how to bundle the XM file as a resource. Do I need to depend on a MASM32 SDK library to do this, or can I stick with with the Irvine library? (I realize that this forum is not for Irvine-related questions, but since everything I have seen relies on non-Irvine libraries, I am going to assume that answer to that question is "no.")

Also, I am using Visual Studio 2017 as my IDE of choice.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 21, 2017, 06:46:17 PM
Hi David,

This example plays a XM music module from the resource.
Title: Re: Bundle and Play XM File As Resource
Post by: Vortex on November 22, 2017, 06:21:06 AM
Hi DavidB,

You can use the fda ( file data assembler ) tool supplied with the Masm32 package to convert any binary file to a MS COFF object module.
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 22, 2017, 12:37:34 PM
Quote from: Siekmanski on November 21, 2017, 06:46:17 PM
Hi David,

This example plays a XM music module from the resource.

Quote from: Vortex on November 22, 2017, 06:21:06 AM
Hi DavidB,

You can use the fda ( file data assembler ) tool supplied with the Masm32 package to convert any binary file to a MS COFF object module.
Great! I used to the fda tool to convert the XM file, and as a result, I got an "inc" and "obj" file, but I cannot figure out what I am actually supposed to do with them. The example that Siekmanski provided is great, but it does not have either an inc or obj file. Also, it does not appear to have been built with Visual Studio. I would assume that from here, I would have to convert these two files to a resource file in some way?
Title: Re: Bundle and Play XM File As Resource
Post by: hutch-- on November 22, 2017, 02:25:41 PM
David,

fda.exe directly converts the file you want to include into an object module which you then link into your executable but this does not make it playable directly. At its simplest you could write the sound file to disk then run an old API PlaySound(). If you have a method of playing the file from memory, you use the start address stored in the INC file and play it directly.

As far as the differences between the Irvine system and MASM32, they are pointed at different targets, the Irvine system is aimed at getting undergraduate students through a semester of assembler where MASM32 was always pointed at production code so that you could write working applications, object modules for VC and dynamic link libraries.
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 22, 2017, 02:49:20 PM
Quote from: hutch-- on November 22, 2017, 02:25:41 PM
David,

fda.exe directly converts the file you want to include into an object module which you then link into your executable but this does not make it playable directly. At its simplest you could write the sound file to disk then run an old API PlaySound(). If you have a method of playing the file from memory, you use the start address stored in the INC file and play it directly.

As far as the differences between the Irvine system and MASM32, they are pointed at different targets, the Irvine system is aimed at getting undergraduate students through a semester of assembler where MASM32 was always pointed at production code so that you could write working applications, object modules for VC and dynamic link libraries.
Well as it so happens, I have been using Irvine "to get through a semester of assembler", but I really would like to learn more about it and not cheat the system. Ideally, I would like to mix Irvine and MASM32 libraries to do this. The problem is that I cannot figure out how to modify my Visual Studio project's linker settings to include my XM as a resource.

As for playing my XM file, I was just going to use uFMOD like this (copied from Siekmanski's HTML encoder example):
invoke  uFMOD_PlaySong,ElteesSong,hinst,XM_RESOURCE

But once again, I cannot figure out how to include the uFMOD libraries in my Visual Studio project.

I realize that typically, Irvine-dependent projects are not supposed to work like this, but I'm sure someone has done it before. I just cannot find any information on how to do it myself. Another thing to consider is that all libraries that project depends on will need to be bundled with the project. I cannot rely on a MASM32 installation on the C drive because not all computer which will be used to Assemble the project will have MASM32 installed.

I found this video (https://www.youtube.com/watch?v=isS432XiT58) which details how to add Irvine32.inc to the linker (I haven't had to do this because we have been given a template project to work with), and I have a feeling that I need to do something similar with the libraries and resources that I want to add, but I am not sure if that is the case.
Title: Re: Bundle and Play XM File As Resource
Post by: jj2007 on November 22, 2017, 03:35:25 PM
See Playing XM sound files (http://masm32.com/board/index.php?topic=6703.0) for another solution.

@Marinus: How do you get sd10menu.xm played, is that a built-in Windows decoder? For my snippet, I had to find the BassMod dll to get it playing...
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 22, 2017, 04:10:34 PM
Quote from: jj2007 on November 22, 2017, 03:35:25 PM
See Playing XM sound files (http://masm32.com/board/index.php?topic=6703.0) for another solution.

@Marinus: How do you get sd10menu.xm played, is that a built-in Windows decoder? For my snippet, I had to find the BassMod dll to get it playing...
Hmm, that's an interesting method. In all of my research of how to do this, that is a method that I have never come across. Unfortunately I am still dealing with the limitation of trying to figure out how to add resources to a MASM project in Visual Studio.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 22, 2017, 04:39:54 PM
\lib\ufmod.lib
\include\ufmod.inc -> look into this, it explains how to use the XM player.

You can load the .XM as a file, from resource or from memory.

You could dump the .XM as a data file, include it in your data section and play it from memory.

More info: http://ufmod.sourceforge.net/
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 22, 2017, 05:14:48 PM
Quote from: Siekmanski on November 22, 2017, 04:39:54 PM
\lib\ufmod.lib
\include\ufmod.inc -> look into this, it explains how to use the XM player.

You can load the .XM as a file, from resource or from memory.

You could dump the .XM as a data file, include it in your data section and play it from memory.

More info: http://ufmod.sourceforge.net/
Okay, thank you. I have not had a chance to look at this in-depth yet, but from the little I have looked at it, what I have to do is:


What would be the difference between using the XM from memory versus from resource? I thought that using things from resource was using them from memory.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 22, 2017, 05:44:36 PM
Quote from: DavidB on November 22, 2017, 05:14:48 PM
Okay, thank you. I have not had a chance to look at this in-depth yet, but from the little I have looked at it, what I have to do is:


  • Get a copy of ufmod.lib and ufmod.inc and put them in the root directory of my Visual Studio project.
  • Include both files in my code.
  • Create a dat file out of my XM, which also should go in the root directory of my project.
  • Use uFMOD to play it.

Yes.  :t

\lib\ufmod.lib
\include\ufmod.inc

Both the are included in the HTMLencoder.zip example I posted.

QuoteWhat would be the difference between using the XM from memory versus from resource? I thought that using things from resource was using them from memory.

Yes,

The only difference between resource and memory:

If you include the .xm as a binary file into the resource. ( the same as, including an icon or an image file )
It will be played from resource memory.

If you don't have a resource section. ( for example a console app. or a window app. without a resource section.)
You create a data dump include file from the .xm file and include it in the data section.
It will be played from data memory.

Option 3,

Load the .xm file from disk as a seperate file. ( .xm is not incuded in the executable file. )

Title: Re: Bundle and Play XM File As Resource
Post by: hutch-- on November 22, 2017, 05:50:18 PM
Quote
Well as it so happens, I have been using Irvine "to get through a semester of assembler", but I really would like to learn more about it and not cheat the system. Ideally, I would like to mix Irvine and MASM32 libraries to do this.
The reason why I moved your earlier post was that Kip Irvine should be providing the support for students that are using his work, there are a few here that will try and help Irvine users but finally if you choose to use his stuff, you should be getting support from him instead of dumping these questions into a forum that is designed for another purpose. Also the choice of using the VS IDE limits the amount of support you will get as many here would not touch it with a barge pole due to its size and how slow it is.

As far as combining the libraries, you are wasting your time as the Irvine libraries are not Intel ABI compliant so the register usage in Irvine examples will cause production code to crash.
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 22, 2017, 06:13:58 PM
Quote from: Siekmanski on November 22, 2017, 05:44:36 PM
Quote from: DavidB on November 22, 2017, 05:14:48 PM
Okay, thank you. I have not had a chance to look at this in-depth yet, but from the little I have looked at it, what I have to do is:


  • Get a copy of ufmod.lib and ufmod.inc and put them in the root directory of my Visual Studio project.
  • Include both files in my code.
  • Create a dat file out of my XM, which also should go in the root directory of my project.
  • Use uFMOD to play it.

Yes.  :t

\lib\ufmod.lib
\include\ufmod.inc

Both the are included in the HTMLencoder.zip example I posted.

QuoteWhat would be the difference between using the XM from memory versus from resource? I thought that using things from resource was using them from memory.

Yes,

The only difference between resource and memory:

If you include the .xm as a binary file into the resource. ( the same as, including an icon or an image file )
It will be played from resource memory.

If you don't have a resource section. ( for example a console app. or a window app. without a resource section.)
You create a data dump include file from the .xm file and include it in the data section.
It will be played from data memory.

Option 3,

Load the .xm file from disk as a seperate file. ( .xm is not incuded in the executable file. )
Great! I cannot wait to try this out tomorrow! Although I am sure that I will have problems along the way that I will have to ask you about. My program is a small console application, so I'm probably going to opt for the data dump method and load it from data memory. Out of curiosity though, why would it be beneficial to use resource memory over data memory in different situations? Also, what's the deal with the "lib" and "inc" files? I realize that I am supposed to use both of them, but I am unsure of why or how entirely.

Quote from: hutch-- on November 22, 2017, 05:50:18 PM
Quote
Well as it so happens, I have been using Irvine "to get through a semester of assembler", but I really would like to learn more about it and not cheat the system. Ideally, I would like to mix Irvine and MASM32 libraries to do this.
The reason why I moved your earlier post was that Kip Irvine should be providing the support for students that are using his work, there are a few here that will try and help Irvine users but finally if you choose to use his stuff, you should be getting support from him instead of dumping these questions into a forum that is designed for another purpose. Also the choice of using the VS IDE limits the amount of support you will get as many here would not touch it with a barge pole due to its size and how slow it is.

As far as combining the libraries, you are wasting your time as the Irvine libraries are not Intel ABI compliant so the register usage in Irvine examples will cause production code to crash.
Well in fairness to me, I was not actually aware that Irvine was a big of a crutch as it apparently is. Now that I know that, I am planning on moving away from Irvine once I am done with my class which requires it, as it seems that MASM32 has its own libraries which are just as capable as Irvine's, if not more-so.

What IDE to programmers on this forum prefer? As much as I love Visual Studio for working with C++, I have to admit that I am not a fan of it as far as ASM development goes, and would love to switch to something else once I am free to do stuff on my own. At this point, my question isn't so much about Irvine usage as much as it is about doing something else in a program that uses Irvine. As for the "Intel ABI compliant" part is concerned, what does that mean? Why would it cause problems?
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 22, 2017, 06:25:00 PM
Good idea.  :t

Click on the "MASM32 Downloads" link in the top right of this page and download the MASM SDK.
It has all you need to get started programming with MASM.
Title: Re: Bundle and Play XM File As Resource
Post by: jj2007 on November 22, 2017, 07:02:15 PM
Quote from: DavidB on November 22, 2017, 06:13:58 PMMy program is a small console application, so I'm probably going to opt for the data dump method and load it from data memory

Console programs can also have resource sections, no problem.

Quote...a program that uses Irvine. As for the "Intel ABI compliant" part is concerned, what does that mean? Why would it cause problems?

It would not necessarily cause problems, but you would need to know exactly what you do. And in any case, Masm32 is a much more mature and powerful package. Kip's stuff is really just meant for students who need a certificate and then quickly forget what assembly is good for.
Title: Re: Bundle and Play XM File As Resource
Post by: aw27 on November 22, 2017, 10:26:28 PM
@DavidB

Here is a VS Project that plays the XM file from Siekmanski.
The XM is added directly as a RCDATA resource into VS.
You need to add these libs and ignore all the others
msvcrt.lib
ufmod.lib
Winmm.lib


.model FLAT, STDCALL

include ufmod.inc

ElteesSong     equ 101

.data
hinst dd 0

.code
main proc
invoke  uFMOD_PlaySong, ElteesSong, hinst, XM_RESOURCE
    ret
main endp

end


Have fun with the music and the Irvine book.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 22, 2017, 10:45:09 PM
Here are 2 to minimal examples of the uFMOD XMplayer

The XMplayer loads a XM file from disk and plays it.
The XMplayerMemory plays a XM hex-dump file from memory. ( XM file included in the executable )
Use the SaveBin2Hex.exe to convert the XM file to a hex-dump include file.
Title: Re: Bundle and Play XM File As Resource
Post by: aw27 on November 23, 2017, 02:47:55 AM
Someone may consider as well to port the ufmod to 64-bit, it looks uncomplicated but I will not volunteer this time.
The site is here https://sourceforge.net/projects/ufmod/
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 23, 2017, 05:47:45 PM
Quote from: Siekmanski on November 22, 2017, 06:25:00 PM
Good idea.  :t

Click on the "MASM32 Downloads" link in the top right of this page and download the MASM SDK.
It has all you need to get started programming with MASM.
Wow. I am so lost. :( I have not even bothered with trying to understand how to use uFMOD yet because I cannot figure out how to convert my XM to a data dump that I could then use in my .data section, nor can I figure out how to include the libraries in my Visual Studio project. I wish I didn't have to use Visual Studio for this.  :(

Quote from: jj2007 on November 22, 2017, 07:02:15 PM
Quote from: DavidB on November 22, 2017, 06:13:58 PMMy program is a small console application, so I'm probably going to opt for the data dump method and load it from data memory

Console programs can also have resource sections, no problem.

Quote...a program that uses Irvine. As for the "Intel ABI compliant" part is concerned, what does that mean? Why would it cause problems?

It would not necessarily cause problems, but you would need to know exactly what you do. And in any case, Masm32 is a much more mature and powerful package. Kip's stuff is really just meant for students who need a certificate and then quickly forget what assembly is good for.
Okay, that's good to know. The only thing I want to do that cannot be done with Irvine for this project is play the XM file. Other than that, everything else can be achieved using Irvine. As I mentioned earlier, my Assembly class is the reason I was introduced to Irvine, but it seems that if I actually want to learn Assembly for real, I need to ditch him. Quite a shame.
Title: Re: Bundle and Play XM File As Resource
Post by: jj2007 on November 23, 2017, 06:47:23 PM
Quote from: DavidB on November 23, 2017, 05:47:45 PMI cannot figure out how to convert my XM to a data dump that I could then use in my .data section

That is the easy part, use the attached tool: Just drag the xm file over the exe (works with any type of file, but there may be size limits, see SetClip$ (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1100)).

Once it's on the clipboard, use the data as follows:include \masm32\include\masm32rt.inc
.code
start:
  mov ebx, offset dend
  mov edi, offset dstart
  sub ebx, edi
  ... your code here ...
  print str$(edi), " is the start of the buffer", 13, 10
  inkey str$(ebx), " bytes are available", 13, 10
  exit
dstart:
db  045h, 078h, 074h, 065h, 06Eh, 064h, 065h, 064h, 020h, 04Dh, 06Fh, 064h, 075h, 06Ch, 065h, 03Ah
db  020h, 048h, 061h, 070h, 070h, 079h, 020h, 048h, 02Eh, 020h, 043h, 068h, 072h, 069h, 073h, 074h
...
db  021h, 000h, 000h, 000h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 073h, 069h, 067h, 06Eh, 065h
db  064h, 02Ch, 020h, 044h, 052h, 041h, 058h, 000h, 000h, 000h, 080h, 000h, 000h, 028h, 000h, 000h
db  000h
dend:
end start
Title: Re: Bundle and Play XM File As Resource
Post by: avcaballero on November 24, 2017, 02:20:27 AM
Hello, this is my contribution, though not in masm, but in PellesC, playing a xm tune from the resource. Full src ready to compile.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 24, 2017, 02:44:02 AM
Cool music  8)
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 24, 2017, 08:51:37 AM
Quote from: jj2007 on November 23, 2017, 06:47:23 PM
Quote from: DavidB on November 23, 2017, 05:47:45 PMI cannot figure out how to convert my XM to a data dump that I could then use in my .data section

That is the easy part, use the attached tool: Just drag the xm file over the exe (works with any type of file, but there may be size limits, see SetClip$ (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1100)).

Once it's on the clipboard, use the data as follows:include \masm32\include\masm32rt.inc
.code
start:
  mov ebx, offset dend
  mov edi, offset dstart
  sub ebx, edi
  ... your code here ...
  print str$(edi), " is the start of the buffer", 13, 10
  inkey str$(ebx), " bytes are available", 13, 10
  exit
dstart:
db  045h, 078h, 074h, 065h, 06Eh, 064h, 065h, 064h, 020h, 04Dh, 06Fh, 064h, 075h, 06Ch, 065h, 03Ah
db  020h, 048h, 061h, 070h, 070h, 079h, 020h, 048h, 02Eh, 020h, 043h, 068h, 072h, 069h, 073h, 074h
...
db  021h, 000h, 000h, 000h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 073h, 069h, 067h, 06Eh, 065h
db  064h, 02Ch, 020h, 044h, 052h, 041h, 058h, 000h, 000h, 000h, 080h, 000h, 000h, 028h, 000h, 000h
db  000h
dend:
end start

Well that method was way too messy, so what I've done instead is added an obj file that was created from the XM file to the linker. I tried adding the inc file created from the XM to the linker instead, but Visual Studio complained that it was invalid.

The inc file has this in it:

; -----------------------------------------------------
; Include the contents of this file in your source file
; to access the data as an OFFSET and use the equate as
; the byte count for the file data in the object module
; -----------------------------------------------------
EXTERNDEF MyXMFile:DWORD
ln_MyXMFile equ <26087>


I've placed this code in the .data segment. I acquired a copy of the ufmod.inc and ufmod.lib and added them to my project like so:

include ufmod.inc
includelib ufmod.lib


After that, I tried loading the offset for my XM file in eax like this:

lea eax, MyXMFile

I followed this line up with:

invoke uFMOD_PlaySong, eax, 0, 0

Moving the offset of MyXMFile to eax seems to have worked, but when I try to do the "PlaySong" part, I get an entire collection of "unresolved external symbol" errors. Here is the section of Visual Studio's output pertaining to this issue.

1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutClose@4
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutGetPosition@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutOpen@24
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutPrepareHeader@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutReset@4
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutUnprepareHeader@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutWrite@12


Where do I go from here? I am fairly certain that I am close, but I am still not quite there.
Title: Re: Bundle and Play XM File As Resource
Post by: dedndave on November 24, 2017, 12:54:11 PM
what i find interesting here is the "sound from memory" ability
i have been looking for a good way to do this, primarily for ham radio stuff

if i wasn't so lazy, i could pour through all the ufmod library code and figure out how it works
(that would probably include learning all about the XM file format)

instead, i wanted a quick list of the functions called to make it happen
so, i did a disassembly on one of Marinus' programs and dumped this  :biggrin:

   Import Module 002: winmm.dll

Addr:00003210 hint(00B5) Name: waveOutGetPosition
Addr:00003226 hint(00B8) Name: waveOutOpen
Addr:00003234 hint(00BA) Name: waveOutPrepareHeader
Addr:0000324C hint(00BB) Name: waveOutReset
Addr:0000325C hint(00C0) Name: waveOutUnprepareHeader
Addr:00003276 hint(00C1) Name: waveOutWrite
Addr:00003200 hint(00AC) Name: waveOutClose


.... wow, Jochen is catching me up - lol - 7666 posts  :shock:
although, he's got a way to go if we count the old forum numbers
Title: Re: Bundle and Play XM File As Resource
Post by: dedndave on November 24, 2017, 01:06:24 PM
David...

what those tell you is that you want to use the winmm inc and lib from the masm32 package
        INCLUDE    \Masm32\Include\Masm32rt.inc
        INCLUDE    \Masm32\Include\WinMm.inc
        INCLUDELIB \Masm32\Lib\WinMm.lib


now you know which functions to learn about
you can read up on them on the msdn site  :t
Title: Re: Bundle and Play XM File As Resource
Post by: aw27 on November 24, 2017, 02:33:24 PM
I posted a complete VS project, David completely ignored it and keeps bumping his head against the walls trying to make his VS project work. These newbies are really funny.  :badgrin:
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 24, 2017, 03:31:23 PM
Quote from: dedndave on November 24, 2017, 01:06:24 PM
David...

what those tell you is that you want to use the winmm inc and lib from the masm32 package
        INCLUDE    \Masm32\Include\Masm32rt.inc
        INCLUDE    \Masm32\Include\WinMm.inc
        INCLUDELIB \Masm32\Lib\WinMm.lib


now you know which functions to learn about
you can read up on them on the msdn site  :t
Awesome! Thanks!

Quote from: aw27 on November 24, 2017, 02:33:24 PM
I posted a complete VS project, David completely ignored it and keeps bumping his head against the walls trying to make his VS project work. These newbies are really funny.  :badgrin:
I would love to see you floundering about clueless about something some day. Unfortunately, it probably won't happen. This forum has a wide variety of people. Some are very helpful and understanding, some are helpful, yet rude about it. And some are both rude and useless. At least you're the second, and for that I am thankful, but nonetheless, there's no reason to be rude about it.

That said, thanks for posting the VS project. I honestly did not see it. I wish I had noticed it earlier.

Update: Although I am sure the code in your project will be helpful after I review it a little more, the project itself does not open properly Visual Studio.
Title: Re: Bundle and Play XM File As Resource
Post by: aw27 on November 24, 2017, 04:00:05 PM
Quote
the project itself does not open properly Visual Studio.

Honestly, you don't appear to have life for IT, but you are really good at judging people.
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 24, 2017, 04:04:08 PM
Quote from: aw27 on November 24, 2017, 04:00:05 PMHonestly, you don't appear to have life for IT,
Well I am sorry you think that.

Quote from: aw27 on November 24, 2017, 04:00:05 PMbut you are really good at judging people.
You're one to talk.
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 24, 2017, 05:13:32 PM
Quote from: dedndave on November 24, 2017, 12:54:11 PM
what i find interesting here is the "sound from memory" ability
i have been looking for a good way to do this, primarily for ham radio stuff

if i wasn't so lazy, i could pour through all the ufmod library code and figure out how it works
(that would probably include learning all about the XM file format)

instead, i wanted a quick list of the functions called to make it happen
so, i did a disassembly on one of Marinus' programs and dumped this  :biggrin:

   Import Module 002: winmm.dll

Addr:00003210 hint(00B5) Name: waveOutGetPosition
Addr:00003226 hint(00B8) Name: waveOutOpen
Addr:00003234 hint(00BA) Name: waveOutPrepareHeader
Addr:0000324C hint(00BB) Name: waveOutReset
Addr:0000325C hint(00C0) Name: waveOutUnprepareHeader
Addr:00003276 hint(00C1) Name: waveOutWrite
Addr:00003200 hint(00AC) Name: waveOutClose


.... wow, Jochen is catching me up - lol - 7666 posts  :shock:
although, he's got a way to go if we count the old forum numbers

Hi Dave,

The XM file format is probably not what you want for ham radio stuff.
It's a format with song data, audio effect routines and separate sound samples mixed to create an audio song.

For ham radio stuff, the simplest way is to set up the sound card as a ring-buffer and feed it with audio portions from your ham data stream directly from memory.

With DirectSound ( and some tricks ) you can get a reliable latency of close to 10 milliseconds.
With DirectSound you don't have exclusive ownership of the sound card.

Low latency audio is often a big deal in radio land, and therefore the "pro's" use ASIO capable sound cards to get 2 milliseconds latency. ( you can record from your microphone and transmit it without hearing a delay )
With ASIO you have exclusive ownership of the sound card.

Do you have an ASIO sound card?
Title: Off topic
Post by: sinsi on November 24, 2017, 08:23:05 PM
QuoteHonestly, you don't appear to have life for IT, but you are really good at judging people.
Don't get many better examples of irony than this  :t
Title: Re: Off topic
Post by: aw27 on November 24, 2017, 09:35:33 PM
Quote from: sinsi on November 24, 2017, 08:23:05 PM
QuoteHonestly, you don't appear to have life for IT, but you are really good at judging people.
Don't get many better examples of irony than this  :t

As Confucio said, when a wise man points at the moon the fool looks at the finger .  :t
Title: Re: Bundle and Play XM File As Resource
Post by: dedndave on November 24, 2017, 10:21:17 PM
good to hear from you, as always, Marinus

Quote from: Siekmanski on November 24, 2017, 05:13:32 PM
The XM file format is probably not what you want for ham radio stuff.

yah - but the wave functions may be useful for generating morse code   :P
i know you are thinking received audio, SDR, DSP, etc

Quote from: Siekmanski on November 24, 2017, 05:13:32 PM
Do you have an ASIO sound card?

no - well, not that i know of
i have a new machine in a box i haven't opened yet
i have to move some things around to make space
no time to play, lately  :(
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 25, 2017, 02:23:24 AM
 :t
Title: Re: Off topic
Post by: DavidB on November 25, 2017, 06:20:00 AM
Quote from: sinsi on November 24, 2017, 08:23:05 PM
QuoteHonestly, you don't appear to have life for IT, but you are really good at judging people.
Don't get many better examples of irony than this  :t
Yeah, that's what I was thinking too. :greenclp: But at least he was helpful. His Visual Studio project has been very useful even though it doesn't open properly.


Quote from: aw27 on November 24, 2017, 09:35:33 PM
Quote from: sinsi on November 24, 2017, 08:23:05 PM
QuoteHonestly, you don't appear to have life for IT, but you are really good at judging people.
Don't get many better examples of irony than this  :t

As Confucio said, when a wise man points at the moon the fool looks at the finger .  :t
Aww, come on now. What's wrong with pointer variables? They can be quite useful!  :lol:
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 25, 2017, 09:54:15 AM
I was finally able to get the XM file to play as part of my program. I want to thank everyone who contributed. Even those of you whom I don't get along very well with.

I am now trying add a WAV file that I want to have play. To do this, I am trying to "invoke PlaySound...", but I am getting an "undefined symbol: PlaySound" error. I tried resolving this by adding "include winmm.inc" (I have winmm.lib configured in the linker, so I don't have the "includelib" line for that.) This resolved the undefined symbol error, but now I have a bunch of "label clash" warnings and two errors:

undefined symbol : SND_ASYNC
INVOKE argument type mismatch : argument : 3


This is the PlaySound line that I am trying to test with.
invoke PlaySound,NULL,NULL,SND_ASYNC
I realize that this will not actually play any sound, but I want to get the program to at least assemble before I worry about that.
Title: Re: Bundle and Play XM File As Resource
Post by: jj2007 on November 25, 2017, 03:41:15 PM
What do you get from a forum search (http://masm32.com/board/index.php?action=search;advanced;search=) for PlaySound?
Title: Re: Bundle and Play XM File As Resource
Post by: DavidB on November 25, 2017, 03:43:53 PM
Quote from: jj2007 on November 25, 2017, 03:41:15 PM
What do you get from a forum search (http://masm32.com/board/index.php?action=search;advanced;search=) for PlaySound?
Nothing useful I'm afraid. I'm under the impression that whatever the problem is, uFMOD is the culprit.
Title: Re: Bundle and Play XM File As Resource
Post by: Vortex on November 25, 2017, 07:38:46 PM
Hi DavidB,

Reading \masm32\include\windows.inc :

SND_ASYNC equ 1h
Title: Re: Bundle and Play XM File As Resource
Post by: LiaoMi on November 25, 2017, 08:29:44 PM
Hi everybody,

I was looking in Google for a library miniufmod x64, which can be integrated into projects on x64 bit systems. There were many topics with a similar question, I believe that there is no such version, but can I find somewhere the source code of the miniufmod library?!
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 25, 2017, 09:30:51 PM
Hi LiaoMi,

Are you sure it is named miniufmod? couldn't find anything other than ufmod.

https://sourceforge.net/projects/ufmod/files/latest/download

Title: Re: Bundle and Play XM File As Resource
Post by: LiaoMi on November 25, 2017, 11:02:20 PM
Quote from: Siekmanski on November 25, 2017, 09:30:51 PM
Hi LiaoMi,

Are you sure it is named miniufmod? couldn't find anything other than ufmod.

https://sourceforge.net/projects/ufmod/files/latest/download

Hi,

yes  :biggrin:, I was wrong in the name, everything mixed together, correct name minifmod  :icon_exclaim: here from this company https://www.fmod.com (https://www.fmod.com)
Title: Re: Bundle and Play XM File As Resource
Post by: Siekmanski on November 26, 2017, 12:17:52 AM
For the free option you need to register for the fmod.dll and  only use it in one production per year.  :(