tasty! apache remover is working
[feisty_meow.git] / nucleus / tools / simple_utilities / playsound.cpp
1 /*****************************************************************************\
2 *                                                                             *
3 *  Name   : playsound                                                         *
4 *  Author : Chris Koeritz                                                     *
5 *                                                                             *
6 *  Purpose:                                                                   *
7 *                                                                             *
8 *    A program intended to be as simple as possible and to play only WAV      *
9 *  files on the win32 platform.  It was decided that this was needed because  *
10 *  windows media player suddenly became political and started complaining     *
11 *  when other programs were registered to play different sound types.         *
12 *    All this does is play WAV files.  That's it.                             *
13 *                                                                             *
14 *******************************************************************************
15 * Copyright (c) 2000-$now By Author.  This program is free software; you can  *
16 * redistribute it and/or modify it under the terms of the GNU General Public  *
17 * License as published by the Free Software Foundation; either version 2 of   *
18 * the License or (at your option) any later version.  This is online at:      *
19 *     http://www.fsf.org/copyleft/gpl.html                                    *
20 * Please send any updates to: fred@gruntose.com                               *
21 \*****************************************************************************/
22
23 #include <basis/utf_conversion.h>
24 #include <basis/astring.h>
25 #include <application/windoze_helper.h>
26 #include <loggers/console_logger.h>
27 #include <structures/static_memory_gremlin.h>
28
29 #ifdef _MSC_VER
30   #include <mmsystem.h>
31 #endif
32
33 using namespace basis;
34 using namespace loggers;
35 using namespace structures;
36
37 ///HOOPLE_STARTUP_CODE;
38 //hmmm: this needs to arise from obscurity too?
39
40 int main(int argc, char *argv[])
41 {
42   console_logger out;
43   if (argc < 2) {
44     out.log(astring(argv[0]) + " usage:", ALWAYS_PRINT);
45     out.log(astring("This program takes one or more parameters which are interpreted"), ALWAYS_PRINT);
46     out.log(astring("as the names of sound files."), ALWAYS_PRINT);
47     return 12;
48   }
49   for (int i = 1; i < argc; i++) {
50 //    out.log(astring(astring::SPRINTF, "soundfile %d: %s", i, argv[i]));
51 #ifdef _MSC_VER
52     if (!PlaySound(to_unicode_temp(argv[i]), NULL_POINTER, SND_FILENAME))
53       out.log(astring("failed to play ") + argv[i], ALWAYS_PRINT);
54 #else
55     out.log(astring("this program is a NO-OP, ignoring ") + argv[i], ALWAYS_PRINT);
56 #endif
57   }
58   return 0;
59 }
60
61 #ifdef __BUILD_STATIC_APPLICATION__
62   // static dependencies found by buildor_gen_deps.sh:
63   #include <application/windoze_helper.cpp>
64   #include <basis/astring.cpp>
65   #include <basis/common_outcomes.cpp>
66   #include <basis/environment.cpp>
67   #include <basis/guards.cpp>
68   #include <basis/mutex.cpp>
69   #include <basis/utf_conversion.cpp>
70   #include <configuration/application_configuration.cpp>
71   #include <configuration/configurator.cpp>
72   #include <configuration/ini_configurator.cpp>
73   #include <configuration/ini_parser.cpp>
74   #include <configuration/table_configurator.cpp>
75   #include <configuration/variable_tokenizer.cpp>
76   #include <filesystem/byte_filer.cpp>
77   #include <filesystem/directory.cpp>
78   #include <filesystem/filename.cpp>
79   #include <loggers/console_logger.cpp>
80   #include <loggers/program_wide_logger.cpp>
81   #include <structures/checksums.cpp>
82   #include <structures/object_packers.cpp>
83   #include <structures/static_memory_gremlin.cpp>
84   #include <structures/string_hasher.cpp>
85   #include <structures/string_table.cpp>
86   #include <structures/version_record.cpp>
87   #include <textual/parser_bits.cpp>
88   #include <timely/earth_time.cpp>
89   #include <timely/time_stamp.cpp>
90 #endif // __BUILD_STATIC_APPLICATION__
91