Playing wav file from any point

BlitzPlus Forums/BlitzPlus Programming/Playing wav file from any point

Timjo(Posted 2009) [#1]
I'm trying to make a wave file editor in Blitzplus.
I have all the 'format' data stored in variables and the sample data for the currently loaded file stored in a bank. I also have the sample data rendered to a canvas(thanks Mahan), with a cursor for the user to move around.
My problem - how can I play the wave file from any position that the user selects?
Is there a way to move through the sample bank to play the file from a given start point?
Any ideas? Thanks.


em22(Posted 2009) [#2]
You could create a copy of the wave bank from the address the user had clicked. Then play that copied bank.


Timjo(Posted 2009) [#3]
That's what I would like to do.
Problem is, how do I play a sound from a bank ?
Are there commands or techniques that I'm unaware of that can do this ?


Mahan(Posted 2009) [#4]
I'm pretty sure that is a bit hard unfortunately :/

Problem in both BlitzPlus and Blitz3D regarding banks is exactly that: We don't have a stream interface for the banks.

What Blitz3D and BlitzPlus would benefit immensely from would be:

1.) Add "Load*" commands (LoadMesh(), LoadImage() etc.) compatible with the existing Stream interface. (The one used for Files, Network already)
2.) Adding a "BankStream" i.e. to be able to treat bank as a simple Write or Read stream.

I assume BRL won't add such additions to these languages at this time as BlitzMax is the "new thing".

What you can do is have your app creating a temporary .wav-file and load+play it. I assume you already explored the .wav format a little, and it's not the whole world to write both readers and writers for them, from/to a bank.


Timjo(Posted 2009) [#5]
That was the only solution I could come up with. Not the quickest or most efficient of solutions, but I guess It'll do for now.
I already have the .wav writing routine in place - so I can re-work some of the 'format' chunk & sample data to save to a temp file for playing.

Thanks for the input.