Re: Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn

On Tuesday, 5 February 2019 at 17:14:05 UTC, Adam D. Ruppe wrote:

On Tuesday, 5 February 2019 at 17:09:10 UTC, Murilo wrote:
When I compile the code above the compiler says Error: linker 
exited with status 1

What should I do?


It might have to be "shoot.wav"w, notice the w on the end.

But I am guessing the main problem is not linking in the winmm 
lib and dll. It will probably work to add


pragma(lib, "winmm");

to your file right after the import.


You were right :) No need for the w but it was necessary the 
pragma(lib, "winmm");


It worked! Thanks so much man, all the best to you.


Re: Simple way to play sounds using D

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 5 February 2019 at 17:09:10 UTC, Murilo wrote:
When I compile the code above the compiler says Error: linker 
exited with status 1

What should I do?


It might have to be "shoot.wav"w, notice the w on the end.

But I am guessing the main problem is not linking in the winmm 
lib and dll. It will probably work to add


pragma(lib, "winmm");

to your file right after the import.


Re: Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn

On Tuesday, 5 February 2019 at 17:01:54 UTC, Adam D. Ruppe wrote:

On Tuesday, 5 February 2019 at 16:50:36 UTC, Murilo wrote:
Hi guys, I would like to play simple sounds but I want 
something easy to use, can you show me the simplest way to do 
that? Like a function that just loads a .wav and plays it.


If you are on Windows, the OS has a nice function for little 
ones:


https://docs.microsoft.com/en-us/previous-versions//dd743680(v=vs.85)#examples


Hi, thanks for the reply.
import std.stdio, core.sys.windows.mmsystem;

void main()
{
PlaySound("shoot.wav", null, SND_FILENAME);
}
When I compile the code above the compiler says Error: linker 
exited with status 1

What should I do?


Re: Simple way to play sounds using D

2019-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 5 February 2019 at 16:50:36 UTC, Murilo wrote:
Hi guys, I would like to play simple sounds but I want 
something easy to use, can you show me the simplest way to do 
that? Like a function that just loads a .wav and plays it.


If you are on Windows, the OS has a nice function for little ones:

https://docs.microsoft.com/en-us/previous-versions//dd743680(v=vs.85)#examples


Simple way to play sounds using D

2019-02-05 Thread Murilo via Digitalmars-d-learn
Hi guys, I would like to play simple sounds but I want something 
easy to use, can you show me the simplest way to do that? Like a 
function that just loads a .wav and plays it.