<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Определение звука]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17586&amp;type=atom" />
	<updated>2023-02-04T12:54:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17586</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156629#p156629" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br />Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[baraban]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42305</uri>
			</author>
			<updated>2023-02-04T12:54:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156629#p156629</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156627#p156627" />
			<content type="html"><![CDATA[<p><strong>baraban</strong> Импорт библиотеки &#039;VA.ahk&#039; в код добавить нужно. У меня она в папке &#039;Lib&#039;, поэтому проблем нет.</p><div class="codebox"><pre><code>#Include VA.ahk</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2023-02-04T02:43:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156627#p156627</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156626#p156626" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br /><span class="postimg"><img src="https://i.imgur.com/MmDeQXz.jpg" alt="https://i.imgur.com/MmDeQXz.jpg" /></span></p>]]></content>
			<author>
				<name><![CDATA[baraban]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42305</uri>
			</author>
			<updated>2023-02-03T23:12:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156626#p156626</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156624#p156624" />
			<content type="html"><![CDATA[<p><strong>baraban</strong>, Надеюсь этот код поможет понять что к чему:</p><div class="codebox"><pre><code>Wait := 500	; Таймер обновления звука.
Rou := 3	; Округление после точки.
VolMax := 0.5	; Макс. громкость.
Return


F2::	; Запуск / Остановка.
KeyWait, % A_ThisHotkey, U
If !AudioMeter{
 AudioMeter := VA_GetAudioMeter(), VA_IAudioMeterInformation_GetMeteringChannelCount(AudioMeter, ChannelCount)
 VarSetCapacity(PeakValues, ChannelCount*4)
}
SetTimer, GetPeakValues, % ((SW := !SW) = 1 ? Wait : &quot;Off&quot;)
ToolTip
ToolTip,,,,2
Return


GetPeakValues:
 SoundGet, Vol
 Vol := Round(Vol), VA_IAudioMeterInformation_GetChannelsPeakValues(AudioMeter, ChannelCount, &amp;PeakValues)
 Loop % ChannelCount{
  If ((V := Round(NumGet(PeakValues, A_Index*4-4, &quot;float&quot;), Rou)) &gt;= VolMax){
   ToolTip % &quot;Канал: &quot; A_Index &quot;, Громкость: &quot; V, 100, 0, 2
   Break
  }
  Else
   ToolTip,,,,2
 }
 ToolTip % &quot;Left:`t&quot; Round(NumGet(PeakValues, 1*4-4, &quot;float&quot;), Rou) &quot;`nRight:`t&quot; Round(NumGet(PeakValues, 2*4-4, &quot;float&quot;), Rou), 0, 0
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2023-02-03T16:18:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156624#p156624</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156609#p156609" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>NumGet(peakValues, A_Index*4-4, &quot;float&quot;)</code></pre></div><p>Тут вы получаете значение от 0 до 1.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-02-03T11:42:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156609#p156609</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156608#p156608" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Я настолько камень что не знаю как это использовать</p>]]></content>
			<author>
				<name><![CDATA[baraban]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42305</uri>
			</author>
			<updated>2023-02-03T11:22:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156608#p156608</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156607#p156607" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>[out] afPeakValues<br />Pointer to an array of peak sample values. The method writes the peak values for the channels into the array. The array contains one element for each channel in the stream. The peak values are numbers in the normalized range from 0.0 to 1.0.</p></blockquote></div><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/endpointvolume/nf-endpointvolume-iaudiometerinformation-getchannelspeakvalues">https://learn.microsoft.com/en-us/windo … peakvalues</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-02-03T10:35:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156607#p156607</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Определение звука]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=156604#p156604" />
			<content type="html"><![CDATA[<p>Приветствую всех.<br />Помогите с написанием скрипта который будет срабатывать на звук. Посмотрев чутка форум нашёл очень похожий по смыслу работы, но он срабатывает на любой звук в диапазоне от 1 до 100. А нужен который будет срабатывать на более высокий диапазон (пример от 50 до 100).<br /></p><div class="codebox"><pre><code>#Include VA.ahk
#Persistent
audioMeter := VA_GetAudioMeter()
VA_IAudioMeterInformation_GetMeteringChannelCount(audioMeter, channelCount)
VarSetCapacity(peakValues, channelCount*4)
SetTimer, GetPeakValues, 100
return

GetPeakValues:
    VA_IAudioMeterInformation_GetChannelsPeakValues(audioMeter, channelCount, &amp;peakValues)
    loop %channelCount%
        if NumGet(peakValues, A_Index*4-4, &quot;float&quot;) {
            MsgBox раздался звук
            break
        }
    return</code></pre></div><br /><p>Задумка такая.<br />1. Происходит запуск скрипта<br />2. Начинается прокликивание ЛКМ с определённой частотой (20мс)<br />3. При скачке выходного звука в диапазоне от 50 до 100 происходит нажатие на Enter</p>]]></content>
			<author>
				<name><![CDATA[baraban]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42305</uri>
			</author>
			<updated>2023-02-03T07:57:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=156604#p156604</id>
		</entry>
</feed>
