aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound_adlib.cpp
AgeCommit message (Collapse)Author
2006-03-12Renamed callback1 to primaryEffect and callback2 to secondaryEffect.Torbjörn Andersson
svn-id: r21246
2006-03-12Cleaned up comment and did some more renaming:Torbjörn Andersson
unk4 -> position (measured on a very short ruler :-) unk5 -> duration svn-id: r21245
2006-03-12- Renames some functions:Johannes Schickel
updateCallback31 -> update_setChannelTempo updateCallback42 -> update_resetToGlobalTempo updateCallback55 -> update_setTempoReset - Renames some vars: unk1 -> tempo unk6 -> tempoReset - Fixes tempo bugs svn-id: r21244
2006-03-12- Changes usage of regBx to regAx in primaryEffect2 (seems to be a bug ↵Johannes Schickel
introduced when renaming). - Changes unk41 and unk32 to signed. - Fixes wrong sound when dropping items (that was also a little bug in primaryEffect2) svn-id: r21240
2006-03-12Compensate for rounding errors in _samplesPerCallback by having readBuffer()Torbjörn Andersson
generate "leap samples". I doubt this will make any noticeable difference, but at least now we can probably rule out timer inaccuracies from the list of possible suspects for the remaining bugs. Also removed unnecessary mutex locking/unlocking from readBuffer(), spotted by LordHoto. svn-id: r21239
2006-03-12Corrects former commit which deleted sound file loading after the scene with ↵Johannes Schickel
malcolm and kallak. Also corrects callback50() which seem to improve the sound a bit in the kallak writing scene. svn-id: r21238
2006-03-12After several days, telling LordHoto over and over that "no, I don't think theTorbjörn Andersson
timer inaccuracies can cause that kind of problems, or we'd have noticed it in the other game engines as well", guess what? The other game engines do not necessary use a timer for their Adlib music. So now Kyra doesn't either. Fortunately for my dignity, the music is still a bit uneven at times, but the situation does seem to have improved a bit, and the sound effects sound better to me now. svn-id: r21237
2006-03-12Music in the last two intro scenes plays now again with adlib.Johannes Schickel
Cleaned up the sound code a bit (removed some unneeded functions). svn-id: r21234
2006-03-12Added debug message for the standard "note on" opcodes as well.Torbjörn Andersson
svn-id: r21233
2006-03-12And now, for a change, some more renamings:Torbjörn Andersson
update1() -> setupDuration() updateAndOutput1() -> setupNote() setInstrument() -> setupInstrument() (just for the symmetry) updateAndOutput3() -> noteOn() That made the following two renamings seem natural: updateCallback10() -> update_playRest() updateCallback27() -> update_playNote() I decided to number the secondary effects, even though there's only one: update_setupSecondaryEffect() -> update_setupSecondaryEffect1() update_removeSecondaryEffect() -> update_removeSecondaryEffect1() And finally, I renamed the effects callbacks: stateCallback1_1() -> primaryEffect1() stateCallback1_2() -> primaryEffect2() stateCallback2_1() -> secondaryEffect1() svn-id: r21232
2006-03-12Added a block of comments about command parsing and timing. Perhaps it will beTorbjörn Andersson
of use in tracking down the tempo bugs. svn-id: r21230
2006-03-11Some more renaming:Torbjörn Andersson
updateCallback18() -> update_setupPrimaryEffect1() updateCallback19() -> update_removePrimaryEffect1() updateCallback21() -> update_setupPrimaryEffect2() updateCallback40() -> update_removePrimaryEffect2() updateCallback14() -> update_setupSecondaryEffect() updateCallback30() -> update_removeSecondaryEffect() updateCallback37() -> update_changeExtraLevel1() updateCallback34() -> update_changeExtraLevel2() svn-id: r21217
2006-03-10More comments, and some very minor cleanup.Torbjörn Andersson
svn-id: r21208
2006-03-10Added comment detailing what I believe I know about the remaining "unk"Torbjörn Andersson
variables in OutputState. svn-id: r21207
2006-03-10Further guesswork: 'unk2' appears to be the priority of a sound, since theTorbjörn Andersson
callbackOutput() and updateCallback3() functions won't change the channel data pointer unless the new sound has a higher unk2 and the current one. Since it's set to 0 when the data pointer is nulled, I've changed the priority to be unsigned. The updateCallback22() function is now update_setPriority(). svn-id: r21206
2006-03-10Fleshed out some guesswork comments.Torbjörn Andersson
svn-id: r21205
2006-03-10Renamed _unkOutputByte1 _curRegOffset. It doesn't always correspond to theTorbjörn Andersson
_curTable channel, but it probably does so whenever both of them are used together. svn-id: r21204
2006-03-10Added guesswork comments for stateCallback2_1() and its related functions andTorbjörn Andersson
variables, and cleaned it up slightly. (Some of its variables are now signed.) svn-id: r21203
2006-03-10Added guesswork comments for stateCallback1_1() and its related functions andTorbjörn Andersson
variables. svn-id: r21202
2006-03-10Fixed some obvious errors in the comments I added before.Torbjörn Andersson
svn-id: r21201
2006-03-10Added some guesswork comments about stateCallback1_2() and related functionsTorbjörn Andersson
and variables. svn-id: r21200
2006-03-10The calculateLowByte1() and 2() functions are used for calculating the "totalTorbjörn Andersson
level", which I believe is the individual channel volume. (The functions also return the "scaling level" bits, but they are preserved, not calculated.) I have renamed these functions calculateOpLevel1() and 2(). The unk25 and unk26 variables have been renamed opLevel1 and opLevel2. These are called oplvl_1 and oplvl_2 in our MidiDriver_ADLIB class. The unk26, unk27 and unk28 variables are potentially added to both operator levels, and have been renamed opExtraLevel1, opExtralevel2 and opExtraLevel3. The updateCallback25() function has been remamed update_setExtraLevel1(). The updateCallback33() function has been renamed update_setExtraLevel2(). The updateCallback32() function has been renamed update_setExtraLevel3(). Note that these callbacks aren't quite as similar as their names would seem to indicate: They differ in whether or not the volume is updated and/or how the parameters are passed. svn-id: r21199
2006-03-10Renamed "algorithm" "twoChan" to be more consistent with our MidiDriver_ADLIBTorbjörn Andersson
class, where the corresponding variable is called _twochan. svn-id: r21198
2006-03-10Since updateAndOutput2() is the only function that sets up wave forms andTorbjörn Andersson
stuff, it pretty much has to be our "set instrument" function. Also, while I'm not entirely sure of the implications, "unk23" is the Algorithm bit for the Feedback / Algorithm register, so I've renamed it "algorithm". svn-id: r21197
2006-03-10Some more/updated comments.Torbjörn Andersson
svn-id: r21196
2006-03-09- Removes deleted waitTicks prototype in KyraEngineJohannes Schickel
- Adds sound fading support to the adlib player - Adds support for stopping running tracks - Changes baseFreq type back to uint8 - corrects octave handling in updateAndOutput1 (Thanks to eriktorbjorn for doing that) svn-id: r21185
2006-03-09As LordHoto pointed out to me, updateCallback41() was slightly different afterTorbjörn Andersson
all: it adjusts the frequency even when state.unk16 is zero. Fixed that, and added some comments to hopefully explain the differences between the cleaned up code and the original disassembly. svn-id: r21184
2006-03-09More cleanups and renamings:Torbjörn Andersson
* Rewrote updateCallback41() in terms of updateAndOutput1(), since they were almost identical to begin with. * Rewrote updateAndOutput1() for better readability. * Made unk10 signed, and renamed it baseOctave. * Made unk14 signed, and renamed it baseNote. * Made unk15 signed, and renamed it baseFreq. * Renamed unk17 regAx. It appears to be a cache for that register. * Renamed unkOutputValue1 regBx. It appears to be a cache for that register. * Renamed updateCallback8() update_setBaseOctave(). * Renamed updateCallback13() update_setBaseNote(). * Renamed updateCallback20() update_setBaseFreq(). Which still leaves the mystery of unk16 and _unkTables[]. Perhaps *this* is the pitch bend? svn-id: r21183
2006-03-09Set down in comments what I know about _outputTable[], and what I suspect aboutTorbjörn Andersson
_unkTable[]. Investigating the latter further might help unravelling several of the "unk" variables. (Right now, I'm suspecting that unk15 is the pitch bend.) svn-id: r21164
2006-03-09Corrected a few comments where I had mistaken the note on/off bit for one ofTorbjörn Andersson
the octave bits. The unkOuput1() function always turns off the note, so I've renamed it noteOff(). I've added some comments to unkOuput2() as well, but I'm still not quite sure what its purpose is. It seems unlikely that it's simply a "note on" function, given the many things it will clear for the channel. It does end by turning the note on, though. Strange. svn-id: r21162
2006-03-08Fixed tons of format string warnings for debug/error calls (including ↵Max Horn
several errors where the format string didn't match the number of arguments to the call) svn-id: r21141
2006-03-08The adlib code was calling the Kyra delay() function instead of the Oystein Eftevaag
system delay, which was causing concurrency problems. svn-id: r21136
2006-03-06Renamed setTempo to update_setTempo, also fixed tempo handling (intro is too ↵Johannes Schickel
fast now though, but seems to be another problem). Also changed some unsigned values to signed. svn-id: r21111
2006-03-06More renamings: _unkTableByte1 is now _tempo, and updateCallback29() isTorbjörn Andersson
setTempo(). svn-id: r21110
2006-03-06CleanupTorbjörn Andersson
svn-id: r21109
2006-03-05Corrects implementation of updateCallback48.Johannes Schickel
svn-id: r21105
2006-03-05Note to self: compile before commit.Torbjörn Andersson
svn-id: r21103
2006-03-05The updateUnk6Value() appears to be some sort of random number generator, so ITorbjörn Andersson
have renamed it getRandomNr(). The _unk6 variable has been renamed _rnd. (Our MidiDriver_ADLIB class also has its own random number generator, so it's not such a far-fetched guess as it may seem.) svn-id: r21102
2006-03-05Renamed output1() to adjustVolume(). I'm still uncertain exactly *how* theTorbjörn Andersson
volume is modified (it depends on several still unknown variables), but that's all it does as far as I can tell. svn-id: r21101
2006-03-04Cleanup: output0x388(0xABCD) is now writeOPL(0xAB, 0xCD), which is slightlyTorbjörn Andersson
more easy to read. svn-id: r21081
2006-03-02Changed timeing related variables to unsigned.Johannes Schickel
Also changed the callback interval. svn-id: r21012
2006-03-01Oops forgot to enable music again.Johannes Schickel
svn-id: r20993
2006-03-01Added debug calls to the adlib functions, also uses mixer samplerate now.Johannes Schickel
Fixed a bug in updateCallback41. svn-id: r20992
2006-03-01Fixed updateCallback11() according to LordHoto's directions, and renamed itTorbjörn Andersson
update_writeAdlib(). (The "update_" prefix will probably be changed later, but for now I want it to remain obvious that the functions belong to the other updateCallback*() functions.) svn-id: r20990
2006-03-01Renamed 'unk9' to a slightly more descriptive 'repeatCounter'. (I should haveTorbjörn Andersson
done that in the previous commit.) svn-id: r20987
2006-03-01Use signed integers for jump offsets, so that the jump opcodes can jump bothTorbjörn Andersson
forward and backward. This seems to fix the looping of the Black forest music (and probably others as well), and might fix the invalid pointer crashes and wrong music that would sometimes play after a song had finished. Changed the names of the jump opcode functions, and added "update_" prefixes to the previously cleaned-up opcode functions. svn-id: r20986
2006-03-01Cleaned up updateCallback36() and renamed it setVibratoDepth().Torbjörn Andersson
svn-id: r20985
2006-03-01Cleaned up updateCallback35() and renamed it setAMDepth(). It looks like theTorbjörn Andersson
_unkOutputByte2 variable is there to keep track of the current value of the BD register (AM Depth / Vibrato Depth / Rhythm) svn-id: r20984
2006-03-01Minor cleanup and comments.Torbjörn Andersson
svn-id: r20983
2006-02-28Added lock() and unlock() again to readBuffer.Johannes Schickel
Implemented stateCallback1_1. Fix some small bugs here and there (can't say what the fixed but it should be correct now) Also set's the correct timer call value (with the other the music was too fast) svn-id: r20973