Author Topic: Sound Samples + Song  (Read 4710 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Sound Samples + Song
« on: March 14, 2011 »
Does anyone know any good ways of playing .wavs while minifmod is playing?

Cheers and apologies for the dumb question..
Shockwave ^ Codigos
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Sound Samples + Song
« Reply #1 on: March 14, 2011 »
What about Win32 API PlaySound or DX routines to play wave?
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Sound Samples + Song
« Reply #2 on: March 15, 2011 »
Hmm, yes I can use the API but I was hoping that there was a way to do it with minifmod :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Sound Samples + Song
« Reply #3 on: March 15, 2011 »
Here's an implimentation of Va!ns idea;

Code: [Select]

    #INCLUDE "windows.bi"       
    #INCLUDE ONCE "win\mmsystem.bi"
    #INCLUDE "explode.bas"

    DIM SHARED PPP AS UBYTE PTR

    PPP=@explode.wav(0)   
    PlaySound(PPP,NULL,SND_MEMORY OR SND_ASYNC)


Explode.bas is just a wav that's been converted with bin2bas, PPP points at the first element of the array in than resource.

It works but it's ugly, occasionally it causes the screen to glitch in tinyptc and you cannot specify a sound channel (as far as I know so if you try and play more than one sample, the other gets cut off).

I am looking for a better solution..

Any ideas?
Shockwave ^ Codigos
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Sound Samples + Song
« Reply #4 on: March 15, 2011 »
Another idea, that could work but you need to figure out some minifmod things. So what about to add to your module some more (empty/unused) channels? So there are unused channels you can use to play your own samples (waves) when ever you want. Maybe there are two ways from now to realise it: You can add your own samples to the module too or you need to point to your own samples (includes or like your own generated waves). I am sure this would be the best way and you have all sound output by DX ;)

Since i never used minifmod i dont know its API nor SDK and if there are any easy ways available to realize. At least this would be much better and cleaner instead using DX and API for playing wave sounds; but it more work.



[Edit - Added:]
Another thing could be waveOutOpen() and all the API for this, mixing channels by yourself.
« Last Edit: March 15, 2011 by va!n »
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Sound Samples + Song
« Reply #5 on: March 15, 2011 »
Does anyone know any good ways of playing .wavs while minifmod is playing?
I was hoping that there was a way to do it with minifmod :)
The minifmod "api" doesn't offer what you're looking for - in contrast to fmod it's just a black-boxish xm-player and not an actual sound system.
If you want to dig into it, it's relatively easy to include such functionality since everything you're asking for is already in there.
As far as I remember the channel allocation was pretty much hard-wired, though, and probably requires some conceptual changes...

If the samples you want to play are already in your xm-file and it's not occupying all 32 channels I could figure out something quick & dirty.
« Last Edit: March 15, 2011 by hellfire »
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Sound Samples + Song
« Reply #6 on: March 15, 2011 »
As far as I remember the channel allocation was pretty much hard-wired, though, and probably requires some conceptual changes...

For what I want to do, the juice isn't worth the squeeze, I don't even know what song I am going to be using so I think that I'll take your advice and look into Fmod instead, if I run out of time I'll just put up with Playsound.

Looking to the future it would be a really cool extension to tinyptc++ to have sound sample playback included though (I think ufmod is in there already?).


As always, thanks for your help :)
Shockwave ^ Codigos
Challenge Trophies Won: