Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Save Sound

Author
Message
Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 9th Dec 2012 23:17 Edited at: 15th Dec 2012 19:56
Actually I don't know if this was posted before XD.

I originally posted this snippet here.



The function will save a already loaded sound as .wav file.
I created this function when I realized that the DBP command "SAVE SOUND" can only be used for sounds recorded with "RECORD SOUND", which is pretty odd imo.

You need the Matrix1Utils by IanM for this.

Quote: "I don't really know much about different .wav formats, but since I'm reading all the important information from the dark basic
memblock I guess it should work just fine with all .wav files that can be loaded by dark basic.

Feel free to use and/or change it.

If there are any problems with this I'm afraid you have to look into it yourself.
However, if you enhance it, it would be nice of you to post the changed version here."


EDIT:
I included some security checks.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Dec 2012 23:40
Haha, I laughed when I saw this thread, because someone was complaining earlier about how save sound doesn't work and here you have it solved.

It works on my side, nice job!

TheComet

Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 9th Dec 2012 23:52 Edited at: 10th Dec 2012 00:05
Thanks .

Actually I would like to include another check, if the created .wav file is valid, but I don't think that's possible without loading and testing it.
And even then I most likely could only say "Valid" or "Some kind of error occured".
So ... this wouldn't really be any help whatsoever XD.

btw.
The one who complained, was that coincidentally me? XD
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Dec 2012 17:07
The one who complained was Leonid. I see you already linked him with this : http://forum.thegamecreators.com/?m=forum_view&t=200315&b=1

TheComet

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 10th Dec 2012 18:32
nice - really useful

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Grasmann
15
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 15th Dec 2012 20:00 Edited at: 12th May 2013 01:18
I added another security-thing XD.

I already asked that in IanM's Matrix1-thread, so I'm not sure, but I think the datafile-operations can destroy your file system in certain cases.

I managed to destroy my filesystem twice now XD, and I'm pretty sure it has something to do with what I'm working on.

What I added:

( the code in the original post is updated )

The command causes the plugin to write the data directly to disk instead of using a write buffer.

Login to post a reply

Server time is: 2024-03-29 02:06:32
Your offset time is: 2024-03-29 02:06:32