Commit Graph

193 Commits (ac65ebfdfcbc998fc7a674652f1596ee48b2e288)

Author SHA1 Message Date
Giel van Schijndel 491b968833 * Make cdAudio_PlayTrack work with an enum instead of "magic numbers"
* Use this enum's values throughout the src/* code
 * Replace scripting function playCDAudio(int) by playIngameCDAudio() which is equivalent to cdAudio_PlayTrack(playlist_ingame)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3687 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-04 16:46:55 +00:00
Giel van Schijndel 8fe5f93991 Add a workaround/hack to prevent starting of new songs when we switch playlists
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3686 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-04 16:35:34 +00:00
Giel van Schijndel 1513ac41e2 Because g_apTrack's size is determined on compile time don't allocate it dynamically but statically
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3678 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-04 12:25:18 +00:00
Dennis Schridde cdb9b7bacc Properly wrap the dummy reference. This issue does not only exist on the Mac and was fixed wrongly in r3659.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3671 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-03 21:38:43 +00:00
Giel van Schijndel e7abee3ced Don't use the OggVorbis callback hack when compiling on the Mac
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3659 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-03 13:47:48 +00:00
Giel van Schijndel aafbc90945 Don't use C99 variable struct members
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3632 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-01 22:12:25 +00:00
Giel van Schijndel 7c204a47ac Change file-specific comment in Doxygen comment
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3631 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-01 21:56:02 +00:00
Giel van Schijndel 6e74be4df9 Use C linkage for frameresource.h and debug.h
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3629 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-01 21:26:37 +00:00
Giel van Schijndel 6ddb4af1d5 Clean up header files of sound library:
* Change file-specific comments into Doxygen comments
 * Remove a whole load of unused and unnecessary macros
 * When compiling as C++ make sure to use C linkage


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3627 4a71c877-e1ca-e34f-864e-861f7616d084
2008-02-01 20:43:11 +00:00
Giel van Schijndel 2b59e6840d Add a Doxygen parameter description to sound_PlayStreamWithBuf for fileHandle, volume, onFinished and user_data
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3596 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-29 13:05:38 +00:00
Dennis Schridde 06a3b11a62 Revert r3588. I already did that in r3586.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3591 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-28 00:51:21 +00:00
Giel van Schijndel 7cf72b6fea #include <math.h> and "lib/framework/math-help.h" where required
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3588 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-28 00:29:19 +00:00
Dennis Schridde 9f9c417240 Include lots of forgotten math.h and roundf() is included in C99.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3586 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-28 00:22:02 +00:00
Giel van Schijndel e5885934b7 Utilise sound_PlayStreamWithBuf in cdAudio_OpenTrack to specify a larger buffer count
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3583 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 23:34:25 +00:00
Giel van Schijndel 024c8c1c10 Add function sound_PlayStreamWithBuf to allow specifying custom buffer counts and sizes to use for a stream
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3582 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 23:32:55 +00:00
Giel van Schijndel 6d99a49ef4 Use the sound_.*Stream functions to implement the cdAudio aka playlist code instead of custom crafted code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3580 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 22:31:16 +00:00
Giel van Schijndel f880720628 Implement sound_StopStream, sound_PauseStream and sound_ResumeStream for stopping, pausing and resuming of playing streams initially created with sound_PlayStream
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3578 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 21:33:10 +00:00
Giel van Schijndel 6de5602631 * Make sound_PlayStream and audio_PlayStream return a AUDIO_STREAM* pointer instead of a bool
This pointer can later on be used to stop, pause & resume playing of the given stream


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3577 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-27 21:28:35 +00:00
Dennis Schridde 31a863a90b Setup eol-style CRLF for vcproj files
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3473 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-14 20:49:48 +00:00
Dennis Schridde d7bbab46af Set eol-style and mime-type for vcproj files
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3471 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-14 19:55:59 +00:00
Dennis Schridde b03ab065f9 Fix breakage from r3367: Soundfilenames were forgotten to be changed inside the sourcecode.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3370 4a71c877-e1ca-e34f-864e-861f7616d084
2008-01-05 22:09:56 +00:00
Giel van Schijndel 30d837ec90 * Allow compilation on MSVC again
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3285 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 21:55:02 +00:00
Giel van Schijndel 3d245df0f9 * Provide an implementation of sound_PlayStream
* Modify audio_PlayStream's prototype to match sound_PlayStream's implementation & prototype
 * In cdspan_PlayInGameAudio use sasprintf instead of a statically sized array and snprintf
 * Add some Doxygen comments

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3276 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 15:16:59 +00:00
Giel van Schijndel 06649908ff * abort() when out of memory
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3275 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 15:02:29 +00:00
Giel van Schijndel de264ad804 * Remove yet some other useless sounds: ID_SOUND_HELP, ID_SOUND_BARB_SCREAM2, ID_SOUND_BARB_SCREAM3
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3270 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 12:02:18 +00:00
Giel van Schijndel f2118ec871 * Remove cheat "no faults"
* Remove sound scream4.ogg (ID_SOUND_NOFAULTS) which it triggered (that's the onlything that cheat did: playing that audiofile)
  * All that audiofile contained was a spoken message: "There are no faults, in the renderer, at the moment."


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3266 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-31 00:28:31 +00:00
Dennis Schridde 6134810a78 My most dumb commit ever: Dummy reference vorbisfile.h symbols to prevent warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3233 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-29 23:24:33 +00:00
Giel van Schijndel db3d933791 * Add a new cheat/debug-command "showsamples"
* This command will cause the amount of samples in the sound library's queues & lists to be constantly displayed (until turned off) on screen

Patch #887 by Buginator


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3107 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-19 20:17:54 +00:00
Giel van Schijndel 29139cc6da * Fix crashes due to failing to call the callback when sounds are removed from the queue/list
Part of patch #887 by Buginator


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3105 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-18 23:25:32 +00:00
Giel van Schijndel eba3731a93 * Put some duplicated code for destroying sound samples in function sound_DestroyIteratedSample
* If in sound_Update() we encounter an error simply destroy the current sample we're working on


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3066 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-15 20:49:02 +00:00
Giel van Schijndel 8fcd2410be * Apply the last bit of patch #884 by Buginator (openal_track.c)
* Make sure that sound_GetError and sound_GetDeviceError are useable in WZ_NOSOUND builds as well


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3053 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-14 15:11:59 +00:00
Giel van Schijndel d179c09f17 * Fix some errors in openal_track.c; part of patch #884 by Buginator
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3052 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-14 12:13:23 +00:00
Giel van Schijndel 456208fcc3 * Update MSVC project files (part of patch #884 by Buginator)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3051 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-14 12:12:36 +00:00
Giel van Schijndel 22f762a3c3 * Prevent a linker error when compiling with -DWZ_NOUSOUND (sound_RemoveActiveSample was used but not defined)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3050 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-14 11:43:15 +00:00
Giel van Schijndel 992ee8583a * Fix yet another bug introduced in r3047 (the game would hang in an infinite loop because of failing to increase the iterators)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3049 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-13 23:54:28 +00:00
Giel van Schijndel ff44e8c84c * Fix a bug introduced in r3047 (segfault due to failing to check for a NULL pointer)
* Apply patch #879 by Buginator (refactored by me to use less handcrafted code, and more functions instead)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3048 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-13 23:47:46 +00:00
Giel van Schijndel 99c55dbf74 * Try to encapsulate knowledge about AUDIO_SAMPLE's internal representation in openal_track.c (i.e. don't use it in client code!)
* Look at sound_StopSample specifically
 * Use a function to manipulate the linked list of audio samples (i.e. get rid of duplicated code)
 * Allow printing of OpenAL vendor, version, renderer and extensions data on multiple debug "channels" to reduce code duplication
 * Add openal_error.[ch] for error detection (and producing debug messages for them!)
 * Add TOSTRING and AT_MACRO macros to macros.h
 * Get rid of some super-nested if-branches where one of them would return (so we don't actually need an else-branch because the function is left anyway)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3047 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-13 23:16:03 +00:00
Giel van Schijndel 51c32760b4 * Fix a bug where would free the wrong pointer (thanks to Buginator for spotting it)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3026 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-09 23:35:56 +00:00
Giel van Schijndel cc12f08b1a * Apply patch #879 by Buginator with some heavy modifications by me
* Upon removing BASE_OBJECTs loop through the lists of outstanding AUDIO_SAMPLEs to delete all of those that refer to this BASE_OBJECT


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3023 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-09 22:36:06 +00:00
Dennis Schridde c64b565f14 Patch #872 by Buginator. Untested by me since in Bugs we trust. ;)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3020 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-09 19:10:34 +00:00
Giel van Schijndel da2f84009b * In addition to the changes of r2853, make passing a NULL pointer safe as well
* In the error messages being output, distinguish between a NULL pointer and an empty string

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2890 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-26 15:57:56 +00:00
Giel van Schijndel a44aa48f00 * Don't use a C99 variably sized struct member to store the filename of a track (instead a plain pointer will be used)
* Make sure to check for a NULL pointer __before__ passing it to strlen
 * Allow the loading of a track (in sound_LoadTrackFromFile), even if GetLastResourceFilename() returns a NULL pointer


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2889 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-26 15:16:51 +00:00
Per Inge Mathisen eeefdc0af0 Do not crash if filename to sound is not set. Modified version of patch #855 by Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2853 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-22 18:35:03 +00:00
Giel van Schijndel 93c387f1fb * Change "failed to open file" error message, when attempting to load a playlist, from LOG_ERROR to LOG_NEVER as it isn't a real error condition
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2717 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-04 18:45:57 +00:00
Giel van Schijndel 6268b6fff2 * Don't allocate memory in PlayList_Init() while we don't need it yet
* Make sure to set '''global''' pointers to NULL when free()ing them
 * Also set the "size" variables belonging to these pointers to zero
* Use a swap(a, b) style function for variable swapping (in PlayList_Shuffle()) rather than obfuscating code
* Make sure that PlayList_CurrentSong() and PlayList_NextSong() return "const char*" rather than "char*" to make sure no one touches memory he/she shouldn't
* Some general changes to conform with coding style (most notably: braces on a line of their own)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2712 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-04 16:14:24 +00:00
Giel van Schijndel aa4bb6c529 * Prevent a segfault occuring when quitting from warzone if a non-power of two number of tracks has been loaded into a playlist (due to uninitialized pointers)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2711 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-04 16:05:11 +00:00
Giel van Schijndel 7a01000da9 * Clean up some of the playlist code:
* Make PlayList_Read return a bool instead of char (using 'char' there was a perfect example of premature optimisation; to save memory most likely)
   * Remove macro CURRENT_TRACK which expanded to playlist[current_track] (it did _not_ increase readability)
   * Make sure to free resources from __all__ return paths from PlayList_Read
   * Check realloc's return value
   * Don't bitshift but multiply!
   * Make sure to follow coding style (in PlayList_Read)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2709 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-04 15:24:37 +00:00
Giel van Schijndel 5efc500f88 * Fix a bug where (in some cases) file names in the music.wpl playlist would be truncated
Bug reported by Jessicatz (on IRC)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2708 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-04 15:16:56 +00:00
Giel van Schijndel c76b591954 * In audio_StopAll() __always__ set psSample->psObj to NULL; this should fix bug #9233 (and bug #9927, which most likely is a duplicate, as well)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2684 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-03 02:07:25 +00:00
Giel van Schijndel e3b3379a83 * Replace malloc() calls immediately followed by memset(0) calls by calloc() calls instead
* Refactor a linked list iteration to for-loop
 * In audio_StopAll() check whether psSample->psObj is marked for deletion (i.e. audio_ObjectDead(psSample->psObj) returns true); if it is, set the pointer to NULL


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2683 4a71c877-e1ca-e34f-864e-861f7616d084
2007-11-03 01:55:11 +00:00