Merge branch 'develop' of github.com:Flamefire/Vocaluxe into develop
This commit is contained in:
commit
e59b1f78ac
80 files changed
+2166
-856
No files matched your search
@@ -152,6 +152,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GSTREAMERHELPER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -205,9 +205,9 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Pozadí obrazu</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Náhled obrazu</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Obrazové záznamy během přehrávání</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Zobrazit nynější obrazový záznam k hudbě na pozadí</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Kamery</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Schopnosti kamer</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Zobrazit nynější obrazový záznam k hudbě na pozadí</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Kamery</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Schopnosti kamer</string>
|
||||
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Přizpůsobení obrazovky</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Stiskněte Ctrl + Alt + Shift + šipky pro upravení obrazovky</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">Ctrl + Alt + Shift + 0 pro vrácení úprav zpět na výchozí hodnoty</string>
|
||||
|
||||
@@ -199,8 +199,8 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Videoachtergronden</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Videopreview</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Video tijdens zingen</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Toon huidige achtergrondmuziekvideo</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Webcaminstellingen</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Toon huidige achtergrondmuziekvideo</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webcaminstellingen</string>
|
||||
<string name="TR_SCREENPVOLUMECONTROL_VOLUME">Volume</string>
|
||||
</resources>
|
||||
@@ -205,9 +205,9 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Video Backgrounds</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Video Preview</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Videos while singing</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Display current backgroundmusic video</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Webcamcapabilities</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Display current backgroundmusic video</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webcam-Resolution</string>
|
||||
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Screen adjustments</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Press CTR + ALT + SHIFT + Arrows to adjust screen</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTR + ALT + SHIFT + 0 to reset</string>
|
||||
|
||||
@@ -205,9 +205,9 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Vidéo en arrière plan</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Prévisualisation des Vidéos</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Vidéos pendant que l\'on chante</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Afficher la vidéo de la musique de fond</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Configuration Webcam</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Afficher la vidéo de la musique de fond</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Configuration Webcam</string>
|
||||
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Ajustements de l\'écran</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Appuyer sur CTR + ALT + SHIFT + Flèches pour ajuster l\'écran</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTR + ALT + SHIFT + 0 pour réinitialiser</string>
|
||||
|
||||
@@ -206,9 +206,9 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Video-Hintergründe</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Video-Vorschau</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Videos während des Singens</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Videos der Hintergrundmusik</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Webcamfähigkeiten</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Videos der Hintergrundmusik</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webcams</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webcam-Auflösung</string>
|
||||
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Anzeigeanpassungen</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">STRG + ALT + SHIFT + Pfeiltasten drücken um den Bildschirm anzupassen</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">STRG + ALT + SHIFT + 0 um die Anpassungen zurückzusetzen</string>
|
||||
|
||||
@@ -190,8 +190,8 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Animált Háttér</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Videó Előnézet</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Videó Éneklés Közben</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Jelenlegi Háttérzene Videó Mutatása</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webkamerák</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Webkamera Tulajdonságok</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Jelenlegi Háttérzene Videó Mutatása</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webkamerák</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webkamera Tulajdonságok</string>
|
||||
<string name="TR_SCREENPVOLUMECONTROL_VOLUME">Hangerő</string>
|
||||
</resources>
|
||||
@@ -173,5 +173,5 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Videos de Fondo</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Previsualización del Video</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Videos al Cantar</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">TODO: Display current backgroundmusic video</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">TODO: Display current backgroundmusic video</string>
|
||||
</resources>
|
||||
@@ -205,9 +205,9 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Video Bakgrund</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Video Förhandsvisning</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Video Samtidigt Med Låt</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Visa nuvarande Video för Bakgrundsmusik</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Webkameror</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Webkamera Kapacitet</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Visa nuvarande Video för Bakgrundsmusik</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webkameror</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webkamera Kapacitet</string>
|
||||
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Skärmjusteringar</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Tryck CTRL + ALT +SHIFT + Pilar för att justera skärmen</string>
|
||||
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTRL + ALT + SHIFT + 0 för att återställa</string>
|
||||
|
||||
@@ -190,8 +190,8 @@
|
||||
<string name="TR_SCREENOVIDEO_VIDEOBACKGROUNDS">Video Arka Planları</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOPREVIEW">Video Önizleme</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOINSONGS">Şarkı Söylerken Videoları Gösterme</string>
|
||||
<string name="TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND">Mevcut Arka Plan Müziği Videosunu Göster</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMDEVICES">Web Kameraları</string>
|
||||
<string name="TR_SCREENO_VIDEO_WEBCAMCAPABILITIES">Web Kameraları Özellikleri</string>
|
||||
<string name="TR_SCREENOVIDEO_VIDEOSTOBACKGROUND">Mevcut Arka Plan Müziği Videosunu Göster</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Web Kameraları</string>
|
||||
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Web Kameraları Özellikleri</string>
|
||||
<string name="TR_SCREENPVOLUMECONTROL_VOLUME">Ses</string>
|
||||
</resources>
|
||||
File renamed without changes.
@@ -0,0 +1,6 @@
|
||||
http://json.codeplex.com/
|
||||
|
||||
Version: Json.NET 6.0 Release 1 (.Net 4.0)
|
||||
|
||||
Files:
|
||||
Newtonsoft.Json.dll
|
||||
Binary file not shown.
@@ -1155,8 +1155,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -1182,8 +1182,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -1209,8 +1209,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -1236,8 +1236,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -1263,8 +1263,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -1290,8 +1290,8 @@
|
||||
<NumBars>8</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
|
||||
@@ -782,11 +782,11 @@
|
||||
<W>230</W>
|
||||
<H>150</H>
|
||||
<!--<NumBars>: Number of equalizer-elements.-->
|
||||
<NumBars>10</NumBars>
|
||||
<NumBars>12</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -794,7 +794,7 @@
|
||||
<Color>ButtonColor</Color>
|
||||
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
|
||||
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
|
||||
<MaxColor>ButtonColor</MaxColor>
|
||||
<MaxColor>ButtonTextColor</MaxColor>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
@@ -813,11 +813,11 @@
|
||||
<W>230</W>
|
||||
<H>150</H>
|
||||
<!--<NumBars>: Number of equalizer-elements.-->
|
||||
<NumBars>10</NumBars>
|
||||
<NumBars>12</NumBars>
|
||||
<!--<Space>: Space between equalizer-elements.-->
|
||||
<Space>2,00</Space>
|
||||
<!--<Style>: Style of equalizer-elements: Collums-->
|
||||
<Style>Collums</Style>
|
||||
<!--<Style>: Style of equalizer-elements: Columns-->
|
||||
<Style>Columns</Style>
|
||||
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON-->
|
||||
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
|
||||
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
|
||||
@@ -825,7 +825,7 @@
|
||||
<Color>ButtonColor</Color>
|
||||
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
|
||||
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
|
||||
<MaxColor>ButtonColor</MaxColor>
|
||||
<MaxColor>ButtonTextColor</MaxColor>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<ScreenOptionsVideo>
|
||||
<ScreenVersion>4</ScreenVersion>
|
||||
<ScreenVersion>5</ScreenVersion>
|
||||
<Background1>
|
||||
<!--<Type>: Background type: None, Color, Texture, Video-->
|
||||
<Type>Video</Type>
|
||||
@@ -233,12 +233,12 @@
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND</Text>
|
||||
<Text>TR_SCREENOVIDEO_VIDEOSTOBACKGROUND</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text5>
|
||||
<Text6>
|
||||
<TextWebcams>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>347</Y>
|
||||
@@ -262,12 +262,12 @@
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_SCREENO_VIDEO_WEBCAMDEVICES</Text>
|
||||
<Text>TR_SCREENOVIDEO_WEBCAMDEVICES</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text6>
|
||||
<Text7>
|
||||
</TextWebcams>
|
||||
<TextWebcamResolution>
|
||||
<!--<X>, <Y>: Text position-->
|
||||
<X>75</X>
|
||||
<Y>407</Y>
|
||||
@@ -291,11 +291,11 @@
|
||||
<!--<Font>: Text font name-->
|
||||
<Font>Outline</Font>
|
||||
<!--<Text>: Nothing or translation tag-->
|
||||
<Text>TR_SCREENO_VIDEO_WEBCAMCAPABILITIES</Text>
|
||||
<Text>TR_SCREENOVIDEO_WEBCAMRESOLUTION</Text>
|
||||
<!--<Reflection> If exists:-->
|
||||
<!-- <Space>: Reflection Space-->
|
||||
<!-- <Height>: Reflection Height-->
|
||||
</Text7>
|
||||
</TextWebcamResolution>
|
||||
<ButtonExit>
|
||||
<!--<Skin>: Texture name-->
|
||||
<Skin>Button</Skin>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
ScreenOptionsTheme
|
||||
++++++++++
|
||||
Version 5:
|
||||
|
||||
Rename:
|
||||
Text5/6 to TextWebcam/TextWebcamResolution
|
||||
|
||||
++++++++++
|
||||
Version 4:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">DebugWin</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{5A4053F1-5AD5-441F-B254-D97A088127B6}</ProjectGuid>
|
||||
@@ -14,29 +14,7 @@
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -48,7 +26,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -59,7 +37,7 @@
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -70,7 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -81,42 +59,7 @@
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x86'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|AnyCPU'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">DebugWin</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{6F3E1874-F28A-40E9-AFBD-31934D593678}</ProjectGuid>
|
||||
@@ -14,29 +14,7 @@
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -48,7 +26,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -59,7 +37,7 @@
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -70,7 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -81,42 +59,7 @@
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x86'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|AnyCPU'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">DebugWin</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{6F3E1874-F28A-40E9-AFBD-31934D593679}</ProjectGuid>
|
||||
@@ -14,29 +14,7 @@
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -48,7 +26,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -59,7 +37,7 @@
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -70,7 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -81,42 +59,7 @@
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x86'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|AnyCPU'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/**********************************************************************
|
||||
|
||||
FFT.cpp
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
September 2000
|
||||
|
||||
*******************************************************************//*!
|
||||
|
||||
\file FFT.cpp
|
||||
\brief Fast Fourier Transform routines.
|
||||
|
||||
This file contains a few FFT routines, including a real-FFT
|
||||
routine that is almost twice as fast as a normal complex FFT,
|
||||
and a power spectrum routine when you know you don't care
|
||||
about phase information.
|
||||
|
||||
Some of this code was based on a free implementation of an FFT
|
||||
by Don Cross, available on the web at:
|
||||
|
||||
http://www.intersrv.com/~dcross/fft.html
|
||||
|
||||
The basic algorithm for his code was based on Numerican Recipes
|
||||
in Fortran. I optimized his code further by reducing array
|
||||
accesses, caching the bit reversal table, and eliminating
|
||||
float-to-double conversions, and I added the routines to
|
||||
calculate a real FFT and a real power spectrum.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "FFT.h"
|
||||
|
||||
#include "RealFFTf.h"
|
||||
|
||||
void DeinitFFT()
|
||||
{
|
||||
// Deallocate any unused RealFFTf tables
|
||||
CleanupFFT();
|
||||
}
|
||||
|
||||
/*
|
||||
* Real Fast Fourier Transform
|
||||
*
|
||||
*/
|
||||
void RealFFT(int NumSamples, float *RealIn, float *RealOut, float *ImagOut)
|
||||
{
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
// Copy the data into the processing buffer
|
||||
for(i=0; i<NumSamples; i++)
|
||||
pFFT[i] = RealIn[i];
|
||||
|
||||
// Perform the FFT
|
||||
RealFFTf(pFFT, hFFT);
|
||||
|
||||
// Copy the data into the real and imaginary outputs
|
||||
for(i=1;i<(NumSamples/2);i++) {
|
||||
RealOut[i]=pFFT[hFFT->BitReversed[i] ];
|
||||
ImagOut[i]=pFFT[hFFT->BitReversed[i]+1];
|
||||
}
|
||||
// Handle the (real-only) DC and Fs/2 bins
|
||||
RealOut[0] = pFFT[0];
|
||||
RealOut[i] = pFFT[1];
|
||||
ImagOut[0] = ImagOut[i] = 0;
|
||||
// Fill in the upper half using symmetry properties
|
||||
for(i++ ; i<NumSamples; i++) {
|
||||
RealOut[i] = RealOut[NumSamples-i];
|
||||
ImagOut[i] = -ImagOut[NumSamples-i];
|
||||
}
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
}
|
||||
|
||||
/*
|
||||
* InverseRealFFT
|
||||
*
|
||||
* This function computes the inverse of RealFFT, above.
|
||||
* The RealIn and ImagIn is assumed to be conjugate-symmetric
|
||||
* and as a result the output is purely real.
|
||||
* Only the first half of RealIn and ImagIn are used due to this
|
||||
* symmetry assumption.
|
||||
*/
|
||||
void InverseRealFFT(int NumSamples, float *RealIn, float *ImagIn, float *RealOut)
|
||||
{
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
// Copy the data into the processing buffer
|
||||
for(i=0; i<(NumSamples/2); i++)
|
||||
pFFT[2*i ] = RealIn[i];
|
||||
if(ImagIn == NULL) {
|
||||
for(i=0; i<(NumSamples/2); i++)
|
||||
pFFT[2*i+1] = 0;
|
||||
} else {
|
||||
for(i=0; i<(NumSamples/2); i++)
|
||||
pFFT[2*i+1] = ImagIn[i];
|
||||
}
|
||||
// Put the fs/2 component in the imaginary part of the DC bin
|
||||
pFFT[1] = RealIn[i];
|
||||
|
||||
// Perform the FFT
|
||||
InverseRealFFTf(pFFT, hFFT);
|
||||
|
||||
// Copy the data to the (purely real) output buffer
|
||||
ReorderToTime(hFFT, pFFT, RealOut);
|
||||
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
}
|
||||
|
||||
void RealInverseRealFFT(int NumSamples, float *In, float *Out){
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
// Copy the data into the processing buffer
|
||||
pFFT[0] = In[0];
|
||||
for(i=1; i<NumSamples/2; i++){
|
||||
pFFT[i] = In[i];
|
||||
pFFT[NumSamples - i] = In[i];
|
||||
}
|
||||
pFFT[NumSamples/2] = In[NumSamples/2];
|
||||
|
||||
// Perform the FFT
|
||||
RealFFTf(pFFT, hFFT);
|
||||
|
||||
// Copy the data into the output
|
||||
for(i=1;i<NumSamples/2;i++) {
|
||||
Out[i]=pFFT[hFFT->BitReversed[i]];
|
||||
}
|
||||
// Handle the (real-only) DC
|
||||
Out[0] = pFFT[0];
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
}
|
||||
|
||||
/*
|
||||
* PowerSpectrum
|
||||
*
|
||||
* This function computes the same as RealFFT, above, but
|
||||
* adds the squares of the real and imaginary part of each
|
||||
* coefficient, extracting the power and throwing away the
|
||||
* phase.
|
||||
*
|
||||
* For speed, it does not call RealFFT, but duplicates some
|
||||
* of its code.
|
||||
*/
|
||||
|
||||
void PowerSpectrum(int NumSamples, float *In, float *Out)
|
||||
{
|
||||
// Remap to RealFFTf() function
|
||||
int i;
|
||||
HFFT hFFT = GetFFT(NumSamples);
|
||||
float *pFFT = new float[NumSamples];
|
||||
// Copy the data into the processing buffer
|
||||
for(i=0; i<NumSamples; i++)
|
||||
pFFT[i] = In[i];
|
||||
|
||||
// Perform the FFT
|
||||
RealFFTf(pFFT, hFFT);
|
||||
|
||||
// Copy the data into the real and imaginary outputs
|
||||
for(i=1;i<NumSamples/2;i++) {
|
||||
Out[i]= (pFFT[hFFT->BitReversed[i] ]*pFFT[hFFT->BitReversed[i] ])
|
||||
+ (pFFT[hFFT->BitReversed[i]+1]*pFFT[hFFT->BitReversed[i]+1]);
|
||||
}
|
||||
// Handle the (real-only) DC and Fs/2 bins
|
||||
Out[0] = pFFT[0]*pFFT[0];
|
||||
Out[i] = pFFT[1]*pFFT[1];
|
||||
delete [] pFFT;
|
||||
ReleaseFFT(hFFT);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/**********************************************************************
|
||||
|
||||
FFT.h
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
September 2000
|
||||
|
||||
This file contains a few FFT routines, including a real-FFT
|
||||
routine that is almost twice as fast as a normal complex FFT,
|
||||
and a power spectrum routine which is more convenient when
|
||||
you know you don't care about phase information. It now also
|
||||
contains a few basic windowing functions.
|
||||
|
||||
Some of this code was based on a free implementation of an FFT
|
||||
by Don Cross, available on the web at:
|
||||
|
||||
http://www.intersrv.com/~dcross/fft.html
|
||||
|
||||
The basic algorithm for his code was based on Numerical Recipes
|
||||
in Fortran. I optimized his code further by reducing array
|
||||
accesses, caching the bit reversal table, and eliminating
|
||||
float-to-double conversions, and I added the routines to
|
||||
calculate a real FFT and a real power spectrum.
|
||||
|
||||
Note: all of these routines use single-precision floats.
|
||||
I have found that in practice, floats work well until you
|
||||
get above 8192 samples. If you need to do a larger FFT,
|
||||
you need to use doubles.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
* This is the function you will use the most often.
|
||||
* Given an array of floats, this will compute the power
|
||||
* spectrum by doing a Real FFT and then computing the
|
||||
* sum of the squares of the real and imaginary parts.
|
||||
* Note that the output array is half the length of the
|
||||
* input array, and that NumSamples must be a power of two.
|
||||
*/
|
||||
|
||||
void PowerSpectrum(int NumSamples, float *In, float *Out);
|
||||
|
||||
/*
|
||||
* Computes an FFT when the input data is real but you still
|
||||
* want complex data as output. The output arrays are the
|
||||
* same length as the input, but will be conjugate-symmetric
|
||||
* NumSamples must be a power of two.
|
||||
*/
|
||||
|
||||
void RealFFT(int NumSamples,
|
||||
float *RealIn, float *RealOut, float *ImagOut);
|
||||
|
||||
/*
|
||||
* Computes an Inverse FFT when the input data is conjugate symmetric
|
||||
* so the output is purely real. NumSamples must be a power of
|
||||
* two.
|
||||
* Requires: EXPERIMENTAL_USE_REALFFTF
|
||||
*/
|
||||
void InverseRealFFT(int NumSamples,
|
||||
float *RealIn, float *ImagIn, float *RealOut);
|
||||
|
||||
void RealInverseRealFFT(int NumSamples, float *In, float *Out);
|
||||
|
||||
void DeinitFFT();
|
||||
@@ -0,0 +1,299 @@
|
||||
Code in this folder is based on Code from Audacity.
|
||||
License of that code is below:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Note: Audacity is distributed under the terms of the GNU GPL.
|
||||
This includes everything in the source code distribution
|
||||
except code in the lib-src directory. Code in the lib-src
|
||||
directory may be released under a different license
|
||||
(which is GPL-compatible). For a summary, see the
|
||||
README.txt file, and for specific details, see the license
|
||||
information inside each subdirectory of lib-src.
|
||||
|
||||
Documentation is distributed under the Creative Commons license.
|
||||
Please see here for that:
|
||||
http://creativecommons.org/licenses/by/3.0/legalcode
|
||||
|
||||
The full text of the GNU GPL follows:
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* Program: REALFFTF.C
|
||||
* Author: Philip Van Baren
|
||||
* Date: 2 September 1993
|
||||
*
|
||||
* Description: These routines perform an FFT on real data to get a conjugate-symmetric
|
||||
* output, and an inverse FFT on conjugate-symmetric input to get a real
|
||||
* output sequence.
|
||||
*
|
||||
* This code is for floating point data.
|
||||
*
|
||||
* Modified 8/19/1998 by Philip Van Baren
|
||||
* - made the InitializeFFT and EndFFT routines take a structure
|
||||
* holding the length and pointers to the BitReversed and SinTable
|
||||
* tables.
|
||||
* Modified 5/23/2009 by Philip Van Baren
|
||||
* - Added GetFFT and ReleaseFFT routines to retain common SinTable
|
||||
* and BitReversed tables so they don't need to be reallocated
|
||||
* and recomputed on every call.
|
||||
* - Added Reorder* functions to undo the bit-reversal
|
||||
*
|
||||
* Copyright (C) 2009 Philip VanBaren
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "RealFFTf.h"
|
||||
#ifdef EXPERIMENTAL_EQ_SSE_THREADED
|
||||
#include "RealFFTf48x.h"
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 /* pi */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the Sine table and Twiddle pointers (bit-reversed pointers)
|
||||
* for the FFT routine.
|
||||
*/
|
||||
HFFT InitializeFFT(int fftlen)
|
||||
{
|
||||
int i;
|
||||
int temp;
|
||||
int mask;
|
||||
HFFT h;
|
||||
|
||||
if((h=(HFFT)malloc(sizeof(FFTParam)))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Error allocating memory for FFT\n");
|
||||
exit(8);
|
||||
}
|
||||
/*
|
||||
* FFT size is only half the number of data points
|
||||
* The full FFT output can be reconstructed from this FFT's output.
|
||||
* (This optimization can be made since the data is real.)
|
||||
*/
|
||||
h->Points = fftlen/2;
|
||||
|
||||
if((h->SinTable=(fft_type *)malloc(2*h->Points*sizeof(fft_type)))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Error allocating memory for Sine table.\n");
|
||||
exit(8);
|
||||
}
|
||||
|
||||
if((h->BitReversed=(int *)malloc(h->Points*sizeof(int)))==NULL)
|
||||
{
|
||||
fprintf(stderr,"Error allocating memory for BitReversed.\n");
|
||||
exit(8);
|
||||
}
|
||||
|
||||
for(i=0;i<h->Points;i++)
|
||||
{
|
||||
temp=0;
|
||||
for(mask=h->Points/2;mask>0;mask >>= 1)
|
||||
temp=(temp >> 1) + (i&mask ? h->Points : 0);
|
||||
|
||||
h->BitReversed[i]=temp;
|
||||
}
|
||||
|
||||
for(i=0;i<h->Points;i++)
|
||||
{
|
||||
h->SinTable[h->BitReversed[i] ]=(fft_type)-sin(2*M_PI*i/(2*h->Points));
|
||||
h->SinTable[h->BitReversed[i]+1]=(fft_type)-cos(2*M_PI*i/(2*h->Points));
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free up the memory allotted for Sin table and Twiddle Pointers
|
||||
*/
|
||||
void EndFFT(HFFT h)
|
||||
{
|
||||
if(h->Points>0) {
|
||||
free(h->BitReversed);
|
||||
free(h->SinTable);
|
||||
}
|
||||
h->Points=0;
|
||||
free(h);
|
||||
}
|
||||
|
||||
#define MAX_HFFT 10
|
||||
static HFFT hFFTArray[MAX_HFFT] = { NULL };
|
||||
static int nFFTLockCount[MAX_HFFT] = { 0 };
|
||||
|
||||
/* Get a handle to the FFT tables of the desired length */
|
||||
/* This version keeps common tables rather than allocating a new table every time */
|
||||
HFFT GetFFT(int fftlen)
|
||||
{
|
||||
int h,n = fftlen/2;
|
||||
for(h=0; (h<MAX_HFFT) && (hFFTArray[h] != NULL) && (n != hFFTArray[h]->Points); h++);
|
||||
if(h<MAX_HFFT) {
|
||||
if(hFFTArray[h] == NULL) {
|
||||
hFFTArray[h] = InitializeFFT(fftlen);
|
||||
nFFTLockCount[h] = 0;
|
||||
}
|
||||
nFFTLockCount[h]++;
|
||||
return hFFTArray[h];
|
||||
} else {
|
||||
// All buffers used, so fall back to allocating a new set of tables
|
||||
return InitializeFFT(fftlen);;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release a previously requested handle to the FFT tables */
|
||||
void ReleaseFFT(HFFT hFFT)
|
||||
{
|
||||
int h;
|
||||
for(h=0; (h<MAX_HFFT) && (hFFTArray[h] != hFFT); h++);
|
||||
if(h<MAX_HFFT) {
|
||||
nFFTLockCount[h]--;
|
||||
} else {
|
||||
EndFFT(hFFT);
|
||||
}
|
||||
}
|
||||
|
||||
/* Deallocate any unused FFT tables */
|
||||
void CleanupFFT()
|
||||
{
|
||||
int h;
|
||||
for(h=0; (h<MAX_HFFT); h++) {
|
||||
if((nFFTLockCount[h] <= 0) && (hFFTArray[h] != NULL)) {
|
||||
EndFFT(hFFTArray[h]);
|
||||
hFFTArray[h] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Forward FFT routine. Must call InitializeFFT(fftlen) first!
|
||||
*
|
||||
* Note: Output is BIT-REVERSED! so you must use the BitReversed to
|
||||
* get legible output, (i.e. Real_i = buffer[ h->BitReversed[i] ]
|
||||
* Imag_i = buffer[ h->BitReversed[i]+1 ] )
|
||||
* Input is in normal order.
|
||||
*
|
||||
* Output buffer[0] is the DC bin, and output buffer[1] is the Fs/2 bin
|
||||
* - this can be done because both values will always be real only
|
||||
* - this allows us to not have to allocate an extra complex value for the Fs/2 bin
|
||||
*
|
||||
* Note: The scaling on this is done according to the standard FFT definition,
|
||||
* so a unit amplitude DC signal will output an amplitude of (N)
|
||||
* (Older revisions would progressively scale the input, so the output
|
||||
* values would be similar in amplitude to the input values, which is
|
||||
* good when using fixed point arithmetic)
|
||||
*/
|
||||
void RealFFTf(fft_type *buffer,HFFT h)
|
||||
{
|
||||
fft_type *A,*B;
|
||||
fft_type *sptr;
|
||||
fft_type *endptr1,*endptr2;
|
||||
int *br1,*br2;
|
||||
fft_type HRplus,HRminus,HIplus,HIminus;
|
||||
fft_type v1,v2,sin,cos;
|
||||
|
||||
int ButterfliesPerGroup=h->Points/2;
|
||||
|
||||
/*
|
||||
* Butterfly:
|
||||
* Ain-----Aout
|
||||
* \ /
|
||||
* / \
|
||||
* Bin-----Bout
|
||||
*/
|
||||
|
||||
endptr1=buffer+h->Points*2;
|
||||
|
||||
while(ButterfliesPerGroup>0)
|
||||
{
|
||||
A=buffer;
|
||||
B=buffer+ButterfliesPerGroup*2;
|
||||
sptr=h->SinTable;
|
||||
|
||||
while(A<endptr1)
|
||||
{
|
||||
sin=*sptr;
|
||||
cos=*(sptr+1);
|
||||
endptr2=B;
|
||||
while(A<endptr2)
|
||||
{
|
||||
v1=*B*cos + *(B+1)*sin;
|
||||
v2=*B*sin - *(B+1)*cos;
|
||||
*B=(*A+v1);
|
||||
*(A++)=*(B++)-2*v1;
|
||||
*B=(*A-v2);
|
||||
*(A++)=*(B++)+2*v2;
|
||||
}
|
||||
A=B;
|
||||
B+=ButterfliesPerGroup*2;
|
||||
sptr+=2;
|
||||
}
|
||||
ButterfliesPerGroup >>= 1;
|
||||
}
|
||||
/* Massage output to get the output for a real input sequence. */
|
||||
br1=h->BitReversed+1;
|
||||
br2=h->BitReversed+h->Points-1;
|
||||
|
||||
while(br1<br2)
|
||||
{
|
||||
sin=h->SinTable[*br1];
|
||||
cos=h->SinTable[*br1+1];
|
||||
A=buffer+*br1;
|
||||
B=buffer+*br2;
|
||||
HRplus = (HRminus = *A - *B ) + (*B * 2);
|
||||
HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2);
|
||||
v1 = (sin*HRminus - cos*HIplus);
|
||||
v2 = (cos*HRminus + sin*HIplus);
|
||||
*A = (HRplus + v1) * (fft_type)0.5;
|
||||
*B = *A - v1;
|
||||
*(A+1) = (HIminus + v2) * (fft_type)0.5;
|
||||
*(B+1) = *(A+1) - HIminus;
|
||||
|
||||
br1++;
|
||||
br2--;
|
||||
}
|
||||
/* Handle the center bin (just need a conjugate) */
|
||||
A=buffer+*br1+1;
|
||||
*A=-*A;
|
||||
/* Handle DC bin separately - and ignore the Fs/2 bin
|
||||
buffer[0]+=buffer[1];
|
||||
buffer[1]=(fft_type)0;*/
|
||||
/* Handle DC and Fs/2 bins separately */
|
||||
/* Put the Fs/2 value into the imaginary part of the DC bin */
|
||||
v1=buffer[0]-buffer[1];
|
||||
buffer[0]+=buffer[1];
|
||||
buffer[1]=v1;
|
||||
}
|
||||
|
||||
|
||||
/* Description: This routine performs an inverse FFT to real data.
|
||||
* This code is for floating point data.
|
||||
*
|
||||
* Note: Output is BIT-REVERSED! so you must use the BitReversed to
|
||||
* get legible output, (i.e. wave[2*i] = buffer[ BitReversed[i] ]
|
||||
* wave[2*i+1] = buffer[ BitReversed[i]+1 ] )
|
||||
* Input is in normal order, interleaved (real,imaginary) complex data
|
||||
* You must call InitializeFFT(fftlen) first to initialize some buffers!
|
||||
*
|
||||
* Input buffer[0] is the DC bin, and input buffer[1] is the Fs/2 bin
|
||||
* - this can be done because both values will always be real only
|
||||
* - this allows us to not have to allocate an extra complex value for the Fs/2 bin
|
||||
*
|
||||
* Note: The scaling on this is done according to the standard FFT definition,
|
||||
* so a unit amplitude DC signal will output an amplitude of (N)
|
||||
* (Older revisions would progressively scale the input, so the output
|
||||
* values would be similar in amplitude to the input values, which is
|
||||
* good when using fixed point arithmetic)
|
||||
*/
|
||||
void InverseRealFFTf(fft_type *buffer,HFFT h)
|
||||
{
|
||||
fft_type *A,*B;
|
||||
fft_type *sptr;
|
||||
fft_type *endptr1,*endptr2;
|
||||
int *br1;
|
||||
fft_type HRplus,HRminus,HIplus,HIminus;
|
||||
fft_type v1,v2,sin,cos;
|
||||
|
||||
int ButterfliesPerGroup=h->Points/2;
|
||||
|
||||
/* Massage input to get the input for a real output sequence. */
|
||||
A=buffer+2;
|
||||
B=buffer+h->Points*2-2;
|
||||
br1=h->BitReversed+1;
|
||||
while(A<B)
|
||||
{
|
||||
sin=h->SinTable[*br1];
|
||||
cos=h->SinTable[*br1+1];
|
||||
HRplus = (HRminus = *A - *B ) + (*B * 2);
|
||||
HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2);
|
||||
v1 = (sin*HRminus + cos*HIplus);
|
||||
v2 = (cos*HRminus - sin*HIplus);
|
||||
*A = (HRplus + v1) * (fft_type)0.5;
|
||||
*B = *A - v1;
|
||||
*(A+1) = (HIminus - v2) * (fft_type)0.5;
|
||||
*(B+1) = *(A+1) - HIminus;
|
||||
|
||||
A+=2;
|
||||
B-=2;
|
||||
br1++;
|
||||
}
|
||||
/* Handle center bin (just need conjugate) */
|
||||
*(A+1)=-*(A+1);
|
||||
/* Handle DC bin separately - this ignores any Fs/2 component
|
||||
buffer[1]=buffer[0]=buffer[0]/2;*/
|
||||
/* Handle DC and Fs/2 bins specially */
|
||||
/* The DC bin is passed in as the real part of the DC complex value */
|
||||
/* The Fs/2 bin is passed in as the imaginary part of the DC complex value */
|
||||
/* (v1+v2) = buffer[0] == the DC component */
|
||||
/* (v1-v2) = buffer[1] == the Fs/2 component */
|
||||
v1=0.5f*(buffer[0]+buffer[1]);
|
||||
v2=0.5f*(buffer[0]-buffer[1]);
|
||||
buffer[0]=v1;
|
||||
buffer[1]=v2;
|
||||
|
||||
/*
|
||||
* Butterfly:
|
||||
* Ain-----Aout
|
||||
* \ /
|
||||
* / \
|
||||
* Bin-----Bout
|
||||
*/
|
||||
|
||||
endptr1=buffer+h->Points*2;
|
||||
|
||||
while(ButterfliesPerGroup>0)
|
||||
{
|
||||
A=buffer;
|
||||
B=buffer+ButterfliesPerGroup*2;
|
||||
sptr=h->SinTable;
|
||||
|
||||
while(A<endptr1)
|
||||
{
|
||||
sin=*(sptr++);
|
||||
cos=*(sptr++);
|
||||
endptr2=B;
|
||||
while(A<endptr2)
|
||||
{
|
||||
v1=*B*cos - *(B+1)*sin;
|
||||
v2=*B*sin + *(B+1)*cos;
|
||||
*B=(*A+v1)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v1;
|
||||
*B=(*A+v2)*(fft_type)0.5;
|
||||
*(A++)=*(B++)-v2;
|
||||
}
|
||||
A=B;
|
||||
B+=ButterfliesPerGroup*2;
|
||||
}
|
||||
ButterfliesPerGroup >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut)
|
||||
{
|
||||
// Copy the data into the real and imaginary outputs
|
||||
for(int i=1;i<hFFT->Points;i++) {
|
||||
RealOut[i]=buffer[hFFT->BitReversed[i] ];
|
||||
ImagOut[i]=buffer[hFFT->BitReversed[i]+1];
|
||||
}
|
||||
RealOut[0] = buffer[0]; // DC component
|
||||
ImagOut[0] = 0;
|
||||
RealOut[hFFT->Points] = buffer[1]; // Fs/2 component
|
||||
ImagOut[hFFT->Points] = 0;
|
||||
}
|
||||
|
||||
void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut)
|
||||
{
|
||||
// Copy the data into the real outputs
|
||||
for(int i=0;i<hFFT->Points;i++) {
|
||||
TimeOut[i*2 ]=buffer[hFFT->BitReversed[i] ];
|
||||
TimeOut[i*2+1]=buffer[hFFT->BitReversed[i]+1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef __realfftf_h
|
||||
#define __realfftf_h
|
||||
|
||||
#define fft_type float
|
||||
typedef struct FFTParamType {
|
||||
int *BitReversed;
|
||||
fft_type *SinTable;
|
||||
int Points;
|
||||
} FFTParam;
|
||||
#define HFFT FFTParam *
|
||||
|
||||
HFFT InitializeFFT(int);
|
||||
void EndFFT(HFFT);
|
||||
HFFT GetFFT(int);
|
||||
void ReleaseFFT(HFFT);
|
||||
void CleanupFFT();
|
||||
void RealFFTf(fft_type *,HFFT);
|
||||
void InverseRealFFTf(fft_type *,HFFT);
|
||||
void ReorderToTime(HFFT hFFT, fft_type *buffer, fft_type *TimeOut);
|
||||
void ReorderToFreq(HFFT hFFT, fft_type *buffer, fft_type *RealOut, fft_type *ImagOut);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -174,6 +174,8 @@
|
||||
<ClCompile Include="compatibility.cpp" />
|
||||
<ClCompile Include="dywapitchtrack\dywapitchtrack.cpp" />
|
||||
<ClCompile Include="dywapitchtrack\ptDyWa.cpp" />
|
||||
<ClCompile Include="FFT\FFT.cpp" />
|
||||
<ClCompile Include="FFT\RealFFTf.cpp" />
|
||||
<ClCompile Include="Helper.cpp" />
|
||||
<ClCompile Include="performous\pitch.cc" />
|
||||
<ClCompile Include="ptAKF.cpp" />
|
||||
@@ -183,6 +185,8 @@
|
||||
<ClInclude Include="compatibility.h" />
|
||||
<ClInclude Include="dywapitchtrack\dywapitchtrack.h" />
|
||||
<ClInclude Include="dywapitchtrack\ptDyWa.h" />
|
||||
<ClInclude Include="FFT\FFT.h" />
|
||||
<ClInclude Include="FFT\RealFFTf.h" />
|
||||
<ClInclude Include="Helper.h" />
|
||||
<ClInclude Include="performous\libda\fft.hpp" />
|
||||
<ClInclude Include="performous\libda\sample.hpp" />
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
<Filter Include="Headerdateien\dywapitchtrack">
|
||||
<UniqueIdentifier>{2a09cee1-51b7-4c24-aa9f-32bec53c3a36}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Quelldateien\FFT">
|
||||
<UniqueIdentifier>{498f64e2-ff83-41fd-be25-c613750f0e34}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Headerdateien\FFT">
|
||||
<UniqueIdentifier>{0791b62f-ef8d-40e2-b67e-a6d9dead8720}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="PitchWrapper.cpp">
|
||||
@@ -51,6 +57,12 @@
|
||||
<ClCompile Include="Helper.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FFT\FFT.cpp">
|
||||
<Filter>Quelldateien\FFT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FFT\RealFFTf.cpp">
|
||||
<Filter>Quelldateien\FFT</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="compatibility.h">
|
||||
@@ -77,6 +89,12 @@
|
||||
<ClInclude Include="dywapitchtrack\ptDyWa.h">
|
||||
<Filter>Headerdateien\dywapitchtrack</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FFT\FFT.h">
|
||||
<Filter>Headerdateien\FFT</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FFT\RealFFTf.h">
|
||||
<Filter>Headerdateien\FFT</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="performous\pitch.hh">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include "../compatibility.h"
|
||||
|
||||
/**
|
||||
* @file sample.hpp Sample format definition and format conversions.
|
||||
|
||||
+26
-5
@@ -17,8 +17,13 @@
|
||||
#include "ptAKF.h"
|
||||
#include <cmath>
|
||||
|
||||
#ifdef USE_FFT
|
||||
#include "FFT/FFT.h"
|
||||
#endif
|
||||
|
||||
static constexpr double BaseToneFrequency = 65.4064; // lowest (half-)tone to analyze (C2 = 65.4064 Hz)
|
||||
static constexpr double HalftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave)
|
||||
|
||||
int PtAKF::_InitCount = 0;
|
||||
float* restrict PtAKF::_SamplesPerPeriodPerTone = NULL;
|
||||
float* restrict PtAKF::_SamplesPerPeriodPerToneFine = NULL;
|
||||
@@ -41,9 +46,9 @@ PtAKF::PtAKF(unsigned step){
|
||||
_SamplesPerPeriodPerToneFine[2 * toneIndex + 1] = static_cast<float>(44100.0 / GetFrequencyFromTone(toneIndex + 1./3.)); // samples for a bit above exact frequency
|
||||
}
|
||||
_Window = new float[_SampleCt];
|
||||
double cosMult = 2. * M_PI / (_SampleCt - 1.); //To simplify and speed up
|
||||
double cosMult = 2. * M_PI / (2 * _SampleCt - 1.); //To simplify and speed up; 2 * _SampleCt because we extend the data by a factor of 2
|
||||
for (int i = 0; i < _SampleCt; i++) {
|
||||
_Window[i] = static_cast<float>(0.64 - 0.36 * cos(i * cosMult));
|
||||
_Window[i] = static_cast<float>(0.54 - 0.46 * cos(i * cosMult));
|
||||
}
|
||||
}
|
||||
_Step = step;
|
||||
@@ -71,7 +76,6 @@ void PtAKF::SetVolumeThreshold(float threshold){
|
||||
int PtAKF::GetNote(float* restrict maxVolume, float* restrict weights){
|
||||
float AnaylsisBuf[_SampleCt];
|
||||
int note = _LastTones[_LastToneIndex];
|
||||
*maxVolume = _LastMaxVol * 0.85f;
|
||||
if(_AnalysisBuf.read(AnaylsisBuf, AnaylsisBuf + _SampleCt)){
|
||||
do{
|
||||
_AnalysisBuf.pop(_Step);
|
||||
@@ -81,6 +85,9 @@ int PtAKF::GetNote(float* restrict maxVolume, float* restrict weights){
|
||||
_LastTones[_LastToneIndex] = note;
|
||||
}while(_AnalysisBuf.read(AnaylsisBuf, AnaylsisBuf + _SampleCt));
|
||||
note = _GetSmoothTone();
|
||||
_LastMaxVol = *maxVolume;
|
||||
}else{
|
||||
*maxVolume = _LastMaxVol * 0.85f;
|
||||
}
|
||||
return note;
|
||||
}
|
||||
@@ -149,12 +156,20 @@ int PtAKF::_GetNote(float samples[_SampleCt], float* restrict maxVolume, float w
|
||||
if(maxVolumeL < _VolTreshold)
|
||||
return -1;
|
||||
|
||||
float samplesWindowed[_SampleCt];
|
||||
float samplesWindowed[_SampleCt * 2];
|
||||
|
||||
for(int i = 0; i < _SampleCt; i++){
|
||||
samplesWindowed[i] = samples[i] * _Window[i];
|
||||
}
|
||||
|
||||
#ifdef USE_FFT
|
||||
for(int i = _SampleCt; i < _SampleCt * 2; i++){
|
||||
samplesWindowed[i] = 0.f;
|
||||
}
|
||||
float samplesFFT[_SampleCt+1]; // +1 for middle value!
|
||||
PowerSpectrum(_SampleCt*2, samplesWindowed, samplesFFT);
|
||||
RealInverseRealFFT(_SampleCt*2, samplesFFT, _AKFValues);
|
||||
#endif
|
||||
// Now analyze the samples and get peaks at the most appropriate tones
|
||||
|
||||
//Attention: We have a peak at lag 0 that might stretch that far, that we detect a wrong "peak" at _MaxHalfTone
|
||||
@@ -163,6 +178,7 @@ int PtAKF::_GetNote(float samples[_SampleCt], float* restrict maxVolume, float w
|
||||
float lastWeight = 1.f;
|
||||
float maxWeight = 0.f;
|
||||
|
||||
//TODO: When using FFT this can be speed up a lot by only checking around the AKF peaks
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (int toneIndex = 0; toneIndex <= _MaxHalfTone; toneIndex++){
|
||||
float curWeight = _AnalyzeByTone(samples, samplesWindowed, toneIndex);
|
||||
@@ -307,6 +323,10 @@ float PtAKF::_AKFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD){
|
||||
int samplesPerPeriod = static_cast<int>(samplesPerPeriodD);
|
||||
float fHigh = samplesPerPeriodD - samplesPerPeriod;
|
||||
float fLow = 1.0f - fHigh;
|
||||
#ifdef USE_FFT
|
||||
float akf2 = _AKFValues[samplesPerPeriod] * fLow + _AKFValues[samplesPerPeriod+1] * fHigh;
|
||||
return akf2 / (_SampleCt * _SampleCt);
|
||||
#else
|
||||
|
||||
float accumDist = 0; // accumulated distances
|
||||
|
||||
@@ -322,10 +342,11 @@ float PtAKF::_AKFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD){
|
||||
}
|
||||
|
||||
return accumDist / _SampleCt;
|
||||
#endif
|
||||
}
|
||||
|
||||
float PtAKF::_AMDFByTone(float samples[_SampleCt], int toneIndex){
|
||||
return _AKFBySampleCt(samples, _SamplesPerPeriodPerTone[toneIndex]);
|
||||
return _AMDFBySampleCt(samples, _SamplesPerPeriodPerTone[toneIndex]);
|
||||
}
|
||||
|
||||
float PtAKF::_AMDFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD){
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define USE_FFT
|
||||
|
||||
struct SPeak{
|
||||
int toneIndex;
|
||||
float weight;
|
||||
@@ -55,14 +57,17 @@ private:
|
||||
float _LastMaxVol;
|
||||
int _LastTones[_SmoothCt];
|
||||
int _LastToneIndex;
|
||||
#ifdef USE_FFT
|
||||
float _AKFValues[_SampleCt*2];
|
||||
#endif
|
||||
|
||||
int _GetNote(float samples[_SampleCt], float* restrict maxVolume, float weights[_MaxHalfTone+1]);
|
||||
int _GetSmoothTone();
|
||||
|
||||
static float _AnalyzeBySampleCt(float samples[_SampleCt], float samplesWindowed[_SampleCt], float samplesPerPeriodD);
|
||||
static inline float _AnalyzeByTone(float samples[_SampleCt], float samplesWindowed[_SampleCt], int toneIndex);
|
||||
static float _AKFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD);
|
||||
static inline float _AKFByTone(float samples[_SampleCt], int toneIndex);
|
||||
float _AnalyzeBySampleCt(float samples[_SampleCt], float samplesWindowed[_SampleCt], float samplesPerPeriodD);
|
||||
inline float _AnalyzeByTone(float samples[_SampleCt], float samplesWindowed[_SampleCt], int toneIndex);
|
||||
float _AKFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD);
|
||||
inline float _AKFByTone(float samples[_SampleCt], int toneIndex);
|
||||
static float _AMDFBySampleCt(float samples[_SampleCt], float samplesPerPeriodD);
|
||||
static inline float _AMDFByTone(float samples[_SampleCt], int toneIndex);
|
||||
static inline void InitPeaks(SPeak peaks[_MaxPeaks]);
|
||||
|
||||
+85
-84
@@ -62,88 +62,89 @@ Global
|
||||
{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x64.ActiveCfg = DebugLinux|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x64.Build.0 = DebugLinux|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x86.ActiveCfg = DebugLinux|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x86.Build.0 = DebugLinux|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x64.ActiveCfg = DebugWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x64.Build.0 = DebugWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x86.ActiveCfg = DebugWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x86.Build.0 = DebugWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x64.ActiveCfg = InstallerWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x64.Build.0 = InstallerWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x86.ActiveCfg = InstallerWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x86.Build.0 = InstallerWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x64.ActiveCfg = DebugLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x64.Build.0 = DebugLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x86.ActiveCfg = DebugLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x86.Build.0 = DebugLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x64.ActiveCfg = DebugWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x64.Build.0 = DebugWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x86.ActiveCfg = DebugWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x86.Build.0 = DebugWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x64.ActiveCfg = InstallerWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x64.Build.0 = InstallerWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x86.ActiveCfg = InstallerWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x86.Build.0 = InstallerWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x64.ActiveCfg = DebugLinux|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x64.Build.0 = DebugLinux|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x86.ActiveCfg = DebugLinux|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x86.Build.0 = DebugLinux|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x64.ActiveCfg = DebugWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x64.Build.0 = DebugWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x86.ActiveCfg = DebugWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x86.Build.0 = DebugWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x64.Build.0 = ReleaseWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x86.Build.0 = ReleaseWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x64.ActiveCfg = DebugLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x64.Build.0 = DebugLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x86.ActiveCfg = DebugLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x86.Build.0 = DebugLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x64.ActiveCfg = DebugWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x64.Build.0 = DebugWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x86.ActiveCfg = DebugWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x86.Build.0 = DebugWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x64.Build.0 = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x86.Build.0 = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x64.Build.0 = DebugLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x86.ActiveCfg = DebugLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugLinux|x86.Build.0 = DebugLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x64.ActiveCfg = DebugWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x64.Build.0 = DebugWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x86.ActiveCfg = DebugWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.DebugWin|x86.Build.0 = DebugWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x64.ActiveCfg = InstallerWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x64.Build.0 = InstallerWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x86.ActiveCfg = InstallerWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.InstallerWin|x86.Build.0 = InstallerWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseLinux|x86.Build.0 = ReleaseLinux|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x64.ActiveCfg = ReleaseWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x64.Build.0 = ReleaseWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Any CPU
|
||||
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}.ReleaseWin|x86.Build.0 = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x64.Build.0 = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x86.ActiveCfg = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugLinux|x86.Build.0 = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x64.ActiveCfg = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x64.Build.0 = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x86.ActiveCfg = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.DebugWin|x86.Build.0 = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x64.ActiveCfg = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x64.Build.0 = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x86.ActiveCfg = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.InstallerWin|x86.Build.0 = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseLinux|x86.Build.0 = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x64.ActiveCfg = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x64.Build.0 = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593679}.ReleaseWin|x86.Build.0 = ReleaseWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x64.Build.0 = DebugLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x86.ActiveCfg = DebugLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugLinux|x86.Build.0 = DebugLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x64.ActiveCfg = DebugWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x64.Build.0 = DebugWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x86.ActiveCfg = DebugWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.DebugWin|x86.Build.0 = DebugWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x64.ActiveCfg = InstallerWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x64.Build.0 = InstallerWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x86.ActiveCfg = InstallerWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.InstallerWin|x86.Build.0 = InstallerWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseLinux|x86.Build.0 = ReleaseLinux|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x64.ActiveCfg = ReleaseWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x64.Build.0 = ReleaseWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Any CPU
|
||||
{5A4053F1-5AD5-441F-B254-D97A088127B6}.ReleaseWin|x86.Build.0 = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x64.Build.0 = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x86.ActiveCfg = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugLinux|x86.Build.0 = DebugLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x64.ActiveCfg = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x64.Build.0 = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x86.ActiveCfg = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.DebugWin|x86.Build.0 = DebugWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x64.ActiveCfg = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x64.Build.0 = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x86.ActiveCfg = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.InstallerWin|x86.Build.0 = InstallerWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseLinux|x86.Build.0 = ReleaseLinux|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x64.ActiveCfg = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x64.Build.0 = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Any CPU
|
||||
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.Build.0 = ReleaseWin|Any CPU
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x64.ActiveCfg = DebugWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x86.ActiveCfg = DebugWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x86.ActiveCfg = DebugWin|Win32
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x86.Build.0 = DebugWin|Win32
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugWin|x64.ActiveCfg = DebugWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugWin|x64.Build.0 = DebugWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugWin|x86.ActiveCfg = DebugWin|Win32
|
||||
@@ -153,7 +154,7 @@ Global
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.InstallerWin|x86.ActiveCfg = ReleaseWin|Win32
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.InstallerWin|x86.Build.0 = ReleaseWin|Win32
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x64.ActiveCfg = ReleaseWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x86.ActiveCfg = ReleaseWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x86.ActiveCfg = ReleaseWin|Win32
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseWin|x64.ActiveCfg = ReleaseWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseWin|x64.Build.0 = ReleaseWin|x64
|
||||
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseWin|x86.ActiveCfg = ReleaseWin|Win32
|
||||
@@ -168,8 +169,8 @@ Global
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.DebugWin|x86.Build.0 = DebugWin|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x64.ActiveCfg = ReleaseWin|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x64.Build.0 = ReleaseWin|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x86.Build.0 = ReleaseLinux|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x86.ActiveCfg = ReleaseWin|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.InstallerWin|x86.Build.0 = ReleaseWin|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU
|
||||
{EC5167E4-CCFB-4CEE-987C-CF816F1062A3}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|Any CPU
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
|
||||
|
||||
@@ -128,8 +128,8 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the background music with values from config
|
||||
/// Has to be called before any other method is used
|
||||
/// Initializes the background music with values from config
|
||||
/// Has to be called before any other method is used
|
||||
/// </summary>
|
||||
public static void Init()
|
||||
{
|
||||
@@ -320,7 +320,7 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (Re-)Starts the _CurrentPlaylistElement
|
||||
/// (Re-)Starts the _CurrentPlaylistElement
|
||||
/// </summary>
|
||||
private static void _StartSong()
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Vocaluxe.Base
|
||||
public static int GameMusicVolume = 80;
|
||||
|
||||
//Folders
|
||||
public static readonly List<string> SongFolders = new List<string>()
|
||||
public static readonly List<string> SongFolders = new List<string>
|
||||
{
|
||||
Path.Combine(Directory.GetCurrentDirectory(), _FolderSongs)
|
||||
|
||||
@@ -115,8 +115,8 @@ namespace Vocaluxe.Base
|
||||
#endif
|
||||
};
|
||||
/// <summary>
|
||||
/// Folders with profiles
|
||||
/// First one is used for new profiles
|
||||
/// Folders with profiles
|
||||
/// First one is used for new profiles
|
||||
/// </summary>
|
||||
public static readonly List<string> ProfileFolders = new List<string>
|
||||
{
|
||||
|
||||
@@ -214,8 +214,8 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ads a cover with the given name if it does not exist yet
|
||||
/// MUST HOLD _Covers lock at this point
|
||||
/// Ads a cover with the given name if it does not exist yet
|
||||
/// MUST HOLD _Covers lock at this point
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the cover</param>
|
||||
/// <param name="file">Filename of image file</param>
|
||||
|
||||
@@ -29,6 +29,7 @@ using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Songs;
|
||||
#if WIN
|
||||
using System.Data.SQLite;
|
||||
|
||||
#else
|
||||
using Mono.Data.Sqlite;
|
||||
using SQLiteConnection = Mono.Data.Sqlite.SqliteConnection;
|
||||
@@ -1181,7 +1182,7 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// You have to hold the CoverMutex when calling this!
|
||||
/// You have to hold the CoverMutex when calling this!
|
||||
/// </summary>
|
||||
private static void _CommitCovers()
|
||||
{
|
||||
|
||||
@@ -223,8 +223,8 @@ namespace Vocaluxe.Base
|
||||
foreach (string file in files)
|
||||
{
|
||||
SPartyMode pm = _LoadPartyMode(file);
|
||||
if(pm.NoErrors)
|
||||
_PartyModes.Add(pm.PartyModeID, pm);
|
||||
if (pm.NoErrors)
|
||||
_PartyModes.Add(pm.PartyModeID, pm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System.Collections.ObjectModel;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using Vocaluxe.Lib.Sound.Record;
|
||||
using Vocaluxe.Lib.Sound.Record.DirectSound;
|
||||
using Vocaluxe.Lib.Sound.Record.PortAudio;
|
||||
@@ -79,6 +96,16 @@ namespace Vocaluxe.Base
|
||||
return _Record.GetMaxVolume(player);
|
||||
}
|
||||
|
||||
public static float GetVolumeThreshold(int player)
|
||||
{
|
||||
return _Record.GetVolumeThreshold(player);
|
||||
}
|
||||
|
||||
public static void SetVolumeThreshold(int player, float threshold)
|
||||
{
|
||||
_Record.SetVolumeThreshold(player, threshold);
|
||||
}
|
||||
|
||||
public static int NumHalfTones(int player)
|
||||
{
|
||||
return _Record.NumHalfTones();
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class contains settings for the program
|
||||
/// These are not editable, everything that can be changed by the user is in CConfig
|
||||
/// This class contains settings for the program
|
||||
/// These are not editable, everything that can be changed by the user is in CConfig
|
||||
/// </summary>
|
||||
static class CSettings
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the SortStrings of the songpointers to the actual category names
|
||||
/// Sets the SortStrings of the songpointers to the actual category names
|
||||
/// </summary>
|
||||
private static void _AdjustCategoryNames()
|
||||
{
|
||||
|
||||
@@ -83,7 +83,8 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
CloseAllStreams();
|
||||
if (_Playback != null)
|
||||
_Playback.Close();
|
||||
_Playback = null;
|
||||
}
|
||||
|
||||
|
||||
+28
-16
@@ -49,58 +49,70 @@ namespace Vocaluxe.Base
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.Close();
|
||||
_Webcam = null;
|
||||
}
|
||||
|
||||
public static bool GetFrame(ref CTexture tex)
|
||||
{
|
||||
return _Webcam.GetFrame(ref tex);
|
||||
return _Webcam != null && _Webcam.GetFrame(ref tex);
|
||||
}
|
||||
|
||||
public static Bitmap GetBitmap()
|
||||
{
|
||||
return _Webcam.GetBitmap();
|
||||
}
|
||||
|
||||
public static void Close()
|
||||
{
|
||||
if (_Webcam != null)
|
||||
{
|
||||
_Webcam.Close();
|
||||
_Webcam = null;
|
||||
}
|
||||
return _Webcam == null ? null : _Webcam.GetBitmap();
|
||||
}
|
||||
|
||||
public static void Pause()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.Pause();
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.Start();
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.Stop();
|
||||
}
|
||||
|
||||
public static void Select(SWebcamConfig c)
|
||||
public static bool Select(SWebcamConfig c)
|
||||
{
|
||||
_Webcam.Select(c);
|
||||
return _Webcam != null && _Webcam.Select(c);
|
||||
}
|
||||
|
||||
public static void DeSelect()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.DeSelect();
|
||||
}
|
||||
|
||||
public static SWebcamDevice[] GetDevices()
|
||||
{
|
||||
return _Webcam.GetDevices();
|
||||
return _Webcam == null ? null : _Webcam.GetDevices();
|
||||
}
|
||||
|
||||
public static bool IsDeviceAvailable()
|
||||
{
|
||||
return _Webcam.IsDeviceAvailable();
|
||||
return (_Webcam != null) && _Webcam.IsDeviceAvailable();
|
||||
}
|
||||
|
||||
public static bool IsCapturing()
|
||||
{
|
||||
return _Webcam.IsCapturing();
|
||||
return (_Webcam != null) && _Webcam.IsCapturing();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,8 +318,8 @@ namespace Vocaluxe.Base.Server
|
||||
{
|
||||
string filename = _SaveImage(avatarData, "snapshot", CConfig.ProfileFolders[0]);
|
||||
|
||||
var avatar = CAvatar.GetAvatar(filename);
|
||||
if (avatar!=null)
|
||||
CAvatar avatar = CAvatar.GetAvatar(filename);
|
||||
if (avatar != null)
|
||||
{
|
||||
CProfiles.AddAvatar(avatar);
|
||||
return avatar;
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Vocaluxe
|
||||
@@ -22,7 +39,7 @@ namespace Vocaluxe
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetDefaultDllDirectories(int directoryFlags);
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using PortAudioSharp;
|
||||
@@ -7,12 +24,11 @@ using Vocaluxe.Base;
|
||||
namespace Vocaluxe.Lib.Sound
|
||||
{
|
||||
/// <summary>
|
||||
/// PortAudio can be used for record and playback
|
||||
/// So do some common stuff here and make sure those 2 do not interfere
|
||||
/// Basic lifetime: On Init() get a new handle, close/dispose it in your close/dispose
|
||||
///
|
||||
/// DO NEVER use following Pa_* functions other than the ones from this class:
|
||||
/// Initialize, Terminate, OpenStream, CloseStream
|
||||
/// PortAudio can be used for record and playback
|
||||
/// So do some common stuff here and make sure those 2 do not interfere
|
||||
/// Basic lifetime: On Init() get a new handle, close/dispose it in your close/dispose
|
||||
/// DO NEVER use following Pa_* functions other than the ones from this class:
|
||||
/// Initialize, Terminate, OpenStream, CloseStream
|
||||
/// </summary>
|
||||
class CPortAudioHandle : IDisposable
|
||||
{
|
||||
@@ -23,7 +39,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
private readonly List<IntPtr> _Streams = new List<IntPtr>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes PortAudio library (if required)
|
||||
/// Initializes PortAudio library (if required)
|
||||
/// </summary>
|
||||
public CPortAudioHandle()
|
||||
{
|
||||
@@ -73,7 +89,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close the PortAudio handle once you are done
|
||||
/// Close the PortAudio handle once you are done
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
@@ -98,7 +114,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convenience method to safely open an input stream and log potential error
|
||||
/// Convenience method to safely open an input stream and log potential error
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="inputParameters"></param>
|
||||
@@ -119,7 +135,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convenience method to safely open an output stream and log potential error
|
||||
/// Convenience method to safely open an output stream and log potential error
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="outputParameters"></param>
|
||||
@@ -152,8 +168,8 @@ namespace Vocaluxe.Lib.Sound
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if PA returned an error and logs it
|
||||
/// Returns true on error
|
||||
/// Checks if PA returned an error and logs it
|
||||
/// Returns true on error
|
||||
/// </summary>
|
||||
/// <param name="action">Action identifier (E.g. openStream)</param>
|
||||
/// <param name="errorCode">Result returned by Pa_* call</param>
|
||||
@@ -180,7 +196,7 @@ namespace Vocaluxe.Lib.Sound
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the most appropriate host api
|
||||
/// Selects the most appropriate host api
|
||||
/// </summary>
|
||||
/// <returns>The most appropriate host api</returns>
|
||||
public int GetHostApi()
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Playback
|
||||
{
|
||||
class CRingBuffer
|
||||
{
|
||||
private readonly byte[] _Data;
|
||||
private readonly int _Size;
|
||||
private int _ReadPos;
|
||||
private int _WritePos;
|
||||
private int _BytesNotRead;
|
||||
|
||||
public int BytesNotRead
|
||||
{
|
||||
get { return _BytesNotRead; }
|
||||
}
|
||||
|
||||
public CRingBuffer(int size)
|
||||
{
|
||||
_Size = size;
|
||||
_Data = new byte[size];
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_ReadPos = 0;
|
||||
_WritePos = 0;
|
||||
_BytesNotRead = 0;
|
||||
}
|
||||
|
||||
public void Write(byte[] data)
|
||||
{
|
||||
int start = 0;
|
||||
int end = data.Length;
|
||||
if (end - start > _Size)
|
||||
start = end - _Size;
|
||||
int lenTotal = end - start;
|
||||
int len = Math.Min(lenTotal, _Size - _WritePos);
|
||||
Buffer.BlockCopy(data, start, _Data, _WritePos, len);
|
||||
_WritePos += len;
|
||||
if (_WritePos >= _Size)
|
||||
{
|
||||
_WritePos = 0;
|
||||
start += len;
|
||||
len = end - start;
|
||||
if (len > 0)
|
||||
{
|
||||
Buffer.BlockCopy(data, start, _Data, _WritePos, len);
|
||||
_WritePos += len;
|
||||
}
|
||||
}
|
||||
_BytesNotRead += lenTotal;
|
||||
}
|
||||
|
||||
public void Read(byte[] data)
|
||||
{
|
||||
int lenTotal = Math.Min(data.Length, _BytesNotRead);
|
||||
if (lenTotal == 0)
|
||||
return;
|
||||
|
||||
int len = Math.Min(lenTotal, _Size - _ReadPos);
|
||||
Buffer.BlockCopy(_Data, _ReadPos, data, 0, len);
|
||||
_ReadPos += len;
|
||||
if (_ReadPos >= _Size)
|
||||
{
|
||||
_ReadPos = 0;
|
||||
int start = len;
|
||||
len = lenTotal - len;
|
||||
if (len > 0)
|
||||
{
|
||||
Buffer.BlockCopy(_Data, _ReadPos, data, start, len);
|
||||
_ReadPos += len;
|
||||
}
|
||||
}
|
||||
_BytesNotRead -= lenTotal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,11 @@ namespace Vocaluxe.Lib.Sound.Playback.Gstreamer
|
||||
return CGstreamerAudioWrapper.Init();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
CloseAll();
|
||||
}
|
||||
|
||||
public void SetGlobalVolume(float volume)
|
||||
{
|
||||
CGstreamerAudioWrapper.SetGlobalVolume(volume);
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
if (Application.IsInitialized)
|
||||
return false;
|
||||
#if ARCH_X86
|
||||
const string path = ".\\x86\\gstreamer";
|
||||
#endif
|
||||
@@ -41,6 +43,14 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
||||
return Application.IsInitialized;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (!Application.IsInitialized)
|
||||
return;
|
||||
CloseAll();
|
||||
Application.Deinit();
|
||||
}
|
||||
|
||||
public void SetGlobalVolume(float volume)
|
||||
{
|
||||
foreach (CGstreamerSharpAudioStream stream in _Streams.Values)
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using GLib;
|
||||
using Gst;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
interface IPlayback
|
||||
{
|
||||
bool Init();
|
||||
void Close();
|
||||
void SetGlobalVolume(float volume);
|
||||
int GetStreamCount();
|
||||
void CloseAll();
|
||||
@@ -72,57 +73,4 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
void Update();
|
||||
#endregion Stream Handling
|
||||
}
|
||||
|
||||
class CRingBuffer
|
||||
{
|
||||
private readonly byte[] _Data;
|
||||
private readonly long _Size;
|
||||
private long _ReadPos;
|
||||
private long _WritePos;
|
||||
private long _BytesNotRead;
|
||||
|
||||
public long BytesNotRead
|
||||
{
|
||||
get { return _BytesNotRead; }
|
||||
}
|
||||
|
||||
public CRingBuffer(long size)
|
||||
{
|
||||
_Size = size;
|
||||
_Data = new byte[size];
|
||||
_ReadPos = 0L;
|
||||
_WritePos = 0L;
|
||||
_BytesNotRead = 0L;
|
||||
}
|
||||
|
||||
public void Write(byte[] data)
|
||||
{
|
||||
long written = 0L;
|
||||
while (written < data.Length)
|
||||
{
|
||||
_Data[_WritePos] = data[written];
|
||||
_WritePos++;
|
||||
if (_WritePos >= _Size)
|
||||
_WritePos = 0L;
|
||||
|
||||
written++;
|
||||
_BytesNotRead++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(byte[] data)
|
||||
{
|
||||
long read = 0L;
|
||||
while (read < data.Length && _BytesNotRead > 0L)
|
||||
{
|
||||
data[read] = _Data[_ReadPos];
|
||||
_ReadPos++;
|
||||
if (_ReadPos >= _Size)
|
||||
_ReadPos = 0L;
|
||||
|
||||
read++;
|
||||
_BytesNotRead--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using OpenTK.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -34,10 +35,15 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
|
||||
private List<SAudioStreams> _Streams;
|
||||
|
||||
~COpenALPlay()
|
||||
{
|
||||
_Dispose(false);
|
||||
}
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
if (_Initialized)
|
||||
CloseAll();
|
||||
return false;
|
||||
|
||||
_Context = new AudioContext();
|
||||
|
||||
@@ -51,6 +57,11 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public void CloseAll()
|
||||
{
|
||||
lock (_MutexDecoder)
|
||||
@@ -321,24 +332,37 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
|
||||
private void _CloseProc(int streamID)
|
||||
{
|
||||
if (_Initialized)
|
||||
if (!_Initialized)
|
||||
return;
|
||||
lock (_MutexDecoder)
|
||||
{
|
||||
lock (_MutexDecoder)
|
||||
if (_AlreadyAdded(streamID))
|
||||
{
|
||||
if (_AlreadyAdded(streamID))
|
||||
{
|
||||
int index = _GetStreamIndex(streamID);
|
||||
_Decoder.RemoveAt(index);
|
||||
_Streams.RemoveAt(index);
|
||||
}
|
||||
int index = _GetStreamIndex(streamID);
|
||||
_Decoder.RemoveAt(index);
|
||||
_Streams.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_Context.Dispose();
|
||||
_Context = null;
|
||||
_Dispose(true);
|
||||
}
|
||||
|
||||
private void _Dispose(bool disposing)
|
||||
{
|
||||
CloseAll();
|
||||
if (disposing)
|
||||
{
|
||||
while (_Decoder.Count > 0)
|
||||
Thread.Sleep(5);
|
||||
}
|
||||
if (_Context != null)
|
||||
{
|
||||
_Context.Dispose();
|
||||
_Context = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void FadeAndStop(int stream, float targetVolume, float seconds)
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
@@ -9,11 +26,11 @@ using VocaluxeLib;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
{
|
||||
class COpenAlStream : IDisposable
|
||||
class COpenAlStream
|
||||
{
|
||||
private const int _BufferSize = 2048;
|
||||
private const int _BufferCount = 5;
|
||||
private const long _Bufsize = 50000L;
|
||||
private const int _Bufsize = 50000;
|
||||
|
||||
private Object _CloseMutex;
|
||||
|
||||
@@ -70,6 +87,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
_StreamID = streamID;
|
||||
_Terminated = true;
|
||||
_CloseMutex = closeMutex;
|
||||
_EventDecode.Set();
|
||||
}
|
||||
|
||||
public float Length
|
||||
@@ -270,7 +288,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
|
||||
lock (_MutexData)
|
||||
{
|
||||
_Data = new CRingBuffer(_Bufsize);
|
||||
_Data.Reset();
|
||||
_NoMoreData = false;
|
||||
}
|
||||
}
|
||||
@@ -372,6 +390,11 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
}
|
||||
|
||||
_Closeproc(_StreamID);
|
||||
if (_EventDecode != null)
|
||||
{
|
||||
_EventDecode.Dispose();
|
||||
_EventDecode = null;
|
||||
}
|
||||
}
|
||||
#endregion Threading
|
||||
|
||||
@@ -464,11 +487,5 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL
|
||||
_CurrentTime = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - 0.1f;
|
||||
_Timer.Restart();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_EventDecode.Close();
|
||||
_EventDecode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,29 +21,43 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
class CPortAudioPlay : IPlayback
|
||||
{
|
||||
private bool _Initialized;
|
||||
private volatile bool _Initialized;
|
||||
private readonly List<CPortAudioStream> _Streams = new List<CPortAudioStream>();
|
||||
private int _NextID;
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
if (_Initialized)
|
||||
CloseAll();
|
||||
return false;
|
||||
|
||||
_Initialized = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_Initialized = false; //Set this first, so threads don't call closeproc anymore
|
||||
List<CPortAudioStream> streams = new List<CPortAudioStream>();
|
||||
//Get all streams but do not modify list without holding the lock
|
||||
//Calling dispose from within the lock may deadlock in closeproc (if a thread is already there)
|
||||
lock (_Streams)
|
||||
{
|
||||
streams.AddRange(_Streams);
|
||||
_Streams.Clear();
|
||||
}
|
||||
foreach (CPortAudioStream stream in streams)
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
public void CloseAll()
|
||||
{
|
||||
lock (_Streams)
|
||||
{
|
||||
foreach (CPortAudioStream stream in _Streams)
|
||||
stream.Free();
|
||||
stream.Close();
|
||||
_Streams.Clear();
|
||||
}
|
||||
_Initialized = false;
|
||||
}
|
||||
|
||||
public void SetGlobalVolume(float volume)
|
||||
@@ -99,7 +113,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
int index = _GetStreamIndex(stream);
|
||||
if (index >= 0)
|
||||
{
|
||||
_Streams[index].Free();
|
||||
_Streams[index].Close();
|
||||
_Streams.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
@@ -287,8 +301,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
#endregion Stream Handling
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if strem with given id is found
|
||||
/// MUST hold _Stream-lock
|
||||
/// Returns true if strem with given id is found
|
||||
/// MUST hold _Stream-lock
|
||||
/// </summary>
|
||||
/// <param name="stream">Stream id</param>
|
||||
/// <returns></returns>
|
||||
@@ -298,8 +312,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the index of the stream with the given id
|
||||
/// MUST hold _Stream-lock
|
||||
/// Returns the index of the stream with the given id
|
||||
/// MUST hold _Stream-lock
|
||||
/// </summary>
|
||||
/// <param name="stream">Stream id</param>
|
||||
/// <returns></returns>
|
||||
@@ -314,7 +328,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the stream with the given handle
|
||||
/// Removes the stream with the given handle
|
||||
/// </summary>
|
||||
/// <param name="stream">Stream handle</param>
|
||||
private void _CloseProc(int stream)
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
@@ -10,8 +27,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
class CPortAudioStream : IDisposable
|
||||
{
|
||||
private const long _Bufsize = 1000000L;
|
||||
private const long _Beginrefill = 800000L;
|
||||
private const int _Bufsize = 1000000;
|
||||
private const int _Beginrefill = 800000;
|
||||
|
||||
public readonly int ID;
|
||||
private readonly Closeproc _Closeproc;
|
||||
@@ -36,22 +53,21 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
|
||||
private bool _FileOpened;
|
||||
|
||||
private bool _Waiting;
|
||||
private bool _Skip;
|
||||
|
||||
private bool _Loop;
|
||||
private float _Duration;
|
||||
private float _CurrentTime;
|
||||
private float _TimeCode;
|
||||
private volatile float _TimeCode;
|
||||
|
||||
private bool _Paused;
|
||||
private volatile bool _Paused;
|
||||
|
||||
private CRingBuffer _Data;
|
||||
private float _SetStart;
|
||||
private volatile float _SetStart;
|
||||
private float _Start;
|
||||
private bool _SetLoop;
|
||||
private bool _SetSkip;
|
||||
private bool _Terminated;
|
||||
private volatile bool _SetLoop;
|
||||
private volatile bool _SetSkip;
|
||||
private volatile bool _Terminated;
|
||||
|
||||
private Thread _DecoderThread;
|
||||
|
||||
@@ -69,12 +85,15 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
|
||||
~CPortAudioStream()
|
||||
{
|
||||
Dispose();
|
||||
_Dispose(false);
|
||||
if (_DecoderThread != null)
|
||||
_DecoderThread.Join();
|
||||
}
|
||||
|
||||
public void Free()
|
||||
public void Close()
|
||||
{
|
||||
_Terminated = true;
|
||||
_EventDecode.Set();
|
||||
}
|
||||
|
||||
public float Length
|
||||
@@ -94,7 +113,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
lock (_LockData)
|
||||
{
|
||||
return _NoMoreData && _Data.BytesNotRead == 0L && _SyncTimer.Time >= _Duration;
|
||||
return _NoMoreData && _Data.BytesNotRead == 0 && _SyncTimer.Time >= _Duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,11 +123,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
get { return _Volume * 100f; }
|
||||
set
|
||||
{
|
||||
lock (_LockData)
|
||||
{
|
||||
value.Clamp(0f, 100f);
|
||||
_Volume = value / 100f;
|
||||
}
|
||||
value.Clamp(0f, 100f);
|
||||
_Volume = value / 100f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,11 +133,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
get { return _VolumeMax * 100f; }
|
||||
set
|
||||
{
|
||||
lock (_LockData)
|
||||
{
|
||||
value.Clamp(0f, 100f);
|
||||
_VolumeMax = value / 100f;
|
||||
}
|
||||
value.Clamp(0f, 100f);
|
||||
_VolumeMax = value / 100f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +146,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
if (Finished)
|
||||
_SyncTimer.Pause();
|
||||
//TODO: Why not use Decoder.GetPosition()?
|
||||
//Decoder may return wrong timestamps. If you change this to exessive testing for monoton timestamps espacially for ogg files
|
||||
//Decoder may return wrong timestamps. If you change this do exessive testing for monoton timestamps espacially for ogg files
|
||||
return _SyncTimer.Time;
|
||||
}
|
||||
}
|
||||
@@ -253,6 +265,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
_ByteCount = 2 * format.ChannelCount;
|
||||
_BytesPerSecond = format.SamplesPerSecond * _ByteCount;
|
||||
_CurrentTime = 0f;
|
||||
_SyncTimer.Pause();
|
||||
_SyncTimer.Time = _CurrentTime;
|
||||
|
||||
PortAudioSharp.PortAudio.PaStreamParameters? outputParams = new PortAudioSharp.PortAudio.PaStreamParameters
|
||||
@@ -283,7 +296,6 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
//From now on closing the driver and the decoder is handled by the thread ONLY!
|
||||
|
||||
_Paused = true;
|
||||
_Waiting = true;
|
||||
_FileOpened = true;
|
||||
_Data = new CRingBuffer(_Bufsize);
|
||||
_NoMoreData = false;
|
||||
@@ -299,7 +311,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
_SetStart = time;
|
||||
_SetSkip = true;
|
||||
_Waiting = true;
|
||||
_EventDecode.Set();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,10 +323,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
_Decoder.SetPosition(_Start);
|
||||
_CurrentTime = _Start;
|
||||
_TimeCode = _Start;
|
||||
_Data = new CRingBuffer(_Bufsize);
|
||||
_Data.Reset();
|
||||
_NoMoreData = false;
|
||||
_EventDecode.Set();
|
||||
_Waiting = false;
|
||||
_SyncTimer.Time = _Start;
|
||||
}
|
||||
}
|
||||
@@ -323,35 +333,27 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
while (!_Terminated)
|
||||
{
|
||||
if (_EventDecode.WaitOne(10))
|
||||
lock (_LockSyncSignals)
|
||||
{
|
||||
lock (_LockSyncSignals)
|
||||
if (_SetSkip)
|
||||
{
|
||||
if (_SetSkip)
|
||||
{
|
||||
_Skip = true;
|
||||
_EventDecode.Set();
|
||||
_Waiting = true;
|
||||
}
|
||||
|
||||
_Skip = true;
|
||||
_SetSkip = false;
|
||||
|
||||
_Start = _SetStart;
|
||||
_Loop = _SetLoop;
|
||||
}
|
||||
|
||||
if (_Skip)
|
||||
{
|
||||
_DoSkip();
|
||||
_Skip = false;
|
||||
}
|
||||
|
||||
if (!_Waiting)
|
||||
{
|
||||
_DoDecode();
|
||||
_Update();
|
||||
}
|
||||
_Start = _SetStart;
|
||||
_Loop = _SetLoop;
|
||||
}
|
||||
|
||||
if (_Skip)
|
||||
{
|
||||
_DoSkip();
|
||||
_Skip = false;
|
||||
}
|
||||
|
||||
_DoDecode();
|
||||
_Update();
|
||||
_EventDecode.WaitOne();
|
||||
}
|
||||
|
||||
_DoFree();
|
||||
@@ -402,12 +404,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
_Data.Write(buffer);
|
||||
_TimeCode = timecode;
|
||||
if (_Data.BytesNotRead < _Beginrefill)
|
||||
{
|
||||
_Waiting = false;
|
||||
_EventDecode.Set();
|
||||
}
|
||||
else
|
||||
_Waiting = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +435,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
try
|
||||
{
|
||||
Marshal.Copy(buf, 0, output, (int)frameCount * _ByteCount);
|
||||
Marshal.Copy(buf, 0, output, buf.Length);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -462,13 +459,8 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
}
|
||||
}
|
||||
|
||||
if (_Data.BytesNotRead < _Beginrefill)
|
||||
{
|
||||
if (_Data.BytesNotRead < _Beginrefill && !_NoMoreData)
|
||||
_EventDecode.Set();
|
||||
_Waiting = false;
|
||||
}
|
||||
else
|
||||
_Waiting = true;
|
||||
|
||||
float latency = buf.Length / _BytesPerSecond + CConfig.AudioLatency / 1000f;
|
||||
float time = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - latency;
|
||||
@@ -483,7 +475,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CLog.LogError("Error PortAudio.treamCallback: " + e.Message);
|
||||
CLog.LogError("Error PortAudio.StreamCallback: " + e.Message);
|
||||
}
|
||||
|
||||
return PortAudioSharp.PortAudio.PaStreamCallbackResult.paContinue;
|
||||
@@ -517,11 +509,25 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_EventDecode != null)
|
||||
_Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void _Dispose(bool disposing)
|
||||
{
|
||||
Close();
|
||||
if (disposing)
|
||||
{
|
||||
_EventDecode.Close();
|
||||
_EventDecode = null;
|
||||
GC.SuppressFinalize(this);
|
||||
if (_DecoderThread != null)
|
||||
{
|
||||
_DecoderThread.Join();
|
||||
_DecoderThread = null;
|
||||
}
|
||||
if (_EventDecode != null)
|
||||
{
|
||||
_EventDecode.Close();
|
||||
_EventDecode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System.Diagnostics;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
{
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Playback.PortAudio
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
using System.Diagnostics;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using Vocaluxe.Base;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Record
|
||||
@@ -9,11 +25,11 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
public int Channel;
|
||||
public bool Finished;
|
||||
public float OrigThreshold;
|
||||
}
|
||||
|
||||
private const float _MaxDelayTime = 1000;
|
||||
public bool Running { get; private set; }
|
||||
private readonly Stopwatch _Timer = new Stopwatch();
|
||||
private int _Stream = -1;
|
||||
|
||||
private readonly SDelayChannel[] _DelaysChannel;
|
||||
@@ -34,24 +50,38 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
Reset();
|
||||
for (int i = 0; i < _DelaysChannel.Length; i++)
|
||||
{
|
||||
if (i < channels.Length)
|
||||
if (i < channels.Length && channels[i] >= 0)
|
||||
{
|
||||
_DelaysChannel[i].Finished = false;
|
||||
_DelaysChannel[i].Channel = channels[i];
|
||||
_DelaysChannel[i].OrigThreshold = CRecord.GetVolumeThreshold(channels[i]);
|
||||
CRecord.SetVolumeThreshold(channels[i], _DelaysChannel[i].OrigThreshold / 3);
|
||||
}
|
||||
else
|
||||
_DelaysChannel[i].Finished = true;
|
||||
_DelaysChannel[i].Channel = -1;
|
||||
}
|
||||
_Stream = CSound.PlaySound(ESounds.T440, false);
|
||||
Running = true;
|
||||
}
|
||||
|
||||
private void _Stop()
|
||||
{
|
||||
if (!Running)
|
||||
return;
|
||||
Running = false;
|
||||
_CloseStream();
|
||||
foreach (SDelayChannel delay in _DelaysChannel)
|
||||
{
|
||||
if (delay.Channel >= 0)
|
||||
CRecord.SetVolumeThreshold(delay.Channel, delay.OrigThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Running = false;
|
||||
_Stop();
|
||||
for (int i = 0; i < _DelaysChannel.Length; i++)
|
||||
Delays[i] = 0;
|
||||
_CloseStream();
|
||||
}
|
||||
|
||||
private void _CloseStream()
|
||||
@@ -67,24 +97,21 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
if (!Running)
|
||||
return;
|
||||
if (!_Timer.IsRunning)
|
||||
{
|
||||
if (CSound.GetPosition(_Stream) > 0f)
|
||||
_Timer.Restart();
|
||||
}
|
||||
if (!_Timer.IsRunning)
|
||||
|
||||
float time = CSound.GetPosition(_Stream) * 1000f;
|
||||
if (time <= 0f)
|
||||
return;
|
||||
|
||||
bool isActive = false;
|
||||
if (_Timer.ElapsedMilliseconds <= _MaxDelayTime)
|
||||
if (time <= _MaxDelayTime)
|
||||
{
|
||||
for (int i = 0; i < _DelaysChannel.Length; i++)
|
||||
{
|
||||
if (_DelaysChannel[i].Channel < 0 || _DelaysChannel[i].Finished)
|
||||
continue;
|
||||
if (CRecord.GetMaxVolume(_DelaysChannel[i].Channel) > 0.1f && CRecord.GetTone(_DelaysChannel[i].Channel) == 9)
|
||||
if (CRecord.GetTone(_DelaysChannel[i].Channel) == 9)
|
||||
{
|
||||
Delays[i] = (int)_Timer.ElapsedMilliseconds;
|
||||
Delays[i] = (int)time;
|
||||
_DelaysChannel[i].Finished = true;
|
||||
}
|
||||
else
|
||||
@@ -92,11 +119,7 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
}
|
||||
}
|
||||
if (!isActive)
|
||||
{
|
||||
Running = false;
|
||||
_CloseStream();
|
||||
_Timer.Stop();
|
||||
}
|
||||
_Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using Vocaluxe.Base;
|
||||
namespace Vocaluxe.Lib.Sound.Record
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class to implement common functionality for Record classes
|
||||
/// Base class to implement common functionality for Record classes
|
||||
/// </summary>
|
||||
abstract class CRecordBase
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Procedure to be called by descendent classes with data that got recorded
|
||||
/// Procedure to be called by descendent classes with data that got recorded
|
||||
/// </summary>
|
||||
/// <param name="device">Device from which the data was recorded</param>
|
||||
/// <param name="data">Recorded samples, assume Int16 and interleaved for multi-channels</param>
|
||||
@@ -125,6 +125,19 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
return _Initialized ? _Buffer[player].MaxVolume : 0f;
|
||||
}
|
||||
|
||||
public float GetVolumeThreshold(int player)
|
||||
{
|
||||
return _Initialized ? _Buffer[player].VolTreshold : 0f;
|
||||
}
|
||||
|
||||
public void SetVolumeThreshold(int player, float threshold)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
_Buffer[player].VolTreshold = threshold;
|
||||
}
|
||||
|
||||
public bool ToneValid(int player)
|
||||
{
|
||||
return _Initialized && _Buffer[player].ToneValid;
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Vocaluxe.Lib.Sound.Record.DirectSound
|
||||
{
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using SlimDX.DirectSound;
|
||||
|
||||
@@ -62,84 +62,100 @@ namespace Vocaluxe.Lib.Sound.Record
|
||||
interface IRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes recording
|
||||
/// Initializes recording
|
||||
/// </summary>
|
||||
/// <returns>True on success</returns>
|
||||
bool Init();
|
||||
|
||||
/// <summary>
|
||||
/// Closes recording. You must not use it before calling Init again
|
||||
/// Closes recording. You must not use it before calling Init again
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording on all enabled devices (PlayerChannelX set)
|
||||
/// Starts recording on all enabled devices (PlayerChannelX set)
|
||||
/// </summary>
|
||||
/// <returns>True on success, false on error or not initialized</returns>
|
||||
bool Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording on all devices
|
||||
/// Stops recording on all devices
|
||||
/// </summary>
|
||||
/// <returns>True on success, false on error or not initialized</returns>
|
||||
bool Stop();
|
||||
|
||||
/// <summary>
|
||||
/// Analyzes the buffer for the given player
|
||||
/// Analyzes the buffer for the given player
|
||||
/// </summary>
|
||||
/// <param name="player"></param>
|
||||
void AnalyzeBuffer(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Get the current raw tone value for a player
|
||||
/// Get the current raw tone value for a player
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Tone between 0 and NumHalftones-1</returns>
|
||||
int GetToneAbs(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Get the current tone value for a player
|
||||
/// Get the current tone value for a player
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Tone between 0 and 11 (one octave)</returns>
|
||||
int GetTone(int player);
|
||||
|
||||
/// <summary>
|
||||
/// DEBUG ONLY: Sets a tone for a player
|
||||
/// DEBUG ONLY: Sets a tone for a player
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <param name="tone">Raw tone value between 0 and NumHalfTones-1</param>
|
||||
void SetTone(int player, int tone);
|
||||
|
||||
/// <summary>
|
||||
/// Get the current maximum input volume (normalized) for a player
|
||||
/// Get the current maximum input volume (normalized) for a player
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Maximum volume between 0 and 1</returns>
|
||||
float GetMaxVolume(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the current tone is valid. That includes, if maximum volume is higher than the threshold
|
||||
/// Gets the treshold for detecting silence
|
||||
/// Value (0-1) for which everything below is considered silence
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Threshold</returns>
|
||||
/// </summary>
|
||||
float GetVolumeThreshold(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the treshold for detecting silence
|
||||
/// Value (0-1) for which everything below is considered silence
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <param name="threshold">Threshold</param>
|
||||
/// </summary>
|
||||
void SetVolumeThreshold(int player, float threshold);
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the current tone is valid. That includes, if maximum volume is higher than the threshold
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>True if tone is detected and volume higher than threshold</returns>
|
||||
bool ToneValid(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of half tones used for the raw tone detection
|
||||
/// Returns the number of half tones used for the raw tone detection
|
||||
/// </summary>
|
||||
/// <returns>number of half tones used for the raw tone detection</returns>
|
||||
int NumHalfTones();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the tone weights for a player as an array of normalized values for each halftone
|
||||
/// Returns the tone weights for a player as an array of normalized values for each halftone
|
||||
/// </summary>
|
||||
/// <param name="player">0-based player index</param>
|
||||
/// <returns>Array of values (0-1) with one entry per halftone</returns>
|
||||
float[] ToneWeigth(int player);
|
||||
|
||||
/// <summary>
|
||||
/// Readonly list of all detected record devices. Modifying the devices should not be done when record is running.
|
||||
/// Readonly list of all detected record devices. Modifying the devices should not be done when record is running.
|
||||
/// </summary>
|
||||
/// <returns>Readonly list of all detected record devices</returns>
|
||||
ReadOnlyCollection<CRecordDevice> RecordDevices();
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
@@ -170,7 +187,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a frame
|
||||
/// Gets a frame
|
||||
/// </summary>
|
||||
/// <param name="frame">Referenz to texture where frame should be put in (can be null, then texture is created)</param>
|
||||
/// <param name="time">Maximum start time for frame</param>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using AForge.Video;
|
||||
using AForge.Video.DirectShow;
|
||||
using System.Collections.Generic;
|
||||
@@ -31,66 +32,33 @@ namespace Vocaluxe.Lib.Webcam
|
||||
private readonly List<SWebcamDevice> _Devices = new List<SWebcamDevice>();
|
||||
private bool _Paused;
|
||||
private VideoCaptureDevice _Webcam;
|
||||
private FilterInfoCollection _WebcamDevices;
|
||||
private SWebcamConfig _Config;
|
||||
private byte[] _Data = new byte[1];
|
||||
private byte[] _Data;
|
||||
private static readonly object _MutexData = new object();
|
||||
private int _Width, _Height;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.SignalToStop();
|
||||
_Webcam.WaitForStop();
|
||||
_Webcam.NewFrame -= _OnFrame;
|
||||
_Data = new byte[1];
|
||||
}
|
||||
|
||||
public bool GetFrame(ref CTexture frame)
|
||||
{
|
||||
lock (_MutexData)
|
||||
{
|
||||
if (_Webcam != null && _Width > 0 && _Height > 0 && _Data.Length == _Width * _Height * 4)
|
||||
CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, _Data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Bitmap GetBitmap()
|
||||
{
|
||||
if (_Webcam != null && _Width > 0 && _Height > 0 && _Data.Length == _Height * _Width * 4)
|
||||
{
|
||||
lock (_MutexData)
|
||||
{
|
||||
var bmp = new Bitmap(_Width, _Height);
|
||||
BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length);
|
||||
bmp.UnlockBits(bitmapdata);
|
||||
return bmp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private bool _NewFrameAvailable;
|
||||
private bool _IsCapturing;
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
_WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
foreach (FilterInfo info in _WebcamDevices)
|
||||
FilterInfoCollection webcams = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
||||
foreach (FilterInfo info in webcams)
|
||||
{
|
||||
var tmpdev = new VideoCaptureDevice(info.MonikerString);
|
||||
if (tmpdev.VideoCapabilities.Length == 0)
|
||||
continue;
|
||||
var device = new SWebcamDevice
|
||||
{
|
||||
Name = info.Name,
|
||||
MonikerString = info.MonikerString,
|
||||
Capabilities = new List<SCapabilities>()
|
||||
Capabilities = new List<SCapabilities>(tmpdev.VideoCapabilities.Length)
|
||||
};
|
||||
var tmpdev = new VideoCaptureDevice(info.MonikerString);
|
||||
|
||||
foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities)
|
||||
{
|
||||
var item = new SCapabilities
|
||||
{
|
||||
Framerate = capabilities.FrameRate,
|
||||
Framerate = capabilities.AverageFrameRate,
|
||||
Height = capabilities.FrameSize.Height,
|
||||
Width = capabilities.FrameSize.Width
|
||||
};
|
||||
@@ -101,44 +69,188 @@ namespace Vocaluxe.Lib.Webcam
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _OnFrame(object sender, NewFrameEventArgs e)
|
||||
public void Close()
|
||||
{
|
||||
if (_Paused)
|
||||
DeSelect();
|
||||
_Devices.Clear();
|
||||
}
|
||||
|
||||
public void DeSelect()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.Stop();
|
||||
_Webcam.NewFrame -= _OnFrame;
|
||||
_IsCapturing = false;
|
||||
lock (_MutexData)
|
||||
{
|
||||
if (_Width != e.Frame.Width || _Height != e.Frame.Height || _Data.Length != e.Frame.Width * e.Frame.Height * 4)
|
||||
_Data = new byte[4 * e.Frame.Width * e.Frame.Height];
|
||||
|
||||
_Width = e.Frame.Width;
|
||||
_Height = e.Frame.Height;
|
||||
BitmapData bitmapdata = e.Frame.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(bitmapdata.Scan0, _Data, 0, _Data.Length);
|
||||
e.Frame.UnlockBits(bitmapdata);
|
||||
_Data = null;
|
||||
_Webcam = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
#region ConfigSelection
|
||||
private static float _GetScore(int value, int valueRequested)
|
||||
{
|
||||
if (_Webcam != null)
|
||||
_Paused = true;
|
||||
if (valueRequested <= 0)
|
||||
return 1;
|
||||
return 1.0f - (float)Math.Abs(value - valueRequested) / Math.Max(value, valueRequested);
|
||||
}
|
||||
|
||||
private static VideoCapabilities _SelectWebcamConfig(VideoCapabilities[] capabilities, SWebcamConfig config)
|
||||
{
|
||||
int configTaken = 0;
|
||||
if (config.Framerate != 0 && config.Height != 0 && config.Width != 0)
|
||||
{
|
||||
float bestMatchScore = 0;
|
||||
for (int i = 0; i < capabilities.Length; i++)
|
||||
{
|
||||
float score = _GetScore(capabilities[i].AverageFrameRate, config.Framerate);
|
||||
score += _GetScore(capabilities[i].FrameSize.Height, config.Height);
|
||||
score += _GetScore(capabilities[i].FrameSize.Width, config.Width);
|
||||
if (score >= bestMatchScore)
|
||||
{
|
||||
// Take the config with the best score, Higher indizes should indicate a better resolution
|
||||
// so choose the last one with best score if 2 have equal scores
|
||||
bestMatchScore = score;
|
||||
configTaken = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return capabilities[configTaken];
|
||||
}
|
||||
#endregion
|
||||
|
||||
public bool Select(SWebcamConfig config)
|
||||
{
|
||||
//Close old camera connection
|
||||
DeSelect();
|
||||
|
||||
if (_Devices.Count < 1)
|
||||
return false;
|
||||
|
||||
string moniker = _Devices[0].MonikerString;
|
||||
if (config.MonikerString != "")
|
||||
{
|
||||
foreach (SWebcamDevice device in _Devices)
|
||||
{
|
||||
if (device.MonikerString == config.MonikerString)
|
||||
{
|
||||
moniker = device.MonikerString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_Webcam = new VideoCaptureDevice(moniker);
|
||||
|
||||
_Webcam.VideoResolution = _SelectWebcamConfig(_Webcam.VideoCapabilities, config);
|
||||
|
||||
_Config.Framerate = _Webcam.VideoResolution.AverageFrameRate;
|
||||
_Config.Height = _Webcam.VideoResolution.FrameSize.Height;
|
||||
_Config.Width = _Webcam.VideoResolution.FrameSize.Width;
|
||||
_Config.MonikerString = _Webcam.Source;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (_Webcam == null)
|
||||
return;
|
||||
_Webcam.NewFrame -= _OnFrame;
|
||||
//Subscribe to NewFrame event
|
||||
_Webcam.NewFrame += _OnFrame;
|
||||
_Webcam.Start();
|
||||
_Paused = false;
|
||||
if (_IsCapturing)
|
||||
{
|
||||
if (_Paused)
|
||||
{
|
||||
_Webcam.NewFrame += _OnFrame;
|
||||
_Paused = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Subscribe to NewFrame event
|
||||
_Webcam.NewFrame += _OnFrame;
|
||||
_Paused = false;
|
||||
_Webcam.Start();
|
||||
_IsCapturing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (_Webcam != null && !_Paused)
|
||||
{
|
||||
_Webcam.NewFrame -= _OnFrame;
|
||||
lock (_MutexData) //Make sure all events are finished or not yet startet for consistency
|
||||
{
|
||||
_Paused = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (_Webcam != null)
|
||||
{
|
||||
_Webcam.SignalToStop();
|
||||
_Webcam.NewFrame -= _OnFrame;
|
||||
lock (_MutexData) //Make sure all events are finished or not yet startet for consistency
|
||||
{
|
||||
_IsCapturing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetFrame(ref CTexture frame)
|
||||
{
|
||||
lock (_MutexData)
|
||||
{
|
||||
if (_Data != null && _Data.Length == _Width * _Height * 4 && _NewFrameAvailable)
|
||||
{
|
||||
CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, _Data);
|
||||
_NewFrameAvailable = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Bitmap GetBitmap()
|
||||
{
|
||||
lock (_MutexData)
|
||||
{
|
||||
if (_Data != null && _Data.Length == _Width * _Height * 4)
|
||||
{
|
||||
var bmp = new Bitmap(_Width, _Height);
|
||||
BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length);
|
||||
bmp.UnlockBits(bitmapdata);
|
||||
return bmp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnFrame(object sender, NewFrameEventArgs e)
|
||||
{
|
||||
if (_Paused)
|
||||
return;
|
||||
if (e.Frame.Width == 0 || e.Frame.Height == 0)
|
||||
return;
|
||||
lock (_MutexData)
|
||||
{
|
||||
if (!IsCapturing())
|
||||
return;
|
||||
if (_Data == null || _Data.Length != e.Frame.Width * e.Frame.Height * 4)
|
||||
_Data = new byte[e.Frame.Width * e.Frame.Height * 4];
|
||||
|
||||
_Width = e.Frame.Width;
|
||||
_Height = e.Frame.Height;
|
||||
BitmapData bitmapdata = e.Frame.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(bitmapdata.Scan0, _Data, 0, _Data.Length);
|
||||
e.Frame.UnlockBits(bitmapdata);
|
||||
_NewFrameAvailable = true;
|
||||
}
|
||||
}
|
||||
|
||||
public SWebcamDevice[] GetDevices()
|
||||
@@ -148,42 +260,12 @@ namespace Vocaluxe.Lib.Webcam
|
||||
|
||||
public bool IsDeviceAvailable()
|
||||
{
|
||||
return _Devices.Count > 0;
|
||||
return _Webcam != null;
|
||||
}
|
||||
|
||||
public bool IsCapturing()
|
||||
{
|
||||
return _Webcam.IsRunning;
|
||||
}
|
||||
|
||||
public bool Select(SWebcamConfig config)
|
||||
{
|
||||
//Close old camera connection
|
||||
Close();
|
||||
|
||||
if (_WebcamDevices == null)
|
||||
return false;
|
||||
if (_WebcamDevices.Count < 1)
|
||||
return false;
|
||||
|
||||
//No MonikerString found, try first webcam
|
||||
_Webcam = config.MonikerString == "" ? new VideoCaptureDevice(_WebcamDevices[0].MonikerString) : new VideoCaptureDevice(config.MonikerString);
|
||||
|
||||
if (_Webcam == null)
|
||||
return false;
|
||||
|
||||
if (config.Framerate != 0 && config.Height != 0 && config.Width != 0)
|
||||
{
|
||||
_Webcam.DesiredFrameRate = config.Framerate;
|
||||
_Webcam.DesiredFrameSize = new Size(config.Width, config.Height);
|
||||
}
|
||||
|
||||
_Config.Framerate = _Webcam.DesiredFrameRate;
|
||||
_Config.Height = _Webcam.DesiredFrameSize.Height;
|
||||
_Config.Width = _Webcam.DesiredFrameSize.Width;
|
||||
_Config.MonikerString = _Webcam.Source;
|
||||
|
||||
return true;
|
||||
return _IsCapturing && !_Paused;
|
||||
}
|
||||
|
||||
public SWebcamConfig GetConfig()
|
||||
|
||||
@@ -46,19 +46,33 @@ namespace Vocaluxe.Lib.Webcam
|
||||
interface IWebcam
|
||||
{
|
||||
bool Init();
|
||||
void Close();
|
||||
|
||||
void Start();
|
||||
void Pause();
|
||||
void Stop();
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// Gets last captured frame. Returns true if frame was updated<br />
|
||||
/// Note that this will invalidate the last frame and not return it again with this function
|
||||
/// </summary>
|
||||
/// <param name="frame"></param>
|
||||
/// <returns></returns>
|
||||
bool GetFrame(ref CTexture frame);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last captured frame as a bitma
|
||||
/// </summary>
|
||||
/// <param name="frame"></param>
|
||||
/// <returns>Null if no frame was captured, the bitmap otherwise</returns>
|
||||
Bitmap GetBitmap();
|
||||
|
||||
SWebcamConfig GetConfig();
|
||||
SWebcamDevice[] GetDevices();
|
||||
bool IsDeviceAvailable();
|
||||
bool IsCapturing();
|
||||
|
||||
bool Select(SWebcamConfig webcamConfig);
|
||||
void DeSelect();
|
||||
}
|
||||
}
|
||||
@@ -268,6 +268,7 @@ namespace Vocaluxe
|
||||
CDraw.Unload();
|
||||
CDataBase.Close();
|
||||
CWebcam.Close();
|
||||
GC.Collect(); // Do a GC run here before we close logs to have finalizers run
|
||||
CLog.CloseAll();
|
||||
}
|
||||
catch (Exception) {}
|
||||
|
||||
@@ -547,7 +547,7 @@ namespace Vocaluxe.Screens
|
||||
for (int i = 1; i <= CGame.NumPlayer; i++)
|
||||
{
|
||||
CRecord.AnalyzeBuffer(i - 1);
|
||||
_Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1));
|
||||
_Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -223,25 +223,29 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (_CheckMicConfig())
|
||||
{
|
||||
_ChannelEnergy[0] = 0f;
|
||||
int player = _SelectSlides[_SelectSlideRecordChannel1].Selection;
|
||||
if (player > 0)
|
||||
int player = _SelectSlides[_SelectSlideRecordChannel1].Selection - 1;
|
||||
if (player >= 0)
|
||||
{
|
||||
_ChannelEnergy[0] = CRecord.GetMaxVolume(player - 1);
|
||||
_Equalizers[_EqualizerChannel1].Update(CRecord.ToneWeigth(player - 1));
|
||||
_ChannelEnergy[0] = CRecord.GetMaxVolume(player);
|
||||
_Equalizers[_EqualizerChannel1].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ChannelEnergy[0] = 0f;
|
||||
_Equalizers[_EqualizerChannel1].Reset();
|
||||
}
|
||||
|
||||
_ChannelEnergy[1] = 0f;
|
||||
player = _SelectSlides[_SelectSlideRecordChannel2].Selection;
|
||||
if (player > 0)
|
||||
player = _SelectSlides[_SelectSlideRecordChannel2].Selection - 1;
|
||||
if (player >= 0)
|
||||
{
|
||||
_ChannelEnergy[1] = CRecord.GetMaxVolume(player - 1);
|
||||
_Equalizers[_EqualizerChannel2].Update(CRecord.ToneWeigth(player - 1));
|
||||
_ChannelEnergy[1] = CRecord.GetMaxVolume(player);
|
||||
_Equalizers[_EqualizerChannel2].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ChannelEnergy[1] = 0f;
|
||||
_Equalizers[_EqualizerChannel2].Reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -150,16 +150,17 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5;
|
||||
CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
|
||||
CConfig.BackgroundMusic=(EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
|
||||
CConfig.BackgroundMusic = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
|
||||
CConfig.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
|
||||
CConfig.BackgroundMusicVolume= _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
|
||||
CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
|
||||
CConfig.SaveConfig();
|
||||
|
||||
CBackgroundMusic.SetMusicSource(CConfig.BackgroundMusicSource);
|
||||
CBackgroundMusic.SetVolume(CConfig.BackgroundMusicVolume);
|
||||
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
|
||||
CBackgroundMusic.Play();
|
||||
else CBackgroundMusic.Pause();
|
||||
else
|
||||
CBackgroundMusic.Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace Vocaluxe.Screens
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 4; }
|
||||
get { return 5; }
|
||||
}
|
||||
|
||||
private const string _SelectSlideVideoBackgrounds = "SelectSlideVideoBackgrounds";
|
||||
@@ -45,6 +45,9 @@ namespace Vocaluxe.Screens
|
||||
private const string _ButtonScreenAdjustments = "ButtonScreenAdjustments";
|
||||
private const string _ButtonExit = "ButtonExit";
|
||||
|
||||
private const string _TextWebcams = "TextWebcams";
|
||||
private const string _TextWebcamResolution = "TextWebcamResolution";
|
||||
|
||||
private SWebcamConfig _Config;
|
||||
private CTexture _WebcamTexture;
|
||||
private int _DeviceNr;
|
||||
@@ -61,6 +64,7 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlideVideoBackgrounds, _SelectSlideVideoPreview, _SelectSlideVideosInSongs, _SelectSlideVideosToBackground, _SelectSlideWebcamDevices,
|
||||
_SelectSlideWebcamCapabilities
|
||||
};
|
||||
_ThemeTexts = new string[] {_TextWebcams, _TextWebcamResolution};
|
||||
}
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
@@ -154,8 +158,8 @@ namespace Vocaluxe.Screens
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
_Statics[_StaticWebcamOutput].Texture = _WebcamTexture;
|
||||
if (CWebcam.GetFrame(ref _WebcamTexture))
|
||||
_Statics[_StaticWebcamOutput].Texture = _WebcamTexture;
|
||||
_SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground;
|
||||
return true;
|
||||
}
|
||||
@@ -170,7 +174,7 @@ namespace Vocaluxe.Screens
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
CWebcam.Close();
|
||||
CWebcam.Stop();
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
@@ -189,25 +193,20 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (devices != null && devices.Length > 0)
|
||||
{
|
||||
_DeviceNr = 0;
|
||||
_CapabilityNr = 0;
|
||||
_GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr);
|
||||
|
||||
foreach (SWebcamDevice d in devices)
|
||||
_SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name);
|
||||
_SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr;
|
||||
|
||||
foreach (SCapabilities c in devices[_DeviceNr].Capabilities)
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS ");
|
||||
_Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString;
|
||||
_Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
|
||||
_Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
|
||||
_Config.Framerate =
|
||||
devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
|
||||
CWebcam.Close();
|
||||
CWebcam.Select(CConfig.WebcamConfig);
|
||||
CWebcam.Start();
|
||||
ssVisible = true;
|
||||
int devNr;
|
||||
int capNr;
|
||||
if (_GetFirstConfiguredWebcamDevice(out devNr, out capNr))
|
||||
{
|
||||
_SelectSlides[_SelectSlideWebcamDevices].Selection = devNr;
|
||||
_OnDeviceEvent();
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].Selection = capNr;
|
||||
_OnCapabilitiesEvent();
|
||||
|
||||
ssVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -218,6 +217,8 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideWebcamDevices].Visible = ssVisible;
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].Visible = ssVisible;
|
||||
_Statics[_StaticWebcamOutput].Visible = ssVisible;
|
||||
_Texts[_TextWebcams].Visible = ssVisible;
|
||||
_Texts[_TextWebcamResolution].Visible = ssVisible;
|
||||
}
|
||||
|
||||
private void _SaveConfig()
|
||||
@@ -239,7 +240,6 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].Clear();
|
||||
_DeviceNr = _SelectSlides[_SelectSlideWebcamDevices].Selection;
|
||||
_CapabilityNr = 0;
|
||||
|
||||
SWebcamDevice d = CWebcam.GetDevices()[_DeviceNr];
|
||||
for (int i = 0; i < d.Capabilities.Count; i++)
|
||||
@@ -247,16 +247,8 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d.Capabilities[i].Width + " x " + d.Capabilities[i].Height +
|
||||
" @ " + d.Capabilities[i].Framerate + "FPS");
|
||||
}
|
||||
_SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0;
|
||||
|
||||
_Config.MonikerString = d.MonikerString;
|
||||
_Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
|
||||
_Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
|
||||
_Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
|
||||
|
||||
CWebcam.Close();
|
||||
CWebcam.Select(_Config);
|
||||
CWebcam.Start();
|
||||
_CapabilityNr = -1;
|
||||
_OnCapabilitiesEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,24 +258,27 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection;
|
||||
|
||||
SWebcamDevice d = CWebcam.GetDevices()[_SelectSlides[_SelectSlideWebcamDevices].Selection];
|
||||
SWebcamDevice d = CWebcam.GetDevices()[_DeviceNr];
|
||||
_Config.MonikerString = d.MonikerString;
|
||||
_Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width;
|
||||
_Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height;
|
||||
_Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate;
|
||||
_Config.Width = d.Capabilities[_CapabilityNr].Width;
|
||||
_Config.Height = d.Capabilities[_CapabilityNr].Height;
|
||||
_Config.Framerate = d.Capabilities[_CapabilityNr].Framerate;
|
||||
|
||||
CWebcam.Close();
|
||||
CWebcam.Select(_Config);
|
||||
CWebcam.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void _GetFirstConfiguredWebcamDevice(ref int device, ref int capabilities)
|
||||
private bool _GetFirstConfiguredWebcamDevice(out int device, out int capabilities)
|
||||
{
|
||||
SWebcamDevice[] devices = CWebcam.GetDevices();
|
||||
|
||||
if (devices == null)
|
||||
return;
|
||||
{
|
||||
device = -1;
|
||||
capabilities = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < devices.Length; i++)
|
||||
{
|
||||
@@ -296,10 +291,13 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
device = i;
|
||||
capabilities = j;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
device = 0;
|
||||
capabilities = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,13 +141,13 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
else if (_Buttons[_ButtonDelete].Selected)
|
||||
_DeleteProfile();
|
||||
else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonWebcam].Selected)
|
||||
_OnWebcam();
|
||||
else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonSaveSnapshot].Selected)
|
||||
_OnSaveSnapshot();
|
||||
else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonDiscardSnapshot].Selected)
|
||||
_OnDiscardSnapshot();
|
||||
else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonTakeSnapshot].Selected)
|
||||
_OnTakeSnapshot();
|
||||
break;
|
||||
|
||||
@@ -235,13 +235,13 @@ namespace Vocaluxe.Screens
|
||||
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex,
|
||||
(EOffOn)_SelectSlides[_SelectSlideActive].Selection);
|
||||
}
|
||||
else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonWebcam].Selected)
|
||||
_OnWebcam();
|
||||
else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonSaveSnapshot].Selected)
|
||||
_OnSaveSnapshot();
|
||||
else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonDiscardSnapshot].Selected)
|
||||
_OnDiscardSnapshot();
|
||||
else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable())
|
||||
else if (_Buttons[_ButtonTakeSnapshot].Selected)
|
||||
_OnTakeSnapshot();
|
||||
}
|
||||
|
||||
@@ -270,15 +270,16 @@ namespace Vocaluxe.Screens
|
||||
|
||||
int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex);
|
||||
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(avatarID);
|
||||
if (CWebcam.IsDeviceAvailable() && CWebcam.IsCapturing())
|
||||
if (_Snapshot == null)
|
||||
{
|
||||
if (_Snapshot == null)
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
|
||||
_Statics[_StaticAvatar].Texture = _WebcamTexture;
|
||||
if (CWebcam.IsCapturing())
|
||||
{
|
||||
if (CWebcam.GetFrame(ref _WebcamTexture))
|
||||
_Statics[_StaticAvatar].Texture = _WebcamTexture;
|
||||
}
|
||||
else
|
||||
_Statics[_StaticAvatar].Texture = CProfiles.GetAvatarTexture(avatarID);
|
||||
}
|
||||
else
|
||||
_Statics[_StaticAvatar].Texture = CProfiles.GetAvatarTexture(avatarID);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -310,22 +311,36 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _OnTakeSnapshot()
|
||||
{
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = true;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = true;
|
||||
_Buttons[_ButtonWebcam].Visible = false;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||
_Snapshot = CWebcam.GetBitmap();
|
||||
if (!CWebcam.IsDeviceAvailable())
|
||||
{
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
_Snapshot = null;
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = false;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = false;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||
_Buttons[_ButtonWebcam].Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CWebcam.Stop(); //Do this first to get consistent frame and bitmap
|
||||
_Snapshot = CWebcam.GetBitmap();
|
||||
if (CWebcam.GetFrame(ref _WebcamTexture))
|
||||
_Statics[_StaticAvatar].Texture = _WebcamTexture;
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = true;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = true;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||
_Buttons[_ButtonWebcam].Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnDiscardSnapshot()
|
||||
{
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
_Snapshot = null;
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = false;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = false;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||
_Buttons[_ButtonWebcam].Visible = true;
|
||||
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
|
||||
}
|
||||
|
||||
private void _OnSaveSnapshot()
|
||||
@@ -339,13 +354,12 @@ namespace Vocaluxe.Screens
|
||||
_Snapshot.Save(filename, ImageFormat.Png);
|
||||
|
||||
_Snapshot = null;
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = false;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = false;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = false;
|
||||
_Buttons[_ButtonWebcam].Visible = true;
|
||||
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
|
||||
|
||||
int id = CProfiles.NewAvatar(filename);
|
||||
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id);
|
||||
@@ -354,9 +368,13 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _OnWebcam()
|
||||
{
|
||||
if (!CWebcam.IsDeviceAvailable())
|
||||
{
|
||||
_Buttons[_ButtonWebcam].Visible = false;
|
||||
return;
|
||||
}
|
||||
_Snapshot = null;
|
||||
CWebcam.Start();
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
_Buttons[_ButtonSaveSnapshot].Visible = false;
|
||||
_Buttons[_ButtonDiscardSnapshot].Visible = false;
|
||||
_Buttons[_ButtonTakeSnapshot].Visible = true;
|
||||
@@ -449,7 +467,7 @@ namespace Vocaluxe.Screens
|
||||
foreach (CAvatar avatar in avatars)
|
||||
{
|
||||
_SelectSlides[_SelectSlideAvatars].AddValue(
|
||||
Path.GetFileName(avatar.FileName),
|
||||
avatar.GetDisplayName(),
|
||||
null,
|
||||
avatar.ID,
|
||||
-1);
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Vocaluxe.Screens
|
||||
case Keys.W:
|
||||
if (CWebcam.IsDeviceAvailable())
|
||||
{
|
||||
_Webcam = !_Webcam;
|
||||
_Webcam = !CWebcam.IsCapturing();
|
||||
if (_Webcam)
|
||||
CWebcam.Start();
|
||||
else
|
||||
@@ -756,7 +756,7 @@ namespace Vocaluxe.Screens
|
||||
CParty.FinishedSinging();
|
||||
|
||||
if (_Webcam)
|
||||
CWebcam.Close();
|
||||
CWebcam.Stop();
|
||||
}
|
||||
|
||||
private int _FindCurrentLine(CVoice voice, CSongLine[] lines, CSong song)
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
<Compile Include="Base\CPlaylistElement.cs" />
|
||||
<Compile Include="Base\CRecord.cs" />
|
||||
<Compile Include="COSFunctions.cs" />
|
||||
<Compile Include="Lib\Sound\Playback\CRingBuffer.cs" />
|
||||
<Compile Include="Lib\Sound\Playback\GstreamerSharp\CGstreamerSharpAudioStream.cs" />
|
||||
<Compile Include="Lib\Sound\Playback\OpenAL\COpenAlStream.cs" />
|
||||
<Compile Include="Lib\Sound\Playback\PortAudio\CPortAudioStream.cs" />
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current value and sets finished
|
||||
/// Gets the current value and sets finished
|
||||
/// </summary>
|
||||
/// <param name="finished">Set to whether fading has finished</param>
|
||||
/// <returns>Current value (between from and to values)</returns>
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list with all files in the given path that match a given pattern
|
||||
/// Returns a list with all files in the given path that match a given pattern
|
||||
/// </summary>
|
||||
/// <param name="path">Path to search for</param>
|
||||
/// <param name="searchPattern">Pattern to match (e.g. "*.jpg")</param>
|
||||
@@ -195,7 +195,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list with all files in the given path that matches at least one of the given patterns
|
||||
/// Returns a list with all files in the given path that matches at least one of the given patterns
|
||||
/// </summary>
|
||||
/// <param name="path">Path to search for</param>
|
||||
/// <param name="searchPatterns">List of patterns to match</param>
|
||||
@@ -212,7 +212,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list with all image files in the given path
|
||||
/// Returns a list with all image files in the given path
|
||||
/// </summary>
|
||||
/// <param name="path">Path to search for</param>
|
||||
/// <param name="recursive">Search directories recursively</param>
|
||||
@@ -224,7 +224,7 @@ namespace VocaluxeLib
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list with all image files in the given path
|
||||
/// Returns a list with all image files in the given path
|
||||
/// </summary>
|
||||
/// <param name="path">Path to search for</param>
|
||||
/// <param name="recursive">Search directories recursively</param>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
enum EEqualizerStyle
|
||||
{
|
||||
Collums
|
||||
Columns
|
||||
}
|
||||
|
||||
struct SThemeEqualizer
|
||||
@@ -64,6 +64,8 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
private float[] _Bars;
|
||||
private int _MaxBar;
|
||||
private float _MaxVolume;
|
||||
|
||||
public CEqualizer(int partyModeID)
|
||||
{
|
||||
@@ -211,17 +213,31 @@ namespace VocaluxeLib.Menu
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Update(float[] weights)
|
||||
public void Update(float[] weights, float volume)
|
||||
{
|
||||
if (weights == null || weights.Length == 0 || _Bars == null)
|
||||
return;
|
||||
if (volume < 0.001)
|
||||
return;
|
||||
if (volume > _MaxVolume)
|
||||
_MaxVolume = volume;
|
||||
_MaxBar = 0;
|
||||
float maxVal = -99f;
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
if (weights.Length > i)
|
||||
{
|
||||
_Bars[i] = 1f - weights[i];
|
||||
if (_Theme.DrawNegative == EOffOn.TR_CONFIG_OFF && weights[i] < 0)
|
||||
_Bars[i] = 1f + weights[i];
|
||||
_Bars[i] = 0f;
|
||||
else
|
||||
{
|
||||
_Bars[i] = weights[i] * volume / _MaxVolume;
|
||||
if (_Bars[i] > maxVal)
|
||||
{
|
||||
maxVal = _Bars[i];
|
||||
_MaxBar = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
_Bars[i] = 0f;
|
||||
@@ -235,30 +251,22 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
_Bars[i] = 0f;
|
||||
_MaxBar = 0;
|
||||
_MaxVolume = 0f;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (_Bars == null || _Theme.Style != EEqualizerStyle.Collums)
|
||||
if (_Bars == null || _Theme.Style != EEqualizerStyle.Columns)
|
||||
return;
|
||||
|
||||
float dx = Rect.W / _Bars.Length;
|
||||
int max = _Bars.Length - 1;
|
||||
float maxB = _Bars[max];
|
||||
for (int i = 0; i < _Bars.Length - 1; i++)
|
||||
{
|
||||
if (_Bars[i] > maxB)
|
||||
{
|
||||
maxB = _Bars[i];
|
||||
max = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
var bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
|
||||
SColorF color = Color;
|
||||
if (i == max)
|
||||
if (i == _MaxBar)
|
||||
color = MaxColor;
|
||||
|
||||
CBase.Drawing.DrawColor(color, bar);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using VocaluxeLib.Draw;
|
||||
|
||||
namespace VocaluxeLib.Profile
|
||||
@@ -22,8 +24,9 @@ namespace VocaluxeLib.Profile
|
||||
public class CAvatar
|
||||
{
|
||||
public int ID;
|
||||
private string _FileName = "";
|
||||
private readonly string _FileName = "";
|
||||
private CTexture _Texture;
|
||||
private const int _MaxNameLen = 12;
|
||||
|
||||
public CTexture Texture
|
||||
{
|
||||
@@ -42,13 +45,9 @@ namespace VocaluxeLib.Profile
|
||||
|
||||
private CAvatar(CTexture texture, string fileName, int id = -1)
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public bool LoadFromFile(string fileName)
|
||||
{
|
||||
_Texture = texture;
|
||||
_FileName = fileName;
|
||||
return Reload();
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public bool Reload()
|
||||
@@ -63,5 +62,14 @@ namespace VocaluxeLib.Profile
|
||||
{
|
||||
CBase.Drawing.RemoveTexture(ref _Texture);
|
||||
}
|
||||
|
||||
public string GetDisplayName()
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(_FileName);
|
||||
Debug.Assert(name != null);
|
||||
if (name.Length > _MaxNameLen)
|
||||
name = name.Substring(0, _MaxNameLen);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,35 @@ namespace VocaluxeLib.Songs
|
||||
_Tw.WriteLine(addLine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a good beat for a line break that is >=firstPossibleBeat and <firstNoteBeat
|
||||
/// Based on algorithm used by YASS: http://www.yass-along.com/errors.html
|
||||
/// </summary>
|
||||
/// <param name="firstPossibleBeat">First beat that is possible for a line break (equal (just after) previous line note end)</param>
|
||||
/// <param name="firstNoteBeat">First note beat on current line</param>
|
||||
/// <returns>A good beat for the line break</returns>
|
||||
private int _GetBreakBeat(int firstPossibleBeat, int firstNoteBeat)
|
||||
{
|
||||
int breakBeat;
|
||||
int diff = firstNoteBeat - firstPossibleBeat;
|
||||
float timeDiff = CBase.Game.GetTimeFromBeats(diff, _Song.BPM);
|
||||
if (timeDiff > 4f)
|
||||
breakBeat = firstPossibleBeat + (int)CBase.Game.GetBeatFromTime(2f, _Song.BPM, 0f);
|
||||
else if (timeDiff > 2f)
|
||||
breakBeat = firstPossibleBeat + (int)CBase.Game.GetBeatFromTime(1f, _Song.BPM, 0f);
|
||||
else if (diff < 2)
|
||||
breakBeat = firstPossibleBeat;
|
||||
else if (diff < 9)
|
||||
breakBeat = firstNoteBeat - 2;
|
||||
else if (diff < 13)
|
||||
breakBeat = firstNoteBeat - 3;
|
||||
else if (diff < 17)
|
||||
breakBeat = firstNoteBeat - 4;
|
||||
else
|
||||
breakBeat = firstPossibleBeat + 12;
|
||||
return breakBeat;
|
||||
}
|
||||
|
||||
private void _WriteNotes()
|
||||
{
|
||||
for (int i = 0; i < _Song.Notes.VoiceCount; i++)
|
||||
@@ -129,13 +158,13 @@ namespace VocaluxeLib.Songs
|
||||
CVoice voice = _Song.Notes.GetVoice(i);
|
||||
if (_Song.Notes.VoiceCount > 1)
|
||||
_Tw.WriteLine("P" + Math.Pow(2, i));
|
||||
bool firstLine = true;
|
||||
int currentBeat = 0;
|
||||
CSongLine lastLine = null;
|
||||
foreach (CSongLine line in voice.Lines)
|
||||
{
|
||||
if (!firstLine)
|
||||
if (lastLine != null)
|
||||
{
|
||||
string lineTxt = "- " + (line.StartBeat - currentBeat);
|
||||
string lineTxt = "- " + (_GetBreakBeat(lastLine.EndBeat + 1, line.FirstNoteBeat) - currentBeat);
|
||||
if (_Song.Relative)
|
||||
{
|
||||
lineTxt += " " + (line.FirstNoteBeat - currentBeat);
|
||||
@@ -143,8 +172,6 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
_Tw.WriteLine(lineTxt);
|
||||
}
|
||||
else
|
||||
firstLine = false;
|
||||
foreach (CSongNote note in line.Notes)
|
||||
{
|
||||
string tag;
|
||||
@@ -164,6 +191,7 @@ namespace VocaluxeLib.Songs
|
||||
}
|
||||
_Tw.WriteLine(tag + " " + (note.StartBeat - currentBeat) + " " + note.Duration + " " + note.Tone + " " + note.Text);
|
||||
}
|
||||
lastLine = line;
|
||||
}
|
||||
}
|
||||
_Tw.WriteLine("E");
|
||||
@@ -177,11 +205,21 @@ namespace VocaluxeLib.Songs
|
||||
_WriteHeader();
|
||||
_WriteNotes();
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
CBase.Log.LogError("Cannot write " + filePath + ". Directory might be readonly or requires admin rights.");
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Unhandled exception while writing " + filePath + ": " + e);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_Tw != null)
|
||||
_Tw.Dispose();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,29 +14,7 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -48,7 +26,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -59,7 +37,7 @@
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
@@ -70,7 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
@@ -81,39 +59,7 @@
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x86'">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|AnyCPU'">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace WebserverInitalConfig
|
||||
CngKey key;
|
||||
try
|
||||
{
|
||||
key= CngKey.Create(CngAlgorithm2.Rsa, Guid.NewGuid().ToString(), keyParam);
|
||||
key = CngKey.Create(CngAlgorithm2.Rsa, Guid.NewGuid().ToString(), keyParam);
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user