本文整理汇总了C#中iSpyApplication.Controls.CameraWindow类的典型用法代码示例。如果您正苦于以下问题:C# CameraWindow类的具体用法?C# CameraWindow怎么用?C# CameraWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraWindow类属于iSpyApplication.Controls命名空间,在下文中一共展示了CameraWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextToSpeech
public TextToSpeech(CameraWindow cw = null)
{
InitializeComponent();
CW = cw;
Text = LocRm.GetString("TextToSpeech");
button1.Text = LocRm.GetString("OK");
}
示例2: SynthToCam
private static void SynthToCam(string text, CameraWindow cw)
{
var synthFormat = new System.Speech.AudioFormat.SpeechAudioFormatInfo(System.Speech.AudioFormat.EncodingFormat.Pcm, 11025, 16, 1, 22100, 2, null);
using (var synthesizer = new SpeechSynthesizer())
{
using (var waveStream = new MemoryStream())
{
//write some silence to the stream to allow camera to initialise properly
var silence = new byte[1 * 22050];
waveStream.Write(silence, 0, silence.Length);
var pbuilder = new PromptBuilder();
var pStyle = new PromptStyle
{
Emphasis = PromptEmphasis.Strong,
Rate = PromptRate.Slow,
Volume = PromptVolume.ExtraLoud
};
pbuilder.StartStyle(pStyle);
pbuilder.StartParagraph();
pbuilder.StartVoice(VoiceGender.Male, VoiceAge.Adult, 2);
pbuilder.StartSentence();
pbuilder.AppendText(text);
pbuilder.EndSentence();
pbuilder.EndVoice();
pbuilder.EndParagraph();
pbuilder.EndStyle();
synthesizer.SetOutputToAudioStream(waveStream, synthFormat);
synthesizer.Speak(pbuilder);
synthesizer.SetOutputToNull();
//write some silence to the stream to allow camera to end properly
waveStream.Write(silence, 0, silence.Length);
waveStream.Seek(0, SeekOrigin.Begin);
var ds = new DirectStream(waveStream) { RecordingFormat = new WaveFormat(11025, 16, 1) };
var talkTarget = TalkHelper.GetTalkTarget(cw.Camobject, ds);
ds.Start();
talkTarget.Start();
while (ds.IsRunning)
{
Thread.Sleep(100);
}
ds.Stop();
talkTarget.Stop();
talkTarget = null;
ds = null;
}
}
}
示例3: SynthToCam
private static void SynthToCam(string fileName, CameraWindow cw)
{
using (var waveStream = new MemoryStream())
{
//write some silence to the stream to allow camera to initialise properly
var silence = new byte[1 * 22050];
waveStream.Write(silence, 0, silence.Count());
//read in and convert the wave stream into our format
using (var reader = new WaveFileReader(fileName))
{
var newFormat = new WaveFormat(11025, 16, 1);
byte[] buff = new byte[22050];
using (var conversionStream = new WaveFormatConversionStream(newFormat, reader))
{
do
{
int i = conversionStream.Read(buff, 0, 22050);
waveStream.Write(buff, 0, i);
if (i < 22050)
break;
} while (true);
}
}
//write some silence to the stream to allow camera to end properly
waveStream.Write(silence, 0, silence.Count());
waveStream.Seek(0, SeekOrigin.Begin);
var ds = new DirectStream(waveStream) { RecordingFormat = new WaveFormat(11025, 16, 1) };
var talkTarget = TalkHelper.GetTalkTarget(cw.Camobject, ds);
ds.Start();
talkTarget.Start();
while (ds.IsRunning)
{
Thread.Sleep(100);
}
ds.Stop();
talkTarget.Stop();
talkTarget = null;
ds = null;
waveStream.Close();
}
}
示例4: PTZController
public PTZController(CameraWindow cameraControl)
{
_cameraControl = cameraControl;
}
示例5: PTZToolUpdate
public void PTZToolUpdate(CameraWindow cw)
{
if (_ptzTool != null)
{
_ptzTool.CameraControl = cw;
}
}
示例6: ShowFiles
internal void ShowFiles(CameraWindow cw)
{
string foldername = Helper.GetMediaDirectory(2, cw.Camobject.id) + "video\\" + cw.Camobject.directory + "\\";
if (!foldername.EndsWith(@"\"))
foldername += @"\";
Process.Start(foldername);
cw.Camobject.newrecordingcount = 0;
}
示例7: TalkTo
public void TalkTo(CameraWindow cw, bool talk)
{
if (string.IsNullOrEmpty(Conf.TalkMic))
return;
if (_talkSource != null)
{
_talkSource.Stop();
_talkSource = null;
}
if (_talkTarget != null)
{
_talkTarget.Stop();
_talkTarget = null;
}
if (!talk)
{
if (cw.VolumeControl != null)
{
cw.VolumeControl.Listening = false;
}
return;
}
Application.DoEvents();
TalkCamera = cw;
_talkSource = new TalkDeviceStream(Conf.TalkMic) {RecordingFormat = new WaveFormat(8000, 16, 1)};
_talkSource.AudioFinished += _talkSource_AudioFinished;
if (!_talkSource.IsRunning)
_talkSource.Start();
_talkTarget = TalkHelper.GetTalkTarget(cw.Camobject, _talkSource);
_talkTarget.TalkStopped += TalkTargetTalkStopped;
_talkTarget.Start();
//auto listen
if (cw.VolumeControl != null)
{
cw.VolumeControl.Listening = true;
}
}
示例8: NewCameraWindow
private CameraWindow NewCameraWindow(int videoSourceIndex)
{
var oc = new objectsCamera
{
alerts = new objectsCameraAlerts(),
detector = new objectsCameraDetector
{
motionzones =
new objectsCameraDetectorZone
[0]
},
notifications = new objectsCameraNotifications(),
recorder = new objectsCameraRecorder(),
schedule = new objectsCameraSchedule {entries = new objectsCameraScheduleEntry[0]},
settings = new objectsCameraSettings(),
ftp = new objectsCameraFtp(),
id = -1,
directory = RandomString(5),
ptz = -1,
x = Convert.ToInt32(Random.NextDouble()*100),
y = Convert.ToInt32(Random.NextDouble()*100),
name = LocRm.GetString("Camera") + " " + NextCameraId
};
oc.ptzschedule = new objectsCameraPtzschedule
{
active = false,
entries = new objectsCameraPtzscheduleEntry[] { }
};
oc.flipx = oc.flipy = false;
oc.width = 320;
oc.height = 240;
oc.description = "";
oc.resolution = "320x240";
oc.newrecordingcount = 0;
oc.alerts.active = true;
oc.alerts.mode = "movement";
oc.alerts.alertoptions = "false,false";
oc.alerts.objectcountalert = 1;
oc.alerts.minimuminterval = 180;
oc.alerts.processmode = "continuous";
oc.alerts.pluginconfig = "";
oc.alerts.trigger = "";
oc.notifications.sendemail = false;
oc.notifications.sendsms = false;
oc.notifications.sendmms = false;
oc.notifications.emailgrabinterval = 0;
oc.ftp.enabled = false;
oc.ftp.port = 21;
oc.ftp.mode = 0;
oc.ftp.server = "ftp://";
oc.ftp.interval = 10;
oc.ftp.filename = "mylivecamerafeed.jpg";
oc.ftp.localfilename = "{0:yyyy-MM-dd_HH-mm-ss_fff}.jpg";
oc.ftp.ready = true;
oc.ftp.text = "www.ispyconnect.com";
oc.ftp.quality = 75;
oc.schedule.active = false;
oc.settings.active = false;
oc.settings.deleteavi = true;
oc.settings.ffmpeg = Conf.FFMPEG_Camera;
oc.settings.emailaddress = EmailAddress;
oc.settings.smsnumber = MobileNumber;
oc.settings.suppressnoise = true;
oc.settings.login = "";
oc.settings.password = "";
oc.settings.useragent = "Mozilla/5.0";
oc.settings.frameinterval = 10;
oc.settings.sourceindex = videoSourceIndex;
oc.settings.micpair = -1;
oc.settings.frameinterval = 200;
oc.settings.maxframerate = 10;
oc.settings.maxframeraterecord = 10;
oc.settings.ptzautotrack = false;
oc.settings.framerate = 10;
oc.settings.timestamplocation = 1;
oc.settings.ptztimetohome = 100;
oc.settings.ptzchannel = "0";
oc.settings.timestampformatter = "FPS: {FPS} {0:G} ";
oc.settings.timestampfontsize = 10;
oc.settings.notifyondisconnect = false;
oc.settings.ptzautohomedelay = 30;
oc.settings.accessgroups = "";
oc.settings.youtube = new objectsCameraSettingsYoutube
{
autoupload = false,
category = Conf.YouTubeDefaultCategory,
tags = "iSpy, Motion Detection, Surveillance",
@public = false
};
oc.settings.desktopresizeheight = 480;
oc.settings.desktopresizewidth = 640;
oc.settings.resize = false;
if (VlcHelper.VlcInstalled)
//.........这里部分代码省略.........
示例9: RemoveCameraPanel
private void RemoveCameraPanel(CameraWindow cameraControl)
{
_pnlCameras.Controls.Remove(cameraControl);
if (!_closing)
{
CameraWindow control = cameraControl;
var oc = Cameras.FirstOrDefault(p => p.id == control.Camobject.id);
if (oc != null)
{
lock (ThreadLock)
{
Masterfilelist.RemoveAll(p => p.ObjectId == oc.id && p.ObjectTypeId == 2);
}
Actions.RemoveAll(p => p.objectid == control.Camobject.id && p.objecttypeid == 2);
Cameras.Remove(oc);
}
foreach (var ofp in FloorPlans)
ofp.needsupdate = true;
NeedsSync = true;
SetNewStartPosition();
}
Application.DoEvents();
cameraControl.Dispose();
if (!_shuttingDown)
{
LoadPreviews();
}
}
示例10: DisplayCamera
internal void DisplayCamera(objectsCamera cam)
{
var cameraControl = new CameraWindow(cam);
SetCameraEvents(cameraControl);
cameraControl.BackColor = Conf.BackColor.ToColor();
_pnlCameras.Controls.Add(cameraControl);
cameraControl.Location = new Point(cam.x, cam.y);
cameraControl.Size = new Size(cam.width, cam.height);
cameraControl.BringToFront();
cameraControl.Tag = GetControlIndex();
if (Conf.AutoSchedule && cam.schedule.active && cam.schedule.entries.Any())
{
cam.settings.active = false;
cameraControl.ApplySchedule();
}
else
{
try
{
if (cam.settings.active)
cameraControl.Enable();
}
catch (Exception ex)
{
Log.Error("", ex);
}
}
string path = Conf.MediaDirectory + "video\\" + cam.directory + "\\";
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
path = Conf.MediaDirectory + "video\\" + cam.directory + "\\thumbs\\";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
//move existing thumbs into directory
var lfi =
Directory.GetFiles(Conf.MediaDirectory + "video\\" + cam.directory + "\\", "*.jpg").ToList();
foreach (string file in lfi)
{
string destfile = file;
int i = destfile.LastIndexOf(@"\", StringComparison.Ordinal);
destfile = file.Substring(0, i) + @"\thumbs" + file.Substring(i);
File.Move(file, destfile);
}
}
path = Conf.MediaDirectory + "video\\" + cam.directory + "\\grabs\\";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}
示例11: RemoveCamera
public void RemoveCamera(CameraWindow cameraControl, bool confirm)
{
if (confirm &&
MessageBox.Show(LocRm.GetString("AreYouSure"), LocRm.GetString("Confirm"), MessageBoxButtons.OKCancel,
MessageBoxIcon.Warning) == DialogResult.Cancel)
return;
cameraControl.ShuttingDown = true;
cameraControl.MouseDown -= CameraControlMouseDown;
cameraControl.MouseUp -= CameraControlMouseUp;
cameraControl.MouseMove -= CameraControlMouseMove;
cameraControl.DoubleClick -= CameraControlDoubleClick;
cameraControl.RemoteCommand -= CameraControlRemoteCommand;
cameraControl.Notification -= ControlNotificationHandler;
if (cameraControl.Recording)
cameraControl.RecordSwitch(false);
cameraControl.Disable();
cameraControl.SaveFileList();
if (cameraControl.VolumeControl != null)
RemoveMicrophone(cameraControl.VolumeControl, false);
if (InvokeRequired)
Invoke(new CameraCommandDelegate(RemoveCameraPanel), cameraControl);
else
RemoveCameraPanel(cameraControl);
}
示例12: Say
public static void Say(string text,CameraWindow cw)
{
var t = new Thread(() => SynthToCam(Uri.UnescapeDataString(text), cw));
t.Start();
}
示例13: Play
public static void Play(string fileName,CameraWindow cw)
{
var t = new Thread(() => SynthToCam(fileName, cw));
t.Start();
}
示例14: SynthToCam
private static void SynthToCam(string fileName, CameraWindow cw)
{
using (var waveStream = new MemoryStream())
{
//write some silence to the stream to allow camera to initialise properly
var silence = new byte[1 * 22050];
waveStream.Write(silence, 0, silence.Count());
//read in and convert the wave stream into our format
using (var reader = new WaveFileReader(fileName))
{
var newFormat = new WaveFormat(11025, 16, 1);
byte[] buff = new byte[22050];
using (var conversionStream = new WaveFormatConversionStream(newFormat, reader))
{
do
{
int i = conversionStream.Read(buff, 0, 22050);
waveStream.Write(buff, 0, i);
if (i < 22050)
break;
} while (true);
}
}
//write some silence to the stream to allow camera to end properly
waveStream.Write(silence, 0, silence.Count());
waveStream.Seek(0, SeekOrigin.Begin);
ITalkTarget talkTarget;
var ds = new DirectStream(waveStream) { RecordingFormat = new WaveFormat(11025, 16, 1) };
switch (cw.Camobject.settings.audiomodel)
{
case "Foscam":
ds.Interval = 40;
ds.PacketSize = 882; // (40ms packet at 22050 bytes per second)
talkTarget = new TalkFoscam(cw.Camobject.settings.audioip, cw.Camobject.settings.audioport,
cw.Camobject.settings.audiousername,
cw.Camobject.settings.audiopassword, ds);
break;
case "NetworkKinect":
ds.Interval = 40;
ds.PacketSize = 882;
talkTarget = new TalkNetworkKinect(cw.Camobject.settings.audioip, cw.Camobject.settings.audioport, ds);
break;
case "iSpyServer":
ds.Interval = 40;
ds.PacketSize = 882;
talkTarget = new TalkiSpyServer(cw.Camobject.settings.audioip,
cw.Camobject.settings.audioport,
ds);
break;
case "Axis":
talkTarget = new TalkAxis(cw.Camobject.settings.audioip, cw.Camobject.settings.audioport,
cw.Camobject.settings.audiousername,
cw.Camobject.settings.audiopassword, ds);
break;
default:
//local playback
talkTarget = new TalkLocal(ds);
break;
}
ds.Start();
talkTarget.Start();
while (ds.IsRunning)
{
Thread.Sleep(100);
}
ds.Stop();
if (talkTarget != null)
talkTarget.Stop();
talkTarget = null;
ds = null;
waveStream.Close();
}
}
示例15: ConfigureProcessorForm
public ConfigureProcessorForm(CameraWindow CW)
{
InitializeComponent();
RenderResources();
CameraControl = CW;
}