aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound_adlib.cpp
AgeCommit message (Collapse)Author
2007-05-30Updated legal headers in source files, based on what Pidgin (the IM client ↵Max Horn
formerly knowns as Gaim) does; added new (incomplete) COPYRIGHT file; updated copyright dates in a few spots svn-id: r27024
2007-04-15Formatting/Cleanup.Johannes Schickel
svn-id: r26511
2007-04-01made _vm/_engine usage consistent. (_engine -> _vm all over the place now).Johannes Schickel
svn-id: r26342
2007-02-20Patch #1663933 (Kill premix channel) with a few tiny additional tweaks by meMax Horn
svn-id: r25752
2007-02-17Only set up the Kyra 1 triggers for Kyra 1, not Kyra 2.Torbjörn Andersson
svn-id: r25650
2007-02-16Added support for Kyrandia 2 ADL files.Johannes Schickel
svn-id: r25634
2007-01-29- adds support for FM-Towns SFX (thanks to Florian Kagerer for his source)Johannes Schickel
- gets rid of GameFlags::hasAudioCD svn-id: r25258
2007-01-26little parameter reodering.Johannes Schickel
svn-id: r25201
2006-08-15- adding LPGL headers to adlib sound specific filesJohannes Schickel
- stating about dual license of adlib sound specific files svn-id: r23708
2006-08-03Committed my own patch #1533833 (minus one line that was left over from anTorbjörn Andersson
earlier experimental version) after discussing it with LordHoto. This works around a bug in the "Pool of Sorrow" Adlib data which caused the channels to drift more and more out of sync for each time the music looped. The patch forces the channels involved to jump in sync. As with all such workarounds, it may cause regressions. But it shouldn't. svn-id: r23659
2006-07-26Removed unnecessary #includeTorbjörn Andersson
svn-id: r23598
2006-06-02Fix for bug # 1497961 ("KYRA1: in-game "Music" option not working").Johannes Schickel
svn-id: r22844
2006-05-28- makes Screen::getPagePtr privateJohannes Schickel
- introduces Screen::getCPagePtr and Screen::getPageRect (which should ease the introduction of dirty rect handling) - moves KyraEngine::loadBitmap to Screen svn-id: r22716
2006-05-28Commits Chriliths patch for fixing Kyra on PalmOS.Johannes Schickel
svn-id: r22708
2006-05-12- little cleanupsJohannes Schickel
- adds kyra3 dummies svn-id: r22425
2006-04-29Moved the AudioCDManager as well as class AudioStream and its (standard) ↵Max Horn
subclasses to namespace Audio svn-id: r22231
2006-04-12Fixing mismatch between format strings and data on some systemsMax Horn
svn-id: r21827
2006-04-12sizeof(void *) != sizeof(int) for a large number of systems.Jonathan Gray
Fix a lot of debug/error statements that were using %d/%x for the result of pointer arithmetic. As C++ apparently has no format string for ptrdiff_t use %lu/%lx as appropriate. svn-id: r21824
2006-03-26Cleaned up update_playRhythmSection(). It's almost possible to understand whatTorbjörn Andersson
it's intended to do now. Renamed _unkOutputByte2 to _vibratoAndAMDepthBits. It's a pretty terrible name, but that's what it is: the two most significant bits of the Adlib BD register. Renamed _rhythmSection to _rhythmSectionBits for consistency: It's the five least significant bits of the Adlib BD register. (The remaining bit is the rhythm on/off bit. I don't think we store that one in any variable.) svn-id: r21463
2006-03-25I believe that the purpose of updateCallback45() is to add a signed value to aTorbjörn Andersson
channel's unsigned tempo. Rewrote the function to make this clearer, and renamed it update_changeChannelTempo(). svn-id: r21448
2006-03-25More renamings:Torbjörn Andersson
unk11 -> durationRandomness updateCallback12() -> update_setupNoteAndDuration() updateCallback26() -> update_setupDuration() updateCallback44() -> update_setDurationRandomness() svn-id: r21447
2006-03-21Implemented "sound triggers" so that the music does not stop shortly afterTorbjörn Andersson
entering the castle. I hope this is a fair approximation of how the original worked. Of course, this led to a couple of more renamings: _unk5 -> _soundTrigger updateCallback54() -> update_setSoundTrigger() snd_setUnk5() -> snd_getSoundTrigger() (yes, "get") At the moment, the only known sound triggers are the ones in the castle. If an unknown trigger is set, the debugging messages will be really, really noisy. I don't know if I should consider this a bug or an extremely annoying feature. svn-id: r21396
2006-03-17Oops, I never meant to remove *that* line! Put it back again. (This fixes theTorbjörn Andersson
flute sound, and probably other regressions as well.) svn-id: r21345
2006-03-17The opcode functions are not allowed to modify their own channel.dataptrTorbjörn Andersson
directly. If they want a new data pointer, they have to use the dataptr parameter. This fixes a subtle bug that would cause the wrong music to play when getting the quill in Kyra 1. svn-id: r21344
2006-03-16More cleanups and renamings: _sfxSecondByteOfSong -> _sfxPriorityTorbjörn Andersson
Added some comments on the strange but probably harmless things going on in playSoundEffect() svn-id: r21340
2006-03-16Went through callbacks 51, 52 and 53, comparing them to LordHoto's annotatedTorbjörn Andersson
disassembly. I think they're correct now, and a bit easier to read. My old comments were wrong, too. I think they are for manipulating the Adlib rhythm section volumes. I'm not sure the Kyra music ever uses the Adlib rhythm section. svn-id: r21339
2006-03-16We have several functions where we need to find the pointer to a program or anTorbjörn Andersson
instrument. These are found using the lookup tables in _soundData on offsets 0 and 500 respectively. Added helper functions for that, which makes the code a lot tidier. Particularly in update_setupRhythmSection(), where it's now much clearer where it's getting all those "unk" values from. Use the checkValue() function (which limits the "total level" to its valid range) for the calculateOpLevel1() and 2() functions as well. Renamed updateCallback16() to update_waitForEndOfProgram(). svn-id: r21337
2006-03-16More renamings:Torbjörn Andersson
callbackOutput() -> setupPrograms() callbackProcess() -> executePrograms() updateCallback3() -> update_setupProgram() _unk4 -> _rhythmSection updateCallback48() -> update_setupRhythmSection() updateCallback49() -> update_playRhythmSection() updateCallback50() -> update_removeRhythmSection() svn-id: r21336
2006-03-16I don't know if it's our bug, or a bug in the original Kyra music driver, butTorbjörn Andersson
updateCallback3() would call unkOutput2(9) in at least one case. This is obviously wrong because it a) reads outside _regOffsets[], and b) writes to invalid Adlib registers. Now unkOutput2() has the same safeguards as noteOff() already had, making callbackOutput() and updateCallback3() even more similar. svn-id: r21335
2006-03-16Fixed some comments and made a couple of cleanups to make it a bit more clearTorbjörn Andersson
just how similar callbackOutput() and updateCallback3() are. svn-id: r21333
2006-03-14Cleanup.Torbjörn Andersson
svn-id: r21304
2006-03-14Added workaround in FMOPL for the pathological case where a note was turned offTorbjörn Andersson
while still at the very beginning of the "attack" phase. This is the very lowest point on the attack curve, yet it would continue from the beginning of the release curve, i.e. its very highest point. This is what caused Kyra to often play low-frequency notes at the very beginning of a new song. (That, and a truly bizarre function for initialising the channels.) The proper fix would be to locate the correct point on the release curve and continue from there. For now, though, only handle the trivial case. svn-id: r21302
2006-03-14Fix typo in comment.Torbjörn Andersson
svn-id: r21298
2006-03-14- Fixes a bug in update_primaryEffect (wrong sound from the birds outside ↵Johannes Schickel
brandons home is fixed with this) - Changes _tempo, tempo, position, unk41, unk32, unk18, unk19, _unkValue3 to unsigned (should be correct this time) svn-id: r21293
2006-03-14Fixes _unkTables, I made a mistake while extracting those last time it seems.Johannes Schickel
svn-id: r21287
2006-03-14Updated comment with more circumstantial evidence that the low-frequency noteTorbjörn Andersson
bug is a bug in our fmopl.cpp. Ken Silverman's Adlib emulator doesn't seem to exhibit the bug either. (But is apparently less feature complete than MAME's.) svn-id: r21275
2006-03-13Further clarifications to the comment about the "low-frequency notes atTorbjörn Andersson
beginning of music" bugs. As an experiment, I tried hooking up ScummVM with the most recent version of the FMOPL code, and the bug went away. Unfortunately, I believe we are stuck with the ancient version for license (and performance?) reasons. svn-id: r21267
2006-03-13Cleaned up the comments in unkOutput2(), and added a big note about the bugTorbjörn Andersson
where low-frequent noises are playing at the beginning of some new sounds. svn-id: r21265
2006-03-13Changed type for samplesleft in order for MIN macro to work properly on all ↵Lars Persson
platforms svn-id: r21264
2006-03-13Things continue to fall into place. In other words, more renamings:Torbjörn Andersson
unk3 -> spacing1 unk7 -> spacing2 unk12 -> fractionalSpacing updateCallback4() -> update_setNoteSpacing() updateCallback9() -> update_stopChannel() updateCallback15() -> update_stopOtherChannel() updateCallback17() -> update_setupInstrument() updateCallback28() -> update_setFractionalNoteSpacing() updateCallback43() -> update_nop1() updateCallback47() -> update_nop2() svn-id: r21261
2006-03-13I was going to hold off on this until the "Pool of Sorrow" music had been fixedTorbjörn Andersson
but it seems that it drifts out of sync after a few repeats even with the original interpreter. It's a feature! This cleanup clears up some of the more confusing break/continues in the callbackProcess() function, and gets rid of _continueFlag. svn-id: r21259
2006-03-12Until now, we have confusingly used the terms "state" or "table" where weTorbjörn Andersson
really mean "channel". Fixed that: OutputState -> Channel _curTable -> _curChannel _outputTables[] -> _channels[] The biggest change was modifying all the "state" and "table" local variables and function parameters. Ahd, at no extra charge: _outputTable[] -> _regOffset[] svn-id: r21247
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