Alan Third <alan@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 3351) by debbugs.gnu.org; 18 Mar 2013 06:48:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 18 02:48:51 2013 Received: from localhost ([127.0.0.1]:60727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UHTsI-0002tY-0J for submit <at> debbugs.gnu.org; Mon, 18 Mar 2013 02:48:50 -0400 Received: from mailout.melmac.se ([62.20.26.67]:38813) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <jan.h.d@HIDDEN>) id 1UHTs9-0002tD-5Z for 3351 <at> debbugs.gnu.org; Mon, 18 Mar 2013 02:48:43 -0400 Received: from mail01.melmac.se (mail01.melmac.se [62.20.26.80]) by mailout.melmac.se (Postfix) with ESMTP id 5CFEF9D2B for <3351 <at> debbugs.gnu.org>; Mon, 18 Mar 2013 07:47:02 +0100 (CET) Received: (qmail 21259 invoked by uid 89); 18 Mar 2013 05:46:55 -0000 Received: from h-46-59-42-18.na.cust.bahnhof.se (HELO coolsville.localdomain) (boel.djarv@HIDDEN@46.59.42.18) by mail01.melmac.se with ESMTPA; 18 Mar 2013 05:46:55 -0000 Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id EFD987FA06C; Mon, 18 Mar 2013 07:47:01 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: bug#3351: 23.0.93; OSX sound support From: =?iso-8859-1?Q?Jan_Dj=E4rv?= <jan.h.d@HIDDEN> In-Reply-To: <wlvc8pmnjh.wl%mituharu@HIDDEN> Date: Mon, 18 Mar 2013 07:47:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <10369D9F-8F2F-4B81-815F-BCDE9BDED0EE@HIDDEN> References: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> <m1boalnene.fsf@HIDDEN> <wlwqt6zals.wl%mituharu@HIDDEN> <wlvc8pmnjh.wl%mituharu@HIDDEN> To: YAMAMOTO Mitsuharu <mituharu@HIDDEN> X-Mailer: Apple Mail (2.1503) X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello. 18 mar 2013 kl. 03:47 skrev YAMAMOTO Mitsuharu <mituharu@HIDDEN>: > > Oops, I didn't realize that play-sound-internal was supposed to be > synchronous and unquittable. Below is an updated one. > [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% [score: 0.4996] X-Debbugs-Envelope-To: 3351 Cc: =?iso-8859-1?Q?Alex_Schr=F6der?= <kensanata@HIDDEN>, Leo Liu <sdl.web@HIDDEN>, 3351 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: 0.7 (/) Hello. 18 mar 2013 kl. 03:47 skrev YAMAMOTO Mitsuharu = <mituharu@HIDDEN>: >=20 > Oops, I didn't realize that play-sound-internal was supposed to be > synchronous and unquittable. Below is an updated one. >=20 I don't think that is a requirement. It is just an artifact of current = implementations. It would be better if all sound implementations where asynchronous and = quittable. Jan D.
bug-gnu-emacs@HIDDEN
:bug#3351
; Package emacs,ns
.
Full text available.Received: (at 3351) by debbugs.gnu.org; 18 Mar 2013 02:49:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 17 22:49:30 2013 Received: from localhost ([127.0.0.1]:60515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UHQ8f-0005YT-9V for submit <at> debbugs.gnu.org; Sun, 17 Mar 2013 22:49:30 -0400 Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:55099) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <mituharu@HIDDEN>) id 1UHQ8Y-0005YD-B3 for 3351 <at> debbugs.gnu.org; Sun, 17 Mar 2013 22:49:27 -0400 Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 3D271C055D; Mon, 18 Mar 2013 11:47:46 +0900 (JST) Date: Mon, 18 Mar 2013 11:47:46 +0900 Message-ID: <wlvc8pmnjh.wl%mituharu@HIDDEN> From: YAMAMOTO Mitsuharu <mituharu@HIDDEN> To: Leo Liu <sdl.web@HIDDEN> Subject: Re: bug#3351: 23.0.93; OSX sound support In-Reply-To: <wlwqt6zals.wl%mituharu@HIDDEN> References: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> <m1boalnene.fsf@HIDDEN> <wlwqt6zals.wl%mituharu@HIDDEN> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: 3351 Cc: Alex =?ISO-8859-1?Q?Schr=F6der?= <kensanata@HIDDEN>, 3351 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -4.4 (----) >>>>> On Sun, 17 Mar 2013 17:36:31 +0900, YAMAMOTO Mitsuharu <mituharu@HIDDEN> said: >> Two conscious abuses (can be fixed): >> - misuse (signal 'wrong-type-argument (list sound)); it requires the >> first item of DATA to be a predicate but I decided not to add another >> function. >> - async; should probably use call-process to stay close to the C >> version. >> BTW, I only remember once in the past years needing the feature. > Below is a quick hack for the Mac port (*) to have sound support. > Perhaps one may use this as a hint. > *: http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00251.html Oops, I didn't realize that play-sound-internal was supposed to be synchronous and unquittable. Below is an updated one. YAMAMOTO Mitsuharu mituharu@HIDDEN === modified file 'configure.ac' *** configure.ac 2013-03-11 03:49:04 +0000 --- configure.ac 2013-03-18 02:36:18 +0000 *************** *** 2752,2757 **** --- 2752,2758 ---- ### Use Mac OS X GUI. if test "${HAVE_MACGUI}" = "yes"; then AC_DEFINE(HAVE_MACGUI, 1, [Define to 1 if you are using GUI on Mac OS X.]) + AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.]) AC_CHECK_HEADERS(AvailabilityMacros.h) MAC_CFLAGS="-fconstant-cfstrings" ## Specify the install directory === modified file 'src/macappkit.h' *** src/macappkit.h 2013-02-09 07:26:28 +0000 --- src/macappkit.h 2013-03-18 02:36:18 +0000 *************** *** 61,66 **** --- 61,67 ---- compiled on Mac OS X 10.5 fails in startup at -[EmacsController methodSignatureForSelector:] when executed on Mac OS X 10.6. */ @protocol NSApplicationDelegate @end + @protocol NSSoundDelegate @end @protocol NSWindowDelegate @end @protocol NSToolbarDelegate @end @protocol NSMenuDelegate @end *************** *** 691,696 **** --- 692,700 ---- #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ + @interface EmacsController (Sound) <NSSoundDelegate> + @end + /* Some methods that are not declared in older versions. Should be used with some runtime check such as `respondsToSelector:'. */ *************** *** 868,870 **** --- 872,881 ---- @end #endif #endif + + #if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 + @interface NSSound (AvailableOn1050AndLater) + - (void)setVolume:(float)volume; + - (void)setPlaybackDeviceIdentifier:(NSString *)deviceUID; + @end + #endif === modified file 'src/macappkit.m' *** src/macappkit.m 2013-03-05 06:19:19 +0000 --- src/macappkit.m 2013-03-18 02:36:41 +0000 *************** *** 12207,12209 **** --- 12207,12263 ---- return result; } + + + /*********************************************************************** + Sound + ***********************************************************************/ + @implementation EmacsController (Sound) + + - (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedPlaying + { + [NSApp postDummyEvent]; + } + + @end + + CFTypeRef + mac_sound_create (Lisp_Object file, Lisp_Object data) + { + NSSound *sound; + + if (STRINGP (file)) + { + file = ENCODE_FILE (file); + sound = [[NSSound alloc] + initWithContentsOfFile:[NSString stringWithUTF8LispString:file] + byReference:YES]; + } + else if (STRINGP (data)) + sound = [[NSSound alloc] + initWithData:[NSData dataWithBytes:(SDATA (data)) + length:(SBYTES (data))]]; + else + sound = nil; + + return CF_BRIDGING_RETAIN (MRC_AUTORELEASE (sound)); + } + + void + mac_sound_play (CFTypeRef mac_sound, Lisp_Object volume, Lisp_Object device) + { + NSSound *sound = (__bridge NSSound *) mac_sound; + + if ((INTEGERP (volume) || FLOATP (volume)) + && [sound respondsToSelector:@selector(setVolume:)]) + [sound setVolume:(INTEGERP (volume) ? XFASTINT (volume) * 0.01 + : XFLOAT_DATA (volume))]; + if (STRINGP (device) + && [sound respondsToSelector:@selector(setPlaybackDeviceIdentifier:)]) + [sound setPlaybackDeviceIdentifier:[NSString stringWithLispString:device]]; + + [sound setDelegate:emacsController]; + [sound play]; + while ([sound isPlaying]) + mac_run_loop_run_once (kEventDurationForever); + } === modified file 'src/macterm.h' *** src/macterm.h 2013-02-09 07:26:28 +0000 --- src/macterm.h 2013-03-18 02:36:18 +0000 *************** *** 652,657 **** --- 652,660 ---- extern void mac_invalidate_frame_cursor_rects (struct frame *f); extern int mac_webkit_supports_svg_p (void); + extern CFTypeRef mac_sound_create (Lisp_Object, Lisp_Object); + extern void mac_sound_play (CFTypeRef, Lisp_Object, Lisp_Object); + #define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, gc) \ CGContextSetFillColorWithColor (context, (gc)->cg_fore_color) #define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, gc) \ === modified file 'src/sound.c' *** src/sound.c 2013-01-01 09:11:05 +0000 --- src/sound.c 2013-03-18 02:36:18 +0000 *************** *** 53,59 **** /* BEGIN: Non Windows Includes */ ! #ifndef WINDOWSNT #include <sys/ioctl.h> --- 53,59 ---- /* BEGIN: Non Windows Includes */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI #include <sys/ioctl.h> *************** *** 79,85 **** /* END: Non Windows Includes */ ! #else /* WINDOWSNT */ /* BEGIN: Windows Specific Includes */ #include <stdio.h> --- 79,85 ---- /* END: Non Windows Includes */ ! #elif defined WINDOWSNT /* BEGIN: Windows Specific Includes */ #include <stdio.h> *************** *** 88,94 **** #include <mmsystem.h> /* END: Windows Specific Includes */ ! #endif /* WINDOWSNT */ /* BEGIN: Common Definitions */ --- 88,97 ---- #include <mmsystem.h> /* END: Windows Specific Includes */ ! #else /* HAVE_MACGUI */ ! #include "blockinput.h" ! #include "macterm.h" ! #endif /* HAVE_MACGUI */ /* BEGIN: Common Definitions */ *************** *** 112,118 **** /* END: Common Definitions */ /* BEGIN: Non Windows Definitions */ ! #ifndef WINDOWSNT /* Structure forward declarations. */ --- 115,121 ---- /* END: Common Definitions */ /* BEGIN: Non Windows Definitions */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI /* Structure forward declarations. */ *************** *** 291,297 **** #endif /* END: Non Windows Definitions */ ! #else /* WINDOWSNT */ /* BEGIN: Windows Specific Definitions */ static int do_play_sound (const char *, unsigned long); --- 294,300 ---- #endif /* END: Non Windows Definitions */ ! #elif defined WINDOWSNT /* BEGIN: Windows Specific Definitions */ static int do_play_sound (const char *, unsigned long); *************** *** 428,434 **** /* END: Common functions */ /* BEGIN: Non Windows functions */ ! #ifndef WINDOWSNT /* Find out the type of the sound file whose file descriptor is FD. S is the sound file structure to fill in. */ --- 431,437 ---- /* END: Common functions */ /* BEGIN: Non Windows functions */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI /* Find out the type of the sound file whose file descriptor is FD. S is the sound file structure to fill in. */ *************** *** 1247,1253 **** /* END: Non Windows functions */ ! #else /* WINDOWSNT */ /* BEGIN: Windows specific functions */ --- 1250,1256 ---- /* END: Non Windows functions */ ! #elif defined WINDOWSNT /* BEGIN: Windows specific functions */ *************** *** 1356,1361 **** --- 1359,1367 ---- Lisp_Object file; struct gcpro gcpro1, gcpro2; Lisp_Object args[2]; + #ifdef HAVE_MACGUI + CFTypeRef mac_sound; + #endif #else /* WINDOWSNT */ int len = 0; Lisp_Object lo_file = {0}; *************** *** 1369,1375 **** if (!parse_sound (sound, attrs)) error ("Invalid sound specification"); ! #ifndef WINDOWSNT file = Qnil; GCPRO2 (sound, file); current_sound_device = xzalloc (sizeof *current_sound_device); --- 1375,1381 ---- if (!parse_sound (sound, attrs)) error ("Invalid sound specification"); ! #if !defined WINDOWSNT && !defined HAVE_MACGUI file = Qnil; GCPRO2 (sound, file); current_sound_device = xzalloc (sizeof *current_sound_device); *************** *** 1435,1441 **** /* Clean up. */ UNGCPRO; ! #else /* WINDOWSNT */ lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); len = XSTRING (lo_file)->size; --- 1441,1447 ---- /* Clean up. */ UNGCPRO; ! #elif defined WINDOWSNT lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); len = XSTRING (lo_file)->size; *************** *** 1464,1470 **** } i_result = do_play_sound (psz_file, ui_volume); ! #endif /* WINDOWSNT */ unbind_to (count, Qnil); return Qnil; --- 1470,1515 ---- } i_result = do_play_sound (psz_file, ui_volume); ! #else /* HAVE_MACGUI */ ! if (inhibit_window_system || noninteractive) ! error ("Sound support on Mac requires a window system"); ! ! file = Qnil; ! GCPRO2 (sound, file); ! ! if (STRINGP (attrs[SOUND_FILE])) ! { ! /* Open the sound file. */ ! int fd = openp (Fcons (Vdata_directory, Qnil), ! attrs[SOUND_FILE], Qnil, &file, Qnil); ! ! if (fd < 0) ! { ! if (errno == 0) ! error ("Could not open sound file"); ! else ! error ("Could not open sound file: %s", strerror (errno)); ! } ! emacs_close (fd); ! } ! ! block_input (); ! mac_sound = mac_sound_create (file, attrs[SOUND_DATA]); ! unblock_input (); ! if (mac_sound == NULL) ! error ("Unknown sound format"); ! ! args[0] = Qplay_sound_functions; ! args[1] = sound; ! Frun_hook_with_args (2, args); ! ! block_input (); ! mac_sound_play (mac_sound, attrs[SOUND_VOLUME], attrs[SOUND_DEVICE]); ! CFRelease (mac_sound); ! unblock_input (); ! ! UNGCPRO; ! #endif /* HAVE_MACGUI */ unbind_to (count, Qnil); return Qnil;
bug-gnu-emacs@HIDDEN
:bug#3351
; Package emacs,ns
.
Full text available.Received: (at 3351) by debbugs.gnu.org; 17 Mar 2013 08:38:12 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 17 04:38:12 2013 Received: from localhost ([127.0.0.1]:58467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UH96Y-000440-MO for submit <at> debbugs.gnu.org; Sun, 17 Mar 2013 04:38:12 -0400 Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:55520) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <mituharu@HIDDEN>) id 1UH96S-00043Q-V3 for 3351 <at> debbugs.gnu.org; Sun, 17 Mar 2013 04:38:08 -0400 Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 13E98C055D; Sun, 17 Mar 2013 17:36:32 +0900 (JST) Date: Sun, 17 Mar 2013 17:36:31 +0900 Message-ID: <wlwqt6zals.wl%mituharu@HIDDEN> From: YAMAMOTO Mitsuharu <mituharu@HIDDEN> To: Leo Liu <sdl.web@HIDDEN> Subject: Re: bug#3351: 23.0.93; OSX sound support In-Reply-To: <m1boalnene.fsf@HIDDEN> References: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> <m1boalnene.fsf@HIDDEN> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 3351 Cc: Alex =?ISO-8859-1?Q?Schr=F6der?= <kensanata@HIDDEN>, 3351 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -4.3 (----) >>>>> On Fri, 15 Mar 2013 18:25:25 +0800, Leo Liu <sdl.web@HIDDEN> said: > On 2009-05-22 21:31 +0800, Alex Schr=F6der wrote: >> In GNU Emacs 23.0.93.2 (i386-apple-darwin8.11.1, NS apple-appkit-824.48) >> of 2009-05-22 on Pyrobombus.local >> Windowing system distributor `Apple', version 10.3.824 >> configured using `configure '--with-ns'' >>=20 >> I'm using Mac OS 10.4.11 and when I try to (play-sound '(sound :file >> "/some/file")) I get the error "This Emacs binary lacks sound >> support". >>=20 >> I think no Emacs is complete without sound support. ;) > I am using this small function to give me sound support on OSX: > https://raw.github.com/leoliu/play-sound-osx/master/play-sound.el > Two conscious abuses (can be fixed): > - misuse (signal 'wrong-type-argument (list sound)); it requires the > first item of DATA to be a predicate but I decided not to add another > function. > - async; should probably use call-process to stay close to the C > version. > BTW, I only remember once in the past years needing the feature. Below is a quick hack for the Mac port (*) to have sound support. Perhaps one may use this as a hint. *: http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00251.html YAMAMOTO Mitsuharu mituharu@HIDDEN =3D=3D=3D modified file 'configure.ac' *** configure.ac 2013-03-11 03:49:04 +0000 --- configure.ac 2013-03-17 08:17:26 +0000 *************** *** 2752,2757 **** --- 2752,2758 ---- ### Use Mac OS X GUI. if test "${HAVE_MACGUI}" =3D "yes"; then AC_DEFINE(HAVE_MACGUI, 1, [Define to 1 if you are using GUI on Mac OS X= .]) + AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.]) AC_CHECK_HEADERS(AvailabilityMacros.h) MAC_CFLAGS=3D"-fconstant-cfstrings" ## Specify the install directory =3D=3D=3D modified file 'src/macappkit.h' *** src/macappkit.h 2013-02-09 07:26:28 +0000 --- src/macappkit.h 2013-03-17 08:17:26 +0000 *************** *** 61,66 **** --- 61,67 ---- compiled on Mac OS X 10.5 fails in startup at -[EmacsController methodSignatureForSelector:] when executed on Mac OS X 10.6. */ @protocol NSApplicationDelegate @end + @protocol NSSoundDelegate @end @protocol NSWindowDelegate @end @protocol NSToolbarDelegate @end @protocol NSMenuDelegate @end *************** *** 194,199 **** --- 195,203 ---- =20 /* Set of windows whose flush is deferred. */ NSMutableSet *deferredFlushWindows; +=20 + /* Set of sounds currently being played. */ + NSMutableSet *soundsBeingPlayed; } - (int)getAndClearMenuItemSelection; - (void)storeInputEvent:(id)sender; *************** *** 691,696 **** --- 695,704 ---- =20 #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ =20 + @interface EmacsController (Sound) <NSSoundDelegate> + - (void)addAndPlaySound:(NSSound *)sound; + @end +=20 /* Some methods that are not declared in older versions. Should be used with some runtime check such as `respondsToSelector:'. */ =20 *************** *** 868,870 **** --- 876,885 ---- @end #endif #endif +=20 + #if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 + @interface NSSound (AvailableOn1050AndLater) + - (void)setVolume:(float)volume; + - (void)setPlaybackDeviceIdentifier:(NSString *)deviceUID; + @end + #endif =3D=3D=3D modified file 'src/macappkit.m' *** src/macappkit.m 2013-03-05 06:19:19 +0000 --- src/macappkit.m 2013-03-17 08:20:12 +0000 *************** *** 12207,12209 **** --- 12207,12270 ---- =20 return result; } +=20 + =0C + /*********************************************************************** + Sound + ***********************************************************************/ + @implementation EmacsController (Sound) +=20 + - (void)addAndPlaySound:(NSSound *)sound + { + if (soundsBeingPlayed =3D=3D nil) + soundsBeingPlayed =3D [[NSMutableSet alloc] initWithCapacity:0]; + [soundsBeingPlayed addObject:sound]; +=20 + [sound setDelegate:self]; + [sound play]; + } +=20 + - (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedPlaying + { + [soundsBeingPlayed removeObject:sound]; + } +=20 + @end +=20 + CFTypeRef + mac_sound_create (Lisp_Object file, Lisp_Object data) + { + NSSound *sound; +=20 + if (STRINGP (file)) + { + file =3D ENCODE_FILE (file); + sound =3D [[NSSound alloc] + initWithContentsOfFile:[NSString stringWithUTF8LispString:file] + byReference:YES]; + } + else if (STRINGP (data)) + sound =3D [[NSSound alloc] + initWithData:[NSData dataWithBytes:(SDATA (data)) + length:(SBYTES (data))]]; + else + sound =3D nil; +=20 + return CF_BRIDGING_RETAIN (MRC_AUTORELEASE (sound)); + } +=20 + void + mac_sound_play (CFTypeRef mac_sound, Lisp_Object volume, Lisp_Object devi= ce) + { + NSSound *sound =3D (__bridge NSSound *) mac_sound; +=20 + if ((INTEGERP (volume) || FLOATP (volume)) + && [sound respondsToSelector:@selector(setVolume:)]) + [sound setVolume:(INTEGERP (volume) ? XFASTINT (volume) * 0.01 + : XFLOAT_DATA (volume))]; + if (STRINGP (device) + && [sound respondsToSelector:@selector(setPlaybackDeviceIdentifier:= )]) + [sound setPlaybackDeviceIdentifier:[NSString stringWithLispString:dev= ice]]; +=20 + [emacsController addAndPlaySound:sound]; + } =3D=3D=3D modified file 'src/sound.c' *** src/sound.c 2013-01-01 09:11:05 +0000 --- src/sound.c 2013-03-17 08:17:27 +0000 *************** *** 53,59 **** =20 =20 /* BEGIN: Non Windows Includes */ ! #ifndef WINDOWSNT =20 #include <sys/ioctl.h> =20 --- 53,59 ---- =20 =20 /* BEGIN: Non Windows Includes */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI =20 #include <sys/ioctl.h> =20 *************** *** 79,85 **** =20 /* END: Non Windows Includes */ =20 ! #else /* WINDOWSNT */ =20 /* BEGIN: Windows Specific Includes */ #include <stdio.h> --- 79,85 ---- =20 /* END: Non Windows Includes */ =20 ! #elif defined WINDOWSNT =20 /* BEGIN: Windows Specific Includes */ #include <stdio.h> *************** *** 88,94 **** #include <mmsystem.h> /* END: Windows Specific Includes */ =20 ! #endif /* WINDOWSNT */ =20 /* BEGIN: Common Definitions */ =20 --- 88,97 ---- #include <mmsystem.h> /* END: Windows Specific Includes */ =20 ! #else /* HAVE_MACGUI */ ! #include "blockinput.h" ! #include "macterm.h" ! #endif /* HAVE_MACGUI */ =20 /* BEGIN: Common Definitions */ =20 *************** *** 112,118 **** /* END: Common Definitions */ =20 /* BEGIN: Non Windows Definitions */ ! #ifndef WINDOWSNT =20 /* Structure forward declarations. */ =20 --- 115,121 ---- /* END: Common Definitions */ =20 /* BEGIN: Non Windows Definitions */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI =20 /* Structure forward declarations. */ =20 *************** *** 291,303 **** #endif =20 /* END: Non Windows Definitions */ ! #else /* WINDOWSNT */ =20 /* BEGIN: Windows Specific Definitions */ static int do_play_sound (const char *, unsigned long); /* END: Windows Specific Definitions */ ! #endif /* WINDOWSNT */ =20 =0C /*********************************************************************** --- 294,309 ---- #endif =20 /* END: Non Windows Definitions */ ! #elif defined WINDOWSNT =20 /* BEGIN: Windows Specific Definitions */ static int do_play_sound (const char *, unsigned long); /* END: Windows Specific Definitions */ ! #else /* HAVE_MACGUI */ ! extern CFTypeRef mac_sound_create (Lisp_Object, Lisp_Object); ! extern void mac_sound_play (CFTypeRef, Lisp_Object, Lisp_Object); ! #endif /* HAVE_MACGUI */ =20 =0C /*********************************************************************** *************** *** 428,434 **** /* END: Common functions */ =20 /* BEGIN: Non Windows functions */ ! #ifndef WINDOWSNT =20 /* Find out the type of the sound file whose file descriptor is FD. S is the sound file structure to fill in. */ --- 434,440 ---- /* END: Common functions */ =20 /* BEGIN: Non Windows functions */ ! #if !defined WINDOWSNT && !defined HAVE_MACGUI =20 /* Find out the type of the sound file whose file descriptor is FD. S is the sound file structure to fill in. */ *************** *** 1247,1253 **** =20 =20 /* END: Non Windows functions */ ! #else /* WINDOWSNT */ =20 /* BEGIN: Windows specific functions */ =20 --- 1253,1259 ---- =20 =20 /* END: Non Windows functions */ ! #elif defined WINDOWSNT =20 /* BEGIN: Windows specific functions */ =20 *************** *** 1356,1361 **** --- 1362,1370 ---- Lisp_Object file; struct gcpro gcpro1, gcpro2; Lisp_Object args[2]; + #ifdef HAVE_MACGUI + CFTypeRef mac_sound; + #endif #else /* WINDOWSNT */ int len =3D 0; Lisp_Object lo_file =3D {0}; *************** *** 1369,1375 **** if (!parse_sound (sound, attrs)) error ("Invalid sound specification"); =20 ! #ifndef WINDOWSNT file =3D Qnil; GCPRO2 (sound, file); current_sound_device =3D xzalloc (sizeof *current_sound_device); --- 1378,1384 ---- if (!parse_sound (sound, attrs)) error ("Invalid sound specification"); =20 ! #if !defined WINDOWSNT && !defined HAVE_MACGUI file =3D Qnil; GCPRO2 (sound, file); current_sound_device =3D xzalloc (sizeof *current_sound_device); *************** *** 1435,1441 **** /* Clean up. */ UNGCPRO; =20 ! #else /* WINDOWSNT */ =20 lo_file =3D Fexpand_file_name (attrs[SOUND_FILE], Qnil); len =3D XSTRING (lo_file)->size; --- 1444,1450 ---- /* Clean up. */ UNGCPRO; =20 ! #elif defined WINDOWSNT =20 lo_file =3D Fexpand_file_name (attrs[SOUND_FILE], Qnil); len =3D XSTRING (lo_file)->size; *************** *** 1464,1470 **** } i_result =3D do_play_sound (psz_file, ui_volume); =20 ! #endif /* WINDOWSNT */ =20 unbind_to (count, Qnil); return Qnil; --- 1473,1513 ---- } i_result =3D do_play_sound (psz_file, ui_volume); =20 ! #else /* HAVE_MACGUI */ ! if (inhibit_window_system || noninteractive) ! error ("Sound support on Mac requires a window system"); !=20 ! file =3D Qnil; ! GCPRO2 (sound, file); !=20 ! if (STRINGP (attrs[SOUND_FILE])) ! { ! /* Open the sound file. */ ! int fd =3D openp (Fcons (Vdata_directory, Qnil), ! attrs[SOUND_FILE], Qnil, &file, Qnil); !=20 ! if (fd < 0) ! error ("Could not open sound file: %s", strerror (errno)); ! emacs_close (fd); ! } !=20 ! block_input (); ! mac_sound =3D mac_sound_create (file, attrs[SOUND_DATA]); ! unblock_input (); ! if (mac_sound =3D=3D NULL) ! error ("Unknown sound format"); !=20 ! args[0] =3D Qplay_sound_functions; ! args[1] =3D sound; ! Frun_hook_with_args (2, args); !=20 ! block_input (); ! mac_sound_play (mac_sound, attrs[SOUND_VOLUME], attrs[SOUND_DEVICE]); ! CFRelease (mac_sound); ! unblock_input (); !=20 ! UNGCPRO; ! #endif /* HAVE_MACGUI */ =20 unbind_to (count, Qnil); return Qnil;
bug-gnu-emacs@HIDDEN
:bug#3351
; Package emacs,ns
.
Full text available.Received: (at 3351) by debbugs.gnu.org; 15 Mar 2013 10:27:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 15 06:27:05 2013 Received: from localhost ([127.0.0.1]:55503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UGRqm-00083z-W8 for submit <at> debbugs.gnu.org; Fri, 15 Mar 2013 06:27:02 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:63492) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <sdl.web@HIDDEN>) id 1UGRqj-00083l-Nw for 3351 <at> debbugs.gnu.org; Fri, 15 Mar 2013 06:26:59 -0400 Received: by mail-pd0-f170.google.com with SMTP id 4so207663pdd.15 for <3351 <at> debbugs.gnu.org>; Fri, 15 Mar 2013 03:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:face:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=QnJn/KrNKA3UrMtwPEmYVxwTvmCAnd0eiR/kAmZy+Ow=; b=r33ElcT0A0Lpn0lzJ51QdKBnWpENrZBuw2jYmOhJXe3kevmTYXD/+Q8zc3Xb1R95KI og4z/0W/0OHh2NFrJcv7HKKa4QVeOHgcEAuCNXUrElZHDjCGO6KJ/+x2JpUTm2Kogu36 jFwQEBMY3hp6N7CfX+wZpGQ3idhYLX+SbyjD3lHffuWTOeqilG5qMK+7t5/yiXtlNPes sV+vHS3AwxzFQPTPhWcHK+JMBl14yUcIU3yOklSbNfMlpdALaQWY07uhwaIcRCMXcW5b PepgSZVSdHz+s5R3DYQApNEDjK5qVdP/9mUPRUnlSQ09z0oTz4m/LkAjYscDNJdpLMX6 zvGw== X-Received: by 10.68.242.65 with SMTP id wo1mr14721314pbc.62.1363343135384; Fri, 15 Mar 2013 03:25:35 -0700 (PDT) Received: from localhost ([182.48.109.29]) by mx.google.com with ESMTPS id y13sm8101517pbv.0.2013.03.15.03.25.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Mar 2013 03:25:34 -0700 (PDT) From: Leo Liu <sdl.web@HIDDEN> To: Alex =?iso-8859-1?Q?Schr=F6der?= <kensanata@HIDDEN> Subject: Re: bug#3351: 23.0.93; OSX sound support References: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Fri, 15 Mar 2013 18:25:25 +0800 In-Reply-To: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> ("Alex \=\?iso-8859-1\?Q\?Schr\=F6der\=22's\?\= message of "Fri, 22 May 2009 15:31:44 +0200") Message-ID: <m1boalnene.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.2) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 3351 Cc: 3351 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -1.9 (-) On 2009-05-22 21:31 +0800, Alex Schr=F6der wrote: > In GNU Emacs 23.0.93.2 (i386-apple-darwin8.11.1, NS apple-appkit-824.48) > of 2009-05-22 on Pyrobombus.local > Windowing system distributor `Apple', version 10.3.824 > configured using `configure '--with-ns'' > > I'm using Mac OS 10.4.11 and when I try to (play-sound '(sound :file > "/some/file")) I get the error "This Emacs binary lacks sound > support". > > I think no Emacs is complete without sound support. ;) I am using this small function to give me sound support on OSX: https://raw.github.com/leoliu/play-sound-osx/master/play-sound.el Two conscious abuses (can be fixed): - misuse (signal 'wrong-type-argument (list sound)); it requires the first item of DATA to be a predicate but I decided not to add another function. - async; should probably use call-process to stay close to the C version. BTW, I only remember once in the past years needing the feature. Leo
bug-gnu-emacs@HIDDEN
:bug#3351
; Package emacs,ns
.
Full text available.Glenn Morris <rgm+emacsbugs@HIDDEN>
to control@HIDDEN
.
Full text available.Received: (at submit) by emacsbugs.donarmstrong.com; 22 May 2009 13:32:15 +0000 From kensanata@HIDDEN Fri May 22 06:32:15 2009 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4MDW9CQ010826 for <submit@HIDDEN>; Fri, 22 May 2009 06:32:10 -0700 Received: from mail.gnu.org ([199.232.76.166]:44188 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from <kensanata@HIDDEN>) id 1M7Ur2-0000U5-Vf for emacs-pretest-bug@HIDDEN; Fri, 22 May 2009 09:32:09 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from <kensanata@HIDDEN>) id 1M7Ur2-00085l-EB for emacs-pretest-bug@HIDDEN; Fri, 22 May 2009 09:32:08 -0400 Received: from mail-ew0-f162.google.com ([209.85.219.162]:55872) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from <kensanata@HIDDEN>) id 1M7Ur2-00085S-3b for emacs-pretest-bug@HIDDEN; Fri, 22 May 2009 09:32:08 -0400 Received: by ewy6 with SMTP id 6so1984947ewy.42 for <emacs-pretest-bug@HIDDEN>; Fri, 22 May 2009 06:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=dazd1u/p4LQbXaM9RipaVjSaFOsd49b1JCKu5lq4gik=; b=tauSkXqghktCeuiQemCD4i7RoxqSr2wFW/hOvB5aXCzsNIQbXTtZ7/IEeVs6kd38Fl j8NDOYjYwWayn6KVWrNzXDgRvQDHxeeYc48fFgT4UbnfVfvgIPz7Yk792SW89u6lb7sv vMefRe4kkMCIB4/NSN3X2tIH7UseeZnt/muoc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=a8an67bkcN7GZ63AZhQC87jxJysVtSotAvrUPfJGk7wnlmqsFtL14dWUervLynMzWN HynH4LM1yiYhH4rpw60ao/eK/etDIjM5lte55GQ/SV94iV0F4aQwIgwk2xtfcKqmqT9J i5kHb3XhzHxxu0ZtbQd5grMlL4zIW9cjylkOk= MIME-Version: 1.0 Received: by 10.216.20.197 with SMTP id p47mr792826wep.13.1242999124105; Fri, 22 May 2009 06:32:04 -0700 (PDT) From: =?ISO-8859-1?Q?Alex_Schr=F6der?= <kensanata@HIDDEN> Date: Fri, 22 May 2009 15:31:44 +0200 Message-ID: <9abbd5730905220631w7256450dp41cc4f1e511ea6d0@HIDDEN> Subject: 23.0.93; OSX sound support To: emacs-pretest-bug@HIDDEN Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) In GNU Emacs 23.0.93.2 (i386-apple-darwin8.11.1, NS apple-appkit-824.48) of 2009-05-22 on Pyrobombus.local Windowing system distributor `Apple', version 10.3.824 configured using `configure '--with-ns'' I'm using Mac OS 10.4.11 and when I try to (play-sound '(sound :file "/some/file")) I get the error "This Emacs binary lacks sound support". I think no Emacs is complete without sound support. ;)
Alex Schröder <kensanata@HIDDEN>
:Emacs Bugs <bug-gnu-emacs@HIDDEN>
.
Full text available.bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>
:bug#3351
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.