ScummVM Audio and Midi questions

Ask for help with ScummVM problems

Moderator: ScummVM Team

User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

LordHoto wrote: I mean that you cannot use the (most probably) AdLib SFX you remember.
Though the AdLib player in the Kyrandia engine should have at least partial support for it already, right? It's just that you have to modify the ScummVM source code a bit for it to even try to use it in this case.

As I remember it, the main focus was to get AdLib to work in Kyrandia 1 so it's probably nowhere near as well tested with Kyrandia 2.
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

eriktorbjorn wrote:
LordHoto wrote: I mean that you cannot use the (most probably) AdLib SFX you remember.
Though the AdLib player in the Kyrandia engine should have at least partial support for it already, right? It's just that you have to modify the ScummVM source code a bit for it to even try to use it in this case.

As I remember it, the main focus was to get AdLib to work in Kyrandia 1 so it's probably nowhere near as well tested with Kyrandia 2.
The only modification needed would be to ignore digital SFX and use the AdLib ones instead. Before we had digital SFX support it always used the AdLib/MIDI ones.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

LordHoto wrote: The only modification needed would be to ignore digital SFX and use the AdLib ones instead. Before we had digital SFX support it always used the AdLib/MIDI ones.
I thought it might be. I made that change to my local copy of ScummVM and tried it before I made my previous post, and it did play some sound effects. I just wasn't sure if it played them correctly or not.

I can't think of any good general purpose setting for eschewing the digitized sound effects, so perhaps this would be a good case for an engine-specific setting?
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

eriktorbjorn wrote:
LordHoto wrote: The only modification needed would be to ignore digital SFX and use the AdLib ones instead. Before we had digital SFX support it always used the AdLib/MIDI ones.
I thought it might be. I made that change to my local copy of ScummVM and tried it before I made my previous post, and it did play some sound effects. I just wasn't sure if it played them correctly or not.
They sound odd yes. But you can compare them against DOSBox, when you only select AdLib there.
eriktorbjorn wrote:I can't think of any good general purpose setting for eschewing the digitized sound effects, so perhaps this would be a good case for an engine-specific setting?
This is rather a case for a better overall audio output configuration. AFAIK SCI also has possibilities for distinct music/sfx settings like these.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

LordHoto wrote:They sound odd yes. But you can compare them against DOSBox, when you only select AdLib there.
I did, but only for two or three rooms. That's all I had the time for this morning. :) The AdLib sound/music sounded louder in DOSBox, but maybe that's my volume settings.
LordHoto wrote: This is rather a case for a better overall audio output configuration. AFAIK SCI also has possibilities for distinct music/sfx settings like these.
Come to think of it, I guess the SCUMM engine could be affected by it too, since there are games where there are both digitized and synthesized sound effects, and ScummVM always picks the digitized one. (Didn't someone complain that the bartender spitting in Monkey Island 2 didn't sound like he remembered it because of that?)
Smewtheye
Posts: 9
Joined: Tue Oct 09, 2012 7:22 pm
Location: Kiev

Post by Smewtheye »

so, I take it, if you're not familiar with coding, there's no way to fix the sfx problem in second kyrandia huh?
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Smewtheye wrote:so, I take it, if you're not familiar with coding, there's no way to fix the sfx problem in second kyrandia huh?
Yes, everything that's been discussed so far has involved making changes to the ScummVM source code and compiling it. Not a big change, though adding a configuration setting for it and see how it should affect other game engines would take a bit of thought.
Smewtheye
Posts: 9
Joined: Tue Oct 09, 2012 7:22 pm
Location: Kiev

Post by Smewtheye »

ok can you do me a favor, and tell me two things: how to access the place where those changes are added manually via code. And approximately what changes should be made to make the program pick the original synth sfx. If that's not too much writing, that is. (or show me to a discussion where I can read all that) The rest I'll research myself
I'm pretty much willing to try and to take a risk at this xD
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Smewtheye wrote:ok can you do me a favor, and tell me two things: how to access the place where those changes are added manually via code. And approximately what changes should be made to make the program pick the original synth sfx. If that's not too much writing, that is. (or show me to a discussion where I can read all that) The rest I'll research myself
I'm pretty much willing to try and to take a risk at this xD
In engines/kyra/kyra_hof.cpp there's a function called KyraEngine_HoF::snd_playSoundEffect(), where part of the code reads:

Code: Select all

    int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]);
    if (vocIndex != -1) {
        _sound->voicePlay(_ingameSoundList[vocIndex], 0, 255, true);
    } else if (_flags.platform == Common::kPlatformPC) {
        if (_sound->getSfxType() == Sound::kMidiMT32)
            track = track < _mt32SfxMapSize ? _mt32SfxMap&#91;track&#93; - 1 &#58; -1;
        else if &#40;_sound->getSfxType&#40;&#41; == Sound&#58;&#58;kMidiGM&#41;
            track = track < _gmSfxMapSize ? _gmSfxMap&#91;track&#93; - 1 &#58; -1;
        else if &#40;_sound->getSfxType&#40;&#41; == Sound&#58;&#58;kPCSpkr&#41;
            track = track < _pcSpkSfxMapSize ? _pcSpkSfxMap&#91;track&#93; - 1 &#58; -1;

        if &#40;track != -1&#41;
            KyraEngine_v1&#58;&#58;snd_playSoundEffect&#40;track&#41;;
What this means, as I understand it, is that if it finds a vocIndex that's not -1, it will play a digitized sound by calling _sound->voicePlay(). If not, it will use a synthesized effect. Depending on what audio driver it uses for sound effects, it will try to find an MT-32, General MIDI or PC Speaker effect. If it's none of these, it will presumably use AdLib.

So if vocIndex was always -1, or that part of the code was just removed, it should use synthesized effects.

Generally, the sound driver for sound effects is the same as the sound driver for the music, so if you're using General MIDI music it will use General MIDI sound effects, not AdLib. However, if you've enabled the "Mixed AdLib/MIDI mode" setting on the MIDI tab of the settings, it should use the AdLib driver to play sound effects regardless of the music driver.
Smewtheye
Posts: 9
Joined: Tue Oct 09, 2012 7:22 pm
Location: Kiev

Post by Smewtheye »

eriktorbjorn wrote:
In engines/kyra/kyra_hof.cpp there's a function called KyraEngine_HoF::snd_playSoundEffect(), where part of the code reads:

Code: Select all

    int16 vocIndex = &#40;int16&#41;READ_LE_UINT16&#40;&_ingameSoundIndex&#91;track * 2&#93;&#41;;
    if &#40;vocIndex != -1&#41; &#123;
        _sound->voicePlay&#40;_ingameSoundList&#91;vocIndex&#93;, 0, 255, true&#41;;
    &#125; else if &#40;_flags.platform == Common&#58;&#58;kPlatformPC&#41; &#123;
        if &#40;_sound->getSfxType&#40;&#41; == Sound&#58;&#58;kMidiMT32&#41;
            track = track < _mt32SfxMapSize ? _mt32SfxMap&#91;track&#93; - 1 &#58; -1;
        else if &#40;_sound->getSfxType&#40;&#41; == Sound&#58;&#58;kMidiGM&#41;
            track = track < _gmSfxMapSize ? _gmSfxMap&#91;track&#93; - 1 &#58; -1;
        else if &#40;_sound->getSfxType&#40;&#41; == Sound&#58;&#58;kPCSpkr&#41;
            track = track < _pcSpkSfxMapSize ? _pcSpkSfxMap&#91;track&#93; - 1 &#58; -1;

        if &#40;track != -1&#41;
            KyraEngine_v1&#58;&#58;snd_playSoundEffect&#40;track&#41;;
What this means, as I understand it, is that if it finds a vocIndex that's not -1, it will play a digitized sound by calling _sound->voicePlay(). If not, it will use a synthesized effect. Depending on what audio driver it uses for sound effects, it will try to find an MT-32, General MIDI or PC Speaker effect. If it's none of these, it will presumably use AdLib.

So if vocIndex was always -1, or that part of the code was just removed, it should use synthesized effects.

Generally, the sound driver for sound effects is the same as the sound driver for the music, so if you're using General MIDI music it will use General MIDI sound effects, not AdLib. However, if you've enabled the "Mixed AdLib/MIDI mode" setting on the MIDI tab of the settings, it should use the AdLib driver to play sound effects regardless of the music driver.
hey dude. was away for some time. but I've tried finding this "engines\.." stuff.. it's nowhere to be found. not in the scummvm folder, not in the games folder, not in the entire computer.
the rest of the stuff you said makes perfect sense to me but is there a way it could be accessed otherwise?
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Smewtheye wrote: hey dude. was away for some time. but I've tried finding this "engines\.." stuff.. it's nowhere to be found. not in the scummvm folder, not in the games folder, not in the entire computer.
the rest of the stuff you said makes perfect sense to me but is there a way it could be accessed otherwise?
Perhaps you only have the compiled version of ScummVM, not the source code? The source code can be found in the files section on the ScummVM SourceForge web page. It's been packaged in a few different ways, but if you're on Windows, I guess the scummvm-1.5.0.zip file is the easiest one to work with.
Smewtheye
Posts: 9
Joined: Tue Oct 09, 2012 7:22 pm
Location: Kiev

Post by Smewtheye »

eriktorbjorn wrote: Perhaps you only have the compiled version of ScummVM, not the source code? The source code can be found in the files section on the ScummVM SourceForge web page. It's been packaged in a few different ways, but if you're on Windows, I guess the scummvm-1.5.0.zip file is the easiest one to work with.
Found it, unpacked it into the ScummVM folder, deleted that part of the code, saved changes. didn't work. did it become part of the program the moment I downloaded it or is there something to do to make it run?
also (sry for a 1000 questions) not all sfx are wrong, just all the action ones (fill flask w\potion, make potion, empty cauldron, drink, take, put, change clothes, apply magnet etc.) as well as some extra sfx that were not in the original game. the background sfx are authentic. maybe that's a more specific problem?
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Smewtheye wrote: Found it, unpacked it into the ScummVM folder, deleted that part of the code, saved changes. didn't work. did it become part of the program the moment I downloaded it or is there something to do to make it run?
Maybe I'm misunderstanding the question, but you will of course have to compile the source code into a new program before any changes you make to it have any effect.
Smewtheye
Posts: 9
Joined: Tue Oct 09, 2012 7:22 pm
Location: Kiev

Post by Smewtheye »

eriktorbjorn wrote:
Maybe I'm misunderstanding the question, but you will of course have to compile the source code into a new program before any changes you make to it have any effect.
yes. as I said, I'm not familiar with coding. does it take much to compile it? I couldn't find any tips on this site. are there any here?
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Smewtheye wrote: yes. as I said, I'm not familiar with coding. does it take much to compile it? I couldn't find any tips on this site. are there any here?
There are some instructions on the ScummVM wiki, but I can only vouch for the Linux instructions (which are a bit out of date, but still basically correct) myself. I have no idea about the others.
Post Reply