From 435f1da1de18bafe57e43e47fd8a6fc69fd8bab7 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 16 Jan 2010 15:33:17 +0000 Subject: updated audio engine git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1503 90c681e8-e032-0410-971d-27865f9a5e38 --- src/ui/mainvisual.cpp | 37 ++++++++++++------------ src/ui/mainvisual.h | 12 ++++---- src/ui/shadedvisual.cpp | 26 ++++++----------- src/ui/shadedvisual.h | 4 +-- src/ui/translations/qmmp_cs.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_de.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_it.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_lt.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_pl_PL.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_pt_BR.ts | 58 ++++++++++++++++++------------------- src/ui/translations/qmmp_ru.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_tr.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_uk_UA.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_zh_CN.ts | 60 +++++++++++++++++++-------------------- src/ui/translations/qmmp_zh_TW.ts | 60 +++++++++++++++++++-------------------- 15 files changed, 365 insertions(+), 372 deletions(-) (limited to 'src/ui') diff --git a/src/ui/mainvisual.cpp b/src/ui/mainvisual.cpp index 77c1f3acc..ada7291df 100644 --- a/src/ui/mainvisual.cpp +++ b/src/ui/mainvisual.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2009 by Ilya Kotov * + * Copyright (C) 2007-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -52,6 +52,7 @@ MainVisual::MainVisual (QWidget *parent) m_nodes.clear(); createMenu(); readSettings(); + m_buf_at = 0; m_instance = this; } @@ -97,42 +98,40 @@ void MainVisual::clear() update(); } -void MainVisual::add (Buffer *b, unsigned long w, int c, int p) +void MainVisual::add (unsigned char *data, qint64 size, int chan) { if (!m_timer->isActive () || !m_vis) return; - long len = b->nbytes, cnt; + long len = size, cnt; short *l = 0, *r = 0; - len /= c; - len /= (p / 8); + + memcpy(m_buf + m_buf_at, data, qMin(qint64(2048 - m_buf_at), size)); + m_buf_at += qMin(qint64(2048 - m_buf_at), size); + if(m_buf_at < 2048) + return; + len = m_buf_at; + len /= chan; + len /= 2; if (len > 512) len = 512; cnt = len; - if (c >= 2) + if (chan >= 2) { l = new short[len]; r = new short[len]; - - if (p == 8) - stereo16_from_stereopcm8 (l, r, b->data, cnt); - else if (p == 16) - stereo16_from_stereopcm16 (l, r, (short *) b->data, cnt); + stereo16_from_stereopcm16 (l, r, (short *) m_buf, cnt); } - else if (c == 1) + else if (chan == 1) { l = new short[len]; - - if (p == 8) - mono16_from_monopcm8 (l, b->data, cnt); - else if (p == 16) - mono16_from_monopcm16 (l, (short *) b->data, cnt); + mono16_from_monopcm16 (l, (short *) m_buf, cnt); } else len = 0; - - m_nodes.append (new VisualNode (l, r, len, w)); + m_buf_at = 0; + m_nodes.append (new VisualNode (l, r, len)); } void MainVisual::timeout() diff --git a/src/ui/mainvisual.h b/src/ui/mainvisual.h index 02fbc7fba..30fcd67ab 100644 --- a/src/ui/mainvisual.h +++ b/src/ui/mainvisual.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2009 by Ilya Kotov * + * Copyright (C) 2007-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -34,8 +34,8 @@ class Buffer; class VisualNode { public: - VisualNode(short *l, short *r, unsigned long n, unsigned long o) - : left(l), right(r), length(n), offset(o) + VisualNode(short *l, short *r, unsigned long n) + : left(l), right(r), length(n) { // left and right are allocated and then passed to this class // the code that allocated left and right should give up all ownership @@ -48,7 +48,7 @@ public: } short *left, *right; - long length, offset; + long length; }; class VisualBase @@ -73,7 +73,7 @@ public: static MainVisual *instance(); void setVisual(VisualBase *newvis); - void add(Buffer *, unsigned long, int, int); + void add(unsigned char *data, qint64 size, int chan); void clear(); void paintEvent(QPaintEvent *); @@ -111,6 +111,8 @@ private: QActionGroup *m_analyzerTypeGroup; QAction *m_peaksAction; QAction *m_transparentAction; + unsigned char m_buf[2048]; + int m_buf_at; int m_ratio; }; diff --git a/src/ui/shadedvisual.cpp b/src/ui/shadedvisual.cpp index d58f96fa1..fdc487c7c 100644 --- a/src/ui/shadedvisual.cpp +++ b/src/ui/shadedvisual.cpp @@ -42,43 +42,35 @@ ShadedVisual::ShadedVisual(QWidget *parent) : Visual(parent) ShadedVisual::~ShadedVisual() {} -void ShadedVisual::add(Buffer *b, unsigned long w, int c, int p) +void ShadedVisual::add(unsigned char *data, qint64 size, int chan) { if (!m_timer->isActive ()) return; - long len = b->nbytes, cnt; + long len = size, cnt; short *l = 0, *r = 0; - len /= c; - len /= ( p / 8 ); + len /= chan; + len /= 2; if ( len > 512 ) len = 512; cnt = len; - if ( c == 2 ) + if (chan == 2) { l = new short[len]; r = new short[len]; - - if ( p == 8 ) - stereo16_from_stereopcm8 ( l, r, b->data, cnt ); - else if ( p == 16 ) - stereo16_from_stereopcm16 ( l, r, ( short * ) b->data, cnt ); + stereo16_from_stereopcm16 ( l, r, (short *) data, cnt); } - else if ( c == 1 ) + else if (chan == 1) { l = new short[len]; - - if ( p == 8 ) - mono16_from_monopcm8 ( l, b->data, cnt ); - else if ( p == 16 ) - mono16_from_monopcm16 ( l, ( short * ) b->data, cnt ); + mono16_from_monopcm16 (l, (short *) data, cnt); } else len = 0; if (len) - m_nodes.append (new VisualNode (l, r, len, w)); + m_nodes.append (new VisualNode (l, r, len)); } void ShadedVisual::clear() diff --git a/src/ui/shadedvisual.h b/src/ui/shadedvisual.h index 3c1cb30db..e276b8b24 100644 --- a/src/ui/shadedvisual.h +++ b/src/ui/shadedvisual.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2009 by Ilya Kotov * + * Copyright (C) 2007-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -40,7 +40,7 @@ public: ~ShadedVisual(); - void add(Buffer *, unsigned long, int, int); + void add(unsigned char *data, qint64 size, int chan); void clear(); void paintEvent (QPaintEvent *); diff --git a/src/ui/translations/qmmp_cs.ts b/src/ui/translations/qmmp_cs.ts index 696fbec6e..17466ae39 100644 --- a/src/ui/translations/qmmp_cs.ts +++ b/src/ui/translations/qmmp_cs.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Režim vizualizace - + Analyzer Frekvenční analýza - + Scope Osciloskop - + Off Vypnuto - + Analyzer Mode Režim analýzy - + Normal Normální - + Fire Oheň - + Vertical Lines Sloupce - + Lines Úzké - + Bars Široké - + Peaks Špičky - + Refresh Rate Obnovovací frekvence - + 50 fps 50 Hz - + 25 fps 25 Hz - + 10 fps 10 Hz - + 5 fps 5 Hz - + Analyzer Falloff Pokles analyzátoru - - + + Slowest Nejpomalejší - - + + Slow Pomalý - - + + Medium Střední - - + + Fast Rychlý - - + + Fastest Nejrychlejší - + Peaks Falloff Pokles špiček - + Background Pozadí - + Transparent Průhledné diff --git a/src/ui/translations/qmmp_de.ts b/src/ui/translations/qmmp_de.ts index e48d2987f..419aa4b70 100644 --- a/src/ui/translations/qmmp_de.ts +++ b/src/ui/translations/qmmp_de.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Visualisierungsmodus - + Analyzer Analyzer - + Scope Oszilloskop - + Off Aus - + Analyzer Mode Analyzer-Modus - + Normal Normal - + Fire Feuer - + Vertical Lines Vertikale Linien - + Lines Linien - + Bars Balken - + Peaks Spitzen - + Refresh Rate Wiederholfrequenz - + 50 fps 50 fps - + 25 fps 25 fps - + 10 fps 10 fps - + 5 fps 5 fps - + Analyzer Falloff Analyzer-Abfall - - + + Slowest Sehr langsam - - + + Slow Langsam - - + + Medium Mittel - - + + Fast Schnell - - + + Fastest Sehr schnell - + Peaks Falloff Peaks-Abfall - + Background Hintergrund - + Transparent Transparent diff --git a/src/ui/translations/qmmp_it.ts b/src/ui/translations/qmmp_it.ts index e68285d9e..d255464aa 100644 --- a/src/ui/translations/qmmp_it.ts +++ b/src/ui/translations/qmmp_it.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Modo visualizzazione - + Analyzer Analizzatore - + Scope Oscilloscopio - + Off Chiudi - + Analyzer Mode Modo analizzatore - + Normal Normale - + Fire Fuoco - + Vertical Lines Linee verticali - + Lines Linee - + Bars Barre - + Peaks Picchi - + Refresh Rate Velocità di aggiornamento - + 50 fps 50 fps - + 25 fps 25 fps - + 10 fps 10 fps - + 5 fps 5 fps - + Analyzer Falloff Ricaduta analizzatore - - + + Slowest Molto lenta - - + + Slow Lenta - - + + Medium Media - - + + Fast Rapida - - + + Fastest Molto veloce - + Peaks Falloff Ricadua picchi - + Background Sfondo - + Transparent Transparente diff --git a/src/ui/translations/qmmp_lt.ts b/src/ui/translations/qmmp_lt.ts index 0af708ad1..424f99be7 100644 --- a/src/ui/translations/qmmp_lt.ts +++ b/src/ui/translations/qmmp_lt.ts @@ -822,132 +822,132 @@ MainVisual - + Visualization Mode Vizualizacijos metodas - + Analyzer Analizatorius - + Scope Scope - + Off Išjungta - + Analyzer Mode Analizatoriaus metodas - + Normal Įprastinis - + Fire Ugnis - + Vertical Lines Vertikalios linijos - + Lines Linijos - + Bars Bangos - + Peaks Pikai - + Refresh Rate Atnaujinimo dažnumas - + 50 fps 50 kps - + 25 fps 25 kps - + 10 fps 10 kps - + 5 fps 5 kps - + Analyzer Falloff Analyzer Falloff - - + + Slowest Lėčiausias - - + + Slow Lėtas - - + + Medium Vidutinis - - + + Fast Greitas - - + + Fastest Greičiausias - + Peaks Falloff Peaks Falloff - + Background Fonas - + Transparent Permatomumas diff --git a/src/ui/translations/qmmp_pl_PL.ts b/src/ui/translations/qmmp_pl_PL.ts index 24fdcaf8d..85c7b2cb4 100644 --- a/src/ui/translations/qmmp_pl_PL.ts +++ b/src/ui/translations/qmmp_pl_PL.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Tryb wizualizacji - + Analyzer Analizator - + Scope - + Off Wyłączone - + Analyzer Mode Tryb Analizatora - + Normal Normalny - + Fire Ogień - + Vertical Lines Pionowe Linie - + Lines Linie - + Bars Słupki - + Peaks Piki - + Refresh Rate Odświeżanie - + 50 fps - + 25 fps - + 10 fps - + 5 fps - + Analyzer Falloff Prędkość Analizatora - - + + Slowest Najwolniej - - + + Slow Wolno - - + + Medium Średnio - - + + Fast Szybko - - + + Fastest Najszybciej - + Peaks Falloff Opadanie Pików - + Background Tło - + Transparent Przezroczystość diff --git a/src/ui/translations/qmmp_pt_BR.ts b/src/ui/translations/qmmp_pt_BR.ts index 90bb1ba03..c730dd312 100644 --- a/src/ui/translations/qmmp_pt_BR.ts +++ b/src/ui/translations/qmmp_pt_BR.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode - + Analyzer - + Scope - + Off - + Analyzer Mode - + Normal - + Fire - + Vertical Lines - + Lines - + Bars - + Peaks - + Refresh Rate - + 50 fps - + 25 fps - + 10 fps - + 5 fps - + Analyzer Falloff + + + + Slowest + + - Slowest + Slow - Slow + Medium - Medium + Fast - Fast - - - - - Fastest - + Peaks Falloff - + Background - + Transparent diff --git a/src/ui/translations/qmmp_ru.ts b/src/ui/translations/qmmp_ru.ts index d5e9fdb5f..67e7cc15c 100644 --- a/src/ui/translations/qmmp_ru.ts +++ b/src/ui/translations/qmmp_ru.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Режим визуализации - + Analyzer Анализатор - + Scope Осциллограф - + Off Выключено - + Analyzer Mode Режим анализатора - + Normal Обычный - + Fire Огонь - + Vertical Lines Вертикальные линии - + Lines Линии - + Bars Полоски - + Peaks Пики - + Refresh Rate Частота обновления - + 50 fps - + 25 fps - + 10 fps - + 5 fps - + Analyzer Falloff Падение анализатора - - + + Slowest Самое медленное - - + + Slow Медленное - - + + Medium Среднее - - + + Fast Быстрое - - + + Fastest Самое быстрое - + Peaks Falloff Падение пиков - + Background Фон - + Transparent Прозрачность diff --git a/src/ui/translations/qmmp_tr.ts b/src/ui/translations/qmmp_tr.ts index 827ea76d4..d4758b244 100644 --- a/src/ui/translations/qmmp_tr.ts +++ b/src/ui/translations/qmmp_tr.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Görselleştirme Modu - + Analyzer Çözümleyici - + Scope Kapsam - + Off Kapat - + Analyzer Mode Çözümleyici Modu - + Normal Normal - + Fire Ateş - + Vertical Lines Dikey Satırlar - + Lines Satırlar - + Bars Çubuklar - + Peaks Tepeler - + Refresh Rate Tazeleme Oranı - + 50 fps 50 fps - + 25 fps 25 fps - + 10 fps 10 fps - + 5 fps 5 fps - + Analyzer Falloff Çözümleyici Düşüşü - - + + Slowest En yavaş - - + + Slow Yavaş - - + + Medium Orta - - + + Fast Hızlı - - + + Fastest En hızlı - + Peaks Falloff Tepe Düşüşü - + Background Arkaplan - + Transparent Transparan diff --git a/src/ui/translations/qmmp_uk_UA.ts b/src/ui/translations/qmmp_uk_UA.ts index 5022c1f2c..d87cb079f 100644 --- a/src/ui/translations/qmmp_uk_UA.ts +++ b/src/ui/translations/qmmp_uk_UA.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode Режим візуалізації - + Analyzer Аналізатор - + Scope Осцилограф - + Off Вимкнено - + Analyzer Mode Режим аналізатора - + Normal Звичайний - + Fire Вогонь - + Vertical Lines Вертикальні лінії - + Lines Лінії - + Bars Смужки - + Peaks Піки - + Refresh Rate Частота оновлення - + 50 fps 50 ф/с - + 25 fps 25 ф/с - + 10 fps 10 ф/с - + 5 fps 5 ф/с - + Analyzer Falloff Падіння аналізатора - - + + Slowest Найповільніше - - + + Slow Повільне - - + + Medium Середнє - - + + Fast Швидке - - + + Fastest Найшвидше - + Peaks Falloff Падіння піків - + Background Тло - + Transparent Прозорість diff --git a/src/ui/translations/qmmp_zh_CN.ts b/src/ui/translations/qmmp_zh_CN.ts index 27d0f1f25..de6287ef7 100644 --- a/src/ui/translations/qmmp_zh_CN.ts +++ b/src/ui/translations/qmmp_zh_CN.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode 可视化模式 - + Analyzer 分析器 - + Scope 示波器 - + Off 关闭 - + Analyzer Mode 分析模式 - + Normal 标准 - + Fire 火花 - + Vertical Lines 垂直线 - + Lines 线形 - + Bars 条形 - + Peaks 峰值 - + Refresh Rate 刷新率 - + 50 fps 50 fps - + 25 fps 25 fps - + 10 fps 10 fps - + 5 fps 5 fps - + Analyzer Falloff 分析器下降速度 - - + + Slowest 最慢 - - + + Slow - - + + Medium - - + + Fast - - + + Fastest 最快 - + Peaks Falloff 峰值下降速度 - + Background 背景 - + Transparent 透明 diff --git a/src/ui/translations/qmmp_zh_TW.ts b/src/ui/translations/qmmp_zh_TW.ts index 753f474f4..39344f0c1 100644 --- a/src/ui/translations/qmmp_zh_TW.ts +++ b/src/ui/translations/qmmp_zh_TW.ts @@ -821,132 +821,132 @@ MainVisual - + Visualization Mode 可視化型態 - + Analyzer 解析器 - + Scope 示波器 - + Off 關閉 - + Analyzer Mode 解析型態 - + Normal 標準 - + Fire 火花 - + Vertical Lines 垂直線 - + Lines 線形 - + Bars 條形 - + Peaks 峰值 - + Refresh Rate 刷新率 - + 50 fps 50 fps - + 25 fps 25 fps - + 10 fps 10 fps - + 5 fps 5 fps - + Analyzer Falloff 解析器下降速度 - - + + Slowest 最慢 - - + + Slow - - + + Medium - - + + Fast - - + + Fastest 最快 - + Peaks Falloff 峰值下降速度 - + Background 背景 - + Transparent 透明 -- cgit v1.2.3-13-gbd6f