diff --git a/GstreamerHelper/GstreamerAudioStream.cpp b/GstreamerHelper/GstreamerAudioStream.cpp
index 1aa4d4c9..212b9eaa 100644
--- a/GstreamerHelper/GstreamerAudioStream.cpp
+++ b/GstreamerHelper/GstreamerAudioStream.cpp
@@ -184,11 +184,9 @@ void GstreamerAudioStream::RefreshDuration()
{
if(Element)
{
- gint64 time;
- if(!gst_element_query_duration(Element, GST_FORMAT_TIME, &time)) {
- LogError("Could not query duration");
- }
- Duration = (gfloat)((gdouble)(time/GST_SECOND));
+ gint64 time = -1000;
+ if(gst_element_query_duration(Element, GST_FORMAT_TIME, &time))
+ Duration = (gfloat)((gdouble)(time/GST_SECOND));
}
}
@@ -196,9 +194,11 @@ float GstreamerAudioStream::GetPosition()
{
if(Element)
{
- gint64 time;
- gst_element_query_position(Element, GST_FORMAT_TIME, &time);
- return (float)((gdouble)time/GST_SECOND);
+ gint64 time = 0;
+ if (gst_element_query_position(Element, GST_FORMAT_TIME, &time))
+ return (float)((gdouble)time/GST_SECOND);
+ else
+ return -1;
}
else return -1;
}
diff --git a/GstreamerHelper/GstreamerVideo.cpp b/GstreamerHelper/GstreamerVideo.cpp
index 214f0709..ab025608 100644
--- a/GstreamerHelper/GstreamerVideo.cpp
+++ b/GstreamerHelper/GstreamerVideo.cpp
@@ -19,7 +19,7 @@ DllExport bool InitVideo()
#if _WIN64
SetDllDirectory(L".\\x64\\gstreamer");
#else
- SetDllDirectory(L".\\x86\gstreamer");
+ SetDllDirectory(L".\\x86\\gstreamer");
#endif
gst_init(NULL, NULL);
diff --git a/Output/Languages/Dutch.xml b/Output/Languages/Dutch.xml
new file mode 100644
index 00000000..4f974b41
--- /dev/null
+++ b/Output/Languages/Dutch.xml
@@ -0,0 +1,199 @@
+
+
+ Nederlands
+ Vocaluxe
+ en
+ Afsluiten
+ Opslaan
+ Terug
+ Start
+ Geluidstreams
+ Videostreams
+ Structuren
+ ToneAbs
+ Maximaal Volume
+ Liedjes geladen
+ Muis
+ Normaal
+ Duet
+ Medley
+ Korte versie
+ Vocale Held
+ Superster
+ Hoofdzanger
+ Ster in wording
+ Hoopvol
+ Wannabe
+ Amateur
+ Toondoof
+ Software
+ OpenGL
+ Direct3D
+ Laagst
+ Laag
+ Medium
+ Hoog
+ Hoogst
+ Uit
+ Aan
+ Alleen FPS
+ Niveau 1
+ Niveau 2
+ Niveau 3
+ Max
+ Lijst
+ Dreidel
+ Tegels
+ Boek
+ Op aanvraag
+ Bij het opstarten
+ Dynamisch
+ Geen
+ Willekeurig
+ Map
+ Artiest
+ Artiestletter
+ Tegelletter
+ Editie
+ Genre
+ Jaar
+ Decennium
+ Taal
+ Eenvoudig
+ Normaal
+ Moeilijk
+ Huidig
+ Te gaan
+ Totaal
+ Normaal
+ Uitgebreid
+ Eigen Muziek en Achtergrondmuziek
+ Geen eigen Muziek
+ Alleen eigen Muziek
+ Alles
+ Alleen namen en avatars
+ Niets
+ Laden
+ Totaal
+ Liedjes
+ geladen
+ Hoofdmenu
+ Zing
+ Party
+ Instellingen
+ Profielen
+ Partymodus Selectie
+ Partymodus
+ Omschrijving
+ Auteur
+ Versie
+ Kan deze Partymodus niet laden
+ Doelgroep
+ Geen teams
+ Aantal teams
+ Aantal spelers
+ Spelerselectie
+ Speler
+ 1 Speler
+ 2 Spelers
+ 3 Spelers
+ 4 Spelers
+ 5 Spelers
+ 6 Spelers
+ Waarschuwing: Er is geen microfoon toegewezen aan speler %v!
+ Waarschuwing: Er zijn geen microfoons toegewezen aan spelers %v!
+ Waarschuwing: Er is geen profiel toegewezen aan speler %v!
+ Waarschuwing: Er zijn geen profielen toegewezen aan spelers %v!
+ Liedjesselectie
+ Zing
+ Toevoegen aan afspeellijst
+ Sluiten
+ Kies een willekeurig liedje
+ Kies een willekeurige categorie
+ Zing alle liedjes
+ Zing alle zichtbare liedjes
+ Open afspeellijst
+ Zing een willekeurige medley
+ Zing medleyliedjes
+ Nieuwe afspeellijst
+ Liedjesopties
+ Zoek:
+ Geen taal
+ Geen jaar
+ Geen genre
+ Geen editie
+ Alle liedjes
+ (%v Liedjes)
+ (%v Liedje)
+ Pauze
+ Stop met zingen
+ Doorgaan
+ Sla dit liedje over
+ Scores
+ Beoordeling
+ Punten
+ Moeilijkheidsgraad
+ Totaalscore
+ Highscore
+ Profielen
+ Spelernaam
+ Moeilijkheidsgraad
+ Avatar
+ Gastprofiel
+ Actief
+ Nieuw
+ Verwijderen
+ Maak Screenshot
+ Bewaar Screenshot
+ Verwijder Screenshot
+ Webcam
+ Menu-opties
+ Spel
+ Geluid
+ Opname
+ Video
+ Songteksten
+ Thema
+ Spelinstellingen
+ Taal
+ Debug Niveau
+ Liedjesmenu
+ Sorteren Liedjes
+ Tabs
+ Moeilijkheidsgraad
+ Timermodus
+ Opname-opties
+ Apparaat
+ Input
+ Kanaal 1
+ Kanaal 2
+ Microfoonvertraging
+ Waarschuwing: Ten minste één speler is toegewezen aan twee microfoons.
+ Vertragingstest
+ Geluidsopties
+ Achtergrondmuziek
+ Volume Achtergrondmuziek
+ Bron Achtergrondmuziek
+ Preview Muziekvolume
+ Spel Muziekvolume
+ Thema-opties
+ Thema
+ Skin
+ Coverthema
+ Toon Nootlijnen
+ Toon Toonhelper
+ Uiterlijk Timer
+ Fade Spelerinformatie
+ Gedrag Laden Covers
+ Songtekstopties
+ Stijl
+ Songteksten bovenaan
+ Video-opties
+ Videoachtergronden
+ Videopreview
+ Video tijdens zingen
+ Toon huidige achtergrondmuziekvideo
+ Webcams
+ Webcaminstellingen
+ Volume
+
diff --git a/Output/Languages/Turkish.xml b/Output/Languages/Turkish.xml
new file mode 100644
index 00000000..0b1cc669
--- /dev/null
+++ b/Output/Languages/Turkish.xml
@@ -0,0 +1,199 @@
+
+
+ Türkçe
+ Vocaluxe
+ ve
+ Çıkış
+ Kaydet
+ Geri
+ Başla
+ Ses akışları
+ Video akışları
+ Desenler
+ ABS Tonu
+ Max Ses
+ Yüklenen şarkılar
+ Fare
+ Normal
+ Düet
+ Potpuri
+ Kısa versiyon
+ Sözlü Kahraman
+ Süperstar
+ Solist
+ Yükselen Yıldız
+ Ümit Vaadeden
+ Taklitçi
+ Amatör
+ Müzik Kulağı Olmayan
+ Yazılım
+ OpenGL
+ Direct3D
+ En düşük
+ Düşük
+ Orta
+ Yüksek
+ En Yüksek
+ Kapalı
+ Açık
+ Sadece FPS
+ Seviye 1
+ Seviye 2
+ Seviye 3
+ Max
+ Liste
+ Dreidel
+ Döşemeli Pano
+ Kitap
+ İstek Üzerine
+ Başlangıçta
+ Dinamik
+ Yok
+ Rasgele
+ Klasör
+ Sanatçı
+ Sanatçı Harfi
+ Başlık Harfi
+ Basım
+ Tür
+ Yıl
+ On yıl
+ Dil
+ Kolay
+ Normal
+ Zor
+ Şimdiki
+ Kalan
+ Toplam
+ Normal
+ Genişletilmiş
+ Kendi Müziğiniz ve Arkaplan Müziği
+ Hiç kendi müziğiniz yok
+ Sadece kendi Müziğim
+ Hepsi
+ Sadece isimler ve fotoğrafları
+ Hiçbirşey
+ Yükleniyor
+ Toplam
+ Şarkılar
+ yüklendi
+ Ana Menü
+ Şarkı
+ Parti
+ Seçenekler
+ Profiller
+ Parti Modu Seçeneği
+ Parti Modu
+ Açıklama
+ Yazar
+ Sürüm
+ Bu parti modu yüklenemedi
+ Hedef dinleyici
+ Takım yok
+ Takım sayısı
+ Oyuncu sayısı
+ Oyuncu Seçimi
+ Oyuncu
+ 1 Oyuncu
+ 2 Oyunculu
+ 3 Oyunculu
+ 4 Oyunculu
+ 5 Oyunculu
+ 6 Oyunculu
+ Uyarı: %v oyuncusu için hiç mikrofon atanmadı!
+ Uyarı: %v oyuncuları için hiç mikrofon atanmadı!
+ Uyarı: %v oyuncusu için hiç profil atanmadı!
+ Uyarı: %v oyuncuları için hiç profil atanmadı!
+ Şarkı Seçimi
+ Şarkı Söyle
+ Çalma Listesine Ekle
+ Kapat
+ Rastgele bir şarkı seç
+ Rastgele bir kategori seç
+ Tüm şarkıları söyle
+ Tüm görünür şarkıları söyle
+ Çalma listesini aç
+ Rastgele bir potpuri söyle
+ Potpuri şarkılarını söyle
+ Yeni Çalma Listesi
+ Şarkı Seçenekleri
+ Arama:
+ Dil yok
+ Yıl yok
+ Tür yok
+ Basım yok
+ Tüm Şarkılar
+ (%v Şarkıları)
+ (%v Şarkısı)
+ Duraklat
+ Şarkı söylemeyi durdur
+ Devam et
+ Bu şarkıyı atla
+ Skorlar
+ Derecelendirme
+ Puanlar
+ Zorluk Derecesi
+ Genel skor
+ Yüksek skor
+ Profiller
+ Oyuncu Adı
+ Oyun Zorluğu
+ Profil Resmi
+ Misafir Profili
+ Aktif
+ Yeni
+ Sil
+ Ekran Görüntüsü Al
+ Ekran Görüntüsünü Kaydet
+ Ekran Görüntüsünü Sil
+ Webcam
+ Menü Seçenekleri
+ Oyun
+ Ses
+ Kayıt
+ Video
+ Sözler
+ Tema
+ Oyun Seçenekleri
+ Dil
+ Hata Ayıklama Seviyesi
+ Şarkı Menüsü
+ Şarkı Sıralama
+ Sekmeler
+ Oyun Zorluğu
+ Zamanlayıcı Modu
+ Kaydetme Seçenekleri
+ Aygıt
+ Giriş
+ Kanal 1
+ Kanal 2
+ Mikrofon Gecikmesi
+ Uyarı: Tek oyuncuya iki mikrofon atandı.
+ Gecikme Testi
+ Ses Seçenekleri
+ Arka Plan Müziği
+ Arka Plan Müziği Seviyesi
+ Arka Plan Müziği Kaynağı
+ Ön İzleme Müziği Seviyesi
+ Oyun Müziği Seviyesi
+ Tema Seçenekleri
+ Tema
+ Renk
+ Kapak Teması
+ Not Çizgilerini Göster
+ Ton Yardımcısını Göster
+ Kronometre Bakışı
+ Oyuncu Bilgisini Kapat
+ Kapak Yüklenme Davranışı
+ Şarkı Sözü Seçenekleri
+ Tarz
+ Sözler Yukarıda Gösterilsin
+ Video Seçenekleri
+ Video Arka Planları
+ Video Önizleme
+ Şarkı Söylerken Videoları Gösterme
+ Mevcut Arka Plan Müziği Videosunu Göster
+ Web Kameraları
+ Web Kameraları Özellikleri
+ Ses
+
diff --git a/Output/PartyModes/Challenge/Languages/Dutch.xml b/Output/PartyModes/Challenge/Languages/Dutch.xml
new file mode 100644
index 00000000..07af44e1
--- /dev/null
+++ b/Output/PartyModes/Challenge/Languages/Dutch.xml
@@ -0,0 +1,29 @@
+
+
+ Engels
+ Uitdaging
+ Speel Uitdaging.
+ Voor iedereen geïnteresseerd in duelleren.
+ Volgende
+ Vorige
+ Start
+ Afsluiten
+ Ja
+ Nee
+ Volgende Ronde
+ Uitdaging: Configuratie
+ Aantal spelers
+ Aantal microfoons
+ Aantal rondes
+ Uitdaging: Kies speler
+ Uitdaging: Overzicht
+ #
+ Naam
+ Rondes
+ Overwinningen
+ Zingpunten
+ Score
+ Wil je echt afsluiten?
+ Speler van volgende ronde:
+ Alle rondes zijn gezongen! De winnaar is...
+
diff --git a/Output/PartyModes/Challenge/Languages/Turkish.xml b/Output/PartyModes/Challenge/Languages/Turkish.xml
new file mode 100644
index 00000000..9ba850ee
--- /dev/null
+++ b/Output/PartyModes/Challenge/Languages/Turkish.xml
@@ -0,0 +1,29 @@
+
+
+ Türkçe
+ Yarışma Modu
+ Biraz yarışma turu oyna.
+ Düello yarışmalarıyla ilgilenen herkes için.
+ Sonraki
+ Önceki
+ Başla
+ Çıkış
+ Evet
+ Hayır
+ Sonraki Tur
+ Yarışma Modu: Yapılandırma
+ Oyuncu sayısı
+ Mikrofon sayısı
+ Tur sayısı
+ Yarışma Modu: Oyuncu Seçiniz
+ Yarışma Modu: Genel Bakış
+ Pozisyon
+ İsim
+ Turlar
+ Kazanma
+ Şarkı Söyleme Puanı
+ Skor
+ Gerçekten çıkmak istiyor musunuz?
+ Sonraki turun oyuncusu:
+ Tüm turlar tamamlandı! Kazanan...
+
diff --git a/Output/PartyModes/ChallengeMedley/Languages/Dutch.xml b/Output/PartyModes/ChallengeMedley/Languages/Dutch.xml
new file mode 100644
index 00000000..cb09ce08
--- /dev/null
+++ b/Output/PartyModes/ChallengeMedley/Languages/Dutch.xml
@@ -0,0 +1,29 @@
+
+
+ Engels
+ Uitdaging Medley
+ Speel Uitdaging met alleen 5 Medleys
+ Voor iedereen geïnteresseerd in duelleren en Medleys.
+ Volgende
+ Vorige
+ Start
+ Afsluiten
+ Ja
+ Nee
+ Volgende Ronde
+ Uitdaging Medley: Configuratie
+ Aantal spelers
+ Aantal microfoons
+ Aantal rondes
+ Uitdaging Medley: Kies speler
+ Uitdaging Medley: Overzicht
+ #
+ Naam
+ Rondes
+ Overwinningen
+ Zingpunten
+ Score
+ Wil je echt afsluiten?
+ Speler van volgende ronde:
+ Alle rondes zijn gezonden! De winnaar is...
+
diff --git a/Output/PartyModes/ChallengeMedley/Languages/Turkish.xml b/Output/PartyModes/ChallengeMedley/Languages/Turkish.xml
new file mode 100644
index 00000000..4085291f
--- /dev/null
+++ b/Output/PartyModes/ChallengeMedley/Languages/Turkish.xml
@@ -0,0 +1,29 @@
+
+
+ Türkçe
+ Potpuri Yarış Modu
+ Sadece 5 Potpuri kullanarak yarışma turları oyna.
+ Düel yarışmaları ve Potpuri ile ilgilenen herkes için.
+ Sonraki
+ Önceki
+ Başla
+ Çık
+ Evet
+ Hayır
+ Sonraki Tur
+ Potpuri Yarış Modu: Yapılandırma
+ Oyuncu sayısı
+ Mikrofon sayısı
+ Tur sayısı
+ Potpuri Yarışma Modu: Oyuncu Seçimi
+ Potpuri Yarışma Modu: Genel Bakış
+ Pos
+ İsim
+ Tur
+ Kazanma
+ Şarkı Söyleme Puanı
+ Skor
+ Gerçekten çıkmak istiyor musunuz?
+ Sonraki tur oyuncusu:
+ Tüm turlar tamamlandı! Kazanan...
+
diff --git a/Output/PartyModes/TicTacToe/Languages/Dutch.xml b/Output/PartyModes/TicTacToe/Languages/Dutch.xml
new file mode 100644
index 00000000..32015cfc
--- /dev/null
+++ b/Output/PartyModes/TicTacToe/Languages/Dutch.xml
@@ -0,0 +1,34 @@
+
+
+ Engels
+ Drie-op-een-rij
+ Speel Drie-op-een-rij op een speciale manier
+ Grappige rondes met strategie, geluk en kunde
+ Volgende
+ Vorige
+ Start
+ Afsluiten
+ Ja
+ Nee
+ Start
+ Liedjes
+ Team
+ Afspeellijst
+ Categorie
+ Alle liedjes
+ Drie-op-een-rij: configuratie
+ Aantal spelers in team 1
+ Aantal spelers in team 2
+ Aantal vakjes
+ Liedjesbron
+ Spelmodus
+ Drie-op-een-rij: Kies speler
+ Team 1
+ Team 2
+ Drie-op-een-rij
+ Kies een vakje.
+ Volgende speler
+ Drie-op-een-rij afsluiten?
+ En de winnaar is...
+ Er is geen winnaar in deze ronde...
+
diff --git a/Output/PartyModes/TicTacToe/Languages/Turkish.xml b/Output/PartyModes/TicTacToe/Languages/Turkish.xml
new file mode 100644
index 00000000..9af5e420
--- /dev/null
+++ b/Output/PartyModes/TicTacToe/Languages/Turkish.xml
@@ -0,0 +1,34 @@
+
+
+ Türkçe
+ XOX oyunu
+ Özel bir şekilde XOX oyna
+ Strateji, şans ve becerilerle eğlenceli turlar
+ Sonraki
+ Önceki
+ Başla
+ Çıkış
+ Evet
+ Hayır
+ Başla
+ Şarkılar
+ Takım
+ Çalma Listesi
+ Kategori
+ Tüm Şarkılar
+ XOX: Yapılandırma
+ 1. takımdaki oyuncu sayısı
+ 2. takımdaki oyuncu sayısı
+ Bölge sayısı
+ Şarkı Kaynağı
+ Oyun Modu
+ XOX: Oyuncu Seç
+ 1. Takım
+ 2. Takım
+ XOX
+ Bir bölge seç.
+ Sonraki oyuncu
+ XOX oyunundan gerçekten çıkmak istiyor musunuz?
+ Ve kazanan...
+ Bu turdan hiç kazanan çıkmadı...
+
diff --git a/Output/x64/SQLite.Interop.dll b/Output/x64/SQLite.Interop.dll
new file mode 100644
index 00000000..0188070e
Binary files /dev/null and b/Output/x64/SQLite.Interop.dll differ
diff --git a/Output/x64/SlimDX.dll b/Output/x64/SlimDX.dll
index 4132e870..ca05cbd7 100644
Binary files a/Output/x64/SlimDX.dll and b/Output/x64/SlimDX.dll differ
diff --git a/Output/x64/System.Data.SQLite.dll b/Output/x64/System.Data.SQLite.dll
index 6f07d5e7..1ee930f1 100644
Binary files a/Output/x64/System.Data.SQLite.dll and b/Output/x64/System.Data.SQLite.dll differ
diff --git a/Output/x64/acinerella.dll b/Output/x64/acinerella.dll
index e851fd01..eb6998e6 100644
Binary files a/Output/x64/acinerella.dll and b/Output/x64/acinerella.dll differ
diff --git a/Output/x64/avcodec-54.dll b/Output/x64/avcodec-54.dll
index ca074e7c..193d96cb 100644
Binary files a/Output/x64/avcodec-54.dll and b/Output/x64/avcodec-54.dll differ
diff --git a/Output/x64/avformat-54.dll b/Output/x64/avformat-54.dll
index 40521b17..67041399 100644
Binary files a/Output/x64/avformat-54.dll and b/Output/x64/avformat-54.dll differ
diff --git a/Output/x64/avutil-51.dll b/Output/x64/avutil-51.dll
deleted file mode 100644
index 5f8cdf7d..00000000
Binary files a/Output/x64/avutil-51.dll and /dev/null differ
diff --git a/Output/x64/avutil-52.dll b/Output/x64/avutil-52.dll
index d1985df4..c7ca9619 100644
Binary files a/Output/x64/avutil-52.dll and b/Output/x64/avutil-52.dll differ
diff --git a/Output/x64/swresample-0.dll b/Output/x64/swresample-0.dll
index f1150429..9b3af43d 100644
Binary files a/Output/x64/swresample-0.dll and b/Output/x64/swresample-0.dll differ
diff --git a/Output/x64/swscale-2.dll b/Output/x64/swscale-2.dll
index dcc41fd3..5d6588fe 100644
Binary files a/Output/x64/swscale-2.dll and b/Output/x64/swscale-2.dll differ
diff --git a/Output/x86/SQLite.Interop.dll b/Output/x86/SQLite.Interop.dll
new file mode 100644
index 00000000..89523cfb
Binary files /dev/null and b/Output/x86/SQLite.Interop.dll differ
diff --git a/Output/x86/SlimDX.dll b/Output/x86/SlimDX.dll
index 8715ac49..c02903f6 100644
Binary files a/Output/x86/SlimDX.dll and b/Output/x86/SlimDX.dll differ
diff --git a/Output/x86/System.Data.SQLite.dll b/Output/x86/System.Data.SQLite.dll
index aa398bbe..1ee930f1 100644
Binary files a/Output/x86/System.Data.SQLite.dll and b/Output/x86/System.Data.SQLite.dll differ
diff --git a/Output/x86/acinerella.dll b/Output/x86/acinerella.dll
index a39e3501..f651542d 100644
Binary files a/Output/x86/acinerella.dll and b/Output/x86/acinerella.dll differ
diff --git a/Output/x86/avcodec-54.dll b/Output/x86/avcodec-54.dll
index 97d7f850..7b08c266 100644
Binary files a/Output/x86/avcodec-54.dll and b/Output/x86/avcodec-54.dll differ
diff --git a/Output/x86/avformat-54.dll b/Output/x86/avformat-54.dll
index 7328c561..9dc249e0 100644
Binary files a/Output/x86/avformat-54.dll and b/Output/x86/avformat-54.dll differ
diff --git a/Output/x86/avutil-51.dll b/Output/x86/avutil-51.dll
deleted file mode 100644
index 5ab61687..00000000
Binary files a/Output/x86/avutil-51.dll and /dev/null differ
diff --git a/Output/x86/avutil-52.dll b/Output/x86/avutil-52.dll
index af2ce47e..100dc0f5 100644
Binary files a/Output/x86/avutil-52.dll and b/Output/x86/avutil-52.dll differ
diff --git a/Output/x86/swresample-0.dll b/Output/x86/swresample-0.dll
index 060469a0..6a77631b 100644
Binary files a/Output/x86/swresample-0.dll and b/Output/x86/swresample-0.dll differ
diff --git a/Output/x86/swscale-2.dll b/Output/x86/swscale-2.dll
index afa902a0..f3b957f8 100644
Binary files a/Output/x86/swscale-2.dll and b/Output/x86/swscale-2.dll differ
diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
index 61103a08..725cc119 100644
--- a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
+++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
@@ -10,9 +10,8 @@
Properties
VocaluxeLib.PartyModes.Challenge
Challenge
- v2.0
-
-
+ v4.0
+ Client
512
diff --git a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
index a09574e8..0990e176 100644
--- a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
+++ b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
@@ -10,9 +10,8 @@
Properties
VocaluxeLib.PartyModes.ChallengeMedley
ChallengeMedley
- v2.0
-
-
+ v4.0
+ Client
512
diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
index 51727704..ecb9f603 100644
--- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
+++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
@@ -10,9 +10,8 @@
Properties
VocaluxeLib.PartyModes.TicTacToe
TicTacToe
- v2.0
-
-
+ v4.0
+ Client
512
diff --git a/Vocaluxe.sln b/Vocaluxe.sln
index c01db1ba..b1eb0f0f 100644
--- a/Vocaluxe.sln
+++ b/Vocaluxe.sln
@@ -1,10 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe", "Vocaluxe\Vocaluxe.csproj", "{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}"
ProjectSection(ProjectDependencies) = postProject
+ {6F3E1874-F28A-40E9-AFBD-31934D593678} = {6F3E1874-F28A-40E9-AFBD-31934D593678}
+ {6F3E1874-F28A-40E9-AFBD-31934D593679} = {6F3E1874-F28A-40E9-AFBD-31934D593679}
{ED007796-367F-4142-AA55-5450C7645C2C} = {ED007796-367F-4142-AA55-5450C7645C2C}
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC} = {D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}
+ {5A4053F1-5AD5-441F-B254-D97A088127B6} = {5A4053F1-5AD5-441F-B254-D97A088127B6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VocaluxeLib", "VocaluxeLib\VocaluxeLib.csproj", "{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}"
@@ -110,13 +113,13 @@ Global
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.ActiveCfg = ReleaseWin|x86
{6F3E1874-F28A-40E9-AFBD-31934D593678}.ReleaseWin|x86.Build.0 = ReleaseWin|x86
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x64.ActiveCfg = DebugWin|x64
- {ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x86.ActiveCfg = DebugWin|Win32
+ {ED007796-367F-4142-AA55-5450C7645C2C}.DebugLinux|x86.ActiveCfg = DebugWin|x64
{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
{ED007796-367F-4142-AA55-5450C7645C2C}.DebugWin|x86.Build.0 = DebugWin|Win32
{ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x64.ActiveCfg = ReleaseWin|x64
- {ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x86.ActiveCfg = ReleaseWin|Win32
+ {ED007796-367F-4142-AA55-5450C7645C2C}.ReleaseLinux|x86.ActiveCfg = ReleaseWin|x64
{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
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index ec7a4a33..ad686f43 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -49,7 +49,7 @@ namespace Vocaluxe.Base
public static ETimerLook TimerLook = ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED;
public static EPlayerInfo PlayerInfo = EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH;
public static EFadePlayerInfo FadePlayerInfo = EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_OFF;
- public static ECoverLoading CoverLoading = ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART;
+ public static ECoverLoading CoverLoading = ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC;
public static ELyricStyle LyricStyle = ELyricStyle.Slide;
// Sound
diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs
index c27f0cc2..b06a93b9 100644
--- a/Vocaluxe/Base/CGraphics.cs
+++ b/Vocaluxe/Base/CGraphics.cs
@@ -311,7 +311,7 @@ namespace Vocaluxe.Base
CInput.Update();
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
- CSongs.LoadCover(30, 1);
+ CSongs.LoadCover();
if (CSettings.GameState != EGameState.EditTheme)
{
diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs
index fe6a1e7a..724171f2 100644
--- a/Vocaluxe/Base/CSettings.cs
+++ b/Vocaluxe/Base/CSettings.cs
@@ -39,7 +39,7 @@ namespace Vocaluxe.Base
public const int iVersionSub = 0; // patches
public const ERevision VersionRevision = ERevision.Alpha;
- public const int iBuild = 76; // Increase on every published version! Never Reset!
+ public const int iBuild = 77; // Increase on every published version! Never Reset!
public const int iDatabaseHighscoreVersion = 2;
public const int iDatabaseCoverVersion = 1;
diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs
index 1837cb2a..53e30bba 100644
--- a/Vocaluxe/Base/CSongs.cs
+++ b/Vocaluxe/Base/CSongs.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Threading;
+
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
@@ -42,6 +44,8 @@ namespace Vocaluxe.Base
public static CSongSorter Sorter = new CSongSorter();
public static CSongCategorizer Categorizer = new CSongCategorizer();
+ private static Thread _CoverLoaderThread = null;
+
public static List Songs
{
get { return _Songs; }
@@ -391,9 +395,7 @@ namespace Vocaluxe.Base
{
Song.ID = _Songs.Count;
_Songs.Add(Song);
- //Workaround to load notes if they are not loaded with the covers as there is no seperate progress indicator
- if (CConfig.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
- Song.ReadNotes();
+ Song.ReadNotes();
}
}
CLog.StopBenchmark(2, "Read TXTs");
@@ -410,14 +412,14 @@ namespace Vocaluxe.Base
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
{
CLog.StartBenchmark(2, "Load Covers/Notes");
- _LoadCoverAndNotes();
+ _LoadCover();
CLog.StopBenchmark(2, "Load Covers/Notes");
}
CLog.StopBenchmark(1, "Load Songs ");
GC.Collect();
}
- public static void LoadCover(int WaitTime, int NumLoads)
+ public static void LoadCover()
{
if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE)
return; //should be removed as soon as the other renderer are ready for queque
@@ -425,12 +427,16 @@ namespace Vocaluxe.Base
if (!SongsLoaded || CoverLoaded)
return;
- if (!_CoverLoadTimer.IsRunning)
+ if (_CoverLoaderThread == null)
{
- _CoverLoadTimer.Reset();
- _CoverLoadTimer.Start();
+ _CoverLoaderThread = new Thread(new ThreadStart(_LoadCover));
+ _CoverLoaderThread.Name = "CoverLoader";
+ _CoverLoaderThread.Priority = ThreadPriority.BelowNormal;
+ _CoverLoaderThread.IsBackground = true;
+ _CoverLoaderThread.Start();
}
+ /*
if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime)
{
for (int i = 0; i < NumLoads; i++)
@@ -449,13 +455,13 @@ namespace Vocaluxe.Base
_CoverLoadTimer.Reset();
_CoverLoadTimer.Start();
}
+ * */
}
- private static void _LoadCoverAndNotes()
+ private static void _LoadCover()
{
foreach (CSong song in _Songs)
{
- song.ReadNotes();
song.LoadSmallCover();
_CoverLoadIndex++;
}
diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
index ba63ece0..0a41a7e7 100644
--- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
+++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
@@ -8,10 +8,6 @@ namespace Vocaluxe.Lib.Sound.Decoder
{
class CAudioDecoderFFmpeg : CAudioDecoder, IDisposable
{
- private TAc_read_callback _rc;
- private TAc_seek_callback _sc;
- private FileStream _fs;
-
private IntPtr _instance = IntPtr.Zero;
private IntPtr _audiodecoder = IntPtr.Zero;
@@ -24,11 +20,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
public override void Init()
{
- _rc = read_proc;
- _sc = seek_proc;
-
_FileOpened = false;
-
_Initialized = true;
}
@@ -38,12 +30,19 @@ namespace Vocaluxe.Lib.Sound.Decoder
return;
_FileName = FileName;
- _fs = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
- _instance = CAcinerella.ac_init();
- CAcinerella.ac_open(_instance, IntPtr.Zero, null, _rc, _sc, null, IntPtr.Zero);
-
- _Instance = (TAc_instance)Marshal.PtrToStructure(_instance, typeof(TAc_instance));
+ try
+ {
+ _instance = CAcinerella.ac_init();
+ CAcinerella.ac_open2(_instance, _FileName);
+ _Instance = (TAc_instance)Marshal.PtrToStructure(_instance, typeof(TAc_instance));
+ }
+ catch (Exception)
+ {
+ CLog.LogError("Error opening audio file: " + _FileName);
+ return;
+ }
+
if (!_Instance.opened)
{
@@ -52,26 +51,17 @@ namespace Vocaluxe.Lib.Sound.Decoder
}
int AudioStreamIndex = -1;
-
- TAc_stream_info Info = new TAc_stream_info();
- for (int i = 0; i < _Instance.stream_count; i++)
+ TAc_decoder Audiodecoder;
+ try
{
- CAcinerella.ac_get_stream_info(_instance, i, out Info);
-
- if (Info.stream_type == TAc_stream_type.AC_STREAM_TYPE_AUDIO)
- {
- try
- {
- _audiodecoder = CAcinerella.ac_create_decoder(_instance, i);
- }
- catch (Exception)
- {
- return;
- }
-
- AudioStreamIndex = i;
- break;
- }
+ _audiodecoder = CAcinerella.ac_create_audio_decoder(_instance);
+ Audiodecoder = (TAc_decoder)Marshal.PtrToStructure(_audiodecoder, typeof(TAc_decoder));
+ AudioStreamIndex = Audiodecoder.stream_index;
+ }
+ catch (Exception)
+ {
+ CLog.LogError("Error opening audio file (can't find decoder): " + _FileName);
+ return;
}
if (AudioStreamIndex < 0)
@@ -80,8 +70,6 @@ namespace Vocaluxe.Lib.Sound.Decoder
return;
}
- TAc_decoder Audiodecoder = (TAc_decoder)Marshal.PtrToStructure(_audiodecoder, typeof(TAc_decoder));
-
_FormatInfo = new FormatInfo();
_FormatInfo.SamplesPerSecond = Audiodecoder.stream_info.audio_info.samples_per_second;
@@ -198,28 +186,8 @@ namespace Vocaluxe.Lib.Sound.Decoder
TimeStamp = 0f;
}
- #region Callbacks
- private Int32 read_proc(IntPtr sender, IntPtr buf, Int32 size)
- {
- Int32 r = 0;
-
- byte[] bb = new byte[size];
- r = _fs.Read(bb, 0, size);
- Marshal.Copy(bb, 0, buf, size);
-
- return r;
- }
-
- private Int64 seek_proc(IntPtr sender, Int64 pos, Int32 whence)
- {
- return _fs.Seek(pos, (SeekOrigin)whence);
- }
- #endregion Callbacks
-
public void Dispose()
{
- _fs.Dispose();
- _fs = null;
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs
index b356492d..930a494c 100644
--- a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs
+++ b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs
@@ -18,84 +18,85 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
#endif
#endregion arch
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void LogCallback(string message);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention=CallingConvention.Cdecl)]
public static extern void SetLogCallback(LogCallback c);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Init();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetGlobalVolume(float Volume);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetStreamCount();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void CloseAll();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Load(string Media);
- [DllImport(Dll, EntryPoint = "LoadPrescan")]
+ [DllImport(Dll, EntryPoint = "LoadPrescan", CallingConvention = CallingConvention.Cdecl)]
public static extern int Load(string Media,
[MarshalAs(UnmanagedType.U1)] bool Prescan);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Close(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Play(int Stream);
[DllImport(Dll, EntryPoint = "PlayLoop")]
public static extern void Play(int Stream,
[MarshalAs(UnmanagedType.U1)] bool Loop);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Pause(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Stop(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Fade(int Stream, float TargetVolume, float Seconds);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void FadeAndPause(int Stream, float TargetVolume, float Seconds);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void FadeAndStop(int Stream, float TargetVolume, float Seconds);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetStreamVolume(int Stream, float Volume);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetStreamVolumeMax(int Stream, float Volume);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetLength(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetPosition(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsPlaying(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsPaused(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsFinished(int Stream);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetPosition(int Stream, float Position);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Update();
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
index 15cd38bf..8b5754a0 100644
--- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
+++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
@@ -291,10 +291,10 @@ namespace PortAudioSharp
#endif
#endif
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetVersion();
- [DllImport(PaDll, EntryPoint = "Pa_GetVersionText")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetVersionText", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr IntPtr_Pa_GetVersionText();
public static string Pa_GetVersionText()
@@ -303,7 +303,7 @@ namespace PortAudioSharp
return Marshal.PtrToStringAnsi(strptr);
}
- [DllImport(PaDll, EntryPoint = "Pa_GetErrorText")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetErrorText", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IntPtr_Pa_GetErrorText(PaError errorCode);
public static string Pa_GetErrorText(PaError errorCode)
@@ -312,19 +312,19 @@ namespace PortAudioSharp
return Marshal.PtrToStringAnsi(strptr);
}
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_Initialize();
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_Terminate();
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetHostApiCount();
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetDefaultHostApi();
- [DllImport(PaDll, EntryPoint = "Pa_GetHostApiInfo")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetHostApiInfo", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IntPtr_Pa_GetHostApiInfo(int hostApi);
public static PaHostApiInfo Pa_GetHostApiInfo(int hostApi)
@@ -333,13 +333,13 @@ namespace PortAudioSharp
return (PaHostApiInfo)Marshal.PtrToStructure(structptr, typeof(PaHostApiInfo));
}
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_HostApiTypeIdToHostApiIndex(PaHostApiTypeId type);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_HostApiDeviceIndexToDeviceIndex(int hostApi, int hostApiDeviceIndex);
- [DllImport(PaDll, EntryPoint = "Pa_GetLastHostErrorInfo")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetLastHostErrorInfo", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IntPtr_Pa_GetLastHostErrorInfo();
public static PaHostErrorInfo Pa_GetLastHostErrorInfo()
@@ -348,16 +348,16 @@ namespace PortAudioSharp
return (PaHostErrorInfo)Marshal.PtrToStructure(structptr, typeof(PaHostErrorInfo));
}
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetDeviceCount();
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetDefaultInputDevice();
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetDefaultOutputDevice();
- [DllImport(PaDll, EntryPoint = "Pa_GetDeviceInfo")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetDeviceInfo", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IntPtr_Pa_GetDeviceInfo(int device);
public static PaDeviceInfo Pa_GetDeviceInfo(int device)
@@ -366,13 +366,13 @@ namespace PortAudioSharp
return (PaDeviceInfo)Marshal.PtrToStructure(structptr, typeof(PaDeviceInfo));
}
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_IsFormatSupported(
ref PaStreamParameters inputParameters,
ref PaStreamParameters outputParameters,
double sampleRate);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_OpenStream(
out IntPtr stream,
ref PaStreamParameters inputParameters,
@@ -383,7 +383,7 @@ namespace PortAudioSharp
PaStreamCallbackDelegate streamCallback,
IntPtr userData);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_OpenStream(
out IntPtr stream,
ref PaStreamParameters inputParameters,
@@ -394,7 +394,7 @@ namespace PortAudioSharp
PaStreamCallbackDelegate streamCallback,
IntPtr userData);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_OpenStream(
out IntPtr stream,
IntPtr inputParameters,
@@ -405,7 +405,7 @@ namespace PortAudioSharp
PaStreamCallbackDelegate streamCallback,
IntPtr userData);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_OpenDefaultStream(
out IntPtr stream,
int numInputChannels,
@@ -416,30 +416,30 @@ namespace PortAudioSharp
PaStreamCallbackDelegate streamCallback,
IntPtr userData);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_CloseStream(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_SetStreamFinishedCallback(
ref IntPtr stream,
[MarshalAs(UnmanagedType.FunctionPtr)] PaStreamFinishedCallbackDelegate streamFinishedCallback);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_StartStream(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_StopStream(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_AbortStream(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_IsStreamStopped(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_IsStreamActive(IntPtr stream);
- [DllImport(PaDll, EntryPoint = "Pa_GetStreamInfo")]
+ [DllImport(PaDll, EntryPoint = "Pa_GetStreamInfo", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IntPtr_Pa_GetStreamInfo(IntPtr stream);
public static PaStreamInfo Pa_GetStreamInfo(IntPtr stream)
@@ -448,106 +448,106 @@ namespace PortAudioSharp
return (PaStreamInfo)Marshal.PtrToStructure(structptr, typeof(PaStreamInfo));
}
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern double Pa_GetStreamTime(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern double Pa_GetStreamCpuLoad(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] float[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] byte[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] sbyte[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] ushort[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] short[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] uint[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_ReadStream(
IntPtr stream,
[Out] int[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] float[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] byte[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] sbyte[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] ushort[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] short[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] uint[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_WriteStream(
IntPtr stream,
[In] int[] buffer,
uint frames);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetStreamReadAvailable(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern int Pa_GetStreamWriteAvailable(IntPtr stream);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern PaError Pa_GetSampleSize(PaSampleFormat format);
- [DllImport(PaDll)]
+ [DllImport(PaDll, CallingConvention = CallingConvention.Cdecl)]
public static extern void Pa_Sleep(int msec);
#endregion
diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs
index f737fcf4..557358c9 100644
--- a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs
+++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs
@@ -72,7 +72,7 @@ namespace PortAudioSharp
/// On Windows, the calling application's main window handle,
/// on Macintosh this value should be zero.
///
- [DllImport("PortAudio.dll")]
+ [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern PaError PaAsio_ShowControlPanel(int device, IntPtr systemSpecific);
// /// Retrieve a pointer to a string containing the name of the specified input channel.
@@ -93,7 +93,7 @@ namespace PortAudioSharp
/// Note that this function may fail if the stream is alredy running and the
/// ASIO driver does not support switching the sample rate of a running stream.
/// paIncompatibleStreamHostApi if stream is not a paASIO stream.
- [DllImport("PortAudio.dll")]
+ [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern PaError PaAsio_SetStreamSampleRate(IntPtr stream, double sampleRate);
#endregion
}
diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs
index 0080e70a..47576c64 100644
--- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs
+++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs
@@ -220,6 +220,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
close_proc: TAc_openclose_callback;
proberesult: PAc_proberesult): integer; cdecl; external ac_dll;
*/
+ /*
[DllImport(AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern Int32 _ac_open(
IntPtr PAc_instance,
@@ -245,6 +246,23 @@ namespace Vocaluxe.Lib.Video.Acinerella
{
return _ac_open(PAc_instance, sender, open_proc, read_proc, seek_proc, close_proc, proberesult);
}
+ }*/
+
+ [DllImport(AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ private static extern Int32 _ac_open2(
+ IntPtr PAc_instance,
+ string filename
+ );
+
+ public static Int32 ac_open2(
+ IntPtr PAc_instance,
+ string filename
+ )
+ {
+ lock (_lock)
+ {
+ return _ac_open2(PAc_instance, filename);
+ }
}
// Closes an opened media file.
@@ -296,17 +314,26 @@ namespace Vocaluxe.Lib.Video.Acinerella
[DllImport(AcDll, EntryPoint = "ac_free_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void ac_free_package(IntPtr PAc_package);
- // Creates an decoder for the specified stream number. Returns NIL if no decoder
- // could be found.
- //function ac_create_decoder(pacInstance: PAc_instance; nb: integer): PAc_decoder; cdecl; external ac_dll;
- [DllImport(AcDll, EntryPoint = "ac_create_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
- private static extern IntPtr _ac_create_decoder(IntPtr PAc_instance, Int32 nb);
- public static IntPtr ac_create_decoder(IntPtr PAc_instance, Int32 nb)
+ [DllImport(AcDll, EntryPoint = "ac_create_video_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
+ private static extern IntPtr _ac_create_video_decoder(IntPtr PAc_instance);
+
+ public static IntPtr ac_create_video_decoder(IntPtr PAc_instance)
{
lock (_lock)
{
- return _ac_create_decoder(PAc_instance, nb);
+ return _ac_create_video_decoder(PAc_instance);
+ }
+ }
+
+ [DllImport(AcDll, EntryPoint = "ac_create_audio_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
+ private static extern IntPtr _ac_create_audio_decoder(IntPtr PAc_instance);
+
+ public static IntPtr ac_create_audio_decoder(IntPtr PAc_instance)
+ {
+ lock (_lock)
+ {
+ return _ac_create_audio_decoder(PAc_instance);
}
}
diff --git a/Vocaluxe/Lib/Video/Acinerella/acinerella.c b/Vocaluxe/Lib/Video/Acinerella/acinerella.c
index 3550bc07..ba9a9a6e 100644
--- a/Vocaluxe/Lib/Video/Acinerella/acinerella.c
+++ b/Vocaluxe/Lib/Video/Acinerella/acinerella.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
#define AUDIO_BUFFER_BASE_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE
@@ -38,15 +39,7 @@
struct _ac_data {
ac_instance instance;
-
AVFormatContext *pFormatCtx;
-
- void *sender;
- ac_openclose_callback open_proc;
- ac_read_callback read_proc;
- ac_seek_callback seek_proc;
- ac_openclose_callback close_proc;
-
void* buffer;
};
@@ -55,8 +48,6 @@ typedef ac_data* lp_ac_data;
struct _ac_decoder_data {
ac_decoder decoder;
- int sought;
- double last_timecode;
};
typedef struct _ac_decoder_data ac_decoder_data;
@@ -64,8 +55,6 @@ typedef ac_decoder_data* lp_ac_decoder_data;
struct _ac_video_decoder {
ac_decoder decoder;
- int sought;
- double last_timecode;
AVCodec *pCodec;
AVCodecContext *pCodecCtx;
AVFrame *pFrame;
@@ -78,10 +67,6 @@ typedef ac_video_decoder* lp_ac_video_decoder;
struct _ac_audio_decoder {
ac_decoder decoder;
- int sought;
- double last_timecode;
- uint8_t *tmp_data;
- int tmp_data_length;
int max_buffer_size;
AVCodec *pCodec;
AVCodecContext *pCodecCtx;
@@ -145,225 +130,41 @@ void CALL_CONVT ac_free(lp_ac_instance pacInstance) {
}
}
-static int io_read(void *opaque, uint8_t *buf, int buf_size)
-{
- if (((lp_ac_data)(opaque))->read_proc != NULL) {
- return ((lp_ac_data)(opaque))->read_proc(
- ((lp_ac_data)(opaque))->sender, buf, buf_size);
- }
-
- return -1;
-}
-
-static int64_t io_seek(void *opaque, int64_t pos, int whence)
-{
- if (((lp_ac_data)(opaque))->seek_proc != NULL) {
- if ((whence >= 0) && (whence <= 2)) {
- return ((lp_ac_data)(opaque))->seek_proc(
- ((lp_ac_data)(opaque))->sender, pos, whence);
- }
- }
-
- return -1;
-}
-
-lp_ac_proberesult CALL_CONVT ac_probe_input_buffer(
- void* buf,
- int bufsize,
- char* filename,
- int* score_max)
-{
- AVProbeData pd;
- AVInputFormat *fmt = NULL;
-
- //Initialize FFMpeg libraries
- ac_init_ffmpeg();
-
- //Set the filename
- pd.filename = "";
- if (filename) {
- pd.filename = filename;
- }
-
- //The given buffer has to be copied to a new one, which is aligned and padded
- void* aligned_buf = av_malloc(bufsize + AVPROBE_PADDING_SIZE);
-
- memset(aligned_buf, 0, bufsize + AVPROBE_PADDING_SIZE);
- memcpy(aligned_buf, buf, bufsize);
-
- //Set the probe data buffer
- pd.buf = aligned_buf;
- pd.buf_size = bufsize;
-
- //Test it
- fmt = (AVInputFormat*)av_probe_input_format2(&pd, 1, score_max);
-
- //Free the temporary buffer
- av_free(aligned_buf);
-
- return (lp_ac_proberesult)fmt;
-}
-
-#define PROBE_BUF_MIN 2048
-#define PROBE_BUF_MAX (1<<20)
-
-
-AVInputFormat* ac_probe_input_stream(
- void* sender,
- ac_read_callback read_proc,
- char* filename,
- void* *buf,
- int* buf_read)
-{
- //Initialize the result variables
- AVInputFormat* fmt = NULL;
- *buf_read = 0;
- *buf = NULL;
- int last_iteration = 0;
- int probe_size = 0;
-
- for (probe_size = PROBE_BUF_MIN;
- (probe_size <= PROBE_BUF_MAX) && !fmt && !last_iteration;
- probe_size<<=1) {
- int score = AVPROBE_SCORE_MAX / 4;
-
- //Allocate some memory for the current probe buffer
- void* tmp_buf = av_malloc(probe_size); //Unaligned memory would also be ok here
- memset(tmp_buf, 0, probe_size);
-
- //Copy the old data to the new buffer
- if (*buf) {
- memcpy(tmp_buf, *buf, *buf_read);
- //Free the old data memory
- av_free(*buf);
- }
-
- //Read the new data
- void* write_ptr = tmp_buf + *buf_read;
- int read_size = probe_size - *buf_read;
- int size;
- if (size = read_proc(sender, write_ptr, read_size) < read_size) {
- last_iteration = 1;
- probe_size = *buf_read + size;
- }
-
- //Probe it
- fmt = (AVInputFormat*)ac_probe_input_buffer(tmp_buf, probe_size, filename, &score);
-
- //Set the new buffer
- *buf = tmp_buf;
- *buf_read = probe_size;
- }
-
- //Return the result
- return fmt;
-}
-
-int CALL_CONVT ac_open(
- lp_ac_instance pacInstance,
- void *sender,
- ac_openclose_callback open_proc,
- ac_read_callback read_proc,
- ac_seek_callback seek_proc,
- ac_openclose_callback close_proc,
- lp_ac_proberesult proberesult)
+int CALL_CONVT ac_open(lp_ac_instance pacInstance, const char* filename)
{
- pacInstance->opened = 0;
-
- //Store the given parameters in the ac Instance
- ((lp_ac_data)pacInstance)->sender = sender;
- ((lp_ac_data)pacInstance)->open_proc = open_proc;
- ((lp_ac_data)pacInstance)->read_proc = read_proc;
- ((lp_ac_data)pacInstance)->seek_proc = seek_proc;
- ((lp_ac_data)pacInstance)->close_proc = close_proc;
+ pacInstance->opened = 0;
- //Call the file open proc
- if (open_proc != NULL) {
- open_proc(sender);
- }
-
- AVInputFormat* fmt = NULL;
- int probe_size = 0;
-
- //Probe the input format, if no probe result is specified
- if(proberesult == NULL)
- {
- fmt = ac_probe_input_stream(sender, read_proc, "",
- (void*)&((lp_ac_data)pacInstance)->buffer, &probe_size);
- }
- else
- {
- fmt = (AVInputFormat*)proberesult;
- }
- if (!fmt) return -1;
+ /* open input file, and allocate format context */
+ int ret = 0;
+ if ((ret = avformat_open_input(&((lp_ac_data)pacInstance)->pFormatCtx, filename, NULL, NULL)) < 0)
+ {
+ return ret;
+ }
- ((lp_ac_data)pacInstance)->pFormatCtx = avformat_alloc_context();
-
- if (!seek_proc) {
- ((lp_ac_data)pacInstance)->pFormatCtx->pb = avio_alloc_context(
- ((lp_ac_data)pacInstance)->buffer,
- probe_size, 0, pacInstance, io_read, 0, NULL);
-
- //Feed the probed bytes into the IO-Context
- ((lp_ac_data)pacInstance)->pFormatCtx->pb->buf_end =
- ((lp_ac_data)pacInstance)->buffer + probe_size;
- ((lp_ac_data)pacInstance)->pFormatCtx->pb->pos = probe_size;
- } else {
- //If the stream is seekable, seek back to the beginning of the stream and
- //let FFMpeg start from the beginning
- if (((lp_ac_data)pacInstance)->buffer)
- av_free(((lp_ac_data)pacInstance)->buffer);
-
- int64_t pos = seek_proc(sender, 0, SEEK_SET);
-
- //Reserve AC_BUFSIZE Bytes of memory
- ((lp_ac_data)pacInstance)->buffer = av_malloc(AC_BUFSIZE);
-
- ((lp_ac_data)pacInstance)->pFormatCtx->pb = avio_alloc_context(
- ((lp_ac_data)pacInstance)->buffer,
- AC_BUFSIZE, 0, pacInstance, io_read, 0, io_seek);
- }
-
- //Open the given input stream (the io structure) with the given format of the stream
- //(fmt) and write the pointer to the new format context to the pFormatCtx variable
- if (avformat_open_input(
- &(((lp_ac_data)pacInstance)->pFormatCtx),
- "",
- fmt,
- NULL) < 0)
- {
- return -1;
- }
+ /* retrieve stream information */
+ if ((ret = avformat_find_stream_info(((lp_ac_data)pacInstance)->pFormatCtx, NULL)) < 0)
+ {
+ return ret;
+ }
+ else
+ pacInstance->info.duration = ((lp_ac_data)pacInstance)->pFormatCtx->duration * 1000 / AV_TIME_BASE;
- //Retrieve stream information
- AVFormatContext *ctx = ((lp_ac_data)pacInstance)->pFormatCtx;
- if(avformat_find_stream_info(ctx, NULL) >= 0) {
- pacInstance->info.duration = ctx->duration * 1000 / AV_TIME_BASE;
- } else {
- return -1;
- }
+ //Set some information in the instance variable
+ pacInstance->stream_count = ((lp_ac_data)pacInstance)->pFormatCtx->nb_streams;
+ pacInstance->opened = pacInstance->stream_count > 0;
- //Set some information in the instance variable
- pacInstance->stream_count = ((lp_ac_data)pacInstance)->pFormatCtx->nb_streams;
- pacInstance->opened = pacInstance->stream_count > 0;
-
- return 0;
+ return 0;
}
void CALL_CONVT ac_close(lp_ac_instance pacInstance) {
if (pacInstance->opened) {
- //Close the opened file
- if (((lp_ac_data)(pacInstance))->close_proc != NULL) {
- ((lp_ac_data)(pacInstance))->close_proc(((lp_ac_data)(pacInstance))->sender);
- }
-
+ //Close the opened file
avformat_close_input(&(((lp_ac_data)(pacInstance))->pFormatCtx));
pacInstance->opened = 0;
//If the seek proc has not been specified, the input buffer is not automatically
//freed, as ffmpeg didn't get the original pointer to the buffer
- if (!((lp_ac_data)(pacInstance))->seek_proc &&
- ((lp_ac_data)(pacInstance))->buffer) {
+ if (((lp_ac_data)(pacInstance))->buffer) {
av_free(((lp_ac_data)(pacInstance))->buffer);
}
@@ -404,42 +205,13 @@ void CALL_CONVT ac_get_stream_info(lp_ac_instance pacInstance, int nb, lp_ac_str
info->stream_type = AC_STREAM_TYPE_AUDIO;
//Store more information about the video stream
- info->audio_info.samples_per_second =
+ info->audio_info.samples_per_second =
((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->sample_rate;
- info->audio_info.channel_count =
- ((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->channels;
-
- // Set bit depth
- switch (((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->sample_fmt) {
- //8-Bit
- case AV_SAMPLE_FMT_U8:
- info->audio_info.bit_depth =
- 8;
- break;
-
- //16-Bit
- case AV_SAMPLE_FMT_S16:
- info->audio_info.bit_depth =
- 16;
- break;
-
-/* //24-Bit (removed in the newest ffmpeg version)
- case SAMPLE_FMT_S24:
- info->additional_info.audio_info.bit_depth =
- 24;
- break; */
-
- //32-Bit
- case AV_SAMPLE_FMT_S32: case AV_SAMPLE_FMT_FLT:
- info->audio_info.bit_depth =
- 32;
- break;
-
- //Unknown format, return zero
- default:
- info->audio_info.bit_depth =
- 0;
- }
+ info->audio_info.channel_count = 2;
+ //((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec->channels;
+
+ // Set bit depth (its always 16Bit because of the conversion!
+ info->audio_info.bit_depth = 16;
break;
default:
@@ -474,7 +246,8 @@ lp_ac_package CALL_CONVT ac_read_package(lp_ac_instance pacInstance) {
}
//Frees the currently loaded package
-void CALL_CONVT ac_free_package(lp_ac_package pPackage) {
+void CALL_CONVT ac_free_package(lp_ac_package pPackage)
+{
//Free the packet
if (pPackage != NULL) {
AVPacket* pkt = &((lp_ac_package_data)pPackage)->ffpackage;
@@ -500,112 +273,98 @@ enum PixelFormat convert_pix_format(ac_output_format fmt) {
return PIX_FMT_RGB32;
}
-//Init a video decoder
-void* ac_create_video_decoder(lp_ac_instance pacInstance, lp_ac_stream_info info, int nb) {
- //Allocate memory for a new decoder instance
- lp_ac_video_decoder pDecoder;
- pDecoder = (lp_ac_video_decoder)(av_malloc(sizeof(ac_video_decoder)));
- memset(pDecoder, 0, sizeof(ac_video_decoder));
-
- //Set a few properties
- pDecoder->decoder.pacInstance = pacInstance;
- pDecoder->decoder.type = AC_DECODER_TYPE_VIDEO;
- pDecoder->decoder.stream_index = nb;
- pDecoder->pCodecCtx = ((lp_ac_data)(pacInstance))->pFormatCtx->streams[nb]->codec;
- pDecoder->decoder.stream_info = *info;
-
- //Find correspondenting codec
- if (!(pDecoder->pCodec = avcodec_find_decoder(pDecoder->pCodecCtx->codec_id))) {
- return NULL; //Codec could not have been found
- }
+lp_ac_decoder CALL_CONVT ac_create_video_decoder(lp_ac_instance pacInstance) {
+ //Allocate memory for a new decoder instance
+ lp_ac_video_decoder pDecoder;
+ pDecoder = (lp_ac_video_decoder)(av_malloc(sizeof(ac_video_decoder)));
+ memset(pDecoder, 0, sizeof(ac_video_decoder));
- pDecoder->pCodecCtx->thread_count = 1; //this is for HT CPUs, it should be
- // tested if there is a better solution
+ int nb = av_find_best_stream(((lp_ac_data)pacInstance)->pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
+ if (nb < 0)
+ return NULL;
+
+ ac_stream_info info;
+ ac_get_stream_info(pacInstance, nb, &info);
+
+ //Set a few properties
+ pDecoder->decoder.pacInstance = pacInstance;
+ pDecoder->decoder.type = AC_DECODER_TYPE_VIDEO;
+ pDecoder->decoder.stream_index = nb;
+ pDecoder->decoder.video_clock = 0;
+ pDecoder->pCodecCtx = ((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec;
+ pDecoder->decoder.stream_info = info;
+ pDecoder->pCodecCtx->thread_count = 1; //this is for HT CPUs, it should be
+ // tested if there is a better solution
+
+ //Find correspondenting codec
+ if (!(pDecoder->pCodec = avcodec_find_decoder(pDecoder->pCodecCtx->codec_id)))
+ return NULL; //Codec could not have been found
- //Open codec
- if (avcodec_open2(pDecoder->pCodecCtx, pDecoder->pCodec, NULL) < 0) {
- return NULL; //Codec could not have been opened
- }
-
- //Reserve frame variables
- pDecoder->pFrame = avcodec_alloc_frame();
- pDecoder->pFrameRGB = avcodec_alloc_frame();
-
- pDecoder->pSwsCtx = NULL;
-
- //Reserve buffer memory
- pDecoder->decoder.buffer_size = avpicture_get_size(convert_pix_format(pacInstance->output_format),
- pDecoder->pCodecCtx->width, pDecoder->pCodecCtx->height);
- pDecoder->decoder.pBuffer = (uint8_t*)av_malloc(pDecoder->decoder.buffer_size);
+ //Open codec
+ if (avcodec_open2(pDecoder->pCodecCtx, pDecoder->pCodec, NULL) < 0)
+ return NULL; //Codec could not have been opened
- //Link decoder to buffer
- avpicture_fill(
- (AVPicture*)(pDecoder->pFrameRGB),
- pDecoder->decoder.pBuffer, convert_pix_format(pacInstance->output_format),
- pDecoder->pCodecCtx->width, pDecoder->pCodecCtx->height);
-
- return (void*)pDecoder;
+ //Reserve frame variables
+ pDecoder->pFrame = avcodec_alloc_frame();
+ pDecoder->pFrameRGB = avcodec_alloc_frame();
+
+ pDecoder->pSwsCtx = NULL;
+
+ //Reserve buffer memory
+ pDecoder->decoder.buffer_size = avpicture_get_size(convert_pix_format(pacInstance->output_format),
+ pDecoder->pCodecCtx->width, pDecoder->pCodecCtx->height);
+ pDecoder->decoder.pBuffer = (uint8_t*)av_malloc(pDecoder->decoder.buffer_size);
+
+ //Link decoder to buffer
+ avpicture_fill(
+ (AVPicture*)(pDecoder->pFrameRGB),
+ pDecoder->decoder.pBuffer, convert_pix_format(pacInstance->output_format),
+ pDecoder->pCodecCtx->width, pDecoder->pCodecCtx->height);
+
+ return (void*)pDecoder;
}
-//Init a audio decoder
-void* ac_create_audio_decoder(lp_ac_instance pacInstance, lp_ac_stream_info info, int nb) {
- //Allocate memory for a new decoder instance
- lp_ac_audio_decoder pDecoder;
- pDecoder = (lp_ac_audio_decoder)(av_malloc(sizeof(ac_audio_decoder)));
- memset(pDecoder, 0, sizeof(ac_audio_decoder));
-
- //Set a few properties
- pDecoder->decoder.pacInstance = pacInstance;
- pDecoder->decoder.type = AC_DECODER_TYPE_AUDIO;
- pDecoder->decoder.stream_index = nb;
- pDecoder->decoder.stream_info = *info;
- pDecoder->decoder.video_clock = 0;
-
- //Temporary store codec context pointer
- AVCodecContext *pCodecCtx = ((lp_ac_data)(pacInstance))->pFormatCtx->streams[nb]->codec;
- pDecoder->pCodecCtx = pCodecCtx;
-
- //Find correspondenting codec
- if (!(pDecoder->pCodec = avcodec_find_decoder(pCodecCtx->codec_id))) {
- return NULL;
- }
-
- //Open codec
- if (avcodec_open2(pCodecCtx, pDecoder->pCodec, NULL) < 0) {
- return NULL;
- }
+lp_ac_decoder CALL_CONVT ac_create_audio_decoder(lp_ac_instance pacInstance)
+{
+ //Allocate memory for a new decoder instance
+ lp_ac_audio_decoder pDecoder;
+ pDecoder = (lp_ac_audio_decoder)(av_malloc(sizeof(ac_audio_decoder)));
+ memset(pDecoder, 0, sizeof(ac_audio_decoder));
- //Initialize the buffers
- pDecoder->decoder.pBuffer = NULL; //av_malloc(AUDIO_BUFFER_BASE_SIZE);
- pDecoder->decoder.buffer_size = 0;
- pDecoder->max_buffer_size = 0;
+ int nb = av_find_best_stream(((lp_ac_data)pacInstance)->pFormatCtx, AVMEDIA_TYPE_AUDIO, -1, -1, NULL, 0);
+ if (nb < 0)
+ return NULL;
+
+ ac_stream_info info;
+ ac_get_stream_info(pacInstance, nb, &info);
- pDecoder->tmp_data = NULL;
- pDecoder->tmp_data_length = 0;
-
- return (void*)pDecoder;
-}
+ //Set a few properties
+ pDecoder->decoder.pacInstance = pacInstance;
+ pDecoder->decoder.type = AC_DECODER_TYPE_AUDIO;
+ pDecoder->decoder.stream_index = nb;
+ pDecoder->decoder.stream_info = info;
+ pDecoder->decoder.video_clock = 0;
+
+ //Temporary store codec context pointer
+ AVCodecContext *pCodecCtx = ((lp_ac_data)pacInstance)->pFormatCtx->streams[nb]->codec;
+ pDecoder->pCodecCtx = pCodecCtx;
+ //pDecoder->pCodecCtx->thread_count = 1; //this is for HT CPUs, it should be
+ // tested if there is a better solution
+
+ //Find correspondenting codec
+ if (!(pDecoder->pCodec = avcodec_find_decoder(pCodecCtx->codec_id)))
+ return NULL;
-lp_ac_decoder CALL_CONVT ac_create_decoder(lp_ac_instance pacInstance, int nb) {
- //Get information about the chosen data stream and create an decoder that can
- //handle this kind of stream.
- ac_stream_info info;
- ac_get_stream_info(pacInstance, nb, &info);
-
- lp_ac_decoder result;
-
- if (info.stream_type == AC_STREAM_TYPE_VIDEO) {
- result = ac_create_video_decoder(pacInstance, &info, nb);
- }
- else if (info.stream_type == AC_STREAM_TYPE_AUDIO) {
- result = ac_create_audio_decoder(pacInstance, &info, nb);
- }
-
- ((lp_ac_decoder_data)result)->last_timecode = 0;
- ((lp_ac_decoder_data)result)->sought = 1;
- result->video_clock = 0;
-
- return result;
+ //Open codec
+ if (avcodec_open2(pCodecCtx, pDecoder->pCodec, NULL) < 0)
+ return NULL;
+
+ //Initialize the buffers
+ pDecoder->decoder.pBuffer = av_malloc(AUDIO_BUFFER_BASE_SIZE);
+ pDecoder->decoder.buffer_size = 0;
+ pDecoder->max_buffer_size = AUDIO_BUFFER_BASE_SIZE;
+
+ return (void*)pDecoder;
}
double ac_sync_video(lp_ac_package pPackage, lp_ac_decoder pDec, AVFrame *src_frame, double pts){
@@ -643,13 +402,7 @@ int ac_decode_video_package(lp_ac_package pPackage, lp_ac_video_decoder pDecoder
pkt_tmp.size -= len;
pkt_tmp.data += len;
}
-
- /*
- avcodec_decode_video2(
- pDecoder->pCodecCtx, pDecoder->pFrame, &finished,
- &(((lp_ac_package_data)pPackage)->ffpackage));
- */
-
+
if (finished != 0) {
pDecoder->pSwsCtx = sws_getCachedContext(pDecoder->pSwsCtx,
pDecoder->pCodecCtx->width, pDecoder->pCodecCtx->height, pDecoder->pCodecCtx->pix_fmt,
@@ -687,6 +440,17 @@ int ac_decode_video_package(lp_ac_package pPackage, lp_ac_video_decoder pDecoder
return 0;
}
+int alloc_samples_array_and_data(uint8_t ***data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
+{
+ int nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
+
+ *data = av_malloc(sizeof(*data) * nb_planes);
+ if (!*data)
+ return AVERROR(ENOMEM);
+ return av_samples_alloc(*data, linesize, nb_channels,
+ nb_samples, sample_fmt, align);
+}
+
int ac_decode_audio_package(lp_ac_package pPackage, lp_ac_audio_decoder pDecoder, lp_ac_decoder pDec) {
double pts;
//Variables describing the destination buffer
@@ -694,17 +458,8 @@ int ac_decode_audio_package(lp_ac_package pPackage, lp_ac_audio_decoder pDecoder
//Make a copy of the package read by avformat, so that we can move the data pointers around
AVPacket pkt_tmp = ((lp_ac_package_data)pPackage)->ffpackage;
-
AVFrame *decoded_frame = NULL;
-
- if (pDecoder->tmp_data_length > 0)
- {
- pkt_tmp.data = av_realloc(pkt_tmp.data, pkt_tmp.size + pDecoder->tmp_data_length);
- pkt_tmp.size = pkt_tmp.size + pDecoder->tmp_data_length;
- memcpy(pkt_tmp.data + pDecoder->tmp_data_length, &pkt_tmp.data, pkt_tmp.size);
- memcpy(&pkt_tmp.data, pDecoder->tmp_data, pDecoder->tmp_data_length);
- }
-
+
while (pkt_tmp.size > 0) {
if (!decoded_frame) {
@@ -718,7 +473,6 @@ int ac_decode_audio_package(lp_ac_package pPackage, lp_ac_audio_decoder pDecoder
int len1 = avcodec_decode_audio4(pDecoder->pCodecCtx, decoded_frame, &got_frame, &pkt_tmp);
-
//If an error occured, skip the frame
if (len1 < 0){
return 0;
@@ -729,67 +483,105 @@ int ac_decode_audio_package(lp_ac_package pPackage, lp_ac_audio_decoder pDecoder
pkt_tmp.data += len1;
if (got_frame){
-
- int data_size = av_samples_get_buffer_size(NULL, (pDecoder->pCodecCtx)->channels,
- decoded_frame->nb_samples,
- (pDecoder->pCodecCtx)->sample_fmt, 1);
-
- //Reserve enough memory for coping the result data
- if (dest_buffer_pos + data_size > pDecoder->max_buffer_size) {
- pDecoder->decoder.pBuffer = av_realloc(pDecoder->decoder.pBuffer, dest_buffer_pos + data_size);
- pDecoder->max_buffer_size = dest_buffer_pos + data_size;
- }
- memcpy(pDecoder->decoder.pBuffer + dest_buffer_pos, decoded_frame->data[0], data_size);
-
- //Increment the destination buffer pointers, copy the result to the output buffer
- dest_buffer_pos += data_size;
- pDecoder->decoder.buffer_size += data_size;
-
-
- pts=0;
-
- if(((lp_ac_package_data)pPackage)->ffpackage.dts != AV_NOPTS_VALUE){
- pts = ((lp_ac_package_data)pPackage)->ffpackage.dts * av_q2d(((lp_ac_data)pDec->pacInstance)->pFormatCtx->streams[pPackage->stream_index]->time_base);
-
- pDec->video_clock = pts;
- } else {
- pts = pDec->video_clock;
- }
-
- double bytes_per_second = 2 * pDec->stream_info.audio_info.samples_per_second * pDec->stream_info.audio_info.channel_count;
- if (bytes_per_second > 0)
- pDec->video_clock += data_size / bytes_per_second;
+ struct SwrContext *swr_ctx;
+ int dst_nb_samples = 0, max_dst_nb_samples = 0, dst_linesize = 0;
+ uint8_t **dst_data = NULL;
+ int ret = 0;
+ int dst_sample_rate = (pDecoder->pCodecCtx)->sample_rate;
- pDec->timecode = pts;
+ swr_ctx = swr_alloc();
- if (pkt_tmp.size > 0)
- {
- pDecoder->tmp_data = av_malloc(pkt_tmp.size);
- memcpy(pDecoder->tmp_data, &pkt_tmp.data, pkt_tmp.size);
- } else {
- av_free(pDecoder->tmp_data);
- pDecoder->tmp_data_length = 0;
- }
+ /* set options */
+ av_opt_set_int(swr_ctx, "in_channel_layout", (pDecoder->pCodecCtx)->channel_layout, 0);
+ av_opt_set_int(swr_ctx, "in_sample_rate", (pDecoder->pCodecCtx)->sample_rate, 0);
+ av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", (pDecoder->pCodecCtx)->sample_fmt, 0);
+
+ av_opt_set_int(swr_ctx, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
+ av_opt_set_int(swr_ctx, "out_sample_rate", dst_sample_rate, 0);
+ av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
+
+ if (swr_init(swr_ctx) < 0)
+ return 0;
+
+ /* compute the number of converted samples: buffering is avoided
+ * ensuring that the output buffer will contain at least all the
+ * converted input samples */
+ max_dst_nb_samples = dst_nb_samples = av_rescale_rnd(
+ decoded_frame->nb_samples, dst_sample_rate, (pDecoder->pCodecCtx)->sample_rate, AV_ROUND_UP);
+
+ if (alloc_samples_array_and_data(&dst_data, &dst_linesize, 2, dst_nb_samples, AV_SAMPLE_FMT_S16, 0) < 0)
+ return 0;
+
+ /* compute destination number of samples */
+ dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, (pDecoder->pCodecCtx)->sample_rate) +
+ decoded_frame->nb_samples, dst_sample_rate, (pDecoder->pCodecCtx)->sample_rate, AV_ROUND_UP);
+
+ if (dst_nb_samples > max_dst_nb_samples) {
+ av_free(dst_data[0]);
+ ret = av_samples_alloc(dst_data, &dst_linesize, 2,
+ dst_nb_samples, AV_SAMPLE_FMT_S16, 1);
+ if (ret < 0)
+ return 0;
+ max_dst_nb_samples = dst_nb_samples;
+ }
+
+ if ((ret = swr_convert(swr_ctx, dst_data, dst_nb_samples, (const uint8_t **)decoded_frame->data, decoded_frame->nb_samples)) < 0)
+ return 0;
+
+ int data_size = av_samples_get_buffer_size(&dst_linesize, 2, ret, AV_SAMPLE_FMT_S16, 1);
+
+ //Reserve enough memory for coping the result data
+ if (dest_buffer_pos + data_size > pDecoder->max_buffer_size) {
+ pDecoder->decoder.pBuffer = av_realloc(pDecoder->decoder.pBuffer, dest_buffer_pos + data_size);
+ pDecoder->max_buffer_size = dest_buffer_pos + data_size;
+ }
+
+ memcpy(pDecoder->decoder.pBuffer + dest_buffer_pos, dst_data[0], data_size);
+
+ //Increment the destination buffer pointers, copy the result to the output buffer
+ dest_buffer_pos += data_size;
+ pDecoder->decoder.buffer_size += data_size;
+
+ pts=0;
+
+ if(((lp_ac_package_data)pPackage)->ffpackage.dts != AV_NOPTS_VALUE){
+ pts = ((lp_ac_package_data)pPackage)->ffpackage.dts * av_q2d(((lp_ac_data)pDec->pacInstance)->pFormatCtx->streams[pPackage->stream_index]->time_base);
- return 1;
+ pDec->video_clock = pts;
+ } else {
+ pts = pDec->video_clock;
+ }
+
+ double bytes_per_second = 4 * pDec->stream_info.audio_info.samples_per_second;
+ if (bytes_per_second > 0)
+ pDec->video_clock += data_size / bytes_per_second;
+
+ pDec->timecode = pts;
+
+ if (dst_data)
+ av_freep(&dst_data[0]);
+ av_freep(&dst_data);
+
+ swr_free(&swr_ctx);
+ return 1;
}
}
- av_free(pDecoder->tmp_data);
- pDecoder->tmp_data_length;
return 0;
}
-int CALL_CONVT ac_decode_package(lp_ac_package pPackage, lp_ac_decoder pDecoder) {
- if (pDecoder->type == AC_DECODER_TYPE_AUDIO) {
- return ac_decode_audio_package(pPackage, (lp_ac_audio_decoder)pDecoder, pDecoder);
- } else if (pDecoder->type == AC_DECODER_TYPE_VIDEO) {
- return ac_decode_video_package(pPackage, (lp_ac_video_decoder)pDecoder, pDecoder);
- }
- return 0;
+int CALL_CONVT ac_decode_package(lp_ac_package pPackage, lp_ac_decoder pDecoder)
+{
+ if (pDecoder->type == AC_DECODER_TYPE_AUDIO)
+ return ac_decode_audio_package(pPackage, (lp_ac_audio_decoder)pDecoder, pDecoder);
+ else if (pDecoder->type == AC_DECODER_TYPE_VIDEO)
+ return ac_decode_video_package(pPackage, (lp_ac_video_decoder)pDecoder, pDecoder);
+
+ return 0;
}
-int CALL_CONVT ac_drop_decode_package(lp_ac_package pPackage, lp_ac_decoder pDecoder) {
+int CALL_CONVT ac_drop_decode_package(lp_ac_package pPackage, lp_ac_decoder pDecoder)
+{
if (pDecoder->type == AC_DECODER_TYPE_VIDEO) {
return ac_drop_decode_video_package(pPackage, (lp_ac_video_decoder)pDecoder, pDecoder);
}
@@ -818,7 +610,6 @@ int ac_drop_decode_video_package(lp_ac_package pPackage, lp_ac_video_decoder pDe
if (finished) {
pts=0;
- //global_video_pkt_pts = ((lp_ac_package_data)pPackage)->ffpackage.pts;
if(((lp_ac_package_data)pPackage)->ffpackage.dts == AV_NOPTS_VALUE &&
*(uint64_t*)pDecoder->pFrame->opaque != AV_NOPTS_VALUE ){
@@ -843,20 +634,17 @@ int ac_drop_decode_video_package(lp_ac_package pPackage, lp_ac_video_decoder pDe
return 0;
}
-int CALL_CONVT ac_get_audio_frame(lp_ac_instance pacInstance, lp_ac_decoder pDecoder) {
-
+int CALL_CONVT ac_get_audio_frame(lp_ac_instance pacInstance, lp_ac_decoder pDecoder)
+{
lp_ac_package pPackage = ac_read_package(pacInstance);
((lp_ac_audio_decoder)pDecoder)->decoder.buffer_size = 0;
int done = 0;
while(done == 0 && pPackage != NULL){
- if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index){
+ if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index)
+ {
done = ac_decode_package(pPackage, pDecoder);
-
ac_free_package(pPackage);
-
- if (((lp_ac_audio_decoder)pDecoder)->decoder.buffer_size < 4096)
- done = 0;
if (done == 0)
pPackage = ac_read_package(pacInstance);
@@ -872,19 +660,21 @@ int CALL_CONVT ac_get_audio_frame(lp_ac_instance pacInstance, lp_ac_decoder pDec
return 1;
}
-int CALL_CONVT ac_get_frame(lp_ac_instance pacInstance, lp_ac_decoder pDecoder) {
-
+int CALL_CONVT ac_get_frame(lp_ac_instance pacInstance, lp_ac_decoder pDecoder)
+{
lp_ac_package pPackage = ac_read_package(pacInstance);
int done = 0;
int pcount = 0;
while(done == 0 && pPackage != NULL){
- if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index){
+ if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index)
+ {
done = ac_decode_package(pPackage, pDecoder);
ac_free_package(pPackage);
pcount++;
if (done == 0)
pPackage = ac_read_package(pacInstance);
- } else {
+ } else
+ {
ac_free_package(pPackage);
pPackage = ac_read_package(pacInstance);
}
@@ -896,25 +686,28 @@ int CALL_CONVT ac_get_frame(lp_ac_instance pacInstance, lp_ac_decoder pDecoder)
return pcount;
}
-int CALL_CONVT ac_skip_frames(lp_ac_instance pacInstance, lp_ac_decoder pDecoder, int num) {
-
+int CALL_CONVT ac_skip_frames(lp_ac_instance pacInstance, lp_ac_decoder pDecoder, int num)
+{
lp_ac_package pPackage = ac_read_package(pacInstance);
int done = 0;
int i;
- for(i=0; i0)
pPackage = ac_read_package(pacInstance);
done = 0;
while(done == 0 && pPackage != NULL){
- if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index){
+ if (((lp_ac_package_data)pPackage)->package.stream_index == pDecoder->stream_index)
+ {
done = ac_drop_decode_package(pPackage, pDecoder);
ac_free_package(pPackage);
if (done == 0)
pPackage = ac_read_package(pacInstance);
- } else {
+ } else
+ {
ac_free_package(pPackage);
pPackage = ac_read_package(pacInstance);
}
@@ -930,73 +723,69 @@ int CALL_CONVT ac_skip_frames(lp_ac_instance pacInstance, lp_ac_decoder pDecoder
return 1;
}
-
-
//Seek function
-int CALL_CONVT ac_seek(lp_ac_decoder pDecoder, int dir, int64_t target_pos) {
- AVRational timebase =
- ((lp_ac_data)pDecoder->pacInstance)->pFormatCtx->streams[pDecoder->stream_index]->time_base;
+int CALL_CONVT ac_seek(lp_ac_decoder pDecoder, int dir, int64_t target_pos)
+{
+ AVRational timebase = ((lp_ac_data)pDecoder->pacInstance)->pFormatCtx->streams[pDecoder->stream_index]->time_base;
+ int flags = dir < 0 ? AVSEEK_FLAG_BACKWARD : 0;
+ int64_t pos = av_rescale(target_pos, AV_TIME_BASE, 1000);
+ pDecoder->timecode = target_pos / 1000.0;
+ pDecoder->video_clock = target_pos / 1000.0;
- int flags = dir < 0 ? AVSEEK_FLAG_BACKWARD : 0;
-
- int64_t pos = av_rescale(target_pos, AV_TIME_BASE, 1000);
-
- ((lp_ac_decoder_data)pDecoder)->sought = 100;
- pDecoder->timecode = target_pos / 1000;
-
- if (av_seek_frame(((lp_ac_data)pDecoder->pacInstance)->pFormatCtx, pDecoder->stream_index,
- av_rescale_q(pos, AV_TIME_BASE_Q, timebase), flags) >= 0) {
-
- if (pDecoder->type == AC_DECODER_TYPE_AUDIO)
+ if (av_seek_frame(((lp_ac_data)pDecoder->pacInstance)->pFormatCtx, pDecoder->stream_index,
+ av_rescale_q(pos, AV_TIME_BASE_Q, timebase), flags) >= 0)
{
- if (((lp_ac_audio_decoder)pDecoder)->pCodecCtx->codec->flush != NULL)
- avcodec_flush_buffers(((lp_ac_audio_decoder)pDecoder)->pCodecCtx);
- av_free(((lp_ac_audio_decoder)pDecoder)->tmp_data);
- ((lp_ac_audio_decoder)pDecoder)->tmp_data_length = 0;
+ if (pDecoder->type == AC_DECODER_TYPE_AUDIO)
+ {
+ if (((lp_ac_audio_decoder)pDecoder)->pCodecCtx->codec->flush != NULL)
+ avcodec_flush_buffers(((lp_ac_audio_decoder)pDecoder)->pCodecCtx);
+ }
+
+ if (pDecoder->type == AC_DECODER_TYPE_VIDEO)
+ {
+ if (((lp_ac_video_decoder)pDecoder)->pCodecCtx->codec->flush != NULL)
+ avcodec_flush_buffers(((lp_ac_video_decoder)pDecoder)->pCodecCtx);
+ }
+ return 1;
}
- return 1;
- }
-
- return 0;
+ return 0;
}
//Free video decoder
-void ac_free_video_decoder(lp_ac_video_decoder pDecoder) {
- av_free(pDecoder->pFrame);
- av_free(pDecoder->pFrameRGB);
- if (pDecoder->pSwsCtx != NULL) {
- sws_freeContext(pDecoder->pSwsCtx);
- }
- avcodec_close(pDecoder->pCodecCtx);
-
- //Free reserved memory for the buffer
- av_free(pDecoder->decoder.pBuffer);
-
- //Free reserved memory for decoder record
- av_free(pDecoder);
+void ac_free_video_decoder(lp_ac_video_decoder pDecoder)
+{
+ av_free(pDecoder->pFrame);
+ av_free(pDecoder->pFrameRGB);
+
+ if (pDecoder->pSwsCtx != NULL)
+ sws_freeContext(pDecoder->pSwsCtx);
+
+ avcodec_close(pDecoder->pCodecCtx);
+
+ //Free reserved memory for the buffer
+ av_free(pDecoder->decoder.pBuffer);
+
+ //Free reserved memory for decoder record
+ av_free(pDecoder);
}
//Free video decoder
-void ac_free_audio_decoder(lp_ac_audio_decoder pDecoder) {
-// av_free(pDecoder->decoder.pBuffer);
- avcodec_close(pDecoder->pCodecCtx);
-
- //Free reserved memory for the buffer
- av_free(pDecoder->decoder.pBuffer);
-
- //Free the memory reserved for the temporary audio buffer
- av_free(pDecoder->tmp_data);
+void ac_free_audio_decoder(lp_ac_audio_decoder pDecoder)
+{
+ avcodec_close(pDecoder->pCodecCtx);
- //Free reserved memory for decoder record
- av_free(pDecoder);
+ //Free reserved memory for the buffer
+ av_free(pDecoder->decoder.pBuffer);
+
+ //Free reserved memory for decoder record
+ av_free(pDecoder);
}
-void CALL_CONVT ac_free_decoder(lp_ac_decoder pDecoder) {
- if (pDecoder->type == AC_DECODER_TYPE_VIDEO) {
- ac_free_video_decoder((lp_ac_video_decoder)pDecoder);
- }
- else if (pDecoder->type == AC_DECODER_TYPE_AUDIO) {
- ac_free_audio_decoder((lp_ac_audio_decoder)pDecoder);
- }
+void CALL_CONVT ac_free_decoder(lp_ac_decoder pDecoder)
+{
+ if (pDecoder->type == AC_DECODER_TYPE_VIDEO)
+ ac_free_video_decoder((lp_ac_video_decoder)pDecoder);
+ else if (pDecoder->type == AC_DECODER_TYPE_AUDIO)
+ ac_free_audio_decoder((lp_ac_audio_decoder)pDecoder);
}
diff --git a/Vocaluxe/Lib/Video/Acinerella/acinerella.h b/Vocaluxe/Lib/Video/Acinerella/acinerella.h
index 203d8750..bdae2056 100644
--- a/Vocaluxe/Lib/Video/Acinerella/acinerella.h
+++ b/Vocaluxe/Lib/Video/Acinerella/acinerella.h
@@ -113,7 +113,7 @@ struct _ac_audio_stream_info {
/*Bits per sample. Can be 8 or 16 Bit.*/
int bit_depth;
/*Count of channels in the audio stream.*/
- int channel_count;
+ int channel_count;
};
typedef struct _ac_audio_stream_info ac_audio_stream_info;
@@ -167,44 +167,17 @@ typedef struct _ac_package ac_package;
/*Pointer on TAc_package*/
typedef ac_package* lp_ac_package;
-typedef void* lp_ac_proberesult;
-
-/*Callback function used to ask the application to read data. Should return
- the number of bytes read or an value smaller than zero if an error occured.*/
-typedef int CALL_CONVT (*ac_read_callback)(void *sender, char *buf, int size);
-/*Callback function used to ask the application to seek. return 0 if succeed , -1 on failure.*/
-typedef int64_t CALL_CONVT (*ac_seek_callback)(void *sender, int64_t pos, int whence);
-/*Callback function that is used to notify the application when the data stream
- is opened or closed. For example the file pointer should be resetted to zero
- when the "open" function is called.*/
-typedef int CALL_CONVT (*ac_openclose_callback)(void *sender);
-
-typedef void* CALL_CONVT (*ac_malloc_callback)(size_t size);
-typedef void* CALL_CONVT (*ac_realloc_callback)(void *ptr, size_t size);
-typedef void CALL_CONVT (*ac_free_callback)(void *ptr);
-
/*Initializes an Acinerella instance.*/
extern lp_ac_instance CALL_CONVT ac_init(void);
extern void CALL_CONVT ac_free(lp_ac_instance pacInstance);
-/*Opens a media file.
- @param(inst specifies the Acinerella Instance the stream should be opened for)
- @param(sender specifies a pointer that is sent to all callback functions to
- allow you to do object orientated programming. May be NULL.)
- @param(open_proc specifies the callback function that is called, when the
- media file is opened. May be NULL.)
- @param(seek_proc specifies the callback function that is called, when the ffmpeg decoder
- wants to seek in the file. May be NULL)
- @param(close_proc specifies the callback function that is called when the media
- file is closed. May be NULL.)*/
-extern int CALL_CONVT ac_open(
+/*Opens a media file.*/
+
+extern int CALL_CONVT ac_open2(
lp_ac_instance pacInstance,
- void *sender,
- ac_openclose_callback open_proc,
- ac_read_callback read_proc,
- ac_seek_callback seek_proc,
- ac_openclose_callback close_proc,
- lp_ac_proberesult proberesult);
+ const char* filename
+);
+
/*Closes an opened media file.*/
extern void CALL_CONVT ac_close(lp_ac_instance pacInstance);
@@ -216,9 +189,8 @@ extern lp_ac_package CALL_CONVT ac_read_package(lp_ac_instance pacInstance);
/*Frees a package that has been read.*/
extern void CALL_CONVT ac_free_package(lp_ac_package pPackage);
-/*Creates an decoder for the specified stream number. Returns NIL if no decoder
- could be found.*/
-extern lp_ac_decoder CALL_CONVT ac_create_decoder(lp_ac_instance pacInstance, int nb);
+extern lp_ac_decoder CALL_CONVT ac_create_audio_decoder(lp_ac_instance pacInstance);
+extern lp_ac_decoder CALL_CONVT ac_create_video_decoder(lp_ac_instance pacInstance);
/*Frees an created decoder.*/
extern void CALL_CONVT ac_free_decoder(lp_ac_decoder pDecoder);
/*Decodes a package using the specified decoder. The decodec data is stored in the
@@ -235,7 +207,4 @@ but seeks the whole file forward. The stream number paremter (nb) is only used f
The parameter "dir" specifies the seek direction: 0 for forward, -1 for backward.
The target_pos paremeter is in milliseconds. Returns 1 if the functions succeded.*/
extern int CALL_CONVT ac_seek(lp_ac_decoder pDecoder, int dir, int64_t target_pos);
-
-extern lp_ac_proberesult CALL_CONVT ac_probe_input_buffer(void* buf, int bufsize, char* filename, int* score_max);
-
#endif /*VIDEOPLAY_H*/
diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs
index a6f9728d..d553001e 100644
--- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs
+++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs
@@ -194,10 +194,6 @@ namespace Vocaluxe.Lib.Video
private int _StreamID; // stream ID for stream closing
private string _FileName; // current video file name
- private FileStream _fs; // video file stream
- private readonly TAc_read_callback _rc; // read callback for acinerella
- private readonly TAc_seek_callback _sc; // seek callback for acinerella
-
private bool _FileOpened;
private float _VideoTimeBase; // frame time
@@ -237,8 +233,6 @@ namespace Vocaluxe.Lib.Video
public Decoder()
{
- _rc = read_proc;
- _sc = seek_proc;
_thread = new Thread(Execute);
}
@@ -359,6 +353,9 @@ namespace Vocaluxe.Lib.Video
#region Threading
private void DoSkip()
{
+ if (!_FileOpened)
+ return;
+
_VideoSkipTime = _Gap;
_SkipTime = _Start + _Gap;
_BeforeLoop = false;
@@ -449,14 +446,11 @@ namespace Vocaluxe.Lib.Video
TAc_instance Instance = new TAc_instance();
try
{
- _fs = new FileStream(_FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
-
-
_instance = CAcinerella.ac_init();
- CAcinerella.ac_open(_instance, IntPtr.Zero, null, _rc, _sc, null, IntPtr.Zero);
+ CAcinerella.ac_open2(_instance, _FileName);
Instance = (TAc_instance)Marshal.PtrToStructure(_instance, typeof(TAc_instance));
- ok = true;
+ ok = Instance.opened;
}
catch (Exception)
{
@@ -474,20 +468,19 @@ namespace Vocaluxe.Lib.Video
_Duration = Instance.info.duration / 1000f;
int VideoStreamIndex = -1;
-
- TAc_stream_info Info = new TAc_stream_info();
- for (int i = 0; i < Instance.stream_count; i++)
+ TAc_decoder Videodecoder;
+ try
{
- CAcinerella.ac_get_stream_info(_instance, i, out Info);
-
- if (Info.stream_type == TAc_stream_type.AC_STREAM_TYPE_VIDEO)
- {
- _videodecoder = CAcinerella.ac_create_decoder(_instance, i);
-
- VideoStreamIndex = i;
- break;
- }
+ _videodecoder = CAcinerella.ac_create_video_decoder(_instance);
+ Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder));
+ VideoStreamIndex = Videodecoder.stream_index;
}
+ catch (Exception)
+ {
+ CLog.LogError("Error opening video file (can't find decoder): " + _FileName);
+ return;
+ }
+
if (VideoStreamIndex < 0)
{
@@ -495,8 +488,6 @@ namespace Vocaluxe.Lib.Video
return;
}
- TAc_decoder Videodecoder = (TAc_decoder)Marshal.PtrToStructure(_videodecoder, typeof(TAc_decoder));
-
_Width = Videodecoder.stream_info.video_info.frame_width;
_Height = Videodecoder.stream_info.video_info.frame_height;
@@ -656,9 +647,6 @@ namespace Vocaluxe.Lib.Video
_NewFrame = false;
}
}
-
- //if (!_BufferFull)
- // EventDecode.Set();
}
private void UploadNewFrame(ref STexture frame)
@@ -685,7 +673,6 @@ namespace Vocaluxe.Lib.Video
_CurrentVideoTime = _FrameBuffer[num].time;
}
_Finished = false;
- //EventDecode.Set();
}
else
{
@@ -738,28 +725,8 @@ namespace Vocaluxe.Lib.Video
}
#endregion Threading
- #region Callbacks
- private Int32 read_proc(IntPtr sender, IntPtr buf, Int32 size)
- {
- Int32 r = 0;
-
- byte[] bb = new byte[size];
- r = _fs.Read(bb, 0, size);
- Marshal.Copy(bb, 0, buf, size);
-
- return r;
- }
-
- private Int64 seek_proc(IntPtr sender, Int64 pos, Int32 whence)
- {
- return _fs.Seek(pos, (SeekOrigin)whence);
- }
- #endregion Callbacks
-
public void Dispose()
{
- _fs.Dispose();
- _fs = null;
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs
index e1f82d89..7d781f33 100644
--- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs
+++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs
@@ -26,7 +26,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer
#region arch
#if ARCH_X86
#if WIN
- private const string Dll = "x86\\gstreamerhelper.dll";
+ private const string Dll = "x86\\gstreamer\\gstreamerhelper.dll";
#endif
#endif
@@ -37,32 +37,33 @@ namespace Vocaluxe.Lib.Video.Gstreamer
#endif
#endregion arch
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void LogCallback(string message);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetVideoLogCallback(LogCallback c);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool InitVideo();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void CloseAllVideos();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern int LoadVideo(string VideoFileName);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool CloseVideo(int StreamID);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetVideoNumStreams();
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetVideoLength(int StreamID);
- [DllImport(Dll, EntryPoint = "GetFrame")]
+ [DllImport(Dll, EntryPoint = "GetFrame", CallingConvention = CallingConvention.Cdecl)]
public static extern NativeFrame GetFrameNative(int StreamID, float Time);
public static ManagedFrame GetFrame(int StreamID, float Time)
@@ -86,25 +87,25 @@ namespace Vocaluxe.Lib.Video.Gstreamer
return m;
}
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Skip(int StreamID, float Start, float Gap);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetVideoLoop(int StreamID,
[MarshalAs(UnmanagedType.U1)] bool Loop);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void PauseVideo(int StreamID);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
public static extern void ResumeVideo(int StreamID);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Finished(int StreamID);
- [DllImport(Dll)]
+ [DllImport(Dll, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool UpdateVideo();
}
diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs
index 26e71ab3..32ec3c6c 100644
--- a/Vocaluxe/Screens/CScreenNames.cs
+++ b/Vocaluxe/Screens/CScreenNames.cs
@@ -580,8 +580,11 @@ namespace Vocaluxe.Screens
//Update texture and name
if (CConfig.Players[i].Length > 0)
{
- Statics[StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
- Texts[TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
+ if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
+ {
+ Statics[StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
+ Texts[TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
+ }
}
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
{
diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs
index 99f19377..da563a10 100644
--- a/Vocaluxe/Screens/CScreenSing.cs
+++ b/Vocaluxe/Screens/CScreenSing.cs
@@ -1342,7 +1342,7 @@ namespace Vocaluxe.Screens
{
for (int i = 0; i < CGame.NumPlayer; i++)
{
- if (CGame.Player[i].ProfileID > -1)
+ if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
else
Statics[StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
@@ -1353,7 +1353,7 @@ namespace Vocaluxe.Screens
{
for (int i = 0; i < CGame.NumPlayer; i++)
{
- if (CGame.Player[i].ProfileID > -1)
+ if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
Texts[TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
else
Texts[TextNames[i, CGame.NumPlayer - 1]].Visible = false;
diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj
index cf32e0fc..8c8bb74a 100644
--- a/Vocaluxe/Vocaluxe.csproj
+++ b/Vocaluxe/Vocaluxe.csproj
@@ -10,12 +10,12 @@
Properties
Vocaluxe
Vocaluxe
- v2.0
+ v4.0
512
false
Vocaluxe.MainProgram
Vocaluxe.ico
-
+ Client
publish\
true
Disk
diff --git a/Vocaluxe/app.config b/Vocaluxe/app.config
index 49666a2b..8d6e9eda 100644
--- a/Vocaluxe/app.config
+++ b/Vocaluxe/app.config
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs
new file mode 100644
index 00000000..15dc154a
--- /dev/null
+++ b/VocaluxeLib/Menu/CPoints.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace VocaluxeLib.Menu
+{
+ public class CPoints
+ {
+ private readonly SPlayer[,] _Rounds;
+
+ public CPoints(int NumRounds, SPlayer[] Player)
+ {
+ _Rounds = new SPlayer[NumRounds, Player.Length];
+
+ for (int round = 0; round < NumRounds; round++)
+ {
+ for (int player = 0; player < Player.Length; player++)
+ {
+ _Rounds[round, player].ProfileID = Player[player].ProfileID;
+ _Rounds[round, player].Name = Player[player].Name;
+ _Rounds[round, player].Difficulty = Player[player].Difficulty;
+ _Rounds[round, player].Points = 0f;
+ _Rounds[round, player].PointsGoldenNotes = 0f;
+ _Rounds[round, player].PointsLineBonus = 0f;
+ _Rounds[round, player].Medley = false;
+ _Rounds[round, player].Duet = false;
+ _Rounds[round, player].ShortSong = false;
+ _Rounds[round, player].SongFinished = false;
+ }
+ }
+ }
+
+ public void SetPoints(int Round, int SongID, SPlayer[] Player, bool Medley, bool Duet, bool ShortSong)
+ {
+ long DateTicks = DateTime.Now.Ticks;
+ for (int player = 0; player < Player.Length; player++)
+ {
+ _Rounds[Round, player].SongID = SongID;
+ _Rounds[Round, player].LineNr = Player[player].LineNr;
+ _Rounds[Round, player].Points = Player[player].Points;
+ _Rounds[Round, player].PointsGoldenNotes = Player[player].PointsGoldenNotes;
+ _Rounds[Round, player].PointsLineBonus = Player[player].PointsLineBonus;
+ _Rounds[Round, player].Medley = Medley;
+ _Rounds[Round, player].Duet = Duet;
+ _Rounds[Round, player].ShortSong = ShortSong;
+ _Rounds[Round, player].DateTicks = DateTicks;
+ _Rounds[Round, player].SongFinished = Player[player].SongFinished;
+ }
+ }
+
+ public int NumRounds
+ {
+ get { return _Rounds.GetLength(0); }
+ }
+
+ public int NumPlayer
+ {
+ get { return _Rounds.GetLength(1); }
+ }
+
+ public SPlayer[] GetPlayer(int Round, int numPlayer)
+ {
+ if (NumPlayer == 0)
+ return new SPlayer[1];
+ if (Round >= NumRounds)
+ return new SPlayer[1];
+
+ SPlayer[] player = new SPlayer[numPlayer];
+
+ for (int p = 0; p < player.Length; p++)
+ {
+ player[p].Name = _Rounds[Round, p].Name;
+ player[p].Points = _Rounds[Round, p].Points;
+ player[p].PointsGoldenNotes = _Rounds[Round, p].PointsGoldenNotes;
+ player[p].PointsLineBonus = _Rounds[Round, p].PointsLineBonus;
+ player[p].SongID = _Rounds[Round, p].SongID;
+ player[p].LineNr = _Rounds[Round, p].LineNr;
+ player[p].Difficulty = _Rounds[Round, p].Difficulty;
+ player[p].Medley = _Rounds[Round, p].Medley;
+ player[p].Duet = _Rounds[Round, p].Duet;
+ player[p].ShortSong = _Rounds[Round, p].ShortSong;
+ player[p].DateTicks = _Rounds[Round, p].DateTicks;
+ player[p].SongFinished = _Rounds[Round, p].SongFinished;
+ player[p].ProfileID = _Rounds[Round, p].ProfileID;
+ }
+ return player;
+ }
+ }
+}
diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs
new file mode 100644
index 00000000..3acc1e8e
--- /dev/null
+++ b/VocaluxeLib/Menu/Enums.cs
@@ -0,0 +1,285 @@
+using System;
+
+namespace VocaluxeLib.Menu
+{
+ #region Inputs
+ [Flags]
+ public enum EModifier
+ {
+ None = 0,
+ Shift = 1,
+ Alt = 2,
+ Ctrl = 4
+ }
+
+ public enum ESender
+ {
+ Mouse,
+ Keyboard,
+ WiiMote,
+ Gamepad
+ }
+ #endregion Inputs
+
+ #region Fonts
+ public enum EAspect
+ {
+ Crop,
+ LetterBox,
+ Stretch
+ }
+
+ public enum EAlignment
+ {
+ Left,
+ Center,
+ Right
+ }
+
+ public enum EHAlignment
+ {
+ Top,
+ Center,
+ Bottom
+ }
+
+ public enum EStyle
+ {
+ Normal,
+ Italic,
+ Bold,
+ BoldItalic
+ }
+ #endregion Fonts
+
+ #region Config
+ public enum ERenderer
+ {
+#if WIN
+ TR_CONFIG_DIRECT3D,
+#endif
+ TR_CONFIG_OPENGL,
+ TR_CONFIG_SOFTWARE
+ }
+
+ public enum EAntiAliasingModes
+ {
+ x0 = 0,
+ x2 = 2,
+ x4 = 4,
+ x8 = 8,
+ x16 = 16,
+ x32 = 32
+ }
+
+ public enum EColorDeep
+ {
+ Bit8 = 8,
+ Bit16 = 16,
+ Bit24 = 24,
+ Bit32 = 32
+ }
+
+ public enum ETextureQuality
+ {
+ TR_CONFIG_TEXTURE_LOWEST,
+ TR_CONFIG_TEXTURE_LOW,
+ TR_CONFIG_TEXTURE_MEDIUM,
+ TR_CONFIG_TEXTURE_HIGH,
+ TR_CONFIG_TEXTURE_HIGHEST
+ }
+
+ public enum EOffOn
+ {
+ TR_CONFIG_OFF,
+ TR_CONFIG_ON
+ }
+
+ public enum EDebugLevel
+ {
+ // don't change the order!
+ TR_CONFIG_OFF, //no debug infos
+ TR_CONFIG_ONLY_FPS,
+ TR_CONFIG_LEVEL1,
+ TR_CONFIG_LEVEL2,
+ TR_CONFIG_LEVEL3,
+ TR_CONFIG_LEVEL_MAX //all debug infos
+ }
+
+ public enum EBufferSize
+ {
+ b0 = 0,
+ b512 = 512,
+ b1024 = 1024,
+ b1536 = 1536,
+ b2048 = 2048,
+ b2560 = 2560,
+ b3072 = 3072,
+ b3584 = 3584,
+ b4096 = 4096
+ }
+
+ public enum EPlaybackLib
+ {
+ PortAudio,
+ OpenAL,
+ Gstreamer
+ }
+
+ public enum EWebcamLib
+ {
+ OpenCV,
+ AForgeNet
+ }
+
+ public enum ERecordLib
+ {
+#if WIN
+ DirectSound,
+#endif
+ PortAudio
+ }
+
+ public enum EVideoDecoder
+ {
+ FFmpeg,
+ Gstreamer
+ }
+
+ public enum ESongMenu
+ {
+ //TR_CONFIG_LIST, //a simple list
+ //TR_CONFIG_DREIDEL, //as in ultrastar deluxe
+ TR_CONFIG_TILE_BOARD, //chessboard like
+ //TR_CONFIG_BOOK //for playlists
+ }
+
+ public enum EDuetOptions
+ {
+ All,
+ Duets,
+ NoDuets
+ }
+
+ public enum ESongSorting
+ {
+ TR_CONFIG_NONE,
+ //TR_CONFIG_RANDOM,
+ TR_CONFIG_FOLDER,
+ TR_CONFIG_ARTIST,
+ TR_CONFIG_ARTIST_LETTER,
+ TR_CONFIG_TITLE_LETTER,
+ TR_CONFIG_EDITION,
+ TR_CONFIG_GENRE,
+ TR_CONFIG_LANGUAGE,
+ TR_CONFIG_YEAR,
+ TR_CONFIG_DECADE
+ }
+
+ public enum ECoverLoading
+ {
+ TR_CONFIG_COVERLOADING_ONDEMAND,
+ TR_CONFIG_COVERLOADING_ATSTART,
+ TR_CONFIG_COVERLOADING_DYNAMIC
+ }
+
+ public enum EGameDifficulty
+ {
+ TR_CONFIG_EASY,
+ TR_CONFIG_NORMAL,
+ TR_CONFIG_HARD
+ }
+
+ public enum ETimerMode
+ {
+ TR_CONFIG_TIMERMODE_CURRENT,
+ TR_CONFIG_TIMERMODE_REMAINING,
+ TR_CONFIG_TIMERMODE_TOTAL
+ }
+
+ public enum ETimerLook
+ {
+ TR_CONFIG_TIMERLOOK_NORMAL,
+ TR_CONFIG_TIMERLOOK_EXPANDED
+ }
+
+ public enum EBackgroundMusicSource
+ {
+ TR_CONFIG_NO_OWN_MUSIC,
+ TR_CONFIG_OWN_MUSIC,
+ TR_CONFIG_ONLY_OWN_MUSIC
+ }
+
+ public enum EPlayerInfo
+ {
+ TR_CONFIG_PLAYERINFO_BOTH,
+ TR_CONFIG_PLAYERINFO_NAME,
+ TR_CONFIG_PLAYERINFO_AVATAR,
+ TR_CONFIG_PLAYERINFO_OFF
+ }
+
+ public enum EFadePlayerInfo
+ {
+ TR_CONFIG_FADEPLAYERINFO_ALL,
+ TR_CONFIG_FADEPLAYERINFO_INFO,
+ TR_CONFIG_FADEPLAYERINFO_OFF
+ }
+
+ public enum ELyricStyle
+ {
+ Fill,
+ Jump,
+ Slide,
+ Zoom
+ }
+ #endregion Config
+
+ public enum EGameState
+ {
+ Start,
+ Normal,
+ EditTheme
+ }
+
+ public enum EGameMode
+ {
+ TR_GAMEMODE_NORMAL,
+ TR_GAMEMODE_MEDLEY,
+ TR_GAMEMODE_DUET,
+ TR_GAMEMODE_SHORTSONG
+ }
+
+ public enum ENoteType
+ {
+ Normal,
+ Golden,
+ Freestyle
+ }
+
+ public enum EScreens
+ {
+ ScreenTest = 0,
+ ScreenLoad = 1,
+ ScreenMain = 2,
+ ScreenSong = 3,
+ ScreenOptions = 4,
+ ScreenSing = 5,
+ ScreenProfiles = 6,
+ ScreenScore = 7,
+ ScreenHighscore = 8,
+
+ ScreenOptionsGame = 9,
+ ScreenOptionsSound = 10,
+ ScreenOptionsRecord = 11,
+ ScreenOptionsVideo = 12,
+ ScreenOptionsLyrics = 13,
+ ScreenOptionsTheme = 14,
+
+ ScreenNames = 15,
+ ScreenCredits = 16,
+ ScreenParty = 17,
+ ScreenPartyDummy = 18,
+
+ ScreenNull = -1
+ }
+}
\ No newline at end of file
diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs
index 2f35326e..42bfd321 100644
--- a/VocaluxeLib/Menu/IMenu.cs
+++ b/VocaluxeLib/Menu/IMenu.cs
@@ -312,642 +312,4 @@ namespace VocaluxeLib.Menu
int GetPlaylistSongCount(int PlaylistID);
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
}
-
- [Flags]
- public enum EModifier
- {
- None = 0,
- Shift = 1,
- Alt = 2,
- Ctrl = 4
- }
-
- public enum ESender
- {
- Mouse,
- Keyboard,
- WiiMote,
- Gamepad
- }
-
- public struct KeyEvent
- {
- public ESender Sender;
- public bool ModALT;
- public bool ModSHIFT;
- public bool ModCTRL;
- public bool KeyPressed;
- public bool Handled;
- public Keys Key;
- public Char Unicode;
- public EModifier Mod;
-
- public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key)
- {
- Sender = sender;
- ModALT = alt;
- ModSHIFT = shift;
- ModCTRL = ctrl;
- KeyPressed = pressed;
- Unicode = unicode;
- Key = key;
- Handled = false;
-
- Mod = EModifier.None;
-
- if (alt)
- Mod |= EModifier.Alt;
- if (shift)
- Mod |= EModifier.Shift;
- if (ctrl)
- Mod |= EModifier.Ctrl;
- }
- }
-
- public struct MouseEvent
- {
- public ESender Sender;
- public bool Handled;
- public int X;
- public int Y;
- public bool LB; //left button click
- public bool LD; //left button double click
- public bool RB; //right button click
- public bool MB; //middle button click
-
- public bool LBH; //left button hold (when moving)
- public bool RBH; //right button hold (when moving)
- public bool MBH; //middle button hold (when moving)
-
- public bool ModALT;
- public bool ModSHIFT;
- public bool ModCTRL;
-
- public EModifier Mod;
- public int Wheel;
-
- public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
- {
- Sender = sender;
- Handled = false;
- X = x;
- Y = y;
- LB = lb;
- LD = ld;
- RB = rb;
- MB = mb;
-
- LBH = lbh;
- RBH = rbh;
- MBH = mbh;
-
- ModALT = alt;
- ModSHIFT = shift;
- ModCTRL = ctrl;
-
- EModifier mALT = EModifier.None;
- EModifier mSHIFT = EModifier.None;
- EModifier mCTRL = EModifier.None;
-
- if (alt)
- mALT = EModifier.Alt;
-
- if (shift)
- mSHIFT = EModifier.Shift;
-
- if (ctrl)
- mCTRL = EModifier.Ctrl;
-
- if (!alt && !shift && !ctrl)
- Mod = EModifier.None;
- else
- Mod = mALT | mSHIFT | mCTRL;
-
- Wheel = wheel;
- }
- }
-
- public enum EGameState
- {
- Start,
- Normal,
- EditTheme
- }
-
- public enum EAspect
- {
- Crop,
- LetterBox,
- Stretch
- }
-
- #region Structs
- public struct SColorF
- {
- public float R;
- public float G;
- public float B;
- public float A;
-
- public SColorF(float r, float g, float b, float a)
- {
- R = r;
- G = g;
- B = b;
- A = a;
- }
-
- public SColorF(SColorF Color)
- {
- R = Color.R;
- G = Color.G;
- B = Color.B;
- A = Color.A;
- }
- }
-
- public struct SRectF
- {
- public float X;
- public float Y;
- public float W;
- public float H;
- public float Z;
- public float Rotation; //0..360°
-
- public SRectF(float x, float y, float w, float h, float z)
- {
- X = x;
- Y = y;
- W = w;
- H = h;
- Z = z;
- Rotation = 0f;
- }
-
- public SRectF(SRectF rect)
- {
- X = rect.X;
- Y = rect.Y;
- W = rect.W;
- H = rect.H;
- Z = rect.Z;
- Rotation = 0f;
- }
- }
-
- public struct SPoint3f
- {
- public float X;
- public float Y;
- public float Z;
- }
-
- public struct SPoint3
- {
- public int X;
- public int Y;
- public int Z;
- }
-
- public struct STexture
- {
- public int index;
- public int PBO;
- public int ID;
-
- public string TexturePath;
-
- public float width;
- public float height;
- public SRectF rect;
-
- public float w2; //power of 2 width
- public float h2; //power of 2 height
- public float width_ratio;
- public float height_ratio;
-
- public SColorF color;
-
- public STexture(int Index)
- {
- index = Index;
- PBO = 0;
- ID = -1;
- TexturePath = String.Empty;
-
- width = 1f;
- height = 1f;
- rect = new SRectF(0f, 0f, 1f, 1f, 0f);
-
- w2 = 2f;
- h2 = 2f;
- width_ratio = 0.5f;
- height_ratio = 0.5f;
-
- color = new SColorF(1f, 1f, 1f, 1f);
- }
- }
- #endregion Structs
-
- #region EnumsConfig
- public enum ERenderer
- {
-#if WIN
- TR_CONFIG_DIRECT3D,
-#endif
- TR_CONFIG_OPENGL,
- TR_CONFIG_SOFTWARE
- }
-
- public enum EAntiAliasingModes
- {
- x0 = 0,
- x2 = 2,
- x4 = 4,
- x8 = 8,
- x16 = 16,
- x32 = 32
- }
-
- public enum EColorDeep
- {
- Bit8 = 8,
- Bit16 = 16,
- Bit24 = 24,
- Bit32 = 32
- }
-
- public enum ETextureQuality
- {
- TR_CONFIG_TEXTURE_LOWEST,
- TR_CONFIG_TEXTURE_LOW,
- TR_CONFIG_TEXTURE_MEDIUM,
- TR_CONFIG_TEXTURE_HIGH,
- TR_CONFIG_TEXTURE_HIGHEST
- }
-
- public enum EOffOn
- {
- TR_CONFIG_OFF,
- TR_CONFIG_ON
- }
-
- public enum EDebugLevel
- {
- // don't change the order!
- TR_CONFIG_OFF, //no debug infos
- TR_CONFIG_ONLY_FPS,
- TR_CONFIG_LEVEL1,
- TR_CONFIG_LEVEL2,
- TR_CONFIG_LEVEL3,
- TR_CONFIG_LEVEL_MAX //all debug infos
- }
-
- public enum EBufferSize
- {
- b0 = 0,
- b512 = 512,
- b1024 = 1024,
- b1536 = 1536,
- b2048 = 2048,
- b2560 = 2560,
- b3072 = 3072,
- b3584 = 3584,
- b4096 = 4096
- }
-
- public enum EPlaybackLib
- {
- PortAudio,
- OpenAL,
- Gstreamer
- }
-
- public enum EWebcamLib
- {
- OpenCV,
- AForgeNet
- }
-
- public enum ERecordLib
- {
-#if WIN
- DirectSound,
-#endif
- PortAudio
- }
-
- public enum EVideoDecoder
- {
- FFmpeg,
- Gstreamer
- }
-
- public enum ESongMenu
- {
- //TR_CONFIG_LIST, //a simple list
- //TR_CONFIG_DREIDEL, //as in ultrastar deluxe
- TR_CONFIG_TILE_BOARD, //chessboard like
- //TR_CONFIG_BOOK //for playlists
- }
-
- public enum EDuetOptions
- {
- All,
- Duets,
- NoDuets
- }
-
- public enum ESongSorting
- {
- TR_CONFIG_NONE,
- //TR_CONFIG_RANDOM,
- TR_CONFIG_FOLDER,
- TR_CONFIG_ARTIST,
- TR_CONFIG_ARTIST_LETTER,
- TR_CONFIG_TITLE_LETTER,
- TR_CONFIG_EDITION,
- TR_CONFIG_GENRE,
- TR_CONFIG_LANGUAGE,
- TR_CONFIG_YEAR,
- TR_CONFIG_DECADE
- }
-
- public enum ECoverLoading
- {
- TR_CONFIG_COVERLOADING_ONDEMAND,
- TR_CONFIG_COVERLOADING_ATSTART,
- TR_CONFIG_COVERLOADING_DYNAMIC
- }
-
- public enum EGameDifficulty
- {
- TR_CONFIG_EASY,
- TR_CONFIG_NORMAL,
- TR_CONFIG_HARD
- }
-
- public enum ETimerMode
- {
- TR_CONFIG_TIMERMODE_CURRENT,
- TR_CONFIG_TIMERMODE_REMAINING,
- TR_CONFIG_TIMERMODE_TOTAL
- }
-
- public enum ETimerLook
- {
- TR_CONFIG_TIMERLOOK_NORMAL,
- TR_CONFIG_TIMERLOOK_EXPANDED
- }
-
- public enum EBackgroundMusicSource
- {
- TR_CONFIG_NO_OWN_MUSIC,
- TR_CONFIG_OWN_MUSIC,
- TR_CONFIG_ONLY_OWN_MUSIC
- }
-
- public enum EPlayerInfo
- {
- TR_CONFIG_PLAYERINFO_BOTH,
- TR_CONFIG_PLAYERINFO_NAME,
- TR_CONFIG_PLAYERINFO_AVATAR,
- TR_CONFIG_PLAYERINFO_OFF
- }
-
- public enum EFadePlayerInfo
- {
- TR_CONFIG_FADEPLAYERINFO_ALL,
- TR_CONFIG_FADEPLAYERINFO_INFO,
- TR_CONFIG_FADEPLAYERINFO_OFF
- }
-
- public enum ELyricStyle
- {
- Fill,
- Jump,
- Slide,
- Zoom
- }
- #endregion EnumsConfig
-
- public enum EAlignment
- {
- Left,
- Center,
- Right
- }
-
- public enum EHAlignment
- {
- Top,
- Center,
- Bottom
- }
-
- public enum EStyle
- {
- Normal,
- Italic,
- Bold,
- BoldItalic
- }
-
- public enum ENoteType
- {
- Normal,
- Golden,
- Freestyle
- }
-
- public struct SProfile
- {
- public string PlayerName;
- public string ProfileFile;
-
- public EGameDifficulty Difficulty;
- public SAvatar Avatar;
- public EOffOn GuestProfile;
- public EOffOn Active;
- }
-
- public struct SAvatar
- {
- public string FileName;
- public STexture Texture;
-
- public SAvatar(int dummy)
- {
- FileName = String.Empty;
- Texture = new STexture(-1);
- }
- }
-
- public struct SPlayer
- {
- public int ProfileID;
- public string Name;
- public EGameDifficulty Difficulty;
- public double Points;
- public double PointsLineBonus;
- public double PointsGoldenNotes;
- public int NoteDiff;
- public int LineNr;
- public List SingLine;
- public int CurrentLine;
- public int CurrentNote;
-
- public int SongID;
- public bool Medley;
- public bool Duet;
- public bool ShortSong;
- public long DateTicks;
- public bool SongFinished;
- }
-
- public class CPoints
- {
- private readonly SPlayer[,] _Rounds;
-
- public CPoints(int NumRounds, SPlayer[] Players)
- {
- _Rounds = new SPlayer[NumRounds,Players.Length];
-
- for (int round = 0; round < NumRounds; round++)
- {
- for (int player = 0; player < Players.Length; player++)
- {
- _Rounds[round, player].ProfileID = Players[player].ProfileID;
- _Rounds[round, player].Name = Players[player].Name;
- _Rounds[round, player].Difficulty = Players[player].Difficulty;
- _Rounds[round, player].Points = 0f;
- _Rounds[round, player].PointsGoldenNotes = 0f;
- _Rounds[round, player].PointsLineBonus = 0f;
- _Rounds[round, player].Medley = false;
- _Rounds[round, player].Duet = false;
- _Rounds[round, player].ShortSong = false;
- _Rounds[round, player].SongFinished = false;
- }
- }
- }
-
- public void SetPoints(int Round, int SongID, SPlayer[] Players, bool Medley, bool Duet, bool ShortSong)
- {
- long DateTicks = DateTime.Now.Ticks;
- for (int player = 0; player < Players.Length; player++)
- {
- _Rounds[Round, player].SongID = SongID;
- _Rounds[Round, player].LineNr = Players[player].LineNr;
- _Rounds[Round, player].Points = Players[player].Points;
- _Rounds[Round, player].PointsGoldenNotes = Players[player].PointsGoldenNotes;
- _Rounds[Round, player].PointsLineBonus = Players[player].PointsLineBonus;
- _Rounds[Round, player].Medley = Medley;
- _Rounds[Round, player].Duet = Duet;
- _Rounds[Round, player].ShortSong = ShortSong;
- _Rounds[Round, player].DateTicks = DateTicks;
- _Rounds[Round, player].SongFinished = Players[player].SongFinished;
- }
- }
-
- public int NumRounds
- {
- get { return _Rounds.GetLength(0); }
- }
-
- public int NumPlayer
- {
- get { return _Rounds.GetLength(1); }
- }
-
- public SPlayer[] GetPlayer(int Round, int numPlayer)
- {
- if (NumPlayer == 0)
- return new SPlayer[1];
- if (Round >= NumRounds)
- return new SPlayer[1];
-
- SPlayer[] player = new SPlayer[numPlayer];
-
- for (int p = 0; p < player.Length; p++)
- {
- player[p].Name = _Rounds[Round, p].Name;
- player[p].Points = _Rounds[Round, p].Points;
- player[p].PointsGoldenNotes = _Rounds[Round, p].PointsGoldenNotes;
- player[p].PointsLineBonus = _Rounds[Round, p].PointsLineBonus;
- player[p].SongID = _Rounds[Round, p].SongID;
- player[p].LineNr = _Rounds[Round, p].LineNr;
- player[p].Difficulty = _Rounds[Round, p].Difficulty;
- player[p].Medley = _Rounds[Round, p].Medley;
- player[p].Duet = _Rounds[Round, p].Duet;
- player[p].ShortSong = _Rounds[Round, p].ShortSong;
- player[p].DateTicks = _Rounds[Round, p].DateTicks;
- player[p].SongFinished = _Rounds[Round, p].SongFinished;
- player[p].ProfileID = _Rounds[Round, p].ProfileID;
- }
- return player;
- }
- }
-
- public struct SScores
- {
- public string Name;
- public int Score;
- public string Date;
- public EGameDifficulty Difficulty;
- public int LineNr;
- public int ID;
- }
-
- public enum EGameMode
- {
- TR_GAMEMODE_NORMAL,
- TR_GAMEMODE_MEDLEY,
- TR_GAMEMODE_DUET,
- TR_GAMEMODE_SHORTSONG
- }
-
- public struct SPartyModeInfos
- {
- public int PartyModeID;
- public string Name;
- public string Description;
- public string TargetAudience;
- public int MaxPlayers;
- public int MinPlayers;
- public int MaxTeams;
- public int MinTeams;
-
- public string Author;
- public bool Playable;
- public int VersionMajor;
- public int VersionMinor;
- }
-
- public enum EScreens
- {
- ScreenTest = 0,
- ScreenLoad = 1,
- ScreenMain = 2,
- ScreenSong = 3,
- ScreenOptions = 4,
- ScreenSing = 5,
- ScreenProfiles = 6,
- ScreenScore = 7,
- ScreenHighscore = 8,
-
- ScreenOptionsGame = 9,
- ScreenOptionsSound = 10,
- ScreenOptionsRecord = 11,
- ScreenOptionsVideo = 12,
- ScreenOptionsLyrics = 13,
- ScreenOptionsTheme = 14,
-
- ScreenNames = 15,
- ScreenCredits = 16,
- ScreenParty = 17,
- ScreenPartyDummy = 18,
-
- ScreenNull = -1
- }
}
\ No newline at end of file
diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs
index 8dabe808..e03d8434 100644
--- a/VocaluxeLib/Menu/SongMenu/CSong.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSong.cs
@@ -1000,7 +1000,7 @@ namespace VocaluxeLib.Menu.SongMenu
CLines lines = Notes.GetLines(0);
//Calculate length of singing
- int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2 + lines.Line[0].StartBeat;
+ int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNote.StartBeat) / 2 + lines.Line[0].FirstNote.StartBeat;
//Check if stop is in series
for (int i = 0; i < series.Count; i++)
diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs
new file mode 100644
index 00000000..41938220
--- /dev/null
+++ b/VocaluxeLib/Menu/Structs.cs
@@ -0,0 +1,292 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+using VocaluxeLib.Menu.SingNotes;
+
+namespace VocaluxeLib.Menu
+{
+ #region Drawing
+ public struct SColorF
+ {
+ public float R;
+ public float G;
+ public float B;
+ public float A;
+
+ public SColorF(float r, float g, float b, float a)
+ {
+ R = r;
+ G = g;
+ B = b;
+ A = a;
+ }
+
+ public SColorF(SColorF Color)
+ {
+ R = Color.R;
+ G = Color.G;
+ B = Color.B;
+ A = Color.A;
+ }
+ }
+
+ public struct SRectF
+ {
+ public float X;
+ public float Y;
+ public float W;
+ public float H;
+ public float Z;
+ public float Rotation; //0..360°
+
+ public SRectF(float x, float y, float w, float h, float z)
+ {
+ X = x;
+ Y = y;
+ W = w;
+ H = h;
+ Z = z;
+ Rotation = 0f;
+ }
+
+ public SRectF(SRectF rect)
+ {
+ X = rect.X;
+ Y = rect.Y;
+ W = rect.W;
+ H = rect.H;
+ Z = rect.Z;
+ Rotation = 0f;
+ }
+ }
+
+ public struct SPoint3f
+ {
+ public float X;
+ public float Y;
+ public float Z;
+ }
+
+ public struct SPoint3
+ {
+ public int X;
+ public int Y;
+ public int Z;
+ }
+
+ public struct STexture
+ {
+ public int index;
+ public int PBO;
+ public int ID;
+
+ public string TexturePath;
+
+ public float width;
+ public float height;
+ public SRectF rect;
+
+ public float w2; //power of 2 width
+ public float h2; //power of 2 height
+ public float width_ratio;
+ public float height_ratio;
+
+ public SColorF color;
+
+ public STexture(int Index)
+ {
+ index = Index;
+ PBO = 0;
+ ID = -1;
+ TexturePath = String.Empty;
+
+ width = 1f;
+ height = 1f;
+ rect = new SRectF(0f, 0f, 1f, 1f, 0f);
+
+ w2 = 2f;
+ h2 = 2f;
+ width_ratio = 0.5f;
+ height_ratio = 0.5f;
+
+ color = new SColorF(1f, 1f, 1f, 1f);
+ }
+ }
+ #endregion Drawing
+
+ #region Inputs
+ public struct KeyEvent
+ {
+ public ESender Sender;
+ public bool ModALT;
+ public bool ModSHIFT;
+ public bool ModCTRL;
+ public bool KeyPressed;
+ public bool Handled;
+ public Keys Key;
+ public Char Unicode;
+ public EModifier Mod;
+
+ public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key)
+ {
+ Sender = sender;
+ ModALT = alt;
+ ModSHIFT = shift;
+ ModCTRL = ctrl;
+ KeyPressed = pressed;
+ Unicode = unicode;
+ Key = key;
+ Handled = false;
+
+ Mod = EModifier.None;
+
+ if (alt)
+ Mod |= EModifier.Alt;
+ if (shift)
+ Mod |= EModifier.Shift;
+ if (ctrl)
+ Mod |= EModifier.Ctrl;
+ }
+ }
+
+ public struct MouseEvent
+ {
+ public ESender Sender;
+ public bool Handled;
+ public int X;
+ public int Y;
+ public bool LB; //left button click
+ public bool LD; //left button double click
+ public bool RB; //right button click
+ public bool MB; //middle button click
+
+ public bool LBH; //left button hold (when moving)
+ public bool RBH; //right button hold (when moving)
+ public bool MBH; //middle button hold (when moving)
+
+ public bool ModALT;
+ public bool ModSHIFT;
+ public bool ModCTRL;
+
+ public EModifier Mod;
+ public int Wheel;
+
+ public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
+ {
+ Sender = sender;
+ Handled = false;
+ X = x;
+ Y = y;
+ LB = lb;
+ LD = ld;
+ RB = rb;
+ MB = mb;
+
+ LBH = lbh;
+ RBH = rbh;
+ MBH = mbh;
+
+ ModALT = alt;
+ ModSHIFT = shift;
+ ModCTRL = ctrl;
+
+ EModifier mALT = EModifier.None;
+ EModifier mSHIFT = EModifier.None;
+ EModifier mCTRL = EModifier.None;
+
+ if (alt)
+ mALT = EModifier.Alt;
+
+ if (shift)
+ mSHIFT = EModifier.Shift;
+
+ if (ctrl)
+ mCTRL = EModifier.Ctrl;
+
+ if (!alt && !shift && !ctrl)
+ Mod = EModifier.None;
+ else
+ Mod = mALT | mSHIFT | mCTRL;
+
+ Wheel = wheel;
+ }
+ }
+ #endregion Inputs
+
+ #region Profiles
+ public struct SProfile
+ {
+ public string PlayerName;
+ public string ProfileFile;
+
+ public EGameDifficulty Difficulty;
+ public SAvatar Avatar;
+ public EOffOn GuestProfile;
+ public EOffOn Active;
+ }
+
+ public struct SAvatar
+ {
+ public string FileName;
+ public STexture Texture;
+
+ public SAvatar(int dummy)
+ {
+ FileName = String.Empty;
+ Texture = new STexture(-1);
+ }
+ }
+ #endregion Profiles
+
+ #region Game
+ public struct SPlayer
+ {
+ public int ProfileID;
+ public string Name;
+ public EGameDifficulty Difficulty;
+ public double Points;
+ public double PointsLineBonus;
+ public double PointsGoldenNotes;
+ public int NoteDiff;
+ public int LineNr;
+ public List SingLine;
+ public int CurrentLine;
+ public int CurrentNote;
+
+ public int SongID;
+ public bool Medley;
+ public bool Duet;
+ public bool ShortSong;
+ public long DateTicks;
+ public bool SongFinished;
+ }
+
+ public struct SScores
+ {
+ public string Name;
+ public int Score;
+ public string Date;
+ public EGameDifficulty Difficulty;
+ public int LineNr;
+ public int ID;
+ }
+
+ public struct SPartyModeInfos
+ {
+ public int PartyModeID;
+ public string Name;
+ public string Description;
+ public string TargetAudience;
+ public int MaxPlayers;
+ public int MinPlayers;
+ public int MaxTeams;
+ public int MinTeams;
+
+ public string Author;
+ public bool Playable;
+ public int VersionMajor;
+ public int VersionMinor;
+ }
+ #endregion Game
+}
\ No newline at end of file
diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj
index b66a1afd..97fcaf9e 100644
--- a/VocaluxeLib/VocaluxeLib.csproj
+++ b/VocaluxeLib/VocaluxeLib.csproj
@@ -10,9 +10,9 @@
Properties
VocaluxeLib
VocaluxeLib
- v2.0
+ v4.0
512
-
+ Client
AnyCPU
@@ -126,11 +126,13 @@
+
+
@@ -145,6 +147,7 @@
+