media

package
v0.5.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

复制自 https://dev.to/ik5/quick-and-dirty-audio-playing-in-golang-3n7c 功能上微调 只适用于 windows

Index

Constants

View Source
const (
	SND_SYNC        uint = 0x0000     /* play synchronously (default) */
	SND_ASYNC       uint = 0x0001     /* play asynchronously */
	SND_NODEFAULT   uint = 0x0002     /* silence (!default) if sound not found */
	SND_MEMORY      uint = 0x0004     /* pszSound points to a memory file */
	SND_LOOP        uint = 0x0008     /* loop the sound until next sndPlaySound */
	SND_NOSTOP      uint = 0x0010     /* don't stop any currently playing sound */
	SND_NOWAIT      uint = 0x00002000 /* don't wait if the driver is busy */
	SND_ALIAS       uint = 0x00010000 /* name is a registry alias */
	SND_ALIAS_ID    uint = 0x00110000 /* alias is a predefined ID */
	SND_FILENAME    uint = 0x00020000 /* name is file name */
	SND_RESOURCE    uint = 0x00040004 /* name is resource name or atom */
	SND_PURGE       uint = 0x0040     /* purge non-static events for task */
	SND_APPLICATION uint = 0x0080     /* look for application specific association */
	SND_SENTRY      uint = 0x00080000 /* Generate a SoundSentry event with this sound */
	SND_RING        uint = 0x00100000 /* Treat this as a "ring" from a communications app - don't duck me */
	SND_SYSTEM      uint = 0x00200000 /* Treat this as a system sound */
	SND_ALIAS_START uint = 0          /* alias base */
)

Variables

This section is empty.

Functions

func QrCodeBase64 added in v0.5.8

func QrCodeBase64(content string) string

func TestSndPlaySoundW

func TestSndPlaySoundW()

func TestTTS

func TestTTS()

Types

type TTS

type TTS struct {
	// contains filtered or unexported fields
}

func (*TTS) Init

func (self *TTS) Init()

初始化

func (*TTS) RemoveTempFile

func (self *TTS) RemoveTempFile()

删除临时文件,要手动执行,在 SayNoWait 和 SayWait 中之行的话会在 windows 执行朗读之前删掉,导致不能朗读

func (*TTS) SayNoWait

func (self *TTS) SayNoWait(message string)

说话,不等待运行结束

func (*TTS) SayWait

func (self *TTS) SayWait(message string)

说话,等待运行结束

func (*TTS) SetRate

func (self *TTS) SetRate(rate int)

设置速度

type WinSound

type WinSound struct {
	// contains filtered or unexported fields
}

func (*WinSound) PlaySound

func (self *WinSound) PlaySound(sound string, hmod int, flags uint)

PlaySound play sound in Windows

func (*WinSound) SndPlaySoundA

func (self *WinSound) SndPlaySoundA(sound string, flags uint)

SndPlaySoundA play sound file in Windows

func (*WinSound) SndPlaySoundW

func (self *WinSound) SndPlaySoundW(sound string, flags uint)

SndPlaySoundW play sound file in Windows

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL