/* sound.c -- sound support.
-Copyright (C) 1998-1999, 2001-2014 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2016 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs 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 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <errno.h>
#include "lisp.h"
-#include "dispextern.h"
#include "atimer.h"
#include "syssignal.h"
/* END: Common Includes */
/* BEGIN: Common Definitions */
-/* Symbols. */
-
-static Lisp_Object QCvolume, QCdevice;
-static Lisp_Object Qsound;
-static Lisp_Object Qplay_sound_functions;
-
/* Indices of attributes in a sound attributes vector. */
enum sound_attr
{
Lisp_Object attrs[SOUND_ATTR_SENTINEL];
ptrdiff_t count = SPECPDL_INDEX ();
- Lisp_Object file;
- Lisp_Object args[2];
- struct gcpro gcpro1, gcpro2;
#ifdef WINDOWSNT
unsigned long ui_volume_tmp = UINT_MAX;
if (!parse_sound (sound, attrs))
error ("Invalid sound specification");
+ Lisp_Object file = Qnil;
+
#ifndef WINDOWSNT
- file = Qnil;
- GCPRO2 (sound, file);
current_sound_device = xzalloc (sizeof *current_sound_device);
current_sound = xzalloc (sizeof *current_sound);
record_unwind_protect_void (sound_cleanup);
else if (FLOATP (attrs[SOUND_VOLUME]))
current_sound_device->volume = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100;
- args[0] = Qplay_sound_functions;
- args[1] = sound;
- Frun_hook_with_args (2, args);
+ CALLN (Frun_hook_with_args, Qplay_sound_functions, sound);
#ifdef HAVE_ALSA
if (!alsa_init (current_sound_device))
/* Play the sound. */
current_sound->play (current_sound, current_sound_device);
- /* Clean up. */
- UNGCPRO;
-
#else /* WINDOWSNT */
file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory);
ui_volume_tmp = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100;
}
- GCPRO2 (sound, file);
-
- args[0] = Qplay_sound_functions;
- args[1] = sound;
- Frun_hook_with_args (2, args);
+ CALLN (Frun_hook_with_args, Qplay_sound_functions, sound);
/*
Based on some experiments I have conducted, a value of 100 or less
}
(void)do_play_sound (SSDATA (file), ui_volume);
- UNGCPRO;
-
#endif /* WINDOWSNT */
- unbind_to (count, Qnil);
- return Qnil;
+ return unbind_to (count, Qnil);
}
\f
/***********************************************************************