Win32 API 日本語リファレンス
ホームDevices.Tapi › LINEMONITORTONE

LINEMONITORTONE

構造体
サイズx64: 20 バイト / x86: 20 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwAppSpecificDWORD4+0+0アプリケーションがトーンにタグを付けるために使用します。このトーンが検出されると、dwAppSpecific メンバーの値がアプリケーションに返されます。
dwDurationDWORD4+4+4検出が行われるまでにトーンが存在している必要がある継続時間(ミリ秒単位)。
dwFrequency1DWORD4+8+8トーンの 1 番目の周波数(ヘルツ単位)。
dwFrequency2DWORD4+12+12トーンの 2 番目の周波数(ヘルツ単位)。
dwFrequency3DWORD4+16+16トーンの 3 番目の周波数(ヘルツ単位)。トーンに必要な周波数が 3 つ未満の場合は、使用しない周波数に 0 を指定します。3 つの周波数すべてが 0 に設定されたトーンは無音として解釈され、無音の検出に使用できます。

公式ドキュメント

LINEMONITORTONE 構造体は、監視対象のトーンを記述します。これは配列の要素として使用されます。 lineMonitorTones 関数および TSPI_lineMonitorTones 関数がこの構造体を使用します。

解説(Remarks)

この構造体は拡張できません。

LINEMONITORTONE 構造体は、検出を目的としてトーンを定義します。トーンの配列は lineMonitorTones 関数に渡されます。この関数はこれらのトーンを監視し、検出が行われるとアプリケーションに LINE_MONITORTONE メッセージを送信します。

すべての周波数が 0 に設定されたトーンは無音に対応します。これにより、アプリケーションは呼び出しの情報ストリームで無音を監視できます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// LINEMONITORTONE  (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct LINEMONITORTONE {
    DWORD dwAppSpecific;
    DWORD dwDuration;
    DWORD dwFrequency1;
    DWORD dwFrequency2;
    DWORD dwFrequency3;
} LINEMONITORTONE;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct LINEMONITORTONE
{
    public uint dwAppSpecific;
    public uint dwDuration;
    public uint dwFrequency1;
    public uint dwFrequency2;
    public uint dwFrequency3;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure LINEMONITORTONE
    Public dwAppSpecific As UInteger
    Public dwDuration As UInteger
    Public dwFrequency1 As UInteger
    Public dwFrequency2 As UInteger
    Public dwFrequency3 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LINEMONITORTONE(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwAppSpecific", wintypes.DWORD),
        ("dwDuration", wintypes.DWORD),
        ("dwFrequency1", wintypes.DWORD),
        ("dwFrequency2", wintypes.DWORD),
        ("dwFrequency3", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct LINEMONITORTONE {
    pub dwAppSpecific: u32,
    pub dwDuration: u32,
    pub dwFrequency1: u32,
    pub dwFrequency2: u32,
    pub dwFrequency3: u32,
}
import "golang.org/x/sys/windows"

type LINEMONITORTONE struct {
	dwAppSpecific uint32
	dwDuration uint32
	dwFrequency1 uint32
	dwFrequency2 uint32
	dwFrequency3 uint32
}
type
  LINEMONITORTONE = packed record
    dwAppSpecific: DWORD;
    dwDuration: DWORD;
    dwFrequency1: DWORD;
    dwFrequency2: DWORD;
    dwFrequency3: DWORD;
  end;
const LINEMONITORTONE = extern struct {
    dwAppSpecific: u32,
    dwDuration: u32,
    dwFrequency1: u32,
    dwFrequency2: u32,
    dwFrequency3: u32,
};
type
  LINEMONITORTONE {.packed.} = object
    dwAppSpecific: uint32
    dwDuration: uint32
    dwFrequency1: uint32
    dwFrequency2: uint32
    dwFrequency3: uint32
align(1)
struct LINEMONITORTONE
{
    uint dwAppSpecific;
    uint dwDuration;
    uint dwFrequency1;
    uint dwFrequency2;
    uint dwFrequency3;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LINEMONITORTONE サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dwAppSpecific : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwDuration : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFrequency1 : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwFrequency2 : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwFrequency3 : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LINEMONITORTONE, pack=1
    #field int dwAppSpecific
    #field int dwDuration
    #field int dwFrequency1
    #field int dwFrequency2
    #field int dwFrequency3
#endstruct

stdim st, LINEMONITORTONE        ; NSTRUCT 変数を確保
st->dwAppSpecific = 100
mes "dwAppSpecific=" + st->dwAppSpecific