0
0

Hi,

I have a problem with the following code:

[code:1k6uj1ky]Public Function LoadSample(sFilename As String, Optional lOffset As Long = 0, Optional lLength As Long = 0) As Long

Dim exinfo As FMOD_CREATESOUNDEXINFO

On Error GoTo Hell

exinfo.cbsize = Len(exinfo)
exinfo.fileoffset = lOffset
exinfo.length = lLength
exinfo.format = FMOD_SOUND_FORMAT_NONE

lResult = FMOD_System_CreateSound(System, sFilename, FMOD_SOFTWARE + FMOD_CREATESAMPLE, exinfo, LoadSample)
ERRCHECK lResult

Exit Function[/code:1k6uj1ky]

When I use a offset different from 0 is says that it’s an unsupported format.

The file and offset are correct, and this routine is converted from the 3.74 FMOD version (where it worked).

The file is OGG sounds campacted into one file (900 MB), and it worked in version 3.74.

Maybe a problem with the VB structure declaration ?

  • You must to post comments
0
0

Great!!

I daisy-chained two DSP’s and it worked.

Thanks.

  • You must to post comments
0
0

Okay, problem number one – the offset is not into the AUDIO DATA of the file, it’s into the file itself (IIRC)

Number two, while it might work to use + instead of Or, it’s not a good idea (if any of the enumeration flags are more than one bit, or overlap, it will not work as desired.)

Number three, loading a file that big as a sample is a terrible idea. Try loading it as a stream, seeking to the part you want, and using readData to load that part into a sample instead.

  • You must to post comments
0
0

Thanks for your feedback.

  1. Yes, I’m aware of the offset being into the file itself. I have just converted the code from 3.74 to 4.0

  2. The reson for using + in insted of OR is is VB IDE that makes it easy when using + and the options just pops up. But it’s not a issue, or should be if the values are correct.

  3. Regarding the file size. It used to be 72000 !!! sound files. Just think about the file search overhead. The reason for not using as a stream is that the file consists of 72000 words to make a natural speech engine, and in order to build up words, for example “Net” and “work” the gap between the words need to be as small as possible. I load several samples from the file into memory and play them after each other. I have tried several scenarios, and this is by far the best.

So it’s still a problem i FMOD 4

  • You must to post comments
0
0

[quote="ddebono":32d2kkh7]Thanks for your feedback.

  1. Yes, I’m aware of the offset being into the file itself. I have just converted the code from 3.74 to 4.0

  2. The reson for using + in insted of OR is is VB IDE that makes it easy when using + and the options just pops up. But it’s not a issue, or should be if the values are correct.

  3. Regarding the file size. It used to be 72000 !!! sound files. Just think about the file search overhead. The reason for not using as a stream is that the file consists of 72000 words to make a natural speech engine, and in order to build up words, for example “Net” and “work” the gap between the words need to be as small as possible. I load several samples from the file into memory and play them after each other. I have tried several scenarios, and this is by far the best.

So it’s still a problem i FMOD 4[/quote:32d2kkh7]Maybe you don’t understand the problems, then:
1. If you skip into the file, FMOD will be unable to read the header. What you probably want is to skip into the AUDIO. This can be done with a stream.

  1. Or opens an intellisense menu in my version of VB (6), just FYI. Have you tried it?

  2. That’s no reason not to use a stream. You can seek a stream to any location and use readData to grab any piece of audio out of it that you want, without the overhead of reading the whole file into memory. You could then create samples of your own out of those chunks of audio you read from the stream.

  • You must to post comments
0
0

Janus: I think that he just sticked together a lot of ogg files in one file, including headers and all.
Then he is just trying to use the offset to load a particular ogg file from the entire file.
This also means that the sample that is being loaded is only a small part of the file, so it’s not like 700MB is being loaded into memory.

And since it worked in 3.73, it should work in 4 as well :)

  • You must to post comments
0
0

Adion:

Your right.

And this topic was not a discussion subject, but a report of a bug in FMOD 4.

This file is a compilation of 72000 ogg files with an extra index file which holds the startoffset and length of each sample. Reason for using OGG is that the FSB format is not compact enough. The wav version of these files takes about 3.4GB!!

Loading and decompressing 3 samples (anywhere) from this file takes less than 0,01 seconds in the VB development environment. Probably faster in the compiled exe. So I don’t want a discussion about streams versus samples.

I just want to know why the offset paramterer dont work (It worked in 3.74) If I load a sample from the file into a VB variable and load the sample into FMOD it works…

  • You must to post comments
0
0

Ahhhhh… that makes much more sense now. :) Definitely odd that offset doesn’t work then, so I can’t really offer any suggestions other than that you could try storing all the oggs in a ZIP or similar archive instead, and just extracting the piece you want that way.

  • You must to post comments
0
0

Janus: That’s exactly what I do 😆

Brett: Thanks. And I love the pitch functionality. It sounds much better now when the playback rate is increased.

  • You must to post comments
0
0

Yes we can always hope. But it reality nothing works now…

I have posted a message in the 4.0.27 beta thread.

Yes, the pitch bending effect is awesome. Thanks!!

And do feel free to speed it ut a bit, and values greater than 2. Would like to have more than twice speed with the pitch bending working.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.