Commit Graph

728 Commits

Author SHA1 Message Date
Max Horn
bfea71b0c4 renamed AudioInputStream -> AudioStream
svn-id: r12110
2004-01-03 14:10:13 +00:00
Max Horn
1805b07a48 simplification (possible since read() doesn't have to be efficient anymore)
svn-id: r12103
2004-01-03 02:30:34 +00:00
Max Horn
d212b2c2e1 replace read() by readBuffer() in CopyRateConverter
svn-id: r12102
2004-01-03 02:29:48 +00:00
Max Horn
81481ad6da more MAD MP3 / Ogg Vorbis cleanup: try not to expose anything about the libs used for MP3/Vorbis support -> this eases changing the implementations, and reduces header dependencies (and thus compile time) :-)
svn-id: r12097
2004-01-03 01:25:45 +00:00
Max Horn
96e2c239c4 removed SoundMixer::playMP3CDTrack; simplified makeMP3Stream (special variant with mad_timer_t was really only needed for MP3TrackInfo class)
svn-id: r12095
2004-01-03 00:55:28 +00:00
Max Horn
d335bce62d added makeVOCStream() (convenience function)
svn-id: r12094
2004-01-03 00:33:14 +00:00
Paweł Kołodziejski
7bf0cc2a98 FT sounds have loops in voc data: 65536, that could be max loops or unfinite loops
svn-id: r11992
2003-12-28 09:14:00 +00:00
Max Horn
d52280ab01 cleanup
svn-id: r11981
2003-12-27 21:31:49 +00:00
Max Horn
fabcb25a68 paranoia
svn-id: r11980
2003-12-27 21:31:41 +00:00
Paweł Kołodziejski
25a7b9ef33 fixed compilation
svn-id: r11976
2003-12-27 18:29:21 +00:00
Max Horn
0aa7993218 renamed VOC functions
svn-id: r11962
2003-12-27 14:10:45 +00:00
Paweł Kołodziejski
160b94fdaa added handing voc loops
svn-id: r11951
2003-12-26 22:53:30 +00:00
Max Horn
692fca88c2 fix warning, add TODO comment
svn-id: r11942
2003-12-26 13:14:03 +00:00
Paweł Kołodziejski
a45e92efed passthrought v7+ sound voices by imuse digital
svn-id: r11939
2003-12-26 12:15:23 +00:00
Max Horn
2755d9c00a add param to playInputStream which makes it possible to retain an input stream even after it has been given to the mixer for playback
svn-id: r11933
2003-12-26 02:19:31 +00:00
Max Horn
91f5f1687c logic fix: we must do wrap around *before* read, not after. otherwise eosIntern will in some border cases return wrong results; some cleanup
svn-id: r11932
2003-12-26 01:32:29 +00:00
Max Horn
859a9c0129 o Added SoundMixer::isReady()
o Removed SoundMixer::bindToSystem()
o In scumm, replaced _silentMixer, _silentDigitalImuse and _noDigitalSamples by SoundMixer::isReady()

svn-id: r11893
2003-12-24 17:42:22 +00:00
Max Horn
3472e93051 explicitly turn off all active sounds -> not all MIDI devices support the 'All note off' event, at least according to http://crystal.apana.org.au/ghansper/midi_introduction/midi_channel_mode.html ; and now, the quicktime MIDI code doesn't support it anymore, too ;-)
svn-id: r11885
2003-12-24 12:54:33 +00:00
Max Horn
e9269257f3 turned PlayingSoundHandle into an 'opaque' (well not really :-) data type, mainly because people kept (accidentally and sometimes on purpose :-) misusing them
svn-id: r11881
2003-12-24 00:25:18 +00:00
Max Horn
43875b42fc Allow sound ID for MP3/Vorbis sounds, too; cleaned up Vorbis playback code a bit
svn-id: r11879
2003-12-23 19:14:57 +00:00
Torbjörn Andersson
cb782764b4 Fix warning generated by the incomprehensibly picky MinGW GCC compiler.
svn-id: r11858
2003-12-22 19:19:04 +00:00
Max Horn
e01c3e1b1d o Got rid of Channel::destroy() method (no more evil 'delete this', plus
slightly more efficient)
o Fixed potential memory leak in SoundMixer::playRaw
o Channel not anymore friend class of SoundMixer
o misc cleanup

svn-id: r11857
2003-12-22 19:08:19 +00:00
Max Horn
21ab8e496e include stdafx.h
svn-id: r11829
2003-12-21 17:35:44 +00:00
Max Horn
e439eb5129 added convenience SoundMixer::playVorbis variant which calls through to playSfxSound_Vorbis; made scumm/queen engines use it
svn-id: r11812
2003-12-21 15:47:52 +00:00
Max Horn
7fbb3e0559 Cleaned up SoundMixer::newStream() a bit (I plan to replace all usages of this by playInputStream(), this cleanup eases this a bit)
svn-id: r11803
2003-12-21 01:17:03 +00:00
Max Horn
ec0ebf5380 o Make use of the new LinearMemoryStream feature which allows auto-disposing the sound data
o This allows us to get rid of the ChannelRaw class
o Removed the sound index return value from several methods
o Removed all methods dealing with sound indices (i.e. stopChannel and pauseChannel)

svn-id: r11801
2003-12-21 00:44:31 +00:00
Max Horn
c55652d4a6 Rewrote make*Stream factory functions to work around bug in MSVC6 (see bug report #860067); added some comments; LinearMemoryStream now can auto-dispose the data passed to it
svn-id: r11798
2003-12-21 00:26:36 +00:00
Max Horn
d8903123b0 distinguish between end of stream and end of data
svn-id: r11756
2003-12-19 01:30:19 +00:00
Max Horn
d21fc5845d o Moved MP3 and Vorbis input streams to mp3.* resp. vorbis.*
o Added SoundMixer::playInputStream and made some of the other play* methods use it
o Added ProcInputStream stub (not working yet) which one day may allow us to replace the premix code, and allow other fancy stuff
o Remove AudioInputStream::readBuffer default implementation (subclasses should always provide it for max. performance)
o Some minor cleanup

svn-id: r11754
2003-12-19 00:32:47 +00:00
Max Horn
32dd4cc006 fix for recent audio stream regression
svn-id: r11752
2003-12-19 00:09:34 +00:00
Chris Apers
3644176c43 PalmOS sound API cannot access globals data, StackLock constructor use g_system
svn-id: r11742
2003-12-18 11:51:58 +00:00
Chris Apers
26fdb102bb This is now supported on PalmOS
svn-id: r11741
2003-12-18 11:49:53 +00:00
Max Horn
e7bf167428 Made sure that *all* AudioInputStream 'know' their sample rate; removed pointless MusicStream class; removed various specific Channel subclasses and instead generalized the base class some more
svn-id: r11699
2003-12-17 02:19:24 +00:00
Max Horn
91997026a0 cleanup
svn-id: r11697
2003-12-17 01:57:37 +00:00
Max Horn
4343567458 changed the way 'streams' are handled: the finalization logic is now in the WrappedAudioInputStream; this allows further streamlining of the channel/mixer code (can you already guess what I am working towards? :-)
svn-id: r11696
2003-12-17 01:50:50 +00:00
Max Horn
d81746ada8 some cleanup
svn-id: r11694
2003-12-17 01:32:00 +00:00
Max Horn
de51f631be cleanup
svn-id: r11686
2003-12-16 15:34:17 +00:00
Robert Göffringmann
5756a41ba6 added mixer flag for little endian samples
svn-id: r11665
2003-12-16 02:11:04 +00:00
Max Horn
0ee89a3277 init some more member vars
svn-id: r11597
2003-12-12 15:05:33 +00:00
Torbjörn Andersson
813e8fbdab Emergency bugfixes:
Initialise _cd.playing to false. Otherwise ScummVM may create a savegame
where a CD track appears to be playing, but everything about it is
undefined, causing ScummVM to crash when loading it.

Initialise _track_info[] with NULLs, otherwise ScummVM crashes for me when
I start the CD version of MI1.

There's probably a lot more that *should* be properly initialised, but this
seems to take care of the most serious issues, and is all I have the time
to do now anyway.

svn-id: r11573
2003-12-11 08:18:51 +00:00
Jamieson Christian
f82a23771c Expanded the Doxygen docs for the MidiParser class.
Painfully detailed in its description of how to
get a MidiParser object hooked up and running.

Hope this helps ya, Joost! ;)

svn-id: r11559
2003-12-11 00:51:51 +00:00
Jamieson Christian
c95e9d12a2 Endian-safe read-and-advance helper functions are
now based on the READ_LE_* and READ_BE_* macros.
Very slight performance gain, woo hoo.

svn-id: r11558
2003-12-10 23:52:29 +00:00
Max Horn
8edcf3f1ca small tweak/fix (?)
svn-id: r11541
2003-12-09 23:01:36 +00:00
Max Horn
bbc03e144c cleanup
svn-id: r11431
2003-11-29 23:40:21 +00:00
Paweł Kołodziejski
f1d0219067 fixed warning
svn-id: r11430
2003-11-29 19:49:49 +00:00
Max Horn
e68ac71155 added API to query CD playback status; renamed AudioCDManager methods
svn-id: r11422
2003-11-29 13:56:33 +00:00
Max Horn
f00cd05b33 moved Audio CD (emulation) code from scumm/sound.cpp to sound/, so that it may be reused by other engines in the future
svn-id: r11421
2003-11-29 12:11:01 +00:00
Paweł Kołodziejski
1f99fbe77c cleanup whitespaces
svn-id: r11221
2003-11-08 23:05:04 +00:00
Travis Howell
a5498d2102 Correct voc rate in DOTT demo
svn-id: r11186
2003-11-07 11:11:06 +00:00
Max Horn
4c833ba23e fix invalid typo fixes ;-) (BTW did anybody get comit mails for khalek's changes? I didn't)
svn-id: r11183
2003-11-07 09:38:06 +00:00
Jonathan Gray
b2e9b73c4c spelling fixes
svn-id: r11180
2003-11-07 02:43:47 +00:00
Joost Peters
6fc0cd7913 whatever
svn-id: r10959
2003-10-25 01:11:14 +00:00
Joost Peters
3ad14b06f5 added extra flag to mixer so we don't use free() on new'd pointers
svn-id: r10958
2003-10-24 23:09:01 +00:00
Max Horn
7eab653832 cleanup
svn-id: r10894
2003-10-18 13:04:59 +00:00
Max Horn
33f2fbff08 We proudly present the latest installment of our hit series 'Untangle the mess': 'Help! Space Invaders refactored the music detector'... in other news, I obviously need to sleep now
svn-id: r10883
2003-10-18 00:22:46 +00:00
Max Horn
ad2db08940 renamed some Timer methods
svn-id: r10868
2003-10-17 16:39:32 +00:00
Max Horn
c11ebb33b6 cleanup
svn-id: r10718
2003-10-10 12:12:56 +00:00
Max Horn
9f537f4b8c clarification: premixer must use native endianess
svn-id: r10621
2003-10-05 17:42:55 +00:00
Jamieson Christian
a722d0601e Preliminary preparation for new YM2612 FM emulator.
All the hooks are in, but actual implementation
needs to be checked for portability.

svn-id: r10615
2003-10-05 15:36:52 +00:00
Max Horn
d4734bd4f2 use namespace Common a bit more; don't zero the RNG in scumm (else the seed gets reset); remove obsolete 256 color blending code
svn-id: r10592
2003-10-04 11:50:21 +00:00
Max Horn
ad293a5ab8 cleanup / doxygenification
svn-id: r10578
2003-10-03 23:34:06 +00:00
Max Horn
88de9a21ae undo aquadran's recent changes here. If this doesn't compile on MSVC7, fine, simply remove it from your project file - it's not supposed to be compiled ATM
svn-id: r10564
2003-10-03 10:30:33 +00:00
Paweł Kołodziejski
f0fae232b9 fixed compilation under msvc7
svn-id: r10562
2003-10-03 07:45:41 +00:00
Max Horn
bb6765f85d cleanup & restructuring; in particular move the midi driver list to its own source file
svn-id: r10550
2003-10-02 22:52:57 +00:00
Max Horn
17bf7b95aa removed duplicate g_timer object (one was global, one was static to timer.cpp); set g_system earlier (might prevent a few race conditions)
svn-id: r10471
2003-09-28 21:08:48 +00:00
Jamieson Christian
4dcb829e78 Timer services are now available through g_timer, so
you don't have to go through the Engine to get to them.

svn-id: r10450
2003-09-27 23:59:00 +00:00
Jamieson Christian
7f707acfb6 Converted the MPU-401 timer to use the Timer class.
Since this was the only place where we were using
create_thread, that method should be removable now.
I also removed the midi_driver_thread overrides
for the MorphOS and YPA1 (Palm) backends. These need
to be tested by their respective porters.

svn-id: r10414
2003-09-26 14:05:33 +00:00
Jamieson Christian
a30eb131bb Fix for Bug [810564] ALL: missing instruments with native MT-32
As defined in Patch [811623] MT-32 patch for Bug 810564

Added a channel mask to MPU-401 devices so that --native-mt32
may force the device to use only the subset of MIDI channels
actually supported by the MT-32. Also added a best-guess
interpretation of iMuse Part priority in the SysEx 0x00 msg,
since part priorities become more of an issue when the
channel count is cramped.

svn-id: r10409
2003-09-25 22:32:05 +00:00
Max Horn
a4675f34a7 work around silly bug in Microsoft Visual Studio .NET 2003. M$ does not stop at breaking HTML and Java, no, now they have to mutilate C/C++, too. MS-C instead of ANSI-C, anybody? *grmbl*
svn-id: r10319
2003-09-19 21:29:59 +00:00
Max Horn
9470c9f661 changed & documented the premixer semantics
svn-id: r10294
2003-09-18 16:01:33 +00:00
Max Horn
be9d4066e1 moved engine.* to base; this fixes some linking issues when building a barebone ScummVM (or maybe I just want to increase our CVS stats? <g>)
svn-id: r10287
2003-09-18 02:07:18 +00:00
Max Horn
231cb16b5b some tweaks to the build system (work toward plugin support)
svn-id: r10279
2003-09-17 21:53:13 +00:00
Torbjörn Andersson
bc90c04c25 Don't call the premix function when the mixer is paused. (This is
particularly noticeable in games with PC speaker emulation, but I could
hear faint noises in AdLib music as well.)

svn-id: r10262
2003-09-16 07:06:17 +00:00
Max Horn
9e88df9e16 some (untested!) support for backends which require unsigned audio samples
svn-id: r10183
2003-09-11 22:57:06 +00:00
Max Horn
c0e2d2be66 fixed module.mk
svn-id: r10155
2003-09-10 12:41:14 +00:00
Max Horn
eae239394c moved declaration of error/warning/debug from engine.h to util.h; added voc.cpp
svn-id: r10150
2003-09-10 12:19:57 +00:00
Travis Howell
123c9035cf Up debug level of this warning, since it floods output in loom
svn-id: r10131
2003-09-09 13:23:09 +00:00
Max Horn
555dae9fee map 0xA5 to 11025 Hz, too
svn-id: r10129
2003-09-09 12:36:41 +00:00
Max Horn
2c67f7b32f map 0xD3 in VOC headers to 22050 Hz, too
svn-id: r10128
2003-09-09 12:34:13 +00:00
Max Horn
ef373fe2e8 start to use code from the original resample codebase, since it uses fixed point math instead of float; however, the code is not at all complete right now, I just commit this to get it off my HD (neither the old nor the new code in resample.cpp work anyway)
svn-id: r10089
2003-09-08 15:32:37 +00:00
Max Horn
ea461dfc3c new header file for VOC specific stuff
svn-id: r10072
2003-09-07 20:23:38 +00:00
Max Horn
0be0196013 removed pauseMixer method from mixer, and renamed stop to stopChannel
svn-id: r10042
2003-09-06 10:47:30 +00:00
Max Horn
eac128f011 optimized channel volume/pan handling
svn-id: r10028
2003-09-05 23:27:11 +00:00
Max Horn
3aa8454efa moved the sound ID param in playRaw before volume/pan
svn-id: r10023
2003-09-05 22:09:56 +00:00
Max Horn
caf8e8f5fc oops
svn-id: r10021
2003-09-05 21:18:44 +00:00
Max Horn
06b6ff9a44 added default volume/pan values
svn-id: r10019
2003-09-05 21:06:32 +00:00
Max Horn
11193b0746 cleaned up sound/mixer.h a bit; renamed some mixer methods for consistency
svn-id: r10018
2003-09-05 20:48:32 +00:00
Paweł Kołodziejski
7bc63a0ce3 fixes for uninitialized pan and volume
svn-id: r9998
2003-09-05 06:22:10 +00:00
Jonathan Gray
e17a451ac5 remove shadow'd var by using variable name from prototype
svn-id: r9979
2003-09-02 22:38:53 +00:00
Paweł Kołodziejski
7c4e678a87 moved volume and pan control into flow func
svn-id: r9976
2003-09-02 20:34:22 +00:00
Torbjörn Andersson
4b49daf3ff Fixed compiler warning that I introduced earlier.
svn-id: r9974
2003-09-02 16:51:51 +00:00
Torbjörn Andersson
f486997822 Added per-channel pausing. Maybe I should have named the pauseChannel()
function simply pause() to be consistent with stop(), but there already is
a pause() function and I don't want to have two functions with the same
name doing different things. (The current pause() function pauses all
channels.)

svn-id: r9968
2003-09-02 13:48:20 +00:00
Paweł Kołodziejski
db18d4657c forgot this
svn-id: r9957
2003-09-01 14:02:45 +00:00
Chris Apers
e6a0261c7e The channel could be destroyed so changeVolumeAndPan can't access it in that case
svn-id: r9955
2003-09-01 10:12:28 +00:00
Paweł Kołodziejski
82fea49671 added comments:
volume: 0 - 127
pan: (-127 <-> 0 <-> 127) (left <-> center <-> right)

svn-id: r9945
2003-08-31 20:36:53 +00:00
Paweł Kołodziejski
2533b23a60 added mixer features: volume and pan control per channel
svn-id: r9944
2003-08-31 20:26:21 +00:00
Torbjörn Andersson
f72681b10a Made PlayingSoundHandle unsigned again, since the mixer change was
reverted.

svn-id: r9930
2003-08-30 20:36:44 +00:00
Paweł Kołodziejski
c684a076ee revert id handle stuff
svn-id: r9927
2003-08-30 20:25:07 +00:00
Torbjörn Andersson
bfee72f757 If -1 is going to be a valid value for a PlayingSoundHandle, the data type
had better be signed...

svn-id: r9925
2003-08-30 20:07:09 +00:00
Paweł Kołodziejski
9c05d44d00 added func isChannelActive for mixer, and fixed handling numbers of channel 0
svn-id: r9924
2003-08-30 18:12:49 +00:00
Max Horn
57493197e8 small cleanup for the Ogg playback code
svn-id: r9852
2003-08-24 21:54:46 +00:00
Jamieson Christian
d7fae3d1cb More corrections to the VAR_MUSIC_TIMER
computations, mostly to produce the
exptected output with AD resources.

svn-id: r9730
2003-08-16 17:08:22 +00:00
Jamieson Christian
121b00a6f7 Corrected timing mechanism for RO music streams.
RO streams have built-in timer markers (the
unknown 0xA0 mentioned in FR [742249]) that
override automated methods of updating
VAR_MUSIC_TIMER. Since these timer markers
do not seem to be present in AD resources, the
old mechanism is used if MD_ADLIB is the current
MidiDriver.

svn-id: r9720
2003-08-16 09:34:19 +00:00
Jamieson Christian
17be1ad7d5 Removed incorrect acknowledgements (copy/paste error)
svn-id: r9680
2003-08-14 05:07:31 +00:00
Bertrand Augereau
0d54ac09c1 ZeroInputStream::readBuffer didn't have the same signature as the base class version, making VC.NET 2K3 complain
svn-id: r9668
2003-08-13 22:01:34 +00:00
Jamieson Christian
fb62ba61ca Added PC Speaker and PCjr command line options,
in preparation for Kirben's addition of WA support
for games that already have AD tracks.

svn-id: r9656
2003-08-13 14:08:21 +00:00
Robert Göffringmann
7f7b0af613 added SoundMixer::pauseChannels for pausing SFX and keeping adlib music running (needed by BASS when menu bar drops down)
svn-id: r9607
2003-08-09 19:19:27 +00:00
Jamieson Christian
154e872d5a Added generic send() option to MidiChannel.
This circumvents problems doing generic send()
calls to MidiDrivers that support more than
16 MIDI channels (i.e. Adlib). Because of the
way it interacts with MidiDriver, Simon could
have run into a problem if it tried to
allocate more than 15 Adlib music channels
(though this would only happen in very, VERY
rare circumstances).

Also fixed a problem with the channel
numbering scheme used by MidiDriver_Adlib,
in particular the percussion channel number.

svn-id: r9604
2003-08-08 11:54:24 +00:00
Jamieson Christian
4353f4531c Send All Notes Off to every channel on close
svn-id: r9593
2003-08-08 07:23:11 +00:00
Max Horn
ac6bd10c59 my code was actually right. Rather the calling code is evil, it passes us odd buffer sizes for 16 bit audio data, which of course made no sense -> I added some asserts against this
svn-id: r9590
2003-08-07 23:54:39 +00:00
Jamieson Christian
93c90f4674 Fix for Bug [780924] IMUSE: Pitchbend isn't reset when changing tracks
When scanning (not jumping) to a target location
in a different track, the current track is first
scanned to the end to update the player state
before starting into the new track.

Miscellaneous scan-related cleanup is included.

svn-id: r9589
2003-08-07 23:42:15 +00:00
Max Horn
f67b126f1d replace code in readBuffer by slightly less efficient but hopefully working code (at least it fixes an endless loop in COMI for me). I did fix the originaly bug in my optimization, and right now I clueless as to why that code isn't working as it should <sigh>. Need sleep
svn-id: r9588
2003-08-07 22:19:55 +00:00
Jamieson Christian
d8464534a5 Added comment to new macro
svn-id: r9581
2003-08-06 20:44:42 +00:00
Jamieson Christian
99716fc38e Changed readSample template function
to Fingolfin's new READSAMPLE macro.
Circumvents buggy template function
handling in MSVC6. Props to Fingolfin
for tracking this bug down by remote.

svn-id: r9580
2003-08-06 20:41:05 +00:00
Max Horn
69ee268e7f some cleanup
svn-id: r9575
2003-08-06 17:13:04 +00:00
Chris Apers
1a0d308e04 Fixed type mismatch error compiling palmos port
svn-id: r9552
2003-08-06 11:53:18 +00:00
Max Horn
75db41750e getting rid of g_mixer; removing lots of whitespace
svn-id: r9527
2003-08-05 23:58:24 +00:00
Max Horn
48d1739e0a some cleanup; added Channel::getVolume, once somebody tells me what exactly is needed, I can add per-channel volume, and also per-channel panning
svn-id: r9525
2003-08-05 23:03:42 +00:00
Max Horn
d618ace0c0 begone, old mixer code
svn-id: r9521
2003-08-05 21:46:56 +00:00
Max Horn
7ff88ea392 more cleanup
svn-id: r9513
2003-08-05 18:17:26 +00:00
Max Horn
79fd7ee441 cleanup
svn-id: r9512
2003-08-05 18:12:59 +00:00
Max Horn
4c4aa4e957 fix bug #783423
svn-id: r9484
2003-08-05 11:30:13 +00:00
Max Horn
1eaf41eda4 more cleanup (like the previous two, I just moved around code, to clearly separate the old and the new mixer code)
svn-id: r9479
2003-08-05 02:05:37 +00:00
Max Horn
2bc604081e some more cleanup
svn-id: r9478
2003-08-05 01:47:47 +00:00
Max Horn
ded1df35f9 cleanup; removed some code duplication
svn-id: r9477
2003-08-05 01:41:29 +00:00
Max Horn
74188e6143 and finally VorbisInputStream::readBuffer. Once we verified the new readBuffer methods all work, we can get rid of readIntern again and merge those back into the regular read() methods
svn-id: r9476
2003-08-05 01:22:09 +00:00
Max Horn
1de064ee2c optimized MP3InputStream::readBuffer (once more, I won't gurantee for correctness although it seems to work fine over here)
svn-id: r9475
2003-08-05 01:14:27 +00:00
Max Horn
154ca4f2cf simplified code a bit
svn-id: r9474
2003-08-05 00:53:25 +00:00
Max Horn
b1d3b7ab99 optimized WrappedMemoryStream::readBuffer (It's almost 3 AM, so I don't trust myself, hence I'll leave this as an #ifdef for now :-)
svn-id: r9473
2003-08-05 00:50:15 +00:00
Max Horn
b96e5501e6 catch one potential problem, namely if eos is already reached when readBuffer is called ('This should never happen anyway', famous last words)
svn-id: r9472
2003-08-05 00:31:00 +00:00
Max Horn
e1ff91ea7d get rid of calls to the obsolete AudioInputStream::size method
svn-id: r9471
2003-08-05 00:29:37 +00:00
Max Horn
8850f858bc not really sure if using readBuffer would give any gain in CopyRateConverter
svn-id: r9470
2003-08-04 22:49:29 +00:00
Max Horn
d280258e09 renamed eof -> eos (end of stream); hid MP3/Vorbis stream classes completly (by providing factory methods); new readBuffer method for AudioInputStream for improved speed of the mixer; new MusicStream class (subclassed for MP3/Vorbis sound) which offers a getRate method; some other tweaks
svn-id: r9467
2003-08-04 22:15:16 +00:00
Max Horn
996d4f1391 fixed EOF handling of MP3 streams (subtract time from duration timer, instead of adding it...)
svn-id: r9464
2003-08-04 16:28:41 +00:00
Max Horn
ada236a63b one addition less
svn-id: r9425
2003-08-02 19:17:54 +00:00
Max Horn
7ec38f5f02 some more tweaks
svn-id: r9424
2003-08-02 19:09:52 +00:00
Max Horn
20ba086511 slightly cut down on the number of times eof() is called
svn-id: r9423
2003-08-02 18:29:52 +00:00
Max Horn
c373ca107d slightly optimized MP3InputStream::eof, and some cleanup
svn-id: r9422
2003-08-02 18:13:37 +00:00
Max Horn
cc8465aa71 don't use asserts in these tight spots
svn-id: r9420
2003-08-02 17:27:17 +00:00
Max Horn
4cc8c70f25 optimize code flow a little
svn-id: r9419
2003-08-02 17:22:52 +00:00
Max Horn
0142ee260e cleanup
svn-id: r9417
2003-08-02 16:31:31 +00:00
Max Horn
e3b64fa757 added FLAG_REVERSE_STEREO support
svn-id: r9416
2003-08-02 16:11:12 +00:00
Max Horn
1bd9026d8a remove debug output
svn-id: r9415
2003-08-02 14:54:54 +00:00
Max Horn
290a730885 fix for st_rate_flow, code is more straightforward now, too
svn-id: r9414
2003-08-02 14:48:11 +00:00
Max Horn
ca0cc3b5ab obsolete
svn-id: r9410
2003-08-02 11:44:57 +00:00
Max Horn
c57f11f09f garhg
svn-id: r9409
2003-08-02 11:42:53 +00:00
Max Horn
d00a9923cc previous mod was techincally incorrect, this one should be better (but might still be buggy?)
svn-id: r9408
2003-08-02 11:38:23 +00:00
Torbjörn Andersson
a4ac513247 I think this fixes bug #780167 ("SIMON1/2: Sound problems"). When
st_rate_flow() had filled the output buffer, rate->icur and rate->ilast
held the same values, which led to some samples being duplicated on the
next call.

svn-id: r9403
2003-08-02 10:47:35 +00:00
Max Horn
326379b95e oops
svn-id: r9396
2003-08-02 02:54:56 +00:00
Max Horn
1f58fea232 converted ChannelMP3 to use new rate conversion scheme, too. Only thing missing now is FLAG_REVERSE_STEREO support (and of course fixing regressions, and the long term goal is to make resample.cpp usable, too)
svn-id: r9395
2003-08-02 02:41:31 +00:00
Max Horn
02d061598c fix ChannelMP3CDMusic volume, too :-)
svn-id: r9393
2003-08-02 02:12:26 +00:00
Max Horn
6da96e17c0 fix Vorbis music volume
svn-id: r9392
2003-08-02 02:11:15 +00:00
Max Horn
208a3925e9 disable debug output
svn-id: r9390
2003-08-02 00:29:53 +00:00
Max Horn
1cfa9d9029 let the input stream handle the looping (by pretending to be of infinite size -> this fixes a problem which cause 'gaps' at loop turn-over points)
svn-id: r9379
2003-08-01 16:32:11 +00:00
Max Horn
d9bd77032a implemented raw sound looping; some debug output enabled temporarily
svn-id: r9360
2003-08-01 12:49:24 +00:00
Max Horn
0df319e952 #include cleanup (explicityl specify the location for headers from common/, so that we at some point can get rid of -Icommon; exception is made for stdafx.h, since a) we might want to rename it and b) might want to move it to the top level)
svn-id: r9359
2003-08-01 12:21:04 +00:00
Max Horn
643e88b04c get rid of BUGGY_NEW_MP3_PLAYER
svn-id: r9347
2003-07-31 20:28:11 +00:00
Max Horn
0b4e48b59e revamped MP3/Vorbis CD 'emulation' code to use a PlayingSoundHandle -> this allows to finally get rid of the hackish isChannelActive/isChannelUsed methods in SoundMixer
svn-id: r9346
2003-07-31 20:24:10 +00:00
Max Horn
d8494d658b fixed MP3InputStream, now seems to work properly (kind of a surprise)
svn-id: r9345
2003-07-31 19:32:38 +00:00
Max Horn
16425977b7 icur was not being saved between rate conversion calls
svn-id: r9344
2003-07-31 19:08:57 +00:00
Paweł Kołodziejski
e5e117006a back disable warnings into stdafx.h, vc6 is lack of warnings support
svn-id: r9337
2003-07-31 18:35:01 +00:00
Max Horn
1b52e9f19c added new header file backends/intern.h; removed some stuff from common/system.h which is either only of interest to backends or code instantiating a backend (->backends/intern.h); also removed fmopl specific enums (->sound/fmopl.h)
svn-id: r9327
2003-07-31 12:33:33 +00:00
Jamieson Christian
7c16006cc7 Fix for RC bug [780675] MI2: Reoccuring crash
Tightened up OOB track selection handling in
MidiParser. Apparently some SMFs in the Mac
version of MI2 (and other games?) specify
track -1 in their jump commands to indicate
a jump within the same track.

svn-id: r9321
2003-07-31 06:50:13 +00:00
Jamieson Christian
c5de745580 Disabled unknown pragma warning in MSVC-6.
svn-id: r9320
2003-07-31 06:47:05 +00:00
Max Horn
f74197ce8b make use of the new MP3InputStream in ChannelMP3CDMusic - but disabled by default, because it is still quite buggy (e.g. crashes at end of stream etc)
svn-id: r9314
2003-07-31 01:36:24 +00:00
Max Horn
9b2d4f92aa removed the AudioInputStream::size method -> only eof() is really needed, and this can be implemented more efficiently stand-alone; implemented MP3InputStream (work in progress)
svn-id: r9313
2003-07-31 01:21:38 +00:00
Max Horn
5225597d85 cleanup
svn-id: r9312
2003-07-31 01:06:01 +00:00
Max Horn
6143058422 fixed incorrect MSVC fixes; simplified readSample code (bugs #780167 and #780420)
svn-id: r9302
2003-07-30 19:43:51 +00:00
Max Horn
26d05c0190 the VC warning for unknown pragmas is now gloabally disabled, no need to work around it locally
svn-id: r9300
2003-07-30 18:40:28 +00:00
Torbjörn Andersson
15378172cd Partial fix for bug #780167 ("SIMON1/2: Sound problems"). It seems to fix
the crash, but the sounds play at the wrong rate, I believe.

svn-id: r9298
2003-07-30 18:20:45 +00:00
Jamieson Christian
20d06e2c3d Fixed MSVC errors
svn-id: r9288
2003-07-30 09:26:54 +00:00
Max Horn
aa6c99b5da removed some debug output
svn-id: r9282
2003-07-29 13:36:06 +00:00
Max Horn
6b470390f7 cleanup
svn-id: r9281
2003-07-29 12:39:41 +00:00
Max Horn
45ebcdbde1 account for the data in the _buffer, too
svn-id: r9276
2003-07-29 03:02:25 +00:00
Max Horn
fb7deafaef after looking at SAM and DOTT, it seems the actor-voice sync actually is *worse* with a non-zero _silenceCut value - setting it to 0 gives perfect sync for me... odd, when did this change? Anyway, removing _silenceCut. If you notice sync problems, tell me
svn-id: r9275
2003-07-29 02:48:38 +00:00
Max Horn
04843469eb some cleanup; moved around some stuff, preparing to unify more code of ChannelMP3CDMusic and ChannelMP3
svn-id: r9274
2003-07-29 02:21:07 +00:00
Max Horn
bb35528f43 return immediately after commiting suicide; enable new rate conversion code
svn-id: r9273
2003-07-29 01:43:35 +00:00
Max Horn
021a701827 hooked up ChannelVorbis to the new rate converter system, using VorbisInputStream
svn-id: r9272
2003-07-29 01:37:50 +00:00
Max Horn
77eb284062 added VorbisInputStream
svn-id: r9271
2003-07-29 01:37:03 +00:00
Max Horn
1be944755f added makeRateConverter factory function
svn-id: r9270
2003-07-29 01:36:10 +00:00
Travis Howell
3f99e8d1d4 Fix mingw compile
svn-id: r9269
2003-07-29 01:35:37 +00:00
Max Horn
4e7c115681 cleanup
svn-id: r9266
2003-07-29 00:05:36 +00:00
Max Horn
57a413f028 experimental new rate conversion code (use SOX_HACK to en-/disable it); note that right now only the linear filter works, the high quality resample in resample.cpp is in flux; right now the top priority for me is to get MP3/Vorbis resampling working
svn-id: r9261
2003-07-28 20:42:54 +00:00
Max Horn
ed6521f332 fix for bug #776169
svn-id: r9259
2003-07-28 20:25:09 +00:00
Max Horn
c6a4a1d37d make wrapped stream work (I can hear some music in CoMI now before it segfaults :-)
svn-id: r9258
2003-07-28 18:01:56 +00:00
Max Horn
475bc72277 moved st_gcd to resample.cpp
svn-id: r9257
2003-07-28 18:01:00 +00:00
Max Horn
13eee4b06f rewrote the input streams, this should be more straightforward and inline slightly better (the fact that the main AudioInputStream methods are virtual still means that no inlining can take place there; but of course, if we did change that, all the rate converters would have to exist in 8, instead of currently 2, compiled versions)
svn-id: r9256
2003-07-28 17:28:29 +00:00
Max Horn
7ea67048c1 more work on WrappedMemoryStream (not yet tested)
svn-id: r9253
2003-07-28 16:55:43 +00:00
Max Horn
9e051fa507 instead of 'int channels', use 'bool stereo' (less extensible, but then I don't think we'll ever support 5.1 sound :-)); fixed a bug in st_rate_flow where it sometimes would overflow the output buffer; made CopyRateConverter a template, too, increasing efficency
svn-id: r9239
2003-07-28 11:13:01 +00:00
Max Horn
81baae7ddc added CopyRateConverter (used if inrate == outrate)
svn-id: r9214
2003-07-28 01:50:46 +00:00
Max Horn
e87bc6d89e use a single converter for both channels (if input data is stereo), for improved efficency; renamed MemoryAudioInputStream -> LinearMemoryStream and use some template voodoo to make the baseclass of Input8bitSignedStream etc. variable; added (commented out) draf of WrappedMemoryStream
svn-id: r9209
2003-07-28 01:13:31 +00:00
Jamieson Christian
be898b414f For for Bug [775654] DOTT: Hanging notes
Corrected active notes tracking when switching
between Type 2 SMF tracks. Although Note Off
events from the previous track are properly
simulated, those sustaining notes are cleared
from the active notes list so that jumps
within the new track will not attempt to
sustain them again.

svn-id: r9194
2003-07-26 19:37:54 +00:00
Max Horn
226ee61f71 oops accidentally broke the 'old' 8bit resampling code :-(
svn-id: r9192
2003-07-26 01:44:37 +00:00
Max Horn
c520d2d423 move AudioInputStream implementations & makeInputStream into separate .cpp file
svn-id: r9190
2003-07-25 13:42:05 +00:00
Max Horn
2ae3e45aea reduced source code duplication
svn-id: r9189
2003-07-25 13:34:25 +00:00
Max Horn
791efd853a lots of mixer changes: replaced _volumeTable by _globalVolume (applying volume after resampling is more accurate); made more member vars of SoundMixer protected (and thus added some new getter methods); added (untested) support for a second (stereo) channel when playing MP3
svn-id: r9184
2003-07-25 01:19:14 +00:00
Max Horn
95bb74e2b8 round to nearest
svn-id: r9183
2003-07-25 01:05:08 +00:00
Max Horn
f086ab5a05 whitespace
svn-id: r9181
2003-07-24 21:26:46 +00:00
Max Horn
09263a1feb added volume support; some cleanup; provided exactly as many samples as were requested in the 'resample' algorithm (if possible)
svn-id: r9180
2003-07-24 21:26:00 +00:00
Max Horn
1622ac31da added RateConverter classes as thin wrappers around st_* functions; renamed InputStream -> AudioInputStream and cleaned up the hierarchy of its subclasses; added makeInputStream() auxillary function
svn-id: r9179
2003-07-24 18:20:12 +00:00
Max Horn
b9d380bba4 new files, based on SoX (http://sox.sf.net): better resampling code. Note that my mixer.cpp changes are on purpose not yet in CVS since they are not complete. Only reasons I checkin these files is that it's much more comfortable to have CVS, since I need to rewrite parts of resample.cpp now (I already have lots of modifications in). Also expect more OO in the future
svn-id: r9176
2003-07-24 17:46:38 +00:00
Torbjörn Andersson
a327f805ac Fixed regression in clamped_add_16() that kept it from clamping. This was
quite noticeable in the BASS floppy intro.

Of course, if it turns out that 'int' is also only 16 bits it still won't
work, but in that case we run into problems even before this function is
called.

svn-id: r9145
2003-07-23 13:16:58 +00:00
Max Horn
0c47e125af simplified code
svn-id: r9061
2003-07-17 20:44:36 +00:00
Max Horn
d31942c898 oops
svn-id: r9023
2003-07-14 20:45:33 +00:00
Max Horn
33e6989944 removed whitespaces at line ends; added stopHandle
svn-id: r9022
2003-07-14 20:09:14 +00:00
Chris Apers
8b27f60434 Fixed RTTI warnings with PalmOS port
svn-id: r8951
2003-07-12 17:43:39 +00:00
Max Horn
1e0b7aaa16 verify chan != 0 even on WinCE
svn-id: r8940
2003-07-12 11:33:13 +00:00
Nicolas Bacca
72c8e0d96b Give sample rate to channel classes (WinCE downsampling) / Do not use dynamic cast with EVC 3 / Fix Tremor Ogg support
svn-id: r8937
2003-07-12 10:12:41 +00:00
Jamieson Christian
8b8b964aad Reverted to "old" YM3812 (FMOPL) emulator code.
Until specific information regarding the benefits
of migrating to the new emulator can be made
available, the "old" code will remain in effect
for the benefit of slower hardware platforms such
as some WinCE-based devices.

svn-id: r8903
2003-07-11 07:14:21 +00:00
Jamieson Christian
4ac4d76718 Fix for Bug [766426]: V5 Games: Adlib SFX not looped
Modified Smart Jump logic to deal with active notes
whose Note On and Note Off events BOTH occur OUTSIDE
the range of the jump. While this is not a thorough
way to deal with Note On events that occur outside
jump points, it at least deals with the issue of
long, unchanging Adlib SFX used by some earlier
SCUMM games.

svn-id: r8892
2003-07-10 04:34:44 +00:00
Max Horn
d25041859d #include scummsys.h so that our custome free() gets used
svn-id: r8849
2003-07-07 23:11:09 +00:00
Max Horn
7e4fa4a1da mix() is really a private method, only to be called by the audio thread; cover setupPremix by the mutex, too (that helps preventing race conditions upon exit)
svn-id: r8809
2003-07-06 17:00:09 +00:00
Max Horn
b6c3d440b5 now that we mutex-protect everything properly, we can get rid of _toBeDestroyed; also, instead of keeping a global _handles array in the mixer, let each Channel manage its own handle
svn-id: r8808
2003-07-06 16:52:09 +00:00
Max Horn
77b9a4f61e the mutex must be locked by everything which might access _channels while the mixer thread is running, because the mixer thread may modify _channels
svn-id: r8805
2003-07-06 15:57:33 +00:00
Travis Howell
817d600d8e More fixes from Hibernatus
svn-id: r8792
2003-07-06 06:36:26 +00:00
Max Horn
5c17c0f7a7 cleanup to the mixer helper proc interface and to ChannelStream
svn-id: r8785
2003-07-06 01:43:40 +00:00
Max Horn
e993f1d231 protect calls to insertChannel with mutex, too (and switch to using StackLock)
svn-id: r8782
2003-07-05 16:01:55 +00:00
Max Horn
d098334fe6 updated code to use type MutexRef; added class StackLock (from sdl backend, now in util.*)
svn-id: r8777
2003-07-05 15:19:11 +00:00
Paweł Kołodziejski
1ed639aedb hack for proper compile for vc6, why I need this ?
svn-id: r8763
2003-07-05 05:31:04 +00:00
Robert Göffringmann
3aa048d710 make SoundMixer::playRaw only check sound IDs if you actually pass one
svn-id: r8746
2003-07-04 20:08:02 +00:00
James Brown
a4b61ddaba Prevent apparantly possible race condition. I don't get this stuff, and I don't see why the next call to insertChannel is immune to the same theoretical problem :)
svn-id: r8742
2003-07-04 14:49:51 +00:00
James Brown
093a31839b Insert preliminary Zak256 sound looping support. It's not perfect, as some Zak256 sounds only loop a part of the sample - which our mixer API doesn't yet support.
svn-id: r8741
2003-07-04 14:10:44 +00:00
Max Horn
c60e1aeb86 cleanup for -Wundef
svn-id: r8726
2003-07-03 22:05:22 +00:00
Max Horn
01f992db9b cleanup (code easier to read; slightly less rounding errors for the volume; and on BE systems, READ_BE_UINT16 is actually faster ;-)
svn-id: r8706
2003-07-02 10:50:04 +00:00
Paweł Kołodziejski
9385979376 fixed warning
svn-id: r8664
2003-06-27 05:02:01 +00:00
Max Horn
0efc3b2adb cleanup
svn-id: r8645
2003-06-24 23:36:05 +00:00
Paweł Kołodziejski
9d09b77f21 fixed warnings
svn-id: r8613
2003-06-22 14:30:32 +00:00
Max Horn
3883de39a9 d'oh
svn-id: r8611
2003-06-22 14:17:44 +00:00
Max Horn
c03fb13a0b fixed Vorbis CD track code
svn-id: r8610
2003-06-22 13:52:40 +00:00
Max Horn
b4ce216327 don't memset the output buffer to 0 if _eof_flag is set; rather, we should 'add 0' to every byte in the output buffer, i.e.: do nothing
svn-id: r8609
2003-06-22 13:50:46 +00:00
Max Horn
d2b61e9bef properly init member vars instead of using memset
svn-id: r8608
2003-06-22 13:48:47 +00:00
Max Horn
4ead10e4d5 Change names of the stream API in the mixer; added endStream method (stop() halts stream immediately; endStream() lets it first finish playing)
svn-id: r8603
2003-06-22 11:47:03 +00:00
Jonathan Gray
0a6b7ad6ac fix compile when vorbis is enabled, loomcd is now broken with vorbis after recent changes :/
svn-id: r8598
2003-06-22 03:54:43 +00:00
Max Horn
4ad5a183ce renamed SoundMixer::hasActiveChannel->hasActiveSFXChannel, and fixed the regression in it caused by removing _beginSlots (I hope); added isActiveChannel method used by scumm/sound.cpp (this allowed me to move the Channel class from mixer.h into mixer.cpp); replaced Channel::soundFinished method by isActive
svn-id: r8597
2003-06-22 01:55:53 +00:00
Max Horn
573a1e3e99 remove the realDestroy methods and instead use destructors; renamed insertAt to insertChannel and simplified/unified its usage; delete the mutex when exiting; cleanup
svn-id: r8596
2003-06-22 01:34:28 +00:00
Max Horn
bd4370c251 lots of mixer cleanup / refactoring / reengineering
svn-id: r8594
2003-06-21 23:29:34 +00:00
Max Horn
7c332d7fdb modified & cleaned up the playStream/append code a bit; but this API really could stand some refinement
svn-id: r8592
2003-06-21 21:17:08 +00:00
Max Horn
11b2961fdb cleanup
svn-id: r8584
2003-06-21 19:52:12 +00:00
Jonathan Gray
2ba86fd0e5 make gcc happy
svn-id: r8583
2003-06-21 15:55:08 +00:00
Jamieson Christian
f83a32464c Fix for bug [756555] ALL: With '-ewindows' notes don't stop at quit
and bug [755176] SIMON2: Hanging notes

More cleanup of the thread issues associated with iMuse and MidiParser
shutdown. Untested.

svn-id: r8546
2003-06-18 22:46:17 +00:00
Marcus Comstedt
2aed2d9284 Use stdafx.h instead of manually including system headers.
svn-id: r8541
2003-06-18 21:10:05 +00:00
Max Horn
fcc46ac891 more cleanup
svn-id: r8497
2003-06-15 01:56:47 +00:00
Max Horn
6f50feb359 fixed cast warnings
svn-id: r8435
2003-06-11 07:14:39 +00:00
Jamieson Christian
01ba60ccef Fixed post-mortem attempts to transmit MIDI data
svn-id: r8433
2003-06-11 06:43:24 +00:00
Jamieson Christian
d2c952b315 Fixed race condition in MPU401 shutdown
svn-id: r8432
2003-06-11 05:54:46 +00:00
Max Horn
f7e85af552 use clear_sound_proc to properly deinit the mixer (this fixes a crash-on-exit)
svn-id: r8410
2003-06-09 01:19:44 +00:00
Bertrand Augereau
17e6779b65 Made some conversions explicit to prevent VC.NET 2003 from complaining
svn-id: r8254
2003-06-01 21:52:53 +00:00
Jamieson Christian
42f6d10581 Fixed hanging notes on Smart Jump when Note Off event cannot be found.
(I'm not sure why the Note Off would not be found,
but at least we're properly dealing with such notes now.)

svn-id: r8250
2003-06-01 18:24:10 +00:00
Jamieson Christian
86138eda44 Documentation corrections
svn-id: r8224
2003-06-01 04:06:24 +00:00
Jamieson Christian
452735e320 Some last SysEx cleanup.
svn-id: r8223
2003-06-01 04:05:13 +00:00