extern char*[] from sounds.h to new sounds.c

Move the list of Tux Paint's internal sound effect filenames
from "sounds.h" to a new "sounds.c" (that compiles to "sounds.o").
This commit is contained in:
Bill Kendrick 2021-10-24 01:20:07 -07:00
parent 5f9ff7e97d
commit b8317f74e0
3 changed files with 78 additions and 43 deletions

View file

@ -4,7 +4,7 @@
# Various contributors (see AUTHORS.txt) # Various contributors (see AUTHORS.txt)
# http://www.tuxpaint.org/ # http://www.tuxpaint.org/
# June 14, 2002 - September 28, 2021 # June 14, 2002 - October 24, 2021
# The version number, for release: # The version number, for release:
@ -1100,7 +1100,7 @@ TuxPaint.dmg:
tuxpaint: obj/tuxpaint.o obj/i18n.o obj/im.o obj/cursor.o obj/pixels.o \ tuxpaint: obj/tuxpaint.o obj/i18n.o obj/im.o obj/cursor.o obj/pixels.o \
obj/rgblinear.o obj/playsound.o obj/fonts.o obj/parse.o obj/fill.o \ obj/rgblinear.o obj/playsound.o obj/fonts.o obj/parse.o obj/fill.o \
obj/progressbar.o obj/dirwalk.o obj/get_fname.o obj/onscreen_keyboard.o \ obj/progressbar.o obj/dirwalk.o obj/get_fname.o obj/onscreen_keyboard.o \
obj/gifenc.o \ obj/gifenc.o obj/sounds.o \
$(ARCH_LIBS) $(ARCH_LIBS)
@echo @echo
@echo "...Linking Tux Paint..." @echo "...Linking Tux Paint..."
@ -1243,6 +1243,12 @@ obj/rgblinear.o: src/rgblinear.c src/rgblinear.h \
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \ @$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/rgblinear.c -o obj/rgblinear.o -c src/rgblinear.c -o obj/rgblinear.o
obj/sounds.o: src/sounds.c src/sounds.h
@echo
@echo "...Compiling sound effect list..."
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/sounds.c -o obj/sounds.o
obj/BeOS_print.o: src/BeOS_print.cpp src/BeOS_print.h obj/BeOS_print.o: src/BeOS_print.cpp src/BeOS_print.h
@echo @echo

66
src/sounds.c Normal file
View file

@ -0,0 +1,66 @@
/*
sounds.c
For Tux Paint
List of sound effects.
Copyright (c) 2002-2021 by Bill Kendrick and others
bill@newbreedsoftware.com
http://www.tuxpaint.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 15, 2002 - October 24, 2021
$Id$
*/
#include "sounds.h"
/* Sound file filenames: */
const char *sound_fnames[NUM_SOUNDS] = {
DATA_PREFIX "sounds/harp.wav",
DATA_PREFIX "sounds/click.wav",
DATA_PREFIX "sounds/bleep.wav",
DATA_PREFIX "sounds/bubble.wav",
DATA_PREFIX "sounds/stamp.wav",
DATA_PREFIX "sounds/line_start.wav",
DATA_PREFIX "sounds/line_end.wav",
DATA_PREFIX "sounds/scroll.wav",
DATA_PREFIX "sounds/paint1.wav",
DATA_PREFIX "sounds/paint2.wav",
DATA_PREFIX "sounds/paint3.wav",
DATA_PREFIX "sounds/paint4.wav",
DATA_PREFIX "sounds/eraser1.wav",
DATA_PREFIX "sounds/eraser2.wav",
DATA_PREFIX "sounds/save.wav",
DATA_PREFIX "sounds/prompt.wav",
DATA_PREFIX "sounds/flip.wav",
DATA_PREFIX "sounds/mirror.wav",
DATA_PREFIX "sounds/keyclick.wav",
DATA_PREFIX "sounds/typewriterbell.wav",
DATA_PREFIX "sounds/return.wav",
DATA_PREFIX "sounds/shrink.wav",
DATA_PREFIX "sounds/grow.wav",
DATA_PREFIX "sounds/italic_on.wav",
DATA_PREFIX "sounds/italic_off.wav",
DATA_PREFIX "sounds/areyousure.wav",
DATA_PREFIX "sounds/youcannot.wav",
DATA_PREFIX "sounds/tuxok.wav",
DATA_PREFIX "sounds/thick.wav",
DATA_PREFIX "sounds/thin.wav",
DATA_PREFIX "sounds/fill.wav"
};

View file

@ -4,7 +4,7 @@
For Tux Paint For Tux Paint
List of sound effects. List of sound effects.
Copyright (c) 2002-2019 by Bill Kendrick and others Copyright (c) 2002-2021 by Bill Kendrick and others
bill@newbreedsoftware.com bill@newbreedsoftware.com
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 15, 2002 - September 12, 2019 June 15, 2002 - October 24, 2021
$Id$ $Id$
*/ */
@ -72,44 +72,7 @@ enum
}; };
/* Sound file filenames: */ /* Sound file filenames (declared in "sounds.c"): */
extern const char *sound_fnames[NUM_SOUNDS];
/* FIXME: These should be moved to a .c file (sounds.c?) and extern'd here, to
avoid being stored multiple times, and to avoid compiler warning
-bjk 2007.07.17 */
static const char *sound_fnames[NUM_SOUNDS] = {
DATA_PREFIX "sounds/harp.wav",
DATA_PREFIX "sounds/click.wav",
DATA_PREFIX "sounds/bleep.wav",
DATA_PREFIX "sounds/bubble.wav",
DATA_PREFIX "sounds/stamp.wav",
DATA_PREFIX "sounds/line_start.wav",
DATA_PREFIX "sounds/line_end.wav",
DATA_PREFIX "sounds/scroll.wav",
DATA_PREFIX "sounds/paint1.wav",
DATA_PREFIX "sounds/paint2.wav",
DATA_PREFIX "sounds/paint3.wav",
DATA_PREFIX "sounds/paint4.wav",
DATA_PREFIX "sounds/eraser1.wav",
DATA_PREFIX "sounds/eraser2.wav",
DATA_PREFIX "sounds/save.wav",
DATA_PREFIX "sounds/prompt.wav",
DATA_PREFIX "sounds/flip.wav",
DATA_PREFIX "sounds/mirror.wav",
DATA_PREFIX "sounds/keyclick.wav",
DATA_PREFIX "sounds/typewriterbell.wav",
DATA_PREFIX "sounds/return.wav",
DATA_PREFIX "sounds/shrink.wav",
DATA_PREFIX "sounds/grow.wav",
DATA_PREFIX "sounds/italic_on.wav",
DATA_PREFIX "sounds/italic_off.wav",
DATA_PREFIX "sounds/areyousure.wav",
DATA_PREFIX "sounds/youcannot.wav",
DATA_PREFIX "sounds/tuxok.wav",
DATA_PREFIX "sounds/thick.wav",
DATA_PREFIX "sounds/thin.wav",
DATA_PREFIX "sounds/fill.wav"
};
#endif #endif