<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17370</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17370&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2».]]></description>
		<lastBuildDate>Thu, 15 Sep 2022 02:38:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154754#p154754</link>
			<description><![CDATA[<p><strong>Malcev</strong><br />Спасибо за уточнение.</p>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Thu, 15 Sep 2022 02:38:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154754#p154754</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154753#p154753</link>
			<description><![CDATA[<div class="quotebox"><cite>Clannad5 пишет:</cite><blockquote><p>вроде там учитывается кодировка</p></blockquote></div><p>Ничего там не учитывается.<br />Всегда будет &quot;W&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Wed, 14 Sep 2022 19:37:25 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154753#p154753</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154752#p154752</link>
			<description><![CDATA[<div class="quotebox"><cite>Clannad5 пишет:</cite><blockquote><p><strong>teadrinker</strong><br /><a href="https://hotkeyit.github.io/v2/docs/commands/WinApi.htm">https://hotkeyit.github.io/v2/docs/commands/WinApi.htm</a></p></blockquote></div><p>Не знал про эту фичу, забавно. Но GetCommandLine — это не название какого-то метода AHK, это просто пример вызова winapi-функции, которая как раз так и называется. Но это, по-моему, только в AHK_H, в обычном такого нет.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Sep 2022 18:52:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154752#p154752</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154751#p154751</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong><br />Почему же, работает.<br />Я выше пример готовый приводил:<br /></p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound)
Sleep 1000

PlaySound( Sound ) {
	Return DllCall(&quot;winmm.dll\PlaySound&quot; ( 1 ? &quot;W&quot; : &quot;A&quot; ), &quot;Ptr&quot;, Sound, &quot;UInt&quot;, 0
	, &quot;UInt&quot;, ((SND_MEMORY:=0x4)|(SND_NODEFAULT:=0x2)))
	}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Wed, 14 Sep 2022 18:40:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154751#p154751</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154750#p154750</link>
			<description><![CDATA[<p>Хм, а что DllCall в v2 не работает?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 14 Sep 2022 18:31:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154750#p154750</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154749#p154749</link>
			<description><![CDATA[<p><strong>teadrinker</strong><br /><a href="https://hotkeyit.github.io/v2/docs/commands/WinApi.htm">https://hotkeyit.github.io/v2/docs/commands/WinApi.htm</a></p>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Wed, 14 Sep 2022 18:23:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154749#p154749</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154748#p154748</link>
			<description><![CDATA[<p>А что за метод GetCommandLine? Я в справке такого не нашёл.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Sep 2022 14:09:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154748#p154748</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154747#p154747</link>
			<description><![CDATA[<p><strong>teadrinker</strong></p><p>Честно без понятия, вроде там учитывается кодировка, не буду врать и придумывать.<br />Однако я покопался еще и нашел метод, который уже встроен в AHK v2 &quot;GetCommandLine&quot;, который вызывает методы WinApi.</p><p>Сократил по итогу код в две строчки:</p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound, 0, 0x4|0x2)
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Wed, 14 Sep 2022 13:33:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154747#p154747</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154746#p154746</link>
			<description><![CDATA[<p>А что означает ( 1 ? &quot;W&quot; : &quot;A&quot; ) и зачем оно нужно?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 14 Sep 2022 13:13:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154746#p154746</guid>
		</item>
		<item>
			<title><![CDATA[AHK: воспроизведение звукого файла с помощью PlaySound в Ahk_H v2]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154745#p154745</link>
			<description><![CDATA[<p>Здравствуйте!</p><p>Возможно это не совсем подходящий форум по вопросам AHK V2, но всё же вопрос идёт с проблемой вызова Playsound, может быть знающие смогут мне объяснить, почему функция отказывается принимать мой файл, который я поместил в буфер?</p><p>Это метод воспроизведения для AHK_L:</p><div class="codebox"><pre><code>
fileread,sound,*c C:\Windows\Media\notify.wav
PlaySound(sound)
Sleep, 1000
ExitApp

PlaySound(sound) {
	DllCall(&quot;winmm.dll\PlaySound&quot;,&quot;uint&quot;,&amp;sound,&quot;uint&quot;,0,&quot;uint&quot;,0x4)
	}
</code></pre></div><p>В AHK_L Функция PlaySound спокойно принимает буфер данные, используя на конце код 0x4.</p><p>Используя AHK_H V2, я сталкиваюсь с некоторыми проблемами:</p><div class="codebox"><pre><code>
sound := fileread(&quot;C:\Windows\Media\notify.wav&quot;, &quot;RAW&quot;)
PlaySound(sound)
Sleep 1000
ExitApp

PlaySound(sound) {
	DllCall(&quot;winmm.dll\PlaySound&quot;,&quot;uint&quot;,&amp;sound,&quot;uint&quot;,0,&quot;uint&quot;,0x4)
	}
</code></pre></div><p>Мне пишет:</p><p><span class="postimg"><img src="https://i.imgur.com/fl5YN57.png" alt="https://i.imgur.com/fl5YN57.png" /></span></p><p>Что же я делаю не так?Возможно AHK_H V2 передаёт параметры неправильно?Или я делаю что-то не так?</p><p>UPD:</p><p>На зарубежном форуме мне помогли найти ответ:</p><div class="codebox"><pre><code>
Sound := FileRead(&quot;C:\1.wav&quot;, &quot;RAW&quot;)
PlaySound(Sound)
Sleep 1000

PlaySound( Sound ) {
	Return DllCall(&quot;winmm.dll\PlaySound&quot; ( 1 ? &quot;W&quot; : &quot;A&quot; ), &quot;Ptr&quot;, Sound, &quot;UInt&quot;, 0
	, &quot;UInt&quot;, ((SND_MEMORY:=0x4)|(SND_NODEFAULT:=0x2)))
	}
</code></pre></div><p>Вопрос решён.</p>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Wed, 14 Sep 2022 12:47:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154745#p154745</guid>
		</item>
	</channel>
</rss>
