Mercurial > vim
annotate src/sound.c @ 30817:e95794dadf52 v9.0.0743
patch 9.0.0743: starting cscope on Unix does not quote the arguments right
Commit: https://github.com/vim/vim/commit/66b8d2a89efb6bd482e3160c7494e646e31aea27
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 13 16:34:30 2022 +0100
patch 9.0.0743: starting cscope on Unix does not quote the arguments right
Problem: Starting cscope on Unix does not quote the arguments correctly.
(Gary Johnson)
Solution: Move the final quote after the arguments.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Oct 2022 17:45:03 +0200 |
parents | 71137f73c94d |
children | e1e21033c859 |
rev | line source |
---|---|
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 * |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 * |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 */ |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 /* |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 * sound.c: functions related making noise |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 */ |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 #include "vim.h" |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
16 #if defined(FEAT_SOUND) || defined(PROTO) |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 static long sound_id = 0; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 typedef struct soundcb_S soundcb_T; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 struct soundcb_S { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 callback_T snd_callback; |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
24 #ifdef MSWIN |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
25 MCIDEVICEID snd_device_id; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
26 long snd_id; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
27 #endif |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 soundcb_T *snd_next; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 }; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 static soundcb_T *first_callback = NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
33 /* |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
34 * Return TRUE when a sound callback has been created, it may be invoked when |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
35 * the sound finishes playing. Also see has_sound_callback_in_queue(). |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
36 */ |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
37 int |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
38 has_any_sound_callback(void) |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
39 { |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
40 return first_callback != NULL; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
41 } |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
42 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 static soundcb_T * |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 get_sound_callback(typval_T *arg) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 callback_T callback; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 soundcb_T *soundcb; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 if (arg->v_type == VAR_UNKNOWN) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 return NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 callback = get_callback(arg); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 if (callback.cb_name == NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 return NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 soundcb = ALLOC_ONE(soundcb_T); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 if (soundcb == NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 free_callback(&callback); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 else |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 soundcb->snd_next = first_callback; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 first_callback = soundcb; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 set_callback(&soundcb->snd_callback, &callback); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 return soundcb; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 /* |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
68 * Call "soundcb" with proper parameters. |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
69 */ |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
70 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
71 call_sound_callback(soundcb_T *soundcb, long snd_id, int result) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
72 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
73 typval_T argv[3]; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
74 typval_T rettv; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
75 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
76 argv[0].v_type = VAR_NUMBER; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
77 argv[0].vval.v_number = snd_id; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
78 argv[1].v_type = VAR_NUMBER; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
79 argv[1].vval.v_number = result; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
80 argv[2].v_type = VAR_UNKNOWN; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
81 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
82 call_callback(&soundcb->snd_callback, -1, &rettv, 2, argv); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
83 clear_tv(&rettv); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
84 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
85 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
86 /* |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 * Delete "soundcb" from the list of pending callbacks. |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 */ |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
89 void |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 delete_sound_callback(soundcb_T *soundcb) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 soundcb_T *p; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 soundcb_T *prev = NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 for (p = first_callback; p != NULL; prev = p, p = p->snd_next) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 if (p == soundcb) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 if (prev == NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 first_callback = p->snd_next; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 else |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 prev->snd_next = p->snd_next; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 free_callback(&p->snd_callback); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 vim_free(p); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 break; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
108 #if defined(HAVE_CANBERRA) || defined(PROTO) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
109 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
110 /* |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
111 * Sound implementation for Linux/Unix using libcanberra. |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
112 */ |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
113 # include <canberra.h> |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
114 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
115 static ca_context *context = NULL; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
116 |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
117 // Structure to store info about a sound callback to be invoked soon. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
118 typedef struct soundcb_queue_S soundcb_queue_T; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
119 |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
120 struct soundcb_queue_S { |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
121 soundcb_queue_T *scb_next; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
122 uint32_t scb_id; // ID of the sound |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
123 int scb_result; // CA_ value |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
124 soundcb_T *scb_callback; // function to call |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
125 }; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
126 |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
127 // Queue of callbacks to invoke from the main loop. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
128 static soundcb_queue_T *callback_queue = NULL; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
129 |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
130 /* |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
131 * Add a callback to the queue of callbacks to invoke later from the main loop. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
132 * That is because the callback may be called from another thread and invoking |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
133 * another sound function may cause trouble. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
134 */ |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 static void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 sound_callback( |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 ca_context *c UNUSED, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 uint32_t id, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 int error_code, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 void *userdata) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 { |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
142 soundcb_T *soundcb = (soundcb_T *)userdata; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
143 soundcb_queue_T *scb; |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
145 scb = ALLOC_ONE(soundcb_queue_T); |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
146 if (scb == NULL) |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
147 return; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
148 scb->scb_next = callback_queue; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
149 callback_queue = scb; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
150 scb->scb_id = id; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
151 scb->scb_result = error_code == CA_SUCCESS ? 0 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 : error_code == CA_ERROR_CANCELED |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 || error_code == CA_ERROR_DESTROYED |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 ? 1 : 2; |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
155 scb->scb_callback = soundcb; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
156 } |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
157 |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
158 /* |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
159 * Return TRUE if there is a sound callback to be called. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
160 */ |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
161 int |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
162 has_sound_callback_in_queue(void) |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
163 { |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
164 return callback_queue != NULL; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
165 } |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
167 /* |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
168 * Invoke queued sound callbacks. |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
169 */ |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
170 void |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
171 invoke_sound_callback(void) |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
172 { |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
173 soundcb_queue_T *scb; |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
175 while (callback_queue != NULL) |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
176 { |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
177 scb = callback_queue; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
178 callback_queue = scb->scb_next; |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
179 |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
180 call_sound_callback(scb->scb_callback, scb->scb_id, scb->scb_result); |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
181 |
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
182 delete_sound_callback(scb->scb_callback); |
17895
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
183 vim_free(scb); |
17708
10696f279e20
patch 8.1.1851: crash when sound_playfile() callback plays sound
Bram Moolenaar <Bram@vim.org>
parents:
17642
diff
changeset
|
184 } |
26466
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
185 redraw_after_callback(TRUE, FALSE); |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 static void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 sound_play_common(typval_T *argvars, typval_T *rettv, int playfile) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 { |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
191 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
192 return; |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
193 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 if (context == NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 ca_context_create(&context); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 if (context != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 soundcb_T *soundcb = get_sound_callback(&argvars[1]); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 int res = CA_ERROR_INVALID; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 ++sound_id; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 if (soundcb == NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 res = ca_context_play(context, sound_id, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 playfile ? CA_PROP_MEDIA_FILENAME : CA_PROP_EVENT_ID, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 tv_get_string(&argvars[0]), |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 CA_PROP_CANBERRA_CACHE_CONTROL, "volatile", |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 NULL); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 else |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 static ca_proplist *proplist = NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 ca_proplist_create(&proplist); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 if (proplist != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 if (playfile) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 ca_proplist_sets(proplist, CA_PROP_MEDIA_FILENAME, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 (char *)tv_get_string(&argvars[0])); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 else |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 ca_proplist_sets(proplist, CA_PROP_EVENT_ID, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 (char *)tv_get_string(&argvars[0])); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 ca_proplist_sets(proplist, CA_PROP_CANBERRA_CACHE_CONTROL, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 "volatile"); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 res = ca_context_play_full(context, sound_id, proplist, |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 sound_callback, soundcb); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 if (res != CA_SUCCESS) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 delete_sound_callback(soundcb); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 ca_proplist_destroy(proplist); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 rettv->vval.v_number = res == CA_SUCCESS ? sound_id : 0; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 f_sound_playevent(typval_T *argvars, typval_T *rettv) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 sound_play_common(argvars, rettv, FALSE); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
243 /* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
244 * implementation of sound_playfile({path} [, {callback}]) |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
245 */ |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 f_sound_playfile(typval_T *argvars, typval_T *rettv) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 sound_play_common(argvars, rettv, TRUE); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
252 /* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
253 * implementation of sound_stop({id}) |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
254 */ |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
258 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
259 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
260 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 if (context != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 ca_context_cancel(context, tv_get_number(&argvars[0])); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
265 /* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
266 * implementation of sound_clear() |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
267 */ |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 void |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
269 f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 if (context != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 { |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 ca_context_destroy(context); |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 context = NULL; |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 } |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
278 # if defined(EXITFREE) || defined(PROTO) |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 void |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 sound_free(void) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 { |
17895
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
282 soundcb_queue_T *scb; |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
283 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 if (context != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 ca_context_destroy(context); |
17895
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
286 |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 while (first_callback != NULL) |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 delete_sound_callback(first_callback); |
17895
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
289 |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
290 while (callback_queue != NULL) |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
291 { |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
292 scb = callback_queue; |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
293 callback_queue = scb->scb_next; |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
294 delete_sound_callback(scb->scb_callback); |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
295 vim_free(scb); |
d55356da47c1
patch 8.1.1944: leaking memory when using sound callback
Bram Moolenaar <Bram@vim.org>
parents:
17708
diff
changeset
|
296 } |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 } |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
298 # endif |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
299 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
300 #elif defined(MSWIN) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
301 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
302 /* |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
303 * Sound implementation for MS-Windows. |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
304 */ |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
305 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
306 static HWND g_hWndSound = NULL; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
307 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
308 static LRESULT CALLBACK |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
309 sound_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
310 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
311 soundcb_T *p; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
312 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
313 switch (message) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
314 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
315 case MM_MCINOTIFY: |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
316 for (p = first_callback; p != NULL; p = p->snd_next) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
317 if (p->snd_device_id == (MCIDEVICEID) lParam) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
318 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
319 char buf[32]; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
320 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
321 vim_snprintf(buf, sizeof(buf), "close sound%06ld", |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
322 p->snd_id); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
323 mciSendString(buf, NULL, 0, 0); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
324 |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
325 long result = wParam == MCI_NOTIFY_SUCCESSFUL ? 0 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
326 : wParam == MCI_NOTIFY_ABORTED ? 1 : 2; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
327 call_sound_callback(p, p->snd_id, result); |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
328 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
329 delete_sound_callback(p); |
26466
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
330 redraw_after_callback(TRUE, FALSE); |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
331 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
332 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
333 break; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
334 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
335 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
336 return DefWindowProc(hwnd, message, wParam, lParam); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
337 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
338 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
339 static HWND |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
340 sound_window() |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
341 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
342 if (g_hWndSound == NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
343 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
344 LPCSTR clazz = "VimSound"; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
345 WNDCLASS wndclass = { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
346 0, sound_wndproc, 0, 0, g_hinst, NULL, 0, 0, NULL, clazz }; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
347 RegisterClass(&wndclass); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
348 g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0, |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
349 HWND_MESSAGE, NULL, g_hinst, NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
350 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
351 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
352 return g_hWndSound; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
353 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
354 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
355 void |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
356 f_sound_playevent(typval_T *argvars, typval_T *rettv) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
357 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
358 WCHAR *wp; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
359 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
360 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
361 return; |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
362 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
363 wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
364 if (wp == NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
365 return; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
366 |
24842
237dace53473
patch 8.2.2959: sound_playfile() is not tested on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19049
diff
changeset
|
367 if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS)) |
237dace53473
patch 8.2.2959: sound_playfile() is not tested on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19049
diff
changeset
|
368 rettv->vval.v_number = ++sound_id; |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
369 free(wp); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
370 } |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
372 void |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
373 f_sound_playfile(typval_T *argvars, typval_T *rettv) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
374 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
375 long newid = sound_id + 1; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
376 size_t len; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
377 char_u *p, *esc; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
378 WCHAR *wp; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
379 soundcb_T *soundcb; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
380 char buf[32]; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
381 MCIERROR err; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
382 |
25356
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
383 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
384 return; |
1cde96e768e4
patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents:
24842
diff
changeset
|
385 |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
386 esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
387 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
388 len = STRLEN(esc) + 5 + 18 + 1; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
389 p = alloc(len); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
390 if (p == NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
391 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
392 free(esc); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
393 return; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
394 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
395 vim_snprintf((char *)p, len, "open %s alias sound%06ld", esc, newid); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
396 free(esc); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
397 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
398 wp = enc_to_utf16((char_u *)p, NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
399 free(p); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
400 if (wp == NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
401 return; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
402 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
403 err = mciSendStringW(wp, NULL, 0, sound_window()); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
404 free(wp); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
405 if (err != 0) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
406 return; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
407 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
408 vim_snprintf(buf, sizeof(buf), "play sound%06ld notify", newid); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
409 err = mciSendString(buf, NULL, 0, sound_window()); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
410 if (err != 0) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
411 goto failure; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
412 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
413 sound_id = newid; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
414 rettv->vval.v_number = sound_id; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
415 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
416 soundcb = get_sound_callback(&argvars[1]); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
417 if (soundcb != NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
418 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
419 vim_snprintf(buf, sizeof(buf), "sound%06ld", newid); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
420 soundcb->snd_id = newid; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
421 soundcb->snd_device_id = mciGetDeviceID(buf); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
422 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
423 return; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
424 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
425 failure: |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
426 vim_snprintf(buf, sizeof(buf), "close sound%06ld", newid); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
427 mciSendString(buf, NULL, 0, NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
428 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
429 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
430 void |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
431 f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
432 { |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
433 long id; |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
434 char buf[32]; |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
435 |
25384
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
436 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
437 return; |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
438 |
e8e2c4d33b9b
patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Bram Moolenaar <Bram@vim.org>
parents:
25356
diff
changeset
|
439 id = tv_get_number(&argvars[0]); |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
440 vim_snprintf(buf, sizeof(buf), "stop sound%06ld", id); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
441 mciSendString(buf, NULL, 0, NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
442 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
443 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
444 void |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
445 f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
446 { |
18006
5594967b38c5
patch 8.1.1999: calling both PlaySoundW() and PlaySoundA()
Bram Moolenaar <Bram@vim.org>
parents:
17895
diff
changeset
|
447 PlaySoundW(NULL, NULL, 0); |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
448 mciSendString("close all", NULL, 0, NULL); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
449 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
450 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
451 # if defined(EXITFREE) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
452 void |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
453 sound_free(void) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
454 { |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
455 CloseWindow(g_hWndSound); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
456 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
457 while (first_callback != NULL) |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
458 delete_sound_callback(first_callback); |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
459 } |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
460 # endif |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
461 |
30719
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
462 #elif defined(MACOS_X_DARWIN) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
463 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
464 // Sound implementation for macOS. |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
465 static void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
466 sound_play_common(typval_T *argvars, typval_T *rettv, bool playfile) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
467 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
468 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
469 return; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
470 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
471 char_u *sound_name = tv_get_string(&argvars[0]); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
472 soundcb_T *soundcb = get_sound_callback(&argvars[1]); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
473 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
474 ++sound_id; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
475 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
476 bool play_success = sound_mch_play(sound_name, sound_id, soundcb, playfile); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
477 if (!play_success && soundcb) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
478 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
479 delete_sound_callback(soundcb); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
480 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
481 rettv->vval.v_number = play_success ? sound_id : 0; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
482 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
483 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
484 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
485 f_sound_playevent(typval_T *argvars, typval_T *rettv) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
486 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
487 sound_play_common(argvars, rettv, false); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
488 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
489 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
490 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
491 f_sound_playfile(typval_T *argvars, typval_T *rettv) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
492 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
493 sound_play_common(argvars, rettv, true); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
494 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
495 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
496 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
497 f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
498 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
499 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
500 return; |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
501 sound_mch_stop(tv_get_number(&argvars[0])); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
502 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
503 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
504 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
505 f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
506 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
507 sound_mch_clear(); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
508 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
509 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
510 #if defined(EXITFREE) || defined(PROTO) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
511 void |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
512 sound_free(void) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
513 { |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
514 sound_mch_free(); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
515 while (first_callback != NULL) |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
516 delete_sound_callback(first_callback); |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
517 } |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
518 #endif |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
519 |
71137f73c94d
patch 9.0.0694: no native sound support on Mac OS
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
520 #endif // MACOS_X_DARWIN |
17131
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
521 |
be5a5cfc991a
patch 8.1.1565: MS-Windows: no sound support
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
522 #endif // FEAT_SOUND |