0
0

I’m trying to use libsidplay2 so create a plugin for FMOD to play .sid-files. I’ve looked at the codec_raw-example and the ape-plugin by Danny Dulai. However my sound programmingknowledge could be better… there’s some parameters in FMOD_CODEC_WAVEFORMAT im not sure what to assign.

lengthpcm? "length in seconds * frequency" says the docs… but I don’t know the length of a sid… don’t think it’s possble to get the length.

format? FMOD_SOUND_FORMAT_PCM16 or FMOD_SOUND_FORMAT_PCM8?

blockalign? I have no idea?

I’ve managed to create a dll-file that fmod successfully loads. Playing a .sid-file now opens it and trying to play it which results in 100% cpu-usage (and no sound), can’t find any errors from fmod or libsidplay though.

  • You must to post comments
0
0

Yes, i think this is a good idea to test the lib first outside of fmod ex :)

  • You must to post comments
0
0

I’ve now added support for subsongs.

Get it at [url:1nxofmhr]http://andreas.blazer.nu/programs.php[/url:1nxofmhr]

  • You must to post comments
0
0

I’m not what you mean here… I have no problem using the play-function (in sidplay2.cpp). But to create a SidTune to play, you must either specify:
* a filename as a string or
* a buffer where the data to the tune is.

So what I was thinking was to get the data that fmod read when opening the file and use that to input to the buffer to create a Sidtune. Is it possible?

  • You must to post comments
0
0

Ahhh, I used fileseek to "rewind" the filepointer to 0, now it reads the whole file! yey! So now I’ll try to get that data to sidplay…

  • You must to post comments
0
0

OMF what a hazzle it was to compile the whole package… When I at last after several hours got it to compile, sidplay2.exe only gave a "unkown format"-error.

Then I tried to compile with VS 7.1 instead of 8.0 and then it worked!

I’m going back to 7.1 now and wait a few years before upgrading….

  • You must to post comments
0
0

Any chance this plugins will be ported to linux?

There seams to be very few codecs for fmodex linux, if any at all.

  • You must to post comments
0
0

Sidplay doesn’t read the file, the read function of sidplay mean "generate me a length byte of data in buffer", it is produced not read from file, where the read function of fmod ex is "read length byte of data from ressource (file/pak…) in buffer", here, the buffer data is inside and not computed, this is why Brett ask you if you can override the read function from Fmod Ex to your own.
Though, when Fmod Ex will read your override read function, you are free to fill the fmod ex buffer the way you want, even computed.

  • You must to post comments
0
0

Yes it works! ๐Ÿ˜€

So now I’ll just add so you can access subsongs and clean up the code, then I’ll put it up for download if someone is interested.

  • You must to post comments
0
0

Seems there is a solution to get it to work, http://sourceforge.net/forum/forum.php? … m_id=28865

haven’t tried it and I won’t bother, I’m STILL back to VS 7.1…

now let’s begin digging into the code…

  • You must to post comments
0
0

I don’t use Linux, but if you do there isn’t very much work to make one. The plugin source is the same, you basically just have to compile it for linux.

  • You must to post comments
0
0

I’m not sure you still understand what I mean. In Sidtune.h there is one contructor that takes a buffer and a length instead of a filename.

[code:256n0ygo]SidTune::SidTune(const uint_least8_t* data, const uint_least32_t dataLen)
{
init();
getFromBuffer(data,dataLen);
}[/code:256n0ygo]

You specify a buffer to load the data (the song) from. So I could use this constructor if I can access the read filedata fmod read to load the sidtune. Are you with me?

  • You must to post comments
0
0

lengthpcm : it can’t be calculated as the sound is generated by the cpu, it is like the spu of the snes (spc700) though you will have to set the time yourself.
By default, it is 3:00 minutes … BUT !
You can alternatively add support for the HVSC songlength database :)

format : SIGNED_SHORT

blockalign : (bps >> 3) * numchannels

  • You must to post comments
0
0

What are you supposed to return in the open callback if the opening fails? I’ve tried FMOD_ERR_FILE_BAD and FMOD_ERR_FORMAT but when using

[code:2n5v3y4s]result = system->createSound("dummyfile.dum", FMOD_SOFTWARE|FMOD_CREATESTREAM, 0, &sound1);[/code:2n5v3y4s]

it crashed even if I return FMOD_ERR_FILE_BAD in the first line in the open callback.[/code]

  • You must to post comments
0
0

wohoo! I now can hear a sid-song from fmod! However it only plays for some second and about 4 times as fast but it’s a start ๐Ÿ˜€

  • You must to post comments
0
0

Yes, it seems that this function can be used as the fileread callback.

  • You must to post comments
0
0

lengthpcm: Yes, I know about the HVSC. :) I set it to 3969000 then (22050*180)?

format: SIGNED_SHORT, what’s that? format must be a FMOD_SOUND_FORMAT enum, and there’s no such thing..?

blockalign: what do you mean with bps? Bytes Per Second?

  • You must to post comments
0
0

[quote="bLAZER":37iwm1dt]I’ll put it up for download if someone is interested.[/quote:37iwm1dt]

I am interested! ๐Ÿ˜†

  • You must to post comments
0
0

Now is sound fine except that the sound sort of stutters. It plays around 0.5 sek, then goes back 0.25 seconds, then plays 0.5 secs etc.

I initialize sidplay2 with these settings:

[code:3s4m91xp] m_cfg.frequency = 44100;
m_cfg.playback = sid2_mono;
m_cfg.precision = 16;
m_cfg.sampleFormat = SID2_LITTLE_SIGNED;[/code:3s4m91xp]

and the plugin with these settings:

[code:3s4m91xp] m->waveformat.channels = 1;
m->waveformat.format = FMOD_SOUND_FORMAT_PCM16;
m->waveformat.frequency = 22050;
m->waveformat.blockalign = (16 >> 3) * m->waveformat.channels;
m->waveformat.lengthpcm = 180*m->waveformat.frequency;[/code:3s4m91xp]

and in the read callback I play the sound like this:
[code:3s4m91xp] unsigned int read2 = m->play((signed short) buffer,codec->waveformat->blockalignsizeof(signed short));
*read = read2/sizeof(signed short);[/code:3s4m91xp]

so where is the problem? If I change the frequency of the codec to 44100 it’s the same problem but it plays at double speed, and also crashes.

  • You must to post comments
0
0

in your open callback you should do a fast check to see if it is a sid file or not first. This is usually done by checking a 4 byte code at the start of the file or something like this. Remember there are about 20 codecs to scan through, it has to be as fast as possible.

Next it looks like if it succeeds, you use the fmod file function to read in the whole sid into memory, then the read callback of the plugin would just call that getFromBuffer function using the memory you just loaded the whole file into, and that buffer interface you mentioned, instead of the filename interface.

If all the sid library supplies is ‘here is the filename’ and hides all the file access stuff (ie you can’t speficy file callbacks or something?), then you would have to use the memory based function, you really have to use fmod’s file functions to do the file access, and dont allow any other library to do any disk access. Remember as i said, it could be a http file, on a harddisk, loaded from memory, depending on what the programmer of the application might be doing.

  • You must to post comments
0
0

lengthpcm : correct

format : FMOD_SOUND_FORMAT_PCM16 is the signed short equivalent.

blockalign : bits per samples (8/16/32), this is the resolution.

  • You must to post comments
Showing 1 - 20 of 43 results
Your Answer

Please first to submit.