Compare commits
39 commits
Author | SHA1 | Date | |
---|---|---|---|
|
33d9cd699e | ||
84dae057db | |||
|
d0f565e1c0 | ||
|
029bcdc47e | ||
|
6a22534686 | ||
|
0d29dda4c1 | ||
|
db86987b6a | ||
|
53bcb38455 | ||
|
200dcf86d4 | ||
|
f0f6e595fb | ||
|
5d56921aeb | ||
|
a935d4e619 | ||
|
fc274179ad | ||
|
7aced09a02 | ||
|
27c7969df3 | ||
|
d94f874259 | ||
|
14ac167dfb | ||
|
86567b8bef | ||
|
8f321b9d69 | ||
|
7bc339dfe3 | ||
|
3244ea2abc | ||
|
3525133287 | ||
|
f87c908d30 | ||
|
7cd4c8fbd8 | ||
|
8c69da5f9d | ||
|
103a33820e | ||
|
7631e54d51 | ||
|
f67ad9b1e1 | ||
|
cd0105c9f9 | ||
|
0979c3608e | ||
|
7a9c0cd0ac | ||
|
5915d4898e | ||
|
d34b972a54 | ||
|
246a8a2f98 | ||
|
ef653553d9 | ||
|
389966782d | ||
|
5a7a82736f | ||
|
88704cd726 | ||
|
1fccbf64fd |
39 changed files with 2648 additions and 848 deletions
|
@ -1,76 +1,99 @@
|
|||
」゙ー撩答ゥラ<EFBFBD><EFBFBD>據巣⊿瞥劇рネナト<EFBFBD>国勵キコエッ埇ーカサヲュ<EFBFBD><EFBFBD>、ォ<EFBFBD><EFBFBD>隆ソーア<EFBFBD>ォ」ャウニヘ那ヤ販モ
|
||||
霒逖亮揶温呢見狭嗣吢绦侅鳇稆<EFBFBD><EFBFBD><EFBFBD>雠疰鬻惆苗稔钋祆铉轴耵鋶〖墴摉
|
||||
<EFBFBD>婆糖抻綆墑徍守受
|
||||
渡杂矣听挻京繑匠看嚩牕到憣汞&觌鋲<EFBFBD>挨嵹谠蓁咚我臈槕悵掝凵拍垍
|
||||
槜棔垞拺敵<EFBFBD><EFBFBD>订ě<EFBFBD>ぃⅰ伎窘姬汗付<EFBFBD>闯抄舷浲资扇瞧拍棉
|
||||
应€倶亷守仕终杂已嘘蝽祀觊桤纟
|
||||
鰞晨蜚<EFBFBD><EFBFBD><EFBFBD><EFBFBD>牾趔蝰饛趹
|
||||
烗照芤臈槂倎倵灉瀲殭槜枙敋<EFBFBD>
|
||||
冩鲵<EFBFBD>藩┄ギゥ【<EFBFBD>烤郊徊<EFBFBD>
|
||||
<EFBFBD>赇<EFBFBD>汊斳烟耸衫乔秦寐晾咿輱<EFBFBD>
|
||||
泉噳挆嫃劳酗铐祀腚翮驽溷忉层
|
||||
鞗'郡<EFBFBD>麇偑<EFBFBD>鈸帊寢妷堉殔剝倎€煘<EFBFBD>
|
||||
庮妮谵喺耸陶偝<EFBFBD><EFBFBD>ⅸ<EFBFBD>亥ぃⅰ牽健
|
||||
<EFBFBD>潺<EFBFBD>φ腙祯吒敀僦扇瞧湍聯堇咿蒈圳谀
|
||||
哦寪€娒田铐铍觇犒驽溷忉帻<EFBFBD>
|
||||
餁う讥㈡麈矧耩弾崓帠増噯厔冄<EFBFBD>
|
||||
掶亮倨蠅殗嗵势€崘<EFBFBD><EFBFBD><EFBFBD>牬Еイ"◇<EFBFBD>
|
||||
<EFBFBD>牷汗阜斗动脖衔吞嗜<EFBFBD>
|
||||
谡谂拿铝垒芰苒谫刈鬃<EFBFBD>
|
||||
晾托镱盱腓媵珂邃汊噔<EFBFBD>
|
||||
祜帑<EFBFBD><EFBFBD>鲼鲲蝰饛帊崏<EFBFBD>
|
||||
増噥檮儌仠煘暅嚉櫂枈晹洅崘<EFBFBD>┌<EFBFBD>┅沪イぞ<EFBFBD>烤〖缓堡范荡<EFBFBD>毕茄趟律郧婆曔铝冗<EFBFBD>
|
||||
蒈坜攀穵劃铆弲<EFBFBD>盱腚蹊珑眸汊後泾<EFBFBD><EFBFBD><EFBFBD>麝
|
||||
豸篥礅焓姨櫀増啅檮儊€湡灊潎殭槜枙敁<EFBFBD>
|
||||
憪<EFBFBD>本他祀虼工!<烤鬼Ш垢丢荡巢毕瓮<EFBFBD>
|
||||
耸商墼<EFBFBD>拫鸭€仢吻谫軈收哉淹酗铎痣觊桤驽<EFBFBD><EFBFBD>
|
||||
饤梗<EFBFBD>铉<EFBFBD><EFBFBD>牾趄蝽鹳帊寢妶攪唴嚐倎€渹
|
||||
応缕虤厞晹摀崘<EFBFBD><EFBFBD><EFBFBD>┄ЕА竣<EFBFBD>饥郊桓<EFBFBD>
|
||||
<EFBFBD>镩岵牠衔屯资缮勤钠寐晾哓淋圳谀字照<EFBFBD>
|
||||
困壋豁<EFBFBD>觊桄<EFBFBD>溻恺喱<EFBFBD><EFBFBD><EFBFBD>澉鲺黠蝰饛<EFBFBD>
|
||||
燏灾葺艆棙儌亖優潩泦槣棖晹挃崘<EFBFBD><EFBFBD><EFBFBD>┇<EFBFBD>
|
||||
从<EFBFBD><EFBFBD>鲷饨<EFBFBD>蓟焊し洞疮氨衔吞讼杖瞧秦寐谅<EFBFBD>
|
||||
太儑帉氈纳杂倚田铎祺肟桤驽驷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
鍠け哀沆弾崓棅墘嚉噭儌亐熓仠洑潉棖柷<EFBFBD>
|
||||
€蛟痤堪<EFBFBD>┅沪ゥ> 烤郊翰ジ范报巢皻<EFBFBD>
|
||||
攥棝€鼗櫄勓蘖肋吡苒圪恼终杂已侒铐祜鲩桠泫
|
||||
鰞景╋仯╅纟<EFBFBD>鏖趔篑鞃帊寢妷逈唴剣瀬€煕<EFBFBD>
|
||||
湜殭槜枙<EFBFBD>
|
||||
搾憪<EFBFBD><EFBFBD>藩┄Еイ><EFBFBD>烤郊缓ジ范荡巢庇瓮趟噬惹谂拿铝肋蘖苒谫刈终扔已酗铐祺觊桤驽溷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺趔蝰鞆帊寢妷垱唴剝倎€焸潨洑櫂棖墧搾憪<EFBFBD><EFBFBD><EFBFBD>┄Еイ<EFBFBD>
|
||||
俺伎窘蓟汗斧兜闯<EFBFBD>衔托耸扇燮拍棉晾咿<EFBFBD>
|
||||
苒谫刈忠扔友畜铐祀鲩桤纟
|
||||
溷忉<EFBFBD><EFBFBD><EFBFBD>帑<EFBFBD><EFBFBD>鲺趔铖饛帒
|
||||
寢妷垏諆槂儊€優潨泦櫂棖<EFBFBD>
|
||||
敁拺惎<EFBFBD>矮<EFBFBD>ɑΕぃ尽牽尽
|
||||
蓟汗阜灏ǔ嘲氁吞耸杖瞧咆
|
||||
寐晾咿庁勤儇资赵右托镱眇
|
||||
腙殍珂邈<EFBFBD>忄<EFBFBD><EFBFBD>恺<EFBFBD><EFBFBD><EFBFBD>鲺<EFBFBD>
|
||||
篁耩弾迧棅垐嚉厔儌潃煘潃
|
||||
洑櫂棖茣彃悙<EFBFBD><EFBFBD><EFBFBD>胆Еジ
|
||||
"<EFBFBD>烤罴Ш赴藩荡巢<EFBFBD>瓮套
|
||||
噬惹婆椓蘖吝蘖苒谫淖终韵
|
||||
已酗铐块鲩殓纟溷忉<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>鲺<EFBFBD>铖饛帒寢妷攪唴劅
|
||||
倎€煘潝泦櫂棖墧搾憣<EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD>ěΕ<EFBFBD>尽牽尽蓟汗し兜疮
|
||||
脖衔吞蒙杖瞧咆寐晾棉蒈燮
|
||||
摔巹梺畤厜緧府<EFBFBD>珖枺苯拣<EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD>嚅桢赍赙骘蝰饛拲寢嫊垏唴槂倎€優潨焼櫂棖晹搾<EFBFBD>
|
||||
惎<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
荡苟本巢<EFBFBD>
|
||||
荆蓟汗阜<EFBFBD><EFBFBD>脖衔托嗽扇瞧拍呗呃咿蒈燮倨字赵右托耦盱腙轸
|
||||
豸<EFBFBD>汊狳
|
||||
<EFBFBD>恺帑纟澉牾梵铖鞆悕寢妷垱
|
||||
啓劅倽€優仠嚉厴嫋墧彃<EFBFBD>
|
||||
惓<EFBFBD><EFBFBD>
|
||||
<EFBFBD>
|
||||
ěΕぃⅰ伎窘蓟汗斧兜闯<EFBFBD>衔托耸扇燮拍棉晾咿淋圳倌字赵弦研矧盱腙蹊珂屮汊徉泾<EFBFBD><EFBFBD><EFBFBD>黯轸篁耢弾崒棅増嚉厔儌<EFBFBD>
|
||||
€煘潃洑櫂嫋晹搸憪<EFBFBD><EFBFBD><EFBFBD>诞·Ⅰン┘竣
|
||||
<EFBFBD><EFBFBD>
|
||||
汗付<EFBFBD>
|
||||
荡舶<EFBFBD>苎陶噬惹婆孛芰肋掭芮谇刈终杂<EFBFBD>
|
||||
脹镱盱腙殍<EFBFBD>邃<EFBFBD><EFBFBD>徉<EFBFBD><EFBFBD><EFBFBD><EFBFBD>鬻鲺趔蝰饛帊屍槙
|
||||
墮唴剝倎湡灊渿殭槜<EFBFBD>
|
||||
晹搾<EFBFBD>
|
||||
惐Θ<EFBFBD><EFBFBD>揣腑。ⅰ牐荆蓟汗阜<EFBFBD><EFBFBD>脖衔托
|
||||
<EFBFBD>
|
||||
霒逖亮揶温呢見狭嗣吢绦侅彝叫蝤臊隗颀蛄翕<EFBFBD><EFBFBD>邮<EFBFBD>磲<EFBFBD>
|
||||
些闯旱榆皾湏毄浊紫
|
||||
^晾咻廖Ё悍Τ…<EFBFBD><EFBFBD>洓稔鼬晻勽<EFBFBD>灊晻<EFBFBD>犷姛崄堜<EFBFBD>
|
||||
趔篪鞆帊嫍妷堈殔剝倽€煘潃洑櫂嫋晹拵憪<EFBFBD>爆<EFBFBD><EFBFBD>〈Еイ"<EFBFBD><EFBFBD>
|
||||
<EFBFBD>们翁讠<EFBFBD>闯肮舷闲耸扇瞧磐<EFBFBD>
|
||||
蟹梗<EFBFBD>累谫谶衷窒已酗铐煦<EFBFBD>
|
||||
麕负牴厄椆~镟<EFBFBD><EFBFBD>黯觚矧耩弾崒嫋
|
||||
涱刳蕾謵潃煘潨洑渼棖晹搾憪<EFBFBD>
|
||||
钾蝻栲盖<EFBFBD><EFBFBD>沧籴<EFBFBD>蓟夯胺蜂ǔ脖衔屯樦
|
||||
劢檪噸英灆仛侠圳仝咧砸弦研镱眄个
|
||||
麍陡鼬汊徉<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺酾<EFBFBD>
|
||||
銗质拊櫀増噯厔個潃煘潨洑殑
|
||||
咑膳诶烂艏爆<EFBFBD><EFBFBD>ЁЦ"<EFBFBD>烤骄<EFBFBD>
|
||||
<EFBFBD>丕厉徉牠衔吞耸耸燮拍寐晾俾
|
||||
蠣劃僧晝喥弦研镱眍轹殍珂邃沐<EFBFBD>
|
||||
騼『鞖桢<EFBFBD>鲺趔痼鞆帊寢妶垱
|
||||
旟勰掱哑缽€洑櫂棖棖彃憪<EFBFBD><EFBFBD><EFBFBD>
|
||||
徽<EFBFBD>地<EFBFBD>敝<EFBFBD><EFBFBD>Ш垢范刀碑毕瓮趟怂<EFBFBD>
|
||||
栈及拷π咎淋圳儇自兹右研镱祜<EFBFBD>
|
||||
鴶憮殮凅晲檨灬<EFBFBD><EFBFBD><EFBFBD>赭梵蝰饛帉迼
|
||||
橍耋桚<EFBFBD>鷳鳊朦巼殭槜枙枒帒惎<EFBFBD><EFBFBD><EFBFBD>
|
||||
黑哐篡壑丿忒牷汗阜斗动脖衔吞事<EFBFBD>
|
||||
诤砍曰欢赶┈ゥ扰刈终杂杏田铐祀觇猁
|
||||
魸潝汃枬嫓铉<EFBFBD><EFBFBD>鲺鲴铖饛帊寛迺
|
||||
<EFBFBD><EFBFBD><EFBFBD>螯撱摐煘潨洑洑嫋晹搾憮<EFBFBD>
|
||||
吭逸迅凶苴本<EFBFBD>烤郊垢ジ范荡吵嘤
|
||||
墀檲煁帓重詴洕剨塘苒谫刈鬃扔已酗铑瑚
|
||||
鴬潤掯羼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺趔驙<EFBFBD>
|
||||
濏<EFBFBD><EFBFBD>殝殯唴剝倎仢倽湜殭槜膲
|
||||
敁挊尟<EFBFBD><EFBFBD><EFBFBD><EFBFBD>亥ぃ〗牽淼牷汗极兜闯<EFBFBD>衔刃耸扇燮拍呸晾邹淋圳弈字菰弦研珧盱腼蹊珑怿汊范泾<EFBFBD>箧<EFBFBD><EFBFBD><EFBFBD>
|
||||
趔蝙鞚钛萋汌忠敊剝個湡灉攪殭槚姇敁拺惎<EFBFBD>
|
||||
<EFBFBD><EFBFBD>吹裴<EFBFBD>敖牽看牷汉公兜床<EFBFBD>衔吞耸稍
|
||||
瞧盘咝<EFBFBD>殱埼勤氽帐赵變托镱祓腙殍珂邃<EFBFBD>
|
||||
忉圜怙湩<EFBFBD>鑻┆瘁铖饗軕寢寠攪唴厽倎€煘潨泦
|
||||
櫂棡墕笪蕾控蝠<EFBFBD><EFBFBD>牒沪アЬ<EFBFBD>疙〖缓袱范荡巢毕<EFBFBD>
|
||||
吞寺遮<EFBFBD>攳哟灉媼熖<EFBFBD>喪酥沼囄研骐耢腙梏珂邃汊徉<EFBFBD>
|
||||
<EFBFBD><EFBFBD>骐槴Ъ鋮<EFBFBD>ぺ虧钰詻攪唽偀倎咽倽湜泤槜枙敁拺<EFBFBD>
|
||||
截麴<EFBFBD>淮Еゥ竣 竣疥缓垢贩┐巢坝瓮倘<EFBFBD>
|
||||
劬灇惼艳晾哌淋圹倌种赵右诱箢盱牿殍玟<EFBFBD>
|
||||
鰰唤叠灬<EFBFBD><EFBFBD>澉鲷麸篌饛帊實枆垏嚈剝個<EFBFBD>
|
||||
嶈睦螝媱棖晻彃憫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>┄ェ工"牸烤郊<EFBFBD>
|
||||
ㄏ珉忄霭牠衔屯资缮勤睦寐晾挢淋圳倌字兆<EFBFBD>
|
||||
困彸焊<EFBFBD><EFBFBD>桤驿<EFBFBD>忄嚆<EFBFBD><EFBFBD><EFBFBD><EFBFBD>牾趔蝽饛帍<EFBFBD>
|
||||
欬衷佑菂憺亐煙仠洓檮柪晹搾搾钞<EFBFBD><EFBFBD>┄Ё<EFBFBD>
|
||||
睹箐汴<EFBFBD>蓟焊し洞疮氨衔吞藶杖瞧拓寐聯<EFBFBD>
|
||||
叹槃毸淖终障已扬蝻祀觊桄铢溷忾<EFBFBD><EFBFBD><EFBFBD>╃
|
||||
铏う垮埇<EFBFBD>鈸帊寠枆垎啓唭倎€煘虁洑檺嫋晳枎
|
||||
凁<EFBFBD><EFBFBD>浼贼<EFBFBD>沪イ⒕<EFBFBD>揪【缓垢范悒巢鼻彝趟险
|
||||
惹婆拿铝<EFBFBD>
|
||||
咿蒈圳儇酥赵右研矧盱腙殍珂<EFBFBD>汊徉<EFBFBD><EFBFBD>帑<EFBFBD><EFBFBD>鲺麸蝰饛帊寢枆垏唴剝倽€煘潨洑檮棖晹搾憪钞<EFBFBD><EFBFBD>┄Шイ"<EFBFBD>烤〖缓垢范胆巢毕瓮趟稚惹婆拿螺肋掭苒谫淖终杂已畜铐祀觊桤<EFBFBD>溷忉<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺梵蝰饛帊寳妷垏唴剝瀬€煘潨洑厴棖晹搾憣<EFBFBD><EFBFBD><EFBFBD>┄沪イ"<EFBFBD>竣
|
||||
<EFBFBD>Ш垢范荡钞毕瓮兴噬熔婆拿蘖肋蘖苒谫<EFBFBD>
|
||||
字赵右傊箢祆膂殍珂<EFBFBD>汊狳
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>膂趑箢耩弾憣媻墧
|
||||
噯厔儌亣優湝泦櫂棖墧捔檶
|
||||
<EFBFBD><EFBFBD><EFBFBD>┋沪い><EFBFBD>烤〖洪堡
|
||||
范荡巢庀彝退收惹婆孛铝烂
|
||||
掭苒谫嬜收沼彝酗铐痣觊棼
|
||||
驽溷忉楚恺<EFBFBD><EFBFBD><EFBFBD>鲺梵簌饟
|
||||
帊寢妷蹌殔厠倽€煘潃洓憳<EFBFBD>
|
||||
枙敁拺铆箔<EFBFBD>┑ěΕ福!Γ
|
||||
窘蓟汗鞍<EFBFBD>党箔衔吞资扇勤
|
||||
拍寐晾邹淋谝倌字赵弦研矧
|
||||
盱腙殍镧<EFBFBD>怅狳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
豸篁耩噷憣妭墧噯厔焸亐焸
|
||||
潨洑櫂煉墧挌憣<EFBFBD><EFBFBD>藩┄Ш
|
||||
イ"<EFBFBD>坊〖翰工范荡<EFBFBD>毕窝
|
||||
趟噬惹蚊孛蒙烂掭苒瀑刈稚
|
||||
杂已酗驽痣脶棼驽溷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>梵簌饟帊寢枆垏啓
|
||||
剝倎€煐虁洓憳嫋晹搸憪<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>ě<EFBFBD>福)牐窘蓟<EFBFBD>阜订
|
||||
闯脖衔艠资认捼拍寐堇咿堇
|
||||
圳儇字輥弦凶候盱腙蹊珂屮
|
||||
汊徉<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>牾趔蝽饛帊<EFBFBD>
|
||||
媻増噯謤焸€稚倽湜殔槚烂<EFBFBD>
|
||||
搾憪<EFBFBD><EFBFBD>藩<EFBFBD>窈イ"綘捐霠
|
||||
┢嚓蹉柔珉喱洀姙垿箓挏浹<EFBFBD>
|
||||
晾咿廖善耸四侨右研箢盱牿殍珂<EFBFBD>汊狳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鲺趔<EFBFBD>
|
||||
耩弾崒堒<EFBFBD>
|
||||
殨殫枱悡<EFBFBD>
|
||||
焵潨洑櫂嫋嫈搾憪<EFBFBD><EFBFBD><EFBFBD>┄Е工舰<EFBFBD>烤綘护垢范荡<EFBFBD><EFBFBD>瓮趟收
|
||||
谡谂拿螺
|
||||
烂蘖芮谂厮稚韵彝旭铐祀觊<EFBFBD>
|
||||
琥屮泾狳<EFBFBD>恺帑纟澉牾梵<EFBFBD>
|
||||
耢彃崘
|
||||
嫋
|
||||
増噯厔儌潃煘潨洑檮棖晹彃憪<EFBFBD><EFBFBD><EFBFBD>胆Еジ"<EFBFBD>>郊沪垢范┐巢庇瓮趟稚惹瀑拿铝苓掭芮谫刈收杂彝酗铐痣觊棼驽溷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>澉鲺麸蝰饛拲寢姇垏唴槂倎€優潨泦櫂棖<EFBFBD>
|
||||
敁拺尟<EFBFBD><EFBFBD><EFBFBD>ě亥ぃⅰ牸弧航景豢剧ǔ<EFBFBD>
|
||||
]<EFBFBD>
|
||||
吞松<EFBFBD>
|
||||
惹桥匮休懒掭苒谫淖日杂已畜铙祀觊桤<EFBFBD>
|
||||
邃忏<EFBFBD>礅<EFBFBD><EFBFBD><EFBFBD>黯轸眚耩弾崘嫈増噯厔<EFBFBD>
|
||||
倎仢倧巼殗槜枙敁帒幆<EFBFBD><EFBFBD><EFBFBD>üΕぃⅰ<EFBFBD>
|
||||
<EFBFBD>郊缓垢范ù巢币瓮趟咨惹曝拿铝肋掭苒谫暸<EFBFBD>
|
||||
允右研镱耢腙轸珂邃<EFBFBD>
|
||||
忉<EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>黯轸睑麴弾崘嫈増噯厔焸焵煘潨泦
|
||||
<EFBFBD>
|
||||
|
|
|
@ -1,42 +1,50 @@
|
|||
*******************************************************************************
|
||||
Libre Media Server Audio - An Open source Media Server for arts and performing.
|
||||
LibreMediaServer Audio - An open source media server for arts and performing.
|
||||
(c) Criptomart - Santiago Noreña 2012-2024 <lms@criptomart.net>
|
||||
https://git.criptomart.net/libremediaserver
|
||||
*******************************************************************************
|
||||
|
||||
Lbre Media Server ChangeLog
|
||||
LibreMediaServer Changelog
|
||||
|
||||
v 0.2.0 Antigona (24/04/2024)
|
||||
+ change engine to miniaudio because is imposible pan in SFML and it has not access to low API and audio processing.
|
||||
+ Refactor all audio methods to MiniAudioEngine.
|
||||
v 0.2.0 Antígona (26/05/2024)
|
||||
+ Change audio engine to miniaudio because is imposible pan in SFML and it has not access to low API and audio processing.
|
||||
+ Refactor all audio methods to MiniAudioEngine class.
|
||||
+ Select sound device output.
|
||||
+ pan.
|
||||
+ Show faders values.
|
||||
+ play offset.
|
||||
+ Refactor AudioMasterWidget to AudioDMXReceptionWidget.
|
||||
+ mp3, flac, wav (mp3 has given some errors seeking cursor...).
|
||||
+ settings dialog not working, only read the conf file at startup.
|
||||
+ variable number of layers.
|
||||
+ olathread, send double channels only once for each dmx frame buffer.
|
||||
|
||||
v 0.1.3 Unreleased (19/04/2024)
|
||||
+ Pan.
|
||||
+ Show faders values. New SliderGroup class.
|
||||
+ Entry Point 16 bits.
|
||||
+ Refactor AudioMasterWidget to dmxWidget.
|
||||
+ Read mp3, flac, wav (mp3 has given some errors seeking cursors...). Audio Engine is working at 48Khz and 32 bits pcm float, if media files are encoding at same configuration, it saves a resampling operation later live.
|
||||
+ Removed settings dialog, only read xml conf file at startup.
|
||||
+ Real dynamic variable number of layers based on conf file setting.
|
||||
+ OlaThread send double channels (volume, entry point, load media) only once for each dmx frame buffer.
|
||||
+ Terminal mode without graphical interface. All audio methods has been refactorized out of QWidget world.
|
||||
+ Compilation without GUI (-DNOGUI).
|
||||
+ New DMX personality version, better sort for audio needs (first load media, set vol, pan, etc, last playback order);
|
||||
+ No QtSignals for sending data, better performance about 20% in my machine. Now, libremediaserver only updates values in AudioWidget, ui refresh is doing with a timer in audiowidget, so there is not problems between graphical and ola thread (the callback). Signals are used only from Ui to libreMediaServer to notify user interactions and Qtimers.
|
||||
+ Load media files from ui clicking in the media labels.
|
||||
+ New Play Modes:
|
||||
- Play all medias found in one folder.
|
||||
- Play all medias in one folder consecutevily.
|
||||
- Play all medias in one folder randomly.
|
||||
+ Multi audio devices output.
|
||||
+ Vumeter for each layer
|
||||
+ Show device name on Ui and ouput bus slider.
|
||||
+ 84dae057dbf7c0
|
||||
|
||||
v 0.1.3 Leúcade (19/04/2024)
|
||||
+ Ubuntu 22.04 jammy.
|
||||
+ Use SFML as audio engine.
|
||||
+ Qt 5.15.3.
|
||||
+ pitch.
|
||||
+ loop.
|
||||
+ Pitch.
|
||||
+ Loop.
|
||||
|
||||
v 0.1.2 Mayordomo (12/08/2015)
|
||||
|
||||
- GUI config
|
||||
- Several bugs tested in real world
|
||||
- variable layers
|
||||
- SFML as audio engine
|
||||
+ GUI config.
|
||||
+ Variable layers.
|
||||
+ SFML as audio engine.
|
||||
|
||||
v 0.1.1 Pascual (24/09/2014)
|
||||
|
||||
+ First Version: 4 layers playing .ogg
|
||||
+ Needs Open Lighting Arquitecture => 0.9.0
|
||||
+ Pure Data as audio engine
|
||||
|
||||
+ First Version: 4 layers playing .ogg.
|
||||
+ Needs Open Lighting Arquitecture => 0.9.0.
|
||||
+ Pure Data as audio engine.
|
||||
+ Qt4
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<dmxSettings fileVersion="1" layersNumber="4" path="/home/snt/Documentos/lab/lms/media/sound">
|
||||
<audioDevice id="3" />
|
||||
<layer0 dmx="1" universe="1" />
|
||||
<layer1 dmx="17" universe="1" />
|
||||
<layer2 dmx="33" universe="1" />
|
||||
<layer3 dmx="49" universe="1" />
|
||||
</dmxSettings>
|
||||
<lmsAudio ui="1" layersNumber="4" path="../media/sound" >
|
||||
<audioDevice devicesNumber="2" id0="3" id1="4"/>
|
||||
<layer id="0" dmx="1" universe="1" audioDevice="0" />
|
||||
<layer id="1" dmx="17" universe="1" audioDevice="0" />
|
||||
<layer id="2" dmx="33" universe="1" audioDevice="1" />
|
||||
<layer id="3" dmx="49" universe="1" audioDevice="1"/>
|
||||
</lmsAudio>
|
||||
|
|
|
@ -5,51 +5,40 @@ https://git.criptomart.net/libremediaserver
|
|||
*******************************************************************************
|
||||
|
||||
Libre Media Server Roadmap
|
||||
(en continuo crecimiento...)
|
||||
|
||||
v 0.2.x
|
||||
- skin, UI/UX
|
||||
v 0.3.0
|
||||
- Ui/Ux: skin, style.
|
||||
- Ui/Ux; Keyboards strokes.
|
||||
- Ui/Ux: Dar la opción clickeando en el widget de tiempo de poner una cuenta atrás en vez de hacia delante.
|
||||
- Ui/Ux: seek cursor playback
|
||||
- live input.
|
||||
- insertar/bypass/eliminar audio procesadores sin reiniciar por capa y master. (compresor, equs).
|
||||
- FX en capas master para que se puedan usar como envíos de auxiliar.
|
||||
- Enroutado de masters en otros masters (retorno de efectos).
|
||||
|
||||
v 0.2.2
|
||||
- Use sACN directly.
|
||||
- remove ola and use sACN directly.
|
||||
+ la instalación de OLA es mediante compilación, el repo de paquetes no está actualizado, nada user-friendly.
|
||||
+ hay que empaquetar OLA, incluirlo en el binario, o implementar sACN y linkarlo estáticamente.
|
||||
+ https://github.com/ETCLabs/sACN
|
||||
- Qt6.
|
||||
- audio processing (eq, rev, compresor, ...) por master y capa.
|
||||
- CIPT/MSex, send icons play-pause-stop.
|
||||
- CIPT/MSex.
|
||||
- Rasp build.
|
||||
- Octopus Sound Card support (6 outputs - 8 inputs).
|
||||
|
||||
v 0.2.1
|
||||
- Multi devices output.
|
||||
- Play Mode:
|
||||
- Play all medias found in folder consecutevily or random, with loop.
|
||||
- Play all medias, consecutevily and random, with loop.
|
||||
- mute/panic on layer.
|
||||
- Master Bus Layer:
|
||||
- each layer will have one "Gain" prefader that acts in source, "Vol" in v 1.3.
|
||||
- each layer will have one volume dmx channel for each bus layer. One aux "Send" prefader.
|
||||
- mute/panic.
|
||||
- fader + value
|
||||
- pan.
|
||||
- magicq .hed
|
||||
- pan
|
||||
- magicq personality .hed
|
||||
- audio device linked, outputs will be redirected there.
|
||||
- dmx address + universe settings.
|
||||
- Rose noise and sine generator in menu to test system.
|
||||
- Keyboards strokes, load media files from ui.
|
||||
- Dar la opción clickeando en el widget de tiempo de poner una cuenta atrás en vez de hacia delante.
|
||||
- compresor/limiter.
|
||||
- Layer:
|
||||
- audio procesadores (compresor, reveb, delay).
|
||||
- mute/panic.
|
||||
- Rose noise and sine generator.
|
||||
- Logs, verbosity, timestamp.
|
||||
- Bufgix: depurar errores cuando no carga la librería de medias, cambia el númmero de capas, cambia el universo, etc.
|
||||
- New control mode without pitch control, it saves resources. MA_SOUND_FLAG_NO_PITCH
|
||||
- Vumeter or indicator about audio output in layer and master.
|
||||
- New play mode without pitch control, it saves resources. MA_SOUND_FLAG_NO_PITCH
|
||||
- SettingsDialog.
|
||||
- Load/save conf file.
|
||||
- ¿stop offset? is it needed?
|
||||
- decouple MiniAudioEngine from AudioWidget, starts whith no gui or with audio in a dedicated thread.
|
||||
- New Status "Iddle" in playbacks if is not loaded.
|
||||
- check return errors, we are too happy....
|
||||
- ¿Exit Point? is it needed?
|
||||
- Hardening: check return errors, try/catch exceptions, i'm too happy....
|
||||
- Tests: errors on wrong conf file.
|
||||
- ampliar writer para recibir un número n de entradas y escribirlas cada una en un buffer
|
||||
- aislar miniaudio del callback dmx tal como hemos hecho con la Ui, al menos las operaciones lentas como cargar medios.
|
||||
- en load media usar un fence para actualizar mediaLoaded.
|
||||
|
|
|
@ -2,9 +2,17 @@ TEMPLATE = app
|
|||
TARGET = libremediaserver-audio
|
||||
QT += webkitwidgets widgets
|
||||
HEADERS += src/libremediaserver-audio.h \
|
||||
src/clickabledoublespinbox.h \
|
||||
src/clickablelabel.h \
|
||||
src/clickableslider.h \
|
||||
src/dmxwidget.h \
|
||||
src/miniaudio.h \
|
||||
src/filterbankwidget.h \
|
||||
src/libremediaserver-audio-gui.h \
|
||||
src/ma_writer_node.h \
|
||||
src/main.h \
|
||||
src/medialibrary.h \
|
||||
src/miniaudio.h \
|
||||
src/ma_writer_node.h \
|
||||
src/miniaudioengine.h \
|
||||
src/olathread.h \
|
||||
src/audiolayerwidget.h \
|
||||
|
@ -14,20 +22,25 @@ HEADERS += src/libremediaserver-audio.h \
|
|||
src/settings.h \
|
||||
src/slidergroup.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/clickabledoublespinbox.cpp \
|
||||
src/clickablelabel.cpp \
|
||||
src/clickableslider.cpp \
|
||||
src/dmxwidget.cpp \
|
||||
src/miniaudio.c \
|
||||
src/filterbankwidget.cpp \
|
||||
src/libremediaserver-audio-gui.cpp \
|
||||
src/libremediaserver-audio.cpp \
|
||||
src/medialibrary.cpp \
|
||||
src/miniaudio.c \
|
||||
src/miniaudioengine.cpp \
|
||||
src/ma_writer_node.c \
|
||||
src/olathread.cpp \
|
||||
src/audiolayerwidget.cpp \
|
||||
src/audiowidget.cpp \
|
||||
src/settings.cpp \
|
||||
src/slidergroup.cpp
|
||||
FORMS += src/libremediaserver-audio.ui
|
||||
CCFLAG += -msse2 -mavx2 #-fsanitize=address -g -O0
|
||||
FORMS += src/libremediaserver-audio-gui.ui
|
||||
CCFLAG += -msse2 -mavx2
|
||||
QMAKE_CXXFLAGS += $$(CXXFLAG)
|
||||
#QMAKE_CXXFLAGS += -fsanitize=address -g -O0
|
||||
QMAKE_CFLAGS += $$(CCFLAG)
|
||||
QMAKE_LFLAGS += $$(LDFLAG)
|
||||
LIBS += -lola -lolacommon -ldl -lpthread -lm
|
||||
|
|
|
@ -1,110 +1,258 @@
|
|||
#include "audiolayerwidget.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
||||
AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name, int layer):
|
||||
QGroupBox(parent)
|
||||
AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
||||
QWidget(parent)
|
||||
, m_oldStatus(Status::PlayingLoop)
|
||||
, m_layer(layer)
|
||||
, m_suspendResumeButton(0)
|
||||
{
|
||||
this->setTitle(name);
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
QHBoxLayout *progressTime = new QHBoxLayout;
|
||||
m_progressTime = new QTimeEdit;
|
||||
m_progressTime->text();
|
||||
m_progressTime->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_progressTime->setReadOnly(true);
|
||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_progressTime->setMaximumWidth(90);
|
||||
m_progressTime->setFocusPolicy(Qt::NoFocus);
|
||||
progressTime->addWidget(m_progressTime);
|
||||
m_totalTimeValue = new QTimeEdit;
|
||||
m_totalTimeValue->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_totalTimeValue->setReadOnly(true);
|
||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_totalTimeValue->setMaximumWidth(90);
|
||||
m_totalTimeValue->setFocusPolicy(Qt::NoFocus);
|
||||
progressTime->addWidget(m_totalTimeValue);
|
||||
layout->addLayout(progressTime);
|
||||
|
||||
m_progressSlider = new QSlider(Qt::Horizontal);
|
||||
m_progressSlider->setFocusPolicy(Qt::NoFocus);
|
||||
layout->addWidget(m_progressSlider);
|
||||
|
||||
QGridLayout *status = new QGridLayout;
|
||||
m_statusValue = new QLabel;
|
||||
status->addWidget(m_statusValue, 0, 0);
|
||||
m_folderValue = new QLabel;
|
||||
m_folderValue->setMaximumWidth(200);
|
||||
status->addWidget(m_folderValue, 1, 0);
|
||||
m_fileValue = new QLabel;
|
||||
m_fileValue->setMaximumWidth(200);
|
||||
status->addWidget(m_fileValue, 2, 0);
|
||||
layout->addLayout(status);
|
||||
|
||||
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||
m_volume = new SliderGroup("Vol", 0 , 100, 2, NULL);
|
||||
volumeBox->addWidget(m_volume);
|
||||
connect(m_volume, SIGNAL(valueChanged(float)), this, SLOT(volumeChanged(float)));
|
||||
m_pan = new SliderGroup("Pan", 0 , 255, 0, NULL);
|
||||
volumeBox->addWidget(m_pan);
|
||||
connect(m_pan, SIGNAL(valueChanged(float)), this, SLOT(panChanged(float)));
|
||||
m_pitch = new SliderGroup("Pitch", 0 , 255, 0, NULL);
|
||||
volumeBox->addWidget(m_pitch);
|
||||
connect(m_pitch, SIGNAL(valueChanged(float)), this, SLOT(pitchChanged(float)));
|
||||
layout->addLayout(volumeBox);
|
||||
m_folderValue = new ClickableLabel;
|
||||
m_folderValue->setAlignment(Qt::AlignLeft);
|
||||
m_folderValue->setFocusPolicy(Qt::NoFocus);
|
||||
m_folderValue->setMinimumWidth(MIN_WIDTH);
|
||||
m_folderValue->setMaximumWidth(MAX_WIDTH);
|
||||
m_folderValue->setContentsMargins(3,1,3,1);
|
||||
m_folderValue->setText("Click to open media file (mp3, wav, flac)");
|
||||
m_folderValue->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"color: white;"
|
||||
"background-color: black;"
|
||||
"font-size: 12px;"
|
||||
);
|
||||
layout->addWidget(m_folderValue);
|
||||
m_fileValue = new ClickableLabel;
|
||||
m_fileValue->setAlignment(Qt::AlignLeft);
|
||||
m_fileValue->setFocusPolicy(Qt::NoFocus);
|
||||
m_fileValue->setMinimumWidth(MIN_WIDTH);
|
||||
m_fileValue->setMaximumWidth(MAX_WIDTH);
|
||||
m_fileValue->setContentsMargins(3,1,3,1);
|
||||
m_fileValue->setText("++ empty ++");
|
||||
connect(m_fileValue, SIGNAL(clicked()), this, SLOT(openMediaDialog()));
|
||||
connect(m_folderValue, SIGNAL(clicked()), this, SLOT(openMediaDialog()));
|
||||
m_fileValue->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"color: white;"
|
||||
"background-color: black;"
|
||||
"font-size: 14px;"
|
||||
);
|
||||
layout->addWidget(m_fileValue);
|
||||
|
||||
m_suspendResumeButton = new QPushButton(this);
|
||||
m_suspendResumeButton->setText(StatusStr[Status::Stopped]);
|
||||
m_suspendResumeButton->setText(statusToString(Status::Iddle));
|
||||
connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
|
||||
layout->addWidget(m_suspendResumeButton);
|
||||
|
||||
m_progress = new QProgressBar(this);
|
||||
m_progress->setOrientation(Qt::Horizontal);
|
||||
m_progress->setFocusPolicy(Qt::NoFocus);
|
||||
m_progress->setAlignment(Qt::AlignHCenter);
|
||||
m_progress->setContentsMargins(0, 1, 0, 1);
|
||||
m_progress->setMinimumWidth(MIN_WIDTH);
|
||||
m_progress->setMaximumWidth(MAX_WIDTH);
|
||||
m_progress->setMaximumHeight(15);
|
||||
m_progress->setRange(0, 0);
|
||||
m_progress->setValue(0);
|
||||
m_progress->setFormat("%v / %m");
|
||||
m_progress->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"font-size: 10px;"
|
||||
"background-color: black;"
|
||||
);
|
||||
layout->addWidget(m_progress);
|
||||
|
||||
m_progressTime = new QTimeEdit;
|
||||
m_progressTime->setToolTip("Current Time");
|
||||
m_progressTime->setObjectName("Current Time");
|
||||
m_progressTime->setDisplayFormat("mm:ss:zzz");
|
||||
m_progressTime->setReadOnly(true);
|
||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_progressTime->setFocusPolicy(Qt::NoFocus);
|
||||
m_progressTime->setAlignment(Qt::AlignHCenter);
|
||||
m_progressTime->setContentsMargins(0,0,0,0);
|
||||
m_progressTime->setMinimumWidth(MIN_WIDTH);
|
||||
m_progressTime->setMaximumWidth(MAX_WIDTH);
|
||||
m_progressTime->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"color: white;"
|
||||
"background-color: black;"
|
||||
"font-size: 16px;"
|
||||
);
|
||||
m_totalTimeValue = new QTimeEdit;
|
||||
m_totalTimeValue->setObjectName("Track Length");
|
||||
m_totalTimeValue->setToolTip("Track Length");
|
||||
m_totalTimeValue->setDisplayFormat("mm:ss:zzz");
|
||||
m_totalTimeValue->setReadOnly(true);
|
||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_totalTimeValue->setFocusPolicy(Qt::NoFocus);
|
||||
m_totalTimeValue->setAlignment(Qt::AlignHCenter);
|
||||
m_totalTimeValue->setContentsMargins(0,0,0,0);
|
||||
m_totalTimeValue->setMinimumWidth(MIN_WIDTH);
|
||||
m_totalTimeValue->setMaximumWidth(MAX_WIDTH);
|
||||
m_totalTimeValue->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"color: white;"
|
||||
"background-color: black;"
|
||||
"font-size: 16px;"
|
||||
);
|
||||
QHBoxLayout *status = new QHBoxLayout;
|
||||
status->addWidget(m_progressTime);
|
||||
status->addWidget(m_totalTimeValue);
|
||||
layout->addLayout(status);
|
||||
|
||||
m_filterBank = new FilterBankWidget(this);
|
||||
m_filterBank->setMaximumWidth(MAX_WIDTH);
|
||||
m_filterBank->setMinimumWidth(MIN_WIDTH);
|
||||
connect(m_filterBank, SIGNAL(setBypass(bool)), this, SLOT(setBypass(bool)));
|
||||
layout->addWidget(m_filterBank);
|
||||
m_pitch = new SliderGroup("Pitch", 0 , 255, 0, NULL);
|
||||
layout->addWidget(m_pitch);
|
||||
connect(m_pitch, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||
m_pan = new SliderGroup("Pan", 0 , 255, 0, NULL);
|
||||
layout->addWidget(m_pan);
|
||||
connect(m_pan, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||
|
||||
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||
m_volume = new SliderGroup("Vol", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_volume);
|
||||
connect(m_volume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
m_bus1 = new SliderGroup("Bus 1", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_bus1);
|
||||
connect(m_bus1, SIGNAL(valueChanged(int)), this, SLOT(bus1VolumeChanged(int)));
|
||||
m_bus2 = new SliderGroup("Bus 2", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_bus2);
|
||||
connect(m_bus2, SIGNAL(valueChanged(int)), this, SLOT(bus2VolumeChanged(int)));
|
||||
volumeBox->setSpacing(0);
|
||||
volumeBox->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(volumeBox);
|
||||
QHBoxLayout *labelsBox = new QHBoxLayout;
|
||||
m_level = new QLabel("-inf");
|
||||
m_level->setStyleSheet("border: 1px solid #CFB0C9;"
|
||||
"margin: 0px;"
|
||||
"background-color: black;"
|
||||
"color: white;"
|
||||
"text-align: center;"
|
||||
"font-size: 15px;");
|
||||
m_level->setMinimumWidth(MIN_WIDTH / 2);
|
||||
m_level->setMaximumWidth(MAX_WIDTH / 3);
|
||||
m_level->setMinimumHeight(25);
|
||||
m_level->setAlignment(Qt::AlignHCenter);
|
||||
m_level->setContentsMargins(0, 4, 0, 4);
|
||||
labelsBox->addWidget(m_level);
|
||||
m_bus1Label = new QLabel("dummy");
|
||||
m_bus1Label->setAlignment(Qt::AlignHCenter);
|
||||
m_bus1Label->setContentsMargins(0, 6, 0, 6);
|
||||
m_bus1Label->setMinimumHeight(25);
|
||||
m_bus1Label->setMinimumWidth(MIN_WIDTH / 4);
|
||||
m_bus1Label->setMaximumWidth(MAX_WIDTH / 3);
|
||||
m_bus1Label->setStyleSheet("border: 1px solid #CFB0C9;"
|
||||
"margin: 0px;"
|
||||
"background-color: black;"
|
||||
"color: white;"
|
||||
"font-size: 10px;");
|
||||
labelsBox->addWidget(m_bus1Label);
|
||||
m_bus2Label = new QLabel("dummy");
|
||||
m_bus2Label->setAlignment(Qt::AlignHCenter);
|
||||
m_bus2Label->setMinimumWidth(MIN_WIDTH / 4);
|
||||
m_bus2Label->setMaximumWidth(MAX_WIDTH / 3);
|
||||
m_bus2Label->setContentsMargins(0, 6, 0, 6);
|
||||
m_bus2Label->setMinimumHeight(25);
|
||||
m_bus2Label->setStyleSheet("border: 1px solid #CFB0C9;"
|
||||
"margin: 0px;"
|
||||
"background-color: black;"
|
||||
"color: white;"
|
||||
"font-size: 10px;");
|
||||
labelsBox->addWidget(m_bus2Label);
|
||||
labelsBox->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(labelsBox);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
layout->setSpacing(1);
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
AudioLayerWidget::~AudioLayerWidget()
|
||||
{
|
||||
|
||||
}
|
||||
AudioLayerWidget::~AudioLayerWidget() {}
|
||||
|
||||
// From UI.
|
||||
void AudioLayerWidget::volumeChanged(float value)
|
||||
void AudioLayerWidget::volumeChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Volume, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::panChanged(float value)
|
||||
void AudioLayerWidget::bus1VolumeChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Bus1, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::bus2VolumeChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Bus2, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::panChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Pan, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::pitchChanged(float value)
|
||||
void AudioLayerWidget::pitchChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Pitch, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setBypass(bool value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Bypass, value));
|
||||
}
|
||||
|
||||
|
||||
void AudioLayerWidget::toggleSuspendResume()
|
||||
{
|
||||
switch (m_status) {
|
||||
case Status::PlayingLoop:
|
||||
case Status::PlayingOnce:
|
||||
case Status::PlayingFolder:
|
||||
case Status::PlayingFolderLoop:
|
||||
case Status::PlayingFolderRandom:
|
||||
m_oldStatus = m_status;
|
||||
this->setPlaybackStatus(Status::Paused);
|
||||
emit uiPlaybackChanged(m_layer, Status::Paused);
|
||||
break;
|
||||
case Status::Paused:
|
||||
case Status::Stopped:
|
||||
this->setPlaybackStatus(Status::PlayingOnce);
|
||||
emit uiPlaybackChanged(m_layer, Status::PlayingOnce);
|
||||
this->setPlaybackStatus(m_oldStatus);
|
||||
emit uiPlaybackChanged(m_layer, m_oldStatus);
|
||||
case Status::Iddle:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioLayerWidget::openMediaDialog()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setNameFilter(tr("Sound Tracks (*.mp3 *.mp3 *.flac *.wav"));
|
||||
dialog.setViewMode(QFileDialog::Detail);
|
||||
dialog.setDirectory(Settings::getInstance()->getPathMedia());
|
||||
if (!dialog.exec())
|
||||
return;
|
||||
QStringList fileNames;
|
||||
fileNames = dialog.selectedFiles();
|
||||
emit uiLoadMedia(m_layer, fileNames.at(0));
|
||||
this->setMediaFile(fileNames.at(0));
|
||||
this->setPlaybackStatus(Status::Stopped);
|
||||
}
|
||||
|
||||
// from DMX signals
|
||||
void AudioLayerWidget::setVol(float vol)
|
||||
{
|
||||
m_volume->blockSignals(true);
|
||||
m_volume->setValue(vol);
|
||||
m_volume->blockSignals(false);
|
||||
m_volume->blockSignals(true);
|
||||
m_volume->setValue(vol);
|
||||
m_volume->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPan(int pan)
|
||||
|
@ -121,51 +269,92 @@ void AudioLayerWidget::setPitch(int pitch)
|
|||
m_pitch->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::fileLoaded(QString file)
|
||||
void AudioLayerWidget::setMediaFile(QString file)
|
||||
{
|
||||
QStringList list = file.split("/");
|
||||
int size = list.size();
|
||||
if (size >= 2) {
|
||||
m_folderValue->setText(list.at(size - 2));
|
||||
m_fileValue->setText(list.at(size - 1));
|
||||
QString tmp = list.at(size - 2);
|
||||
tmp.truncate(60);
|
||||
m_folderValue->setText(tmp);
|
||||
tmp = list.at(size - 1);
|
||||
tmp.truncate(40);
|
||||
m_fileValue->setText(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPlaybackStatus(Status status)
|
||||
void AudioLayerWidget::setPlaybackStatus(Status s)
|
||||
{
|
||||
m_status = status;
|
||||
if (status == Status::Stopped)
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
||||
m_statusValue->blockSignals(true);
|
||||
m_suspendResumeButton->blockSignals(true);
|
||||
m_statusValue->setText(StatusStr[status]);
|
||||
m_suspendResumeButton->setText(StatusStr[status]);
|
||||
switch (m_status) {
|
||||
case Status::Paused:
|
||||
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||
break;
|
||||
case Status::PlayingLoop:
|
||||
case Status::PlayingOnce:
|
||||
m_statusValue->setStyleSheet("QLabel { color : green; }");
|
||||
break;
|
||||
case Status::Stopped:
|
||||
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||
break;
|
||||
}
|
||||
m_statusValue->blockSignals(false);
|
||||
m_status = s;
|
||||
m_suspendResumeButton->setText(statusToString(s));
|
||||
m_suspendResumeButton->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::durationChanged(float dur)
|
||||
void AudioLayerWidget::setDuration(float dur)
|
||||
{
|
||||
dur *= 1000;
|
||||
m_progressSlider->setMaximum(dur);
|
||||
m_progress->blockSignals(true);
|
||||
m_progressTime->blockSignals(true);
|
||||
m_totalTimeValue->blockSignals(true);
|
||||
m_progress->setRange(0, dur);
|
||||
m_progress->setValue(0);
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
||||
m_totalTimeValue->setTime(QTime::fromMSecsSinceStartOfDay(dur));
|
||||
m_progress->blockSignals(false);
|
||||
m_progressTime->blockSignals(false);
|
||||
m_totalTimeValue->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::refreshUi(float progress)
|
||||
void AudioLayerWidget::setCurrentTime(float progress)
|
||||
{
|
||||
progress *= 1000;
|
||||
m_progressSlider->setValue(progress);
|
||||
m_progress->blockSignals(true);
|
||||
m_progressTime->blockSignals(true);
|
||||
m_progress->setValue(progress);
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(progress));
|
||||
m_progress->blockSignals(false);
|
||||
m_progressTime->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setFilterParam(int channel, int value)
|
||||
{
|
||||
if (channel <= FILTER_BANK_GAIN - HP_FREQ){
|
||||
m_filterBank->blockSignals(true);
|
||||
m_filterBank->setValue(channel, value);
|
||||
m_filterBank->blockSignals(false);
|
||||
} else if (channel == SEND1 - HP_FREQ) {
|
||||
m_bus1->blockSignals(true);
|
||||
m_bus1->setValue((value * 256) + 255);
|
||||
m_bus1->blockSignals(false);
|
||||
} else if (channel == SEND2 - HP_FREQ) {
|
||||
m_bus2->blockSignals(true);
|
||||
m_bus2->setValue(value * 256 + 255);
|
||||
m_bus2->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setLevel(float db)
|
||||
{
|
||||
m_level->blockSignals(true);
|
||||
if (db > -140)
|
||||
|
||||
m_level->setText(QString::number(db, 'f', 2));
|
||||
else
|
||||
m_level->setText("-inf");
|
||||
m_level->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setBusName(uint bus, char *name)
|
||||
{
|
||||
if (name && strlen(name) > 17)
|
||||
name[16] = '\0';
|
||||
if (bus == 0) {
|
||||
m_bus1Label->blockSignals(true);
|
||||
m_bus1Label->setText(name);
|
||||
m_bus1Label->blockSignals(false);
|
||||
} else if (bus == 1) {
|
||||
m_bus2Label->blockSignals(true);
|
||||
m_bus2Label->setText(name);
|
||||
m_bus2Label->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,53 +3,69 @@
|
|||
|
||||
#include <QPushButton>
|
||||
#include <QTimeEdit>
|
||||
#include <QLabel>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "defines.h"
|
||||
#include "slidergroup.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "settings.h"
|
||||
#include "filterbankwidget.h"
|
||||
|
||||
class AudioLayerWidget : public QGroupBox
|
||||
class AudioLayerWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AudioLayerWidget(QWidget *parent = 0, QString name = "Layer", int layer = 0);
|
||||
explicit AudioLayerWidget(QWidget *parent = 0, int layer = 0);
|
||||
~AudioLayerWidget();
|
||||
|
||||
// From OLA -> LibreMediaServer -> AudioWidget
|
||||
void setMediaFile(QString file);
|
||||
void setDuration(float dur);
|
||||
void setCurrentTime(float progress);
|
||||
void setPlaybackStatus(Status status);
|
||||
void setVol(float vol);
|
||||
void resume();
|
||||
void setPan(int pan);
|
||||
void setPitch(int pitch);
|
||||
void setLoop(bool on);
|
||||
void setPlaybackStatus(Status status);
|
||||
inline Status getPlaybackStatus() { return m_status; }
|
||||
void setFilterParam(int channel, int value);
|
||||
void setLevel(float db);
|
||||
void setBusName(uint bus, char *name);
|
||||
|
||||
private:
|
||||
Status m_status;
|
||||
Status m_oldStatus;
|
||||
int m_layer;
|
||||
QPushButton *m_suspendResumeButton;
|
||||
QLabel * m_statusValue;
|
||||
QLabel *m_fileValue;
|
||||
QLabel * m_folderValue;
|
||||
ClickableLabel *m_fileValue;
|
||||
ClickableLabel * m_folderValue;
|
||||
SliderGroup *m_volume;
|
||||
SliderGroup *m_pan;
|
||||
SliderGroup *m_pitch;
|
||||
QSlider *m_progressSlider;
|
||||
SliderGroup *m_bus1;
|
||||
SliderGroup *m_bus2;
|
||||
QTimeEdit *m_progressTime;
|
||||
QTimeEdit *m_totalTimeValue;
|
||||
QProgressBar *m_progress;
|
||||
FilterBankWidget *m_filterBank;
|
||||
QLabel *m_level;
|
||||
QLabel *m_bus1Label;
|
||||
QLabel *m_bus2Label;
|
||||
|
||||
public slots:
|
||||
// From Ui
|
||||
private slots:
|
||||
void openMediaDialog();
|
||||
void toggleSuspendResume();
|
||||
void volumeChanged(float vol);
|
||||
void panChanged(float pan);
|
||||
void pitchChanged(float pitch);
|
||||
void fileLoaded(QString file);
|
||||
void durationChanged(float dur);
|
||||
void refreshUi(float progress);
|
||||
void volumeChanged(int vol);
|
||||
void bus1VolumeChanged(int vol);
|
||||
void bus2VolumeChanged(int vol);
|
||||
void panChanged(int pan);
|
||||
void pitchChanged(int pitch);
|
||||
void setBypass(bool value);
|
||||
|
||||
signals:
|
||||
void uiPlaybackChanged(int layer, Status s);
|
||||
void uiSliderChanged(int layer, Slider s, int value);
|
||||
|
||||
void uiLoadMedia(int layer, QString s);
|
||||
};
|
||||
|
||||
#endif // AUDIOLAYERWIDGET_H
|
||||
|
|
|
@ -1,121 +1,135 @@
|
|||
#include "audiowidget.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
|
||||
AudioWidget::AudioWidget() :
|
||||
m_layout(new QHBoxLayout())
|
||||
, m_refreshUi(new QTimer(this))
|
||||
AudioWidget::AudioWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
, m_layout(new QHBoxLayout())
|
||||
{
|
||||
for (int i= 0; i < Settings::getInstance()->getLayersNumber(); i++ ) {
|
||||
AudioLayerWidget *alw = new AudioLayerWidget(this, tr("Layer %1").arg(i + 1), i);
|
||||
m_layers = Settings::getInstance()->getLayersNumber();
|
||||
for (uint i= 0; i < m_layers; i++ ) {
|
||||
AudioLayerWidget *alw = new AudioLayerWidget(this, i);
|
||||
m_layout->insertWidget(i, alw);
|
||||
connect(alw, SIGNAL(uiSliderChanged(int, Slider, int)), this, SLOT(uiSliderAction(int, Slider, int)));
|
||||
connect(alw, SIGNAL(uiPlaybackChanged(int, Status)), this, SLOT(uiChangePlaybackStatus(int, Status)));
|
||||
connect(alw, SIGNAL(uiSliderChanged(int, Slider, int)), this, SIGNAL(uiSliderChanged(int, Slider, int)));
|
||||
connect(alw, SIGNAL(uiPlaybackChanged(int, Status)), this, SIGNAL(uiPlaybackChanged(int, Status)));
|
||||
connect(alw, SIGNAL(uiLoadMedia(int, QString)), this, SIGNAL(uiLoadMedia(int, QString)));
|
||||
m_layerUpdate[i].status = Status::Iddle;
|
||||
m_layerUpdate[i].duration = -1;
|
||||
m_layerUpdate[i].media = "";
|
||||
m_layerUpdate[i].vol = -1;
|
||||
m_layerUpdate[i].pan = -1;
|
||||
m_layerUpdate[i].pitch = -1;
|
||||
m_layerUpdate[i].cursor = -1;
|
||||
m_layerUpdate[i].level = 100;
|
||||
for (int j = 0; j < FILTER_CHANNELS; j++)
|
||||
m_filtersUpdate[i][j] = -1;
|
||||
}
|
||||
m_layout->setSpacing(0);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setStyleSheet("margin: 2px;");
|
||||
setLayout(m_layout);
|
||||
m_refreshUi = new QTimer(this);
|
||||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
m_refreshUi->start(UI_REFRESH_TIME);
|
||||
m_refreshUi->start(UI_REFRESH_TIME * 1.5);
|
||||
}
|
||||
|
||||
bool AudioWidget::startEngine(int id)
|
||||
void AudioWidget::mediaLoaded(int layer, QString file, float duration)
|
||||
{
|
||||
return (m_mae.startEngine(id));
|
||||
}
|
||||
|
||||
bool AudioWidget::startEngine()
|
||||
{
|
||||
return (m_mae.startEngine(Settings::getInstance()->getAudioDeviceId()));
|
||||
}
|
||||
|
||||
void AudioWidget::stopEngine()
|
||||
{
|
||||
m_mae.stopEngine();
|
||||
}
|
||||
|
||||
void AudioWidget::mediaLoaded(int layer, QString file)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
if (m_currentMedia[layer].compare(file) == 0 ) {
|
||||
return;
|
||||
}
|
||||
if (!QFile::exists(file)) {
|
||||
qWarning("Can not access to file %s", file.toLatin1().constData());
|
||||
return;
|
||||
}
|
||||
result = m_mae.loadMedia(layer, file.toLatin1().data());
|
||||
if (result != MA_SUCCESS) {
|
||||
qWarning("can not open file %s", file.toLatin1().constData());
|
||||
return;
|
||||
}
|
||||
m_currentMedia[layer] = file;
|
||||
float pLength = m_mae.getDuration(layer);
|
||||
qInfo("File loaded: %s - Duration: %f secs", file.toLatin1().constData(), pLength);
|
||||
m_mae.printFormatInfo(layer);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->fileLoaded(file);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->durationChanged(pLength);
|
||||
m_layerUpdate[layer].media = file;
|
||||
m_layerUpdate[layer].duration = duration;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::volChanged(int layer, float vol) {
|
||||
m_mae.volChanged(layer, vol);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setVol(vol);
|
||||
m_layerUpdate[layer].vol = vol;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::panChanged(int layer, int pan) {
|
||||
m_mae.panChanged(layer, pan);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setPan(pan);
|
||||
m_layerUpdate[layer].pan = pan;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::pitchChanged(int layer, int pitch) {
|
||||
m_mae.pitchChanged(layer, pitch);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setPitch(pitch);
|
||||
|
||||
m_layerUpdate[layer].pitch = pitch;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::playbackChanged(int layer, Status status)
|
||||
{
|
||||
m_mae.playbackChanged(layer, status);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setPlaybackStatus(status);
|
||||
m_layerUpdate[layer].status = status;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::entryPointChanged(int layer, int cursor)
|
||||
void AudioWidget::cursorChanged(int layer, float cursor)
|
||||
{
|
||||
m_mae.setCursor(layer, cursor);
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
AudioLayerWidget *aw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
aw->refreshUi(m_mae.getCursor(layer));
|
||||
m_layerUpdate[layer].cursor = cursor;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::refreshUi() {
|
||||
for (int i= 0; i < Settings::getInstance()->getLayersNumber(); i++ ) {
|
||||
QLayoutItem * const item = m_layout->itemAt(i);
|
||||
AudioLayerWidget *aw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
Status s = aw->getPlaybackStatus();
|
||||
if (s == Status::PlayingOnce || s == Status::PlayingLoop) {
|
||||
aw->refreshUi(m_mae.getCursor(i));
|
||||
void AudioWidget::refreshUi()
|
||||
{
|
||||
for (uint i = 0; i < m_layers; i++)
|
||||
{
|
||||
if (m_layerUpdate[i].updated) {
|
||||
QLayoutItem *item = m_layout->itemAt(i);
|
||||
AudioLayerWidget *alw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
if (m_layerUpdate[i].vol > -1) {
|
||||
alw->setVol(m_layerUpdate[i].vol);
|
||||
m_layerUpdate[i].vol = -1;
|
||||
}
|
||||
if (m_layerUpdate[i].cursor > -1) {
|
||||
alw->setCurrentTime(m_layerUpdate[i].cursor);
|
||||
m_layerUpdate[i].cursor = -1;
|
||||
}
|
||||
if (m_layerUpdate[i].pan > -1) {
|
||||
alw->setPan(m_layerUpdate[i].pan);
|
||||
m_layerUpdate[i].pan = -1;
|
||||
}
|
||||
if (m_layerUpdate[i].pitch > -1) {
|
||||
alw->setPitch(m_layerUpdate[i].pitch);
|
||||
m_layerUpdate[i].pitch = -1;
|
||||
}
|
||||
if (m_layerUpdate[i].status != Status::Iddle) {
|
||||
alw->setPlaybackStatus(m_layerUpdate[i].status);
|
||||
m_layerUpdate[i].status = Status::Iddle;
|
||||
}
|
||||
if (m_layerUpdate[i].duration > -1) {
|
||||
alw->setMediaFile(m_layerUpdate[i].media);
|
||||
alw->setDuration(m_layerUpdate[i].duration);
|
||||
m_layerUpdate[i].duration = -1;
|
||||
}
|
||||
for (int j = 0; j < FILTER_CHANNELS; j++) {
|
||||
if (m_filtersUpdate[i][j] > -1)
|
||||
alw->setFilterParam(j, m_filtersUpdate[i][j]);
|
||||
m_filtersUpdate[i][j] = -1;
|
||||
}
|
||||
if (m_layerUpdate[i].level < 100) {
|
||||
alw->setLevel(m_layerUpdate[i].level);
|
||||
m_layerUpdate[i].level = 100;
|
||||
}
|
||||
m_layerUpdate[i].updated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWidget::uiSliderAction(int layer, Slider s, int value)
|
||||
void AudioWidget::filterParamChanged(int layer, int channel, int value)
|
||||
{
|
||||
switch (s){
|
||||
case Slider::Volume:
|
||||
m_mae.volChanged(layer, value);
|
||||
break;
|
||||
case Slider::Pan:
|
||||
m_mae.panChanged(layer, value);
|
||||
break;
|
||||
case Slider::Pitch:
|
||||
m_mae.pitchChanged(layer, value);
|
||||
break;
|
||||
m_filtersUpdate[layer][channel - HP_FREQ] = value;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::levelChanged(int layer, float db)
|
||||
{
|
||||
m_layerUpdate[layer].level = db;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::busNameChanged(uint bus, char* name)
|
||||
{
|
||||
for (uint i = 0; i < m_layers; i++) {
|
||||
QLayoutItem *item = m_layout->itemAt(i);
|
||||
AudioLayerWidget *alw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
alw->setBusName(bus, name);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWidget::uiChangePlaybackStatus(int layer, Status s) {
|
||||
m_mae.playbackChanged(layer, s);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#define AUDIOWIDGET_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QBoxLayout>
|
||||
|
||||
#include "audiolayerwidget.h"
|
||||
#include "settings.h"
|
||||
#include "miniaudioengine.h"
|
||||
#include "defines.h" // MAX_LAYERS
|
||||
|
||||
class AudioWidget : public QWidget
|
||||
|
@ -13,29 +13,32 @@ class AudioWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioWidget();
|
||||
bool startEngine();
|
||||
bool startEngine(int id);
|
||||
void stopEngine();
|
||||
void mediaLoaded(int layer, QString media );
|
||||
AudioWidget(QWidget *parent = nullptr);
|
||||
void filterParamChanged(int layer, int channel, int value);
|
||||
void levelChanged(int layer, float db);
|
||||
void busNameChanged(uint bus, char *name);
|
||||
|
||||
private:
|
||||
QHBoxLayout *m_layout;
|
||||
layerData m_layerUpdate[MAX_LAYERS];
|
||||
QTimer *m_refreshUi;
|
||||
uint m_layers;
|
||||
int m_filtersUpdate[MAX_LAYERS][FILTER_CHANNELS];
|
||||
|
||||
public slots:
|
||||
void volChanged(int layer, float vol);
|
||||
void panChanged(int layer, int pan);
|
||||
void pitchChanged(int layer, int pitch);
|
||||
void cursorChanged(int layer, float cursor);
|
||||
void mediaLoaded(int layer, QString media, float duration);
|
||||
void playbackChanged(int layer, Status status);
|
||||
void entryPointChanged(int layer, int cursor);
|
||||
|
||||
private:
|
||||
MiniAudioEngine m_mae;
|
||||
QString m_currentMedia[MAX_LAYERS];
|
||||
QHBoxLayout *m_layout;
|
||||
QTimer *m_refreshUi;
|
||||
|
||||
public slots:
|
||||
void uiSliderAction(int layer, Slider s, int value);
|
||||
void uiChangePlaybackStatus(int layer, Status s);
|
||||
|
||||
private slots:
|
||||
void refreshUi();
|
||||
signals:
|
||||
void uiPlaybackChanged(int layer, Status s);
|
||||
void uiSliderChanged(int layer, Slider s, int vol);
|
||||
void uiLoadMedia(int layer, QString s);
|
||||
};
|
||||
|
||||
#endif // AUDIOWIDGET_H
|
||||
|
|
17
src/clickabledoublespinbox.cpp
Normal file
17
src/clickabledoublespinbox.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "clickabledoublespinbox.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ClickableDoubleSpinBox::ClickableDoubleSpinBox(QWidget *parent)
|
||||
: QDoubleSpinBox(parent)
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
setValue(-1);
|
||||
setDecimals(1);
|
||||
setAlignment(Qt::AlignHCenter);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
setMaximumWidth(66);
|
||||
setMinimumWidth(25);
|
||||
}
|
||||
|
25
src/clickabledoublespinbox.h
Normal file
25
src/clickabledoublespinbox.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef CLICKABLEDOUBLESPINBOX_H
|
||||
#define CLICKABLEDOUBLESPINBOX_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
class ClickableDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
|
||||
protected:
|
||||
void mousePressEvent ( QMouseEvent * event ) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit click();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
signals:
|
||||
void click();
|
||||
};
|
||||
|
||||
#endif // CLICKABLEDOUBLESPINBOX_H
|
14
src/clickablelabel.cpp
Normal file
14
src/clickablelabel.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "clickablelabel.h"
|
||||
|
||||
ClickableLabel::ClickableLabel(QWidget *parent, Qt::WindowFlags f)
|
||||
: QLabel{parent}
|
||||
{
|
||||
Q_UNUSED(f);
|
||||
}
|
||||
|
||||
ClickableLabel::~ClickableLabel() {}
|
||||
|
||||
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event);
|
||||
emit clicked();
|
||||
}
|
22
src/clickablelabel.h
Normal file
22
src/clickablelabel.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef CLICKABLELABEL_H
|
||||
#define CLICKABLELABEL_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <Qt>
|
||||
|
||||
class ClickableLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ClickableLabel(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~ClickableLabel();
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
};
|
||||
|
||||
#endif // CLICKABLELABEL_H
|
3
src/clickableslider.cpp
Normal file
3
src/clickableslider.cpp
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "clickableslider.h"
|
||||
|
||||
ClickableSlider::ClickableSlider(QWidget *parent) : QSlider{parent} {}
|
30
src/clickableslider.h
Normal file
30
src/clickableslider.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef CLICKABLESLIDER_H
|
||||
#define CLICKABLESLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
class ClickableSlider : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickableSlider(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::RightButton)
|
||||
{
|
||||
if (this->isEnabled()) {
|
||||
qDebug() << "disabling slider";
|
||||
this->setDisabled(true);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
QSlider::mousePressEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CLICKABLESLIDER_H
|
|
@ -1,19 +1,26 @@
|
|||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
//#define VERSION "LibreMediaServerAudio 0.2.0 Antigona Release"
|
||||
#define VERSION "Kike Substitutor - No AI required - v0.2.0"
|
||||
#define COPYRIGHT "(C) 2014-2024 Santi Noreña <lms@criptomart.net>"
|
||||
#define LICENSE "GPL 3 Licensed. See LICENSE.txt.\nSound guys are not allowed to use this software."
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
#define MAX_LAYERS 16
|
||||
#define UI_REFRESH_TIME 200
|
||||
#define VERSION "LibreMediaServerAudio v0.2.0 Antigona"
|
||||
#define COPYRIGHT "(C) 2014-2024 Santi Noreña <lms@criptomart.net>"
|
||||
#define LICENSE "GPL3 Licensed. See LICENSE.txt."
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
#define MAX_LAYERS 4
|
||||
#define MAX_AUDIODEVICES 8
|
||||
#define FORMAT ma_format_f32 /* Must always be f32. */
|
||||
#define CHANNELS 2
|
||||
#define SAMPLE_RATE 48000
|
||||
#define UI_REFRESH_TIME 123
|
||||
#define FADE_TIME 25
|
||||
#define FILTER_CHANNELS 16 // number of dmx channels dedicated to filters by layer
|
||||
#define MAX_WIDTH 500
|
||||
#define MIN_WIDTH 50
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
int address;
|
||||
unsigned int universe;
|
||||
int layer;
|
||||
int audioDevice;
|
||||
};
|
||||
|
||||
enum Status
|
||||
|
@ -22,15 +29,10 @@ enum Status
|
|||
Paused,
|
||||
PlayingOnce,
|
||||
PlayingLoop,
|
||||
};
|
||||
|
||||
static const char* StatusStr[] =
|
||||
{
|
||||
"Stop",
|
||||
"Pause",
|
||||
"Playing One",
|
||||
"Playing Loop",
|
||||
0x0
|
||||
Iddle,
|
||||
PlayingFolder,
|
||||
PlayingFolderLoop,
|
||||
PlayingFolderRandom
|
||||
};
|
||||
|
||||
enum Slider
|
||||
|
@ -38,7 +40,44 @@ enum Slider
|
|||
Volume,
|
||||
Pan,
|
||||
Pitch,
|
||||
Bypass,
|
||||
Bus1,
|
||||
Bus2
|
||||
};
|
||||
|
||||
#endif // DEFINES_H
|
||||
#ifdef __cplusplus
|
||||
constexpr const char* statusToString(Status e) noexcept
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
case Status::Stopped: return "Stop";
|
||||
case Status::Paused: return "Paused";
|
||||
case Status::PlayingOnce: return "Play 1";
|
||||
case Status::PlayingLoop: return "Play Loop";
|
||||
case Status::Iddle: return "Iddle";
|
||||
case Status::PlayingFolder: return "Play Folder";
|
||||
case Status::PlayingFolderLoop: return "Play Folder Loop";
|
||||
case Status::PlayingFolderRandom: return "Playing Folder Random";
|
||||
default: return "--++--";
|
||||
}
|
||||
}
|
||||
|
||||
#include <QString>
|
||||
struct layerData {
|
||||
QString media;
|
||||
Status status;
|
||||
bool updated;
|
||||
float vol;
|
||||
float cursor;
|
||||
int pan;
|
||||
int pitch;
|
||||
float duration;
|
||||
int address;
|
||||
unsigned int universe;
|
||||
int device;
|
||||
int bus1Vol;
|
||||
int bus2Vol;
|
||||
float level;
|
||||
};
|
||||
#endif // __cplusplus
|
||||
#endif // DEFINES_H
|
||||
|
|
|
@ -1,39 +1,52 @@
|
|||
#ifndef DMXPERSONALITY_H
|
||||
#define DMXPERSONALITY_H
|
||||
|
||||
/** Define the DMX personality to avoid dealing with
|
||||
* numbers and change it easyly in case
|
||||
*
|
||||
1 - Volumen Coarse
|
||||
2 - Pan
|
||||
3 - Folder
|
||||
4 - File
|
||||
5 - Playback
|
||||
0-24 : Play once.
|
||||
25-49: Stop. Returns to start of file.
|
||||
50-74: Pause. It keeps the time of reproductions.
|
||||
75-99: Play loop.
|
||||
6 - Control - Reservado, sin uso en este momento.
|
||||
7 - Volume Fine
|
||||
8 - Entry Point Coarse - Punto de entrada de reproducción.
|
||||
9 - Entry Point Fine - El valor de estos dos canales en centésimas de segundo.
|
||||
10 - Pan
|
||||
11 - Pitch
|
||||
*/
|
||||
#define DMX_FOLDER 0
|
||||
#define DMX_FILE 1
|
||||
#define VOLUME_FINE 2
|
||||
#define VOLUME_COARSE 3
|
||||
#define ENTRY_POINT_FINE 4
|
||||
#define ENTRY_POINT_COARSE 5
|
||||
#define PAN 6
|
||||
#define PITCH 7
|
||||
#define PLAYBACK 8
|
||||
#define HP_FREQ 9
|
||||
#define LOW_FREQ 10
|
||||
#define LOW_Q 11
|
||||
#define LOW_GAIN 12
|
||||
#define MIDLOW_FREQ 13
|
||||
#define MIDLOW_Q 14
|
||||
#define MIDLOW_GAIN 15
|
||||
#define MIDHIGH_FREQ 16
|
||||
#define MIDHIGH_Q 17
|
||||
#define MIDHIGH_GAIN 18
|
||||
#define HIGH_FREQ 19
|
||||
#define HIGH_Q 20
|
||||
#define HIGH_GAIN 21
|
||||
#define FILTER_BANK_GAIN 22
|
||||
#define SEND1 23
|
||||
#define SEND2 24
|
||||
#define LAYER_CHANNELS 25
|
||||
|
||||
// ToDo: Mejor inicializacion, primero folder, file, después params, ultimo playback.7
|
||||
// quitar CONTROL no usado
|
||||
#define VOLUME_COARSE 0
|
||||
#define PAN 1
|
||||
#define DMX_FOLDER 2
|
||||
#define DMX_FILE 3
|
||||
#define PLAYBACK 4
|
||||
#define CONTROL 5
|
||||
#define VOLUME_FINE 6
|
||||
#define ENTRY_POINT_COARSE 7
|
||||
#define ENTRY_POINT_FINE 8
|
||||
#define PITCH 9
|
||||
|
||||
#define LAYER_CHANNELS 10
|
||||
constexpr const char* dmxChannelToString(int e) noexcept
|
||||
{
|
||||
switch (e) {
|
||||
case HP_FREQ: return "High Pass Cutoff Frec";
|
||||
case LOW_FREQ: return "Low Cutoff Frec";
|
||||
case LOW_Q: return "Low Slope";
|
||||
case LOW_GAIN: return "Low Gain";
|
||||
case MIDLOW_FREQ: return "Mid Low Frec";
|
||||
case MIDLOW_Q: return "Mid Low Q";
|
||||
case MIDLOW_GAIN: return "Mid Low Gain";
|
||||
case MIDHIGH_FREQ: return "Mid High Frec";
|
||||
case MIDHIGH_Q: return "Mid High Q";
|
||||
case MIDHIGH_GAIN: return "Mid High Gain";
|
||||
case HIGH_FREQ: return "High Cutoff Frec";
|
||||
case HIGH_Q: return "High Slope";
|
||||
case HIGH_GAIN: return "High Gain";
|
||||
case FILTER_BANK_GAIN: return "Post Filters Gain";
|
||||
default: return "++--++--++";
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DMXPERSONALITY_H
|
||||
|
|
|
@ -9,6 +9,8 @@ dmxWidget::dmxWidget(QWidget *parent) :
|
|||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
m_receiveDMX->setText("DMX Signal");
|
||||
vbox->addWidget(m_receiveDMX);
|
||||
vbox->setSpacing(1);
|
||||
vbox->setContentsMargins(1, 1, 1, 1);
|
||||
this->setLayout(vbox);
|
||||
connect(m_watchDMX, SIGNAL(timeout()),
|
||||
this, SLOT(watchDMXExpired()));
|
||||
|
|
103
src/filterbankwidget.cpp
Normal file
103
src/filterbankwidget.cpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
#include "filterbankwidget.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include "dmxPersonality.h"
|
||||
#include "defines.h"
|
||||
|
||||
#define BORDER "#CFB0C9;"
|
||||
#define BACK "#281024;"
|
||||
|
||||
FilterBankWidget::FilterBankWidget(QWidget *parent)
|
||||
: QWidget{parent}
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setStyleSheet("border: 1px solid #CFB0C9;"
|
||||
"margin: 0px;"
|
||||
"background-color: #080402;"
|
||||
"font-size: 13px;");
|
||||
for (int i = 0; i < 13; i++) {
|
||||
fb[i] = new ClickableDoubleSpinBox;
|
||||
const char *name = dmxChannelToString(i + 9);
|
||||
fb[i]->setObjectName(name);
|
||||
fb[i]->setToolTip(name);
|
||||
}
|
||||
QVBoxLayout *master = new QVBoxLayout;
|
||||
fb[0]->setRange(0, 500);
|
||||
m_bypass = new QCheckBox;
|
||||
master->addWidget(m_bypass);
|
||||
m_bypass->setText("Bypass");
|
||||
m_bypass->setMinimumWidth(MIN_WIDTH / 4);
|
||||
m_bypass->setStyleSheet("QCheckBox { border: 1px solid #CFB0C9;"
|
||||
"margin: 0px;"
|
||||
"background-color: #c82840;"
|
||||
"font-size: 8px;}");
|
||||
connect(m_bypass, SIGNAL(stateChanged(int)), this, SLOT(bypassChanged(int)));
|
||||
master->addWidget(fb[0]);
|
||||
layout->addLayout(master);
|
||||
for (int i = 1; i < 13;) {
|
||||
QVBoxLayout *filterLayout= new QVBoxLayout;
|
||||
for (int j = i; j < i + 3; j++) {
|
||||
if ((j - 1) % 3 == 0)
|
||||
fb[j]->setRange(0, 24000);
|
||||
else if ((i - 1) % 3 == 1) {
|
||||
fb[j]->setRange(0, 10);
|
||||
} else {
|
||||
fb[j]->setRange(-50, 50);
|
||||
}
|
||||
filterLayout->insertWidget(j, fb[j]);
|
||||
}
|
||||
filterLayout->setSpacing(0);
|
||||
filterLayout->setAlignment(Qt::AlignHCenter);
|
||||
filterLayout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(filterLayout);
|
||||
i += 3;
|
||||
}
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void FilterBankWidget::setValue(int filter, int value)
|
||||
{
|
||||
double result = 0;
|
||||
int channel = filter + 9;
|
||||
|
||||
if (channel == HP_FREQ) {
|
||||
result = double((value * 1.31) + 16.0f); // 16 - 350
|
||||
} else if (channel == LOW_FREQ) {
|
||||
result = 30 + (value * 1.647); // 30 - 450
|
||||
} else if (channel == LOW_Q) {
|
||||
result = (double)(value / 32.0f) + 0.1f; // 0.1 - 8
|
||||
} else if (channel == LOW_GAIN) {
|
||||
result = (double)(value / 21.25f) - 6.023528412f;
|
||||
} else if (channel == MIDLOW_FREQ) {
|
||||
result = 200 + (value * 9.019607843); // 200 - 450
|
||||
} else if (channel == MIDLOW_Q) {
|
||||
result = (double)( value / 64.0f) + 0.10; // 0.1 - 4
|
||||
} else if (channel == MIDLOW_GAIN) {
|
||||
result = (double)(value / 7.0833333333333f) - 18.0f;
|
||||
} else if (channel == MIDHIGH_FREQ) {
|
||||
result = 600 + (value * 25.09803922); // 600 - 7000
|
||||
} else if (channel == MIDHIGH_Q) {
|
||||
result = (double)( value / 64.0f) + 0.10; // 0.1 - 4
|
||||
} else if (channel == MIDHIGH_GAIN) {
|
||||
result = (double)(value / 7.0833333333333f) - 18.0f;
|
||||
} else if (channel == HIGH_FREQ) {
|
||||
result = 1500 + (value * 56.8627451); // 1500 - 16000
|
||||
} else if (channel == HIGH_Q) {
|
||||
result = (double)( value / 32.0f) + 0.1f;
|
||||
} else if (channel == HIGH_GAIN) {
|
||||
result = (double)(value / 21.25) - 6.023528412f;
|
||||
} else
|
||||
result = (double)value;
|
||||
fb[filter]->setValue(result);
|
||||
}
|
||||
|
||||
void FilterBankWidget::bypassChanged(int value)
|
||||
{
|
||||
if (value == 0)
|
||||
emit setBypass(false);
|
||||
else
|
||||
emit setBypass(true);
|
||||
}
|
26
src/filterbankwidget.h
Normal file
26
src/filterbankwidget.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef FILTERBANKWIDGET_H
|
||||
#define FILTERBANKWIDGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
#include "clickabledoublespinbox.h"
|
||||
|
||||
|
||||
class FilterBankWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FilterBankWidget(QWidget *parent = nullptr);
|
||||
ClickableDoubleSpinBox *fb[13];
|
||||
QCheckBox *m_bypass;
|
||||
void setValue(int filter, int value);
|
||||
|
||||
private slots:
|
||||
void bypassChanged(int value);
|
||||
|
||||
signals:
|
||||
void setBypass(bool value);
|
||||
};
|
||||
|
||||
#endif // FILTERBANKWIDGET_H
|
57
src/libremediaserver-audio-gui.cpp
Normal file
57
src/libremediaserver-audio-gui.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
|
||||
Libre Media Server Audio - An Open source Media Server for arts and performing.
|
||||
(c) Criptomart - Santiago Noreña 2012-2024 <lms@criptomart.net>
|
||||
https://git.criptomart.net/libremediaserver
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "libremediaserver-audio-gui.h"
|
||||
|
||||
|
||||
libreMediaServerAudioUi::libreMediaServerAudioUi(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
this->setWindowTitle(VERSION);
|
||||
m_aw = new AudioWidget(this);
|
||||
setCentralWidget(m_aw);
|
||||
m_dmxWidget = new dmxWidget(this);
|
||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||
topWidget->setWidget(m_dmxWidget);
|
||||
topWidget->setContentsMargins(0, 0, 0, 0);
|
||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
this->setStyleSheet(
|
||||
"margin: 0px;"
|
||||
"color: white;"
|
||||
"background-color: #3f3038;"
|
||||
"selection-color: blue;"
|
||||
"selection-background-color: green"
|
||||
);
|
||||
}
|
||||
|
||||
libreMediaServerAudioUi::~libreMediaServerAudioUi()
|
||||
{
|
||||
}
|
||||
|
||||
void libreMediaServerAudioUi::olasetup()
|
||||
{
|
||||
QWebView *view = new QWebView();
|
||||
view->load(QUrl("http://localhost:9090/ola.html"));
|
||||
view->show();
|
||||
}
|
48
src/libremediaserver-audio-gui.h
Normal file
48
src/libremediaserver-audio-gui.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
Libre Media Server Audio - An Open source Media Server for arts and performing.
|
||||
(c) Criptomart - Santiago Noreña 2012-2024 <lms@criptomart.net>
|
||||
https://git.criptomart.net/libremediaserver
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBREMEDIASERVERAUDIOUI_H
|
||||
#define LIBREMEDIASERVERAUDIOUI_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QWebView>
|
||||
|
||||
#include "audiowidget.h"
|
||||
#include "dmxwidget.h"
|
||||
#include "defines.h"
|
||||
#include "ui_libremediaserver-audio-gui.h"
|
||||
|
||||
class libreMediaServerAudioUi : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
libreMediaServerAudioUi(QWidget *parent = 0);
|
||||
virtual ~libreMediaServerAudioUi();
|
||||
AudioWidget *m_aw;
|
||||
dmxWidget *m_dmxWidget;
|
||||
|
||||
private:
|
||||
Ui::LibreMediaServerAudio ui;
|
||||
|
||||
private slots:
|
||||
void olasetup();
|
||||
};
|
||||
|
||||
#endif // LIBREMEDIASERVERAUDIOUI_H
|
55
src/libremediaserver-audio-gui.ui
Normal file
55
src/libremediaserver-audio-gui.ui
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>Santi Noreña lms@criptomart.net</author>
|
||||
<class>LibreMediaServerAudio</class>
|
||||
<widget class="QMainWindow" name="LibreMediaServerAudio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Unifont</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LibreMediaServer</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>../../../../criptomart/artwork/logo_v2_criptomart.net.png</normaloff>../../../../criptomart/artwork/logo_v2_criptomart.net.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionLaunch_OLA_Setup"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
</widget>
|
||||
<action name="actionLaunch_OLA_Setup">
|
||||
<property name="text">
|
||||
<string>OLA Setup</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -21,106 +21,270 @@
|
|||
#include "libremediaserver-audio.h"
|
||||
|
||||
|
||||
libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
libreMediaServerAudio::libreMediaServerAudio()
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
ui.setupUi(this);
|
||||
this->setWindowTitle(VERSION);
|
||||
Settings *set = Settings::getInstance();
|
||||
set->readFile();
|
||||
m_settings = Settings::getInstance();
|
||||
m_settings->readFile();
|
||||
m_ui = m_settings->getShowUi();
|
||||
m_layersQty = m_settings->getLayersNumber();
|
||||
m_dmxSettings = m_settings->getDmxSettings();
|
||||
m_mediaLibrary = new MediaLibrary;
|
||||
m_mediaLibrary->initMediaLibrary();
|
||||
m_aw = new AudioWidget;
|
||||
setCentralWidget(m_aw);
|
||||
m_dmxWidget = new dmxWidget(this);
|
||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||
topWidget->setWidget(m_dmxWidget);
|
||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||
m_ola = new olaThread(this, set->getLayersNumber());
|
||||
for (uint i = 0; i < m_layersQty; i++) {
|
||||
m_currentMedia[i] = "";
|
||||
m_currentStatus[i] = Status::Iddle;
|
||||
#ifdef NOGUI
|
||||
m_updateUi[i][0] = -1;
|
||||
m_updateUi[i][1] = -1;
|
||||
m_updateUi[i][2] = -1;
|
||||
m_updateUi[i][3] = -1;
|
||||
#endif
|
||||
}
|
||||
if (!m_mae.startEngine(m_layersQty, m_settings->getAudioDeviceId(), m_settings->getAudioDeviceQty())) {
|
||||
cout << "Can not start Audio Engine!" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
m_ola = new olaThread(this, m_layersQty);
|
||||
Q_CHECK_PTR(m_ola);
|
||||
m_ola->blockSignals(true);
|
||||
connect(m_ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
||||
connect(m_ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
||||
m_ola->registerUniverse();
|
||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||
m_aw->startEngine();
|
||||
qDebug("Init Complete.");
|
||||
m_ola->blockSignals(false);
|
||||
#ifdef NOGUI
|
||||
m_ola->start(QThread::TimeCriticalPriority );
|
||||
#endif
|
||||
m_ola->blockSignals(false);
|
||||
cout << "Core init Complete." << endl;
|
||||
}
|
||||
|
||||
libreMediaServerAudio::~libreMediaServerAudio()
|
||||
{
|
||||
m_ola->stop();
|
||||
m_aw->stopEngine();
|
||||
m_mae.stopEngine();
|
||||
sleep(1);
|
||||
cout << "bye!" << endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::olasetup()
|
||||
void libreMediaServerAudio::loadMedia(int layer, int folder, int file)
|
||||
{
|
||||
QWebView *view = new QWebView();
|
||||
view->load(QUrl("http://localhost:9090/ola.html"));
|
||||
view->show();
|
||||
QString mediaFile = m_mediaLibrary->requestNewFile(folder, file);
|
||||
if (strcmp(mediaFile.toLatin1().constData(), m_currentMedia[layer].toLatin1().constData()) == 0)
|
||||
return;
|
||||
if (QFile::exists(mediaFile)){
|
||||
m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
||||
m_currentMedia[layer] = mediaFile;
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->mediaLoaded(layer, mediaFile, m_mae.getDuration(layer));
|
||||
#endif
|
||||
m_mae.printFormatInfo(layer);
|
||||
}
|
||||
if (m_currentStatus[layer] == Status::PlayingFolder \
|
||||
|| (m_currentStatus[layer] == Status::PlayingFolderLoop)\
|
||||
|| (m_currentStatus[layer] == Status::PlayingFolderRandom)) {
|
||||
m_played.append(file);
|
||||
} else if (m_currentStatus[layer] == Status::PlayingOnce \
|
||||
|| m_currentStatus[layer] == Status::PlayingLoop) {
|
||||
m_played.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||
{
|
||||
if (layer > LAYER_CHANNELS)
|
||||
if (layer >= MAX_LAYERS || channel >= LAYER_CHANNELS)
|
||||
return;
|
||||
QString mediaFile = NULL;
|
||||
int aux;
|
||||
switch(channel){
|
||||
case DMX_FOLDER:
|
||||
aux = m_ola->getValue(layer, DMX_FILE);
|
||||
mediaFile = m_mediaLibrary->requestNewFile(value, aux);
|
||||
if (QFile::exists(mediaFile))
|
||||
m_aw->mediaLoaded(layer, mediaFile);
|
||||
break;
|
||||
case DMX_FILE:
|
||||
aux = m_ola->getValue(layer, DMX_FOLDER);
|
||||
mediaFile = m_mediaLibrary->requestNewFile(aux, value);
|
||||
if (QFile::exists(mediaFile))
|
||||
m_aw->mediaLoaded(layer, mediaFile);
|
||||
break;
|
||||
case VOLUME_COARSE:
|
||||
case VOLUME_FINE:
|
||||
m_aw->volChanged(layer, (value / 65025.0f));
|
||||
break;
|
||||
case PAN:
|
||||
m_aw->panChanged(layer, value);
|
||||
break;
|
||||
case PITCH:
|
||||
m_aw->pitchChanged(layer, value);
|
||||
break;
|
||||
case ENTRY_POINT_COARSE:
|
||||
case ENTRY_POINT_FINE:
|
||||
m_aw->entryPointChanged(layer, value);
|
||||
break;
|
||||
case PLAYBACK:
|
||||
if (value == 0)
|
||||
break;
|
||||
if (channel == VOLUME_COARSE || channel == VOLUME_FINE) {
|
||||
m_mae.volChanged(layer, value);
|
||||
m_updateUi[layer][0] = value;
|
||||
} else if (channel == PAN) {
|
||||
m_mae.panChanged(layer, value);
|
||||
m_updateUi[layer][1] = value;
|
||||
} else if (channel == PITCH) {
|
||||
m_mae.pitchChanged(layer, value);
|
||||
m_updateUi[layer][2] = value;
|
||||
} else if (channel == ENTRY_POINT_COARSE || channel == ENTRY_POINT_FINE) {
|
||||
m_mae.setCursor(layer, value);
|
||||
m_updateUi[layer][3] = value;
|
||||
} else if (channel == PLAYBACK && value > 0) {
|
||||
aux = value / 25;
|
||||
switch (aux) {
|
||||
case 0 :
|
||||
m_aw->playbackChanged(layer, PlayingOnce);
|
||||
break;
|
||||
case 1 :
|
||||
m_aw->playbackChanged(layer, Stopped);
|
||||
break;
|
||||
case 2 :
|
||||
m_aw->playbackChanged(layer, Paused);
|
||||
break;
|
||||
case 3 :
|
||||
m_aw->playbackChanged(layer, PlayingLoop);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
Status s = m_currentStatus[layer];
|
||||
if (aux == 0)
|
||||
s = Status::PlayingOnce;
|
||||
else if (aux == 1)
|
||||
s = Status::Stopped;
|
||||
else if (aux == 2)
|
||||
s = Status::Paused;
|
||||
else if (aux == 3)
|
||||
s = Status::PlayingLoop;
|
||||
else if (aux == 4)
|
||||
s = Status::PlayingFolder;
|
||||
else if (aux == 5)
|
||||
s = Status::PlayingFolderLoop;
|
||||
else if (aux == 6)
|
||||
s = Status::PlayingFolderRandom;
|
||||
m_mae.playbackChanged(layer, s);
|
||||
m_currentStatus[layer] = s;
|
||||
qInfo() << "Layer" << layer << statusToString(s);
|
||||
#ifndef NOGUI
|
||||
if (m_ui) {
|
||||
m_lmsUi->m_aw->playbackChanged(layer, s);
|
||||
m_updateUi[layer][3] = 1;
|
||||
m_played.clear();
|
||||
m_played.append(m_ola->getValue(layer, DMX_FILE));
|
||||
}
|
||||
default:
|
||||
#endif
|
||||
} else if (channel >= HP_FREQ) {
|
||||
m_mae.filterParamChanged(layer, channel, value);
|
||||
#ifndef NOGUI
|
||||
if (m_ui) {
|
||||
m_lmsUi->m_aw->filterParamChanged(layer, channel, value);
|
||||
m_played.clear();
|
||||
m_played.append(m_ola->getValue(layer, DMX_FILE));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifndef NOGUI
|
||||
void libreMediaServerAudio::refreshUi() {
|
||||
if (!m_ui) return;
|
||||
for (int i= 0; i < m_settings->getLayersNumber(); i++ ) {
|
||||
if (m_updateUi[i][0] >= 0) {
|
||||
m_lmsUi->m_aw->volChanged(i, m_updateUi[i][0]);
|
||||
m_updateUi[i][0] = -1;
|
||||
}
|
||||
if (m_updateUi[i][1] >= 0) {
|
||||
m_lmsUi->m_aw->panChanged(i, m_updateUi[i][1]);
|
||||
m_updateUi[i][1] = -1;
|
||||
}
|
||||
if (m_updateUi[i][2] >= 0) {
|
||||
m_lmsUi->m_aw->pitchChanged(i, m_updateUi[i][2]);
|
||||
m_updateUi[i][2] = -1;
|
||||
}
|
||||
if (m_updateUi[i][3] >= 0 \
|
||||
|| m_currentStatus[i] == Status::PlayingOnce\
|
||||
|| m_currentStatus[i] == Status::PlayingLoop\
|
||||
|| m_currentStatus[i] == Status::PlayingFolder\
|
||||
|| m_currentStatus[i] == Status::PlayingFolderLoop
|
||||
|| m_currentStatus[i] == Status::PlayingFolderRandom) {
|
||||
m_lmsUi->m_aw->cursorChanged(i, m_mae.getCursor(i));
|
||||
m_updateUi[i][3] = -1;
|
||||
}
|
||||
m_lmsUi->m_aw->levelChanged(i, m_mae.getLevel(i));
|
||||
if (m_mae.getAtEnd(i)) {
|
||||
if (m_currentStatus[i] == Status::PlayingOnce) {
|
||||
m_currentStatus[i] = Status::Stopped;
|
||||
m_lmsUi->m_aw->playbackChanged(i, Status::Stopped);
|
||||
}
|
||||
if (m_currentStatus[i] == Status::PlayingFolder) {
|
||||
uint last = m_played.last();
|
||||
int folder = m_ola->getValue(i, DMX_FOLDER);
|
||||
last++;
|
||||
if (last < m_mediaLibrary->getMediaFolderCount(folder)) {
|
||||
this->loadMedia(i, folder, last);
|
||||
m_mae.playbackChanged(i, Status::PlayingFolder);
|
||||
}
|
||||
else {
|
||||
m_currentStatus[i] = Status::Stopped;
|
||||
m_lmsUi->m_aw->playbackChanged(i, Status::Stopped);
|
||||
}
|
||||
}
|
||||
else if (m_currentStatus[i] == Status::PlayingFolderLoop) {
|
||||
uint last = m_played.last();
|
||||
int folder = m_ola->getValue(i, DMX_FOLDER);
|
||||
last++;
|
||||
if (last >= m_mediaLibrary->getMediaFolderCount(folder)) {
|
||||
this->loadMedia(i, folder, 0);
|
||||
m_mae.playbackChanged(i, Status::PlayingFolderLoop);
|
||||
} else {
|
||||
this->loadMedia(i, folder, last);
|
||||
m_mae.playbackChanged(i, Status::PlayingFolder);
|
||||
}
|
||||
}
|
||||
else if (m_currentStatus[i] == Status::PlayingFolderRandom) {
|
||||
int last = -1;
|
||||
int folder = m_ola->getValue(i, DMX_FOLDER);
|
||||
if (uint(abs(m_played.size())) >= m_mediaLibrary->getMediaFolderCount(folder))
|
||||
m_played.clear();
|
||||
while (last == -1) {
|
||||
last = rand() % m_mediaLibrary->getMediaFolderCount(folder);
|
||||
if (m_played.contains(last))
|
||||
last = -1;
|
||||
}
|
||||
this->loadMedia(i, folder, last);
|
||||
m_mae.playbackChanged(i, Status::PlayingFolderRandom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::setUi(libreMediaServerAudioUi *lmsUi)
|
||||
{
|
||||
m_lmsUi = lmsUi;
|
||||
m_ui = true;
|
||||
connect(m_ola, SIGNAL(universeReceived(int)), m_lmsUi->m_dmxWidget, SLOT(updateWatchDMX(int)));
|
||||
connect(m_lmsUi->m_aw, SIGNAL(uiSliderChanged(int, Slider, int)), this, SLOT(uiSliderChanged(int, Slider, int)));
|
||||
connect(m_lmsUi->m_aw, SIGNAL(uiPlaybackChanged(int, Status)), this, SLOT(uiPlaybackChanged(int, Status)));
|
||||
connect(m_lmsUi->m_aw, SIGNAL(uiLoadMedia(int, QString)), this, SLOT(uiLoadMedia(int, QString)));
|
||||
m_refreshUi = new QTimer(this);
|
||||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
m_refreshUi->start(UI_REFRESH_TIME);
|
||||
m_ola->start(QThread::TimeCriticalPriority );
|
||||
for (uint i = 0; i < m_settings->getAudioDeviceQty(); i++) {
|
||||
char *name = m_mae.getDeviceName(i);
|
||||
m_lmsUi->m_aw->busNameChanged(i, name);
|
||||
}
|
||||
};
|
||||
|
||||
// From Ui widgets
|
||||
void libreMediaServerAudio::uiSliderChanged(int layer, Slider s, int value)
|
||||
{
|
||||
switch (s){
|
||||
case Slider::Volume:
|
||||
m_mae.volChanged(layer, value);
|
||||
break;
|
||||
case Slider::Pan:
|
||||
m_mae.panChanged(layer, value);
|
||||
break;
|
||||
case Slider::Pitch:
|
||||
m_mae.pitchChanged(layer, value);
|
||||
break;
|
||||
case Slider::Bypass:
|
||||
m_mae.setBypass(m_dmxSettings.at(layer).audioDevice, layer, value);
|
||||
break;
|
||||
case Slider::Bus1:
|
||||
m_mae.filterParamChanged(layer, SEND1, value / 255.0f);
|
||||
break;
|
||||
case Slider::Bus2:
|
||||
m_mae.filterParamChanged(layer, SEND2, value / 255.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::uiPlaybackChanged(int layer, Status s)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
result = m_mae.playbackChanged(layer, s);
|
||||
if (result == MA_SUCCESS) {
|
||||
m_currentStatus[layer] = s;
|
||||
} else {
|
||||
qWarning() << "ui playback change error " << result << " status " << statusToString(s) << "layer" << layer;
|
||||
}
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::uiLoadMedia(int layer, QString mediaFile)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
if (strcmp(mediaFile.toLatin1().constData(), m_currentMedia[layer].toLatin1().constData()) == 0)
|
||||
return;
|
||||
result = m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
||||
if (result == MA_SUCCESS) {
|
||||
m_currentMedia[layer] = mediaFile;
|
||||
m_lmsUi->m_aw->mediaLoaded(layer, mediaFile, m_mae.getDuration(layer));
|
||||
} else {
|
||||
qWarning() << "ui load media error" << result << "file" << mediaFile << "layer" << layer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,35 +20,56 @@
|
|||
#ifndef LIBREMEDIASERVERAUDIO_H
|
||||
#define LIBREMEDIASERVERAUDIO_H
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QWebView>
|
||||
|
||||
#include "audiowidget.h"
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
#include "medialibrary.h"
|
||||
#include "miniaudioengine.h"
|
||||
#include "olathread.h"
|
||||
#include "settings.h"
|
||||
#include "dmxwidget.h"
|
||||
#include "defines.h"
|
||||
#include "ui_libremediaserver-audio.h"
|
||||
#ifndef NOGUI
|
||||
#include "libremediaserver-audio-gui.h"
|
||||
#endif
|
||||
|
||||
class libreMediaServerAudio : public QMainWindow
|
||||
class libreMediaServerAudio : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
libreMediaServerAudio (QStringList args, QWidget *parent = 0);
|
||||
libreMediaServerAudio();
|
||||
virtual ~libreMediaServerAudio();
|
||||
Ui::LibreMediaServerAudio ui;
|
||||
void dmxInput(int layer, int channel, int value);
|
||||
void loadMedia(int layer, int folder, int file);
|
||||
#ifndef NOGUI
|
||||
void setUi(libreMediaServerAudioUi *lmsUi);
|
||||
bool inline getShowUi() { return m_settings->getShowUi(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
AudioWidget *m_aw;
|
||||
dmxWidget *m_dmxWidget;
|
||||
olaThread *m_ola;
|
||||
MediaLibrary *m_mediaLibrary;
|
||||
MiniAudioEngine m_mae;
|
||||
Settings *m_settings;
|
||||
QString m_currentMedia[MAX_LAYERS];
|
||||
Status m_currentStatus[MAX_LAYERS];
|
||||
QList<dmxSetting> m_dmxSettings;
|
||||
bool m_ui;
|
||||
QList<int> m_played;
|
||||
uint m_layersQty;
|
||||
#ifndef NOGUI
|
||||
QTimer *m_refreshUi;
|
||||
libreMediaServerAudioUi *m_lmsUi;
|
||||
float m_updateUi[MAX_LAYERS][4];
|
||||
|
||||
private slots:
|
||||
void olasetup();
|
||||
void dmxInput(int layer, int channel, int value);
|
||||
void refreshUi();
|
||||
void uiSliderChanged(int layer, Slider s, int value);
|
||||
void uiPlaybackChanged(int layer, Status s);
|
||||
void uiLoadMedia(int layer, QString s);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // LIBREMEDIASERVERAUDIO_H
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>Santi Noreña belfegor@gmail.com</author>
|
||||
<class>LibreMediaServerAudio</class>
|
||||
<widget class="QMainWindow" name="LibreMediaServerAudio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>114</width>
|
||||
<height>218</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LibreMediaServer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>114</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionLaunch_OLA_Setup"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
</widget>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_conf">
|
||||
<property name="text">
|
||||
<string>Open Configuration...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_conf">
|
||||
<property name="text">
|
||||
<string>Save Configuration...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Settings">
|
||||
<property name="text">
|
||||
<string>Settings...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInitMSEX">
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Init</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionIP_Address">
|
||||
<property name="text">
|
||||
<string>IP Address</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMake_Thumbs">
|
||||
<property name="text">
|
||||
<string>Make Thumbs</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLaunch_OLA_Setup">
|
||||
<property name="text">
|
||||
<string>OLA Setup...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
250
src/ma_writer_node.c
Normal file
250
src/ma_writer_node.c
Normal file
|
@ -0,0 +1,250 @@
|
|||
#include "ma_writer_node.h"
|
||||
#include "miniaudio.c"
|
||||
MA_API ma_writer_node_config ma_writer_node_config_init(ma_uint32 channels, ma_uint32 bufferSizeInFrames, ma_pcm_rb *rb)
|
||||
{
|
||||
ma_writer_node_config config;
|
||||
|
||||
MA_ZERO_OBJECT(&config);
|
||||
config.nodeConfig = ma_node_config_init();
|
||||
config.channels = channels;
|
||||
config.bufferSizeInFrames = bufferSizeInFrames;
|
||||
config.pBuffer = rb;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static void ma_writer_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut)
|
||||
{
|
||||
ma_writer_node* pWriteNode = (ma_writer_node*)pNode;
|
||||
|
||||
MA_ASSERT(pWriteNode != NULL);
|
||||
MA_ASSERT(ma_node_get_input_bus_count(&pWriteNode->baseNode) == 2);
|
||||
|
||||
if (*pFrameCountIn > 0) {
|
||||
void *pWriteBuffer = NULL;
|
||||
ma_pcm_rb_acquire_write(pWriteNode->pBuffer, pFrameCountIn, &pWriteBuffer);
|
||||
if (pWriteBuffer != NULL) {
|
||||
ma_copy_pcm_frames(pWriteBuffer, ppFramesIn[1], *pFrameCountIn, ma_format_f32, pWriteNode->channels);
|
||||
ma_pcm_rb_commit_write(pWriteNode->pBuffer, *pFrameCountIn);
|
||||
}
|
||||
}
|
||||
ma_copy_pcm_frames(ppFramesOut[0], ppFramesIn[0], *pFrameCountOut, ma_format_f32, pWriteNode->channels);
|
||||
}
|
||||
|
||||
static ma_node_vtable g_ma_writer_node_vtable =
|
||||
{
|
||||
ma_writer_node_process_pcm_frames,
|
||||
NULL,
|
||||
2,
|
||||
1,
|
||||
0
|
||||
};
|
||||
|
||||
MA_API ma_result ma_writer_node_init(ma_node_graph* pNodeGraph, const ma_writer_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_writer_node* pWriteNode)
|
||||
{
|
||||
ma_result result;
|
||||
ma_node_config baseConfig;
|
||||
ma_uint32 inputChannels[2];
|
||||
ma_uint32 outputChannels[1];
|
||||
|
||||
if (pWriteNode == NULL || pConfig == NULL || pConfig->pBuffer == NULL \
|
||||
|| (pConfig->channels > MA_MAX_NODE_BUS_COUNT) ) {
|
||||
return MA_INVALID_ARGS;
|
||||
}
|
||||
|
||||
MA_ZERO_OBJECT(pWriteNode);
|
||||
inputChannels[0] = pConfig->channels;
|
||||
inputChannels[1] = pConfig->channels;
|
||||
outputChannels[0] = pConfig->channels;
|
||||
baseConfig = pConfig->nodeConfig;
|
||||
baseConfig.vtable = &g_ma_writer_node_vtable;
|
||||
baseConfig.pInputChannels = inputChannels;
|
||||
baseConfig.pOutputChannels = outputChannels;
|
||||
|
||||
result = ma_node_init(pNodeGraph, &baseConfig, pAllocationCallbacks, &pWriteNode->baseNode);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
pWriteNode->bufferSizeInFrames = pConfig->bufferSizeInFrames;
|
||||
pWriteNode->pBuffer = pConfig->pBuffer;
|
||||
pWriteNode->channels = pConfig->channels;
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API void ma_writer_node_uninit(ma_writer_node* pWriteNode, const ma_allocation_callbacks* pAllocationCallbacks)
|
||||
{
|
||||
ma_node_uninit(&pWriteNode->baseNode, pAllocationCallbacks);
|
||||
}
|
||||
|
||||
/*
|
||||
* Data Source Ring Buffer
|
||||
*/
|
||||
|
||||
ma_result ma_data_source_rb_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead)
|
||||
{
|
||||
ma_data_source_rb* ds = (ma_data_source_rb*)pDataSource;
|
||||
|
||||
ma_uint32 pcmFramesAvailableInRB = 0;
|
||||
ma_uint32 pcmFramesProcessed = 0;
|
||||
while (pcmFramesProcessed < frameCount) {
|
||||
pcmFramesAvailableInRB = ma_pcm_rb_available_read(ds->rb);
|
||||
if (pcmFramesAvailableInRB == 0) {
|
||||
break;
|
||||
}
|
||||
ma_uint32 framesToRead = frameCount - pcmFramesProcessed;
|
||||
if (framesToRead > pcmFramesAvailableInRB) {
|
||||
framesToRead = pcmFramesAvailableInRB;
|
||||
}
|
||||
void* pReadBuffer = NULL;
|
||||
ma_pcm_rb_acquire_read(ds->rb, &framesToRead, &pReadBuffer);
|
||||
if (pReadBuffer != NULL) {
|
||||
ma_copy_pcm_frames(pFramesOut, pReadBuffer, framesToRead, ma_format_f32, 2);
|
||||
ma_pcm_rb_commit_read(ds->rb, framesToRead);
|
||||
pcmFramesProcessed += framesToRead;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pFramesRead += pcmFramesProcessed;
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
ma_result ma_data_source_rb_seek(ma_data_source* pDataSource, ma_uint64 frameIndex)
|
||||
{
|
||||
(void)pDataSource;
|
||||
(void)frameIndex;
|
||||
return MA_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ma_result ma_data_source_rb_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap)
|
||||
{
|
||||
(void)pDataSource;
|
||||
*pFormat = ma_format_f32;
|
||||
*pChannels = 2;
|
||||
*pSampleRate = ma_standard_sample_rate_48000;
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
ma_result ma_data_source_rb_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor)
|
||||
{
|
||||
(void)pDataSource;
|
||||
*pCursor = 0;
|
||||
return MA_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ma_result ma_data_source_rb_get_length(ma_data_source* pDataSource, ma_uint64* pLength)
|
||||
{
|
||||
(void)pDataSource;
|
||||
*pLength = 0;
|
||||
return MA_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ma_data_source_vtable g_ma_data_source_rb_vtable =
|
||||
{
|
||||
ma_data_source_rb_read,
|
||||
ma_data_source_rb_seek,
|
||||
ma_data_source_rb_get_data_format,
|
||||
ma_data_source_rb_get_cursor,
|
||||
ma_data_source_rb_get_length
|
||||
};
|
||||
|
||||
ma_result ma_data_source_rb_init(ma_data_source_rb* pMyDataSource, ma_pcm_rb *ringBuffer)
|
||||
{
|
||||
ma_result result;
|
||||
ma_data_source_config baseConfig;
|
||||
|
||||
baseConfig = ma_data_source_config_init();
|
||||
baseConfig.vtable = &g_ma_data_source_rb_vtable;
|
||||
|
||||
result = ma_data_source_init(&baseConfig, &pMyDataSource->base);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
pMyDataSource->rb = ringBuffer;
|
||||
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
void ma_data_source_rb_uninit(ma_data_source_rb* pMyDataSource)
|
||||
{
|
||||
ma_data_source_uninit(&pMyDataSource->base);
|
||||
}
|
||||
|
||||
/*
|
||||
* vumeter
|
||||
*/
|
||||
|
||||
MA_API ma_vumeter_node_config ma_vumeter_node_config_init(ma_uint32 channels, ma_uint32 format, ma_uint32 sampleRate)
|
||||
{
|
||||
ma_vumeter_node_config config;
|
||||
|
||||
MA_ZERO_OBJECT(&config);
|
||||
config.nodeConfig = ma_node_config_init();
|
||||
config.channels = channels;
|
||||
config.sampleRate = sampleRate;
|
||||
config.format = format;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static void ma_vumeter_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut)
|
||||
{
|
||||
ma_vumeter_node* pVumeterNode = (ma_vumeter_node*)pNode;
|
||||
|
||||
MA_ASSERT(pVumeterNode != NULL);
|
||||
MA_ASSERT(ma_node_get_input_bus_count(&pVumeterNode->baseNode) == 1);
|
||||
|
||||
for (uint i = 0; i < *pFrameCountIn; i++) {
|
||||
float input = fabsf(ppFramesIn[0][i]);
|
||||
pVumeterNode->level += pVumeterNode->alpha * (input - pVumeterNode->level);
|
||||
}
|
||||
ma_copy_pcm_frames(ppFramesOut[0], ppFramesIn[0], *pFrameCountOut, pVumeterNode->format, pVumeterNode->channels);
|
||||
}
|
||||
|
||||
static ma_node_vtable g_ma_vumeter_node_vtable =
|
||||
{
|
||||
ma_vumeter_node_process_pcm_frames,
|
||||
NULL,
|
||||
1,
|
||||
1,
|
||||
0
|
||||
};
|
||||
|
||||
MA_API ma_result ma_vumeter_node_init(ma_node_graph* pNodeGraph, const ma_vumeter_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_vumeter_node* pVumeterNode)
|
||||
{
|
||||
ma_result result;
|
||||
ma_node_config baseConfig;
|
||||
ma_uint32 inputChannels[1];
|
||||
ma_uint32 outputChannels[1];
|
||||
|
||||
if (pVumeterNode == NULL || pConfig == NULL \
|
||||
|| (pConfig->channels > MA_MAX_NODE_BUS_COUNT) ) {
|
||||
return MA_INVALID_ARGS;
|
||||
}
|
||||
|
||||
MA_ZERO_OBJECT(pVumeterNode);
|
||||
inputChannels[0] = pConfig->channels;
|
||||
outputChannels[0] = pConfig->channels;
|
||||
baseConfig = pConfig->nodeConfig;
|
||||
baseConfig.vtable = &g_ma_vumeter_node_vtable;
|
||||
baseConfig.pInputChannels = inputChannels;
|
||||
baseConfig.pOutputChannels = outputChannels;
|
||||
|
||||
result = ma_node_init(pNodeGraph, &baseConfig, pAllocationCallbacks, &pVumeterNode->baseNode);
|
||||
if (result != MA_SUCCESS) { return result;
|
||||
}
|
||||
pVumeterNode->sampleRate = pConfig->sampleRate;
|
||||
pVumeterNode->channels = pConfig->channels;
|
||||
pVumeterNode->format = pConfig->format;
|
||||
pVumeterNode->level = 0;
|
||||
pVumeterNode->TC = 0.250f;
|
||||
pVumeterNode->alpha = 1.0 - expf( (-2.0 * M_PI) / (pVumeterNode->TC * pConfig->sampleRate));
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API void ma_vumeter_node_uninit(ma_vumeter_node* pVumeterNode, const ma_allocation_callbacks* pAllocationCallbacks)
|
||||
{
|
||||
ma_node_uninit(&pVumeterNode->baseNode, pAllocationCallbacks);
|
||||
}
|
85
src/ma_writer_node.h
Normal file
85
src/ma_writer_node.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* Include ma_writer_node.h after miniaudio.h */
|
||||
#ifndef ma_writer_node_h
|
||||
#define ma_writer_node_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "miniaudio.h"
|
||||
|
||||
/*
|
||||
* writer
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_node_config nodeConfig;
|
||||
ma_uint32 channels;
|
||||
ma_uint32 bufferSizeInFrames;
|
||||
ma_pcm_rb *pBuffer;
|
||||
} ma_writer_node_config;
|
||||
|
||||
MA_API ma_writer_node_config ma_writer_node_config_init(ma_uint32 channels, ma_uint32 bufferSizeInFrames, ma_pcm_rb *rb);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_node_base baseNode;
|
||||
ma_uint32 bufferSizeInFrames;
|
||||
ma_pcm_rb *pBuffer;
|
||||
ma_uint32 channels;
|
||||
} ma_writer_node;
|
||||
|
||||
MA_API ma_result ma_writer_node_init(ma_node_graph* pNodeGraph, const ma_writer_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_writer_node* pWriteNode);
|
||||
MA_API void ma_writer_node_uninit(ma_writer_node* pWriteNode, const ma_allocation_callbacks* pAllocationCallbacks);
|
||||
/**
|
||||
* data source ring buffer
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_data_source_base base;
|
||||
ma_pcm_rb *rb;
|
||||
} ma_data_source_rb;
|
||||
|
||||
ma_result ma_data_source_rb_read(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead);
|
||||
ma_result ma_data_source_rb_seek(ma_data_source* pDataSource, ma_uint64 frameIndex);
|
||||
ma_result ma_data_source_rb_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap);
|
||||
ma_result ma_data_source_rb_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor);
|
||||
ma_result ma_data_source_rb_get_length(ma_data_source* pDataSource, ma_uint64* pLength);
|
||||
ma_result ma_data_source_rb_init(ma_data_source_rb* pMyDataSource, ma_pcm_rb *ringBuffer);
|
||||
void ma_data_source_rb_uninit(ma_data_source_rb* pMyDataSource);
|
||||
|
||||
|
||||
/*
|
||||
* VU meter
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ma_node_config nodeConfig;
|
||||
ma_uint32 channels;
|
||||
ma_uint32 sampleRate;
|
||||
ma_uint32 format;
|
||||
} ma_vumeter_node_config;
|
||||
|
||||
MA_API ma_vumeter_node_config ma_vumeter_node_config_init(ma_uint32 channels, ma_uint32 format, ma_uint32 sampleRate);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_node_base baseNode;
|
||||
ma_uint32 channels;
|
||||
ma_uint32 sampleRate;
|
||||
ma_uint32 format;
|
||||
float level;
|
||||
float TC;
|
||||
float alpha;
|
||||
} ma_vumeter_node;
|
||||
|
||||
MA_API ma_result ma_vumeter_node_init(ma_node_graph* pNodeGraph, const ma_vumeter_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_vumeter_node* pVumeterNode);
|
||||
MA_API void ma_vumeter_node_uninit(ma_vumeter_node* pVumeterNode, const ma_allocation_callbacks* pAllocationCallbacks);
|
||||
MA_API inline float ma_vumeter_node_get_level(ma_vumeter_node* pVumeterNode) { return 5 * pVumeterNode->level; };
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ma_writer_node_h */
|
38
src/main.cpp
38
src/main.cpp
|
@ -18,34 +18,28 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "libremediaserver-audio.h"
|
||||
#include "main.h"
|
||||
|
||||
bool hasUi(int &argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "--gui"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QStringList args = app.arguments();
|
||||
if (args.size() > 1)
|
||||
libreMediaServerAudio lms;
|
||||
#ifndef NOGUI
|
||||
if (hasUi(argc, argv) || lms.getShowUi())
|
||||
{
|
||||
if (args.contains("-v"))
|
||||
{
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
return 0;
|
||||
}
|
||||
if (args.contains("-h"))
|
||||
{
|
||||
qDebug() << VERSION;
|
||||
qDebug() << COPYRIGHT;
|
||||
qDebug() << LICENSE;
|
||||
qDebug() << "Help for command line options:";
|
||||
qDebug() << "-v show the version and exits";
|
||||
qDebug() << "-h this help";
|
||||
return 0;
|
||||
}
|
||||
libreMediaServerAudioUi *lmsUi = new libreMediaServerAudioUi();
|
||||
lms.setUi(lmsUi);
|
||||
lmsUi->show();
|
||||
}
|
||||
libreMediaServerAudio libreMediaServerAudio(args);
|
||||
libreMediaServerAudio.show();
|
||||
#endif
|
||||
return app.exec();
|
||||
}
|
||||
|
|
20
src/main.h
Normal file
20
src/main.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
|
||||
#include "medialibrary.h"
|
||||
#include "olathread.h"
|
||||
#include "settings.h"
|
||||
#include "libremediaserver-audio.h"
|
||||
#include "libremediaserver-audio-gui.h"
|
||||
#include "defines.h"
|
||||
|
||||
olaThread *m_ola;
|
||||
MediaLibrary *m_mediaLibrary;
|
||||
|
||||
// slots
|
||||
void dmxInput(int layer, int channel, int value);
|
||||
|
||||
#endif // MAIN_H
|
|
@ -27,14 +27,11 @@ class MediaLibrary : public QObject
|
|||
|
||||
public:
|
||||
MediaLibrary(QObject *parent = 0);
|
||||
/**
|
||||
* @brief request a new file from the media library
|
||||
* @param int folder - the folder required
|
||||
* @param int layer - file required
|
||||
* @return QString the file required with full path
|
||||
*/
|
||||
QString requestNewFile(int folder, int layer);
|
||||
void initMediaLibrary();
|
||||
inline uint getMediaFolderCount(int folder) {
|
||||
return m_media->at(folder).m_ElementCount;
|
||||
}
|
||||
|
||||
private:
|
||||
QList<MediaFolder> *m_media;
|
||||
|
|
|
@ -1,72 +1,304 @@
|
|||
#include "miniaudioengine.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
MiniAudioEngine::MiniAudioEngine()
|
||||
{
|
||||
#define BIAS 1.0f
|
||||
#define FILTER_ORDER 3
|
||||
|
||||
}
|
||||
MiniAudioEngine::MiniAudioEngine() {}
|
||||
|
||||
void MiniAudioEngine::audioDataCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
result = ma_engine_read_pcm_frames((ma_engine*)pDevice->pUserData, pOutput, frameCount, NULL);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": error audio callback.";
|
||||
}
|
||||
(void)pInput;
|
||||
//Do master audio processing before sending to device.
|
||||
ma_engine_read_pcm_frames((ma_engine*)pDevice->pUserData, pOutput, frameCount, NULL);
|
||||
}
|
||||
|
||||
void MiniAudioEngine::stopEngine()
|
||||
{
|
||||
ma_engine_uninit(&engine);
|
||||
ma_device_uninit(&device);
|
||||
ma_context_uninit(&context);
|
||||
ma_resource_manager_uninit(&resourceManager);
|
||||
for (uint i = 0; i < m_mae.layersQty; i++) {
|
||||
if (m_mae.mediaLoaded[i])
|
||||
ma_sound_uninit(&m_mae.sounds[i]);
|
||||
}
|
||||
for (uint i = 0; i < m_mae.layersQty; i++) {
|
||||
ma_splitter_node_uninit(&m_mae.filters[i].input, NULL);
|
||||
ma_hpf_node_uninit(&m_mae.filters[i].hpf, NULL);
|
||||
ma_loshelf_node_uninit(&m_mae.filters[i].loshelf, NULL);
|
||||
ma_peak_node_uninit(&m_mae.filters[i].mLow, NULL);
|
||||
ma_peak_node_uninit(&m_mae.filters[i].mHigh, NULL);
|
||||
ma_hishelf_node_uninit(&m_mae.filters[i].hishelf, NULL);
|
||||
ma_splitter_node_uninit(&m_mae.filters[i].output, NULL);
|
||||
}
|
||||
for (uint i = 0; i < m_mae.audioDevicesQty; i++) {
|
||||
if (i > 0) {
|
||||
ma_writer_node_uninit(&m_mae.sendAuxNode[i], NULL);
|
||||
ma_pcm_rb_uninit(&m_mae.auxBuffers[i]);
|
||||
}
|
||||
ma_engine_uninit(&m_mae.engines[i]);
|
||||
ma_device_uninit(&m_mae.devices[i]);
|
||||
}
|
||||
ma_context_uninit(&m_mae.context);
|
||||
ma_resource_manager_uninit(&m_mae.resourceManager);
|
||||
}
|
||||
|
||||
bool MiniAudioEngine::startEngine(int n)
|
||||
bool MiniAudioEngine::startEngine(uint layers, uint* audioDevicesId, uint audioDevicesQty)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
m_mae.layersQty = layers;
|
||||
m_mae.audioDevicesId = audioDevicesId;
|
||||
m_mae.audioDevicesQty = audioDevicesQty;
|
||||
for (uint i =0; i < m_mae.layersQty; i++) {
|
||||
m_mae.mediaLoaded[i] = MA_FALSE;
|
||||
m_mae.currentStatus[i].status = Status::Iddle;
|
||||
m_mae.currentStatus[i].pan = 128;
|
||||
m_mae.currentStatus[i].pitch = 128;
|
||||
m_mae.currentStatus[i].vol = 0.0f;
|
||||
m_mae.currentStatus[i].cursor = 0;
|
||||
m_mae.currentStatus[i].updated = false;
|
||||
}
|
||||
result = this->startContext();
|
||||
if (result != MA_SUCCESS) return false;
|
||||
result = this->getAllAudioDevices();
|
||||
if (result != MA_SUCCESS) return false;
|
||||
result = this->startDevices();
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed start audio devices." << endl;
|
||||
return false;
|
||||
}
|
||||
result = this->setNodeGraph();
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to set node graph." << endl;
|
||||
return false;
|
||||
}
|
||||
for (uint i = 0; i < m_mae.audioDevicesQty; i++) {
|
||||
result = ma_engine_start(&m_mae.engines[i]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to start audio device" << m_mae.audioDevicesId[i] << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::createFilterBank(uint layer)
|
||||
{
|
||||
ma_result result;
|
||||
ma_node_graph *ng = ma_engine_get_node_graph(&m_mae.engines[0]);
|
||||
ma_node *endpoint = ma_engine_get_endpoint(&m_mae.engines[0]);
|
||||
filterBank *fb = &m_mae.filters[layer];
|
||||
|
||||
ma_splitter_node_config splitterConfig = ma_splitter_node_config_init(CHANNELS);
|
||||
splitterConfig.outputBusCount= 3;
|
||||
result = ma_splitter_node_init(ng, &splitterConfig, NULL, &fb->input);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init input node." << endl;
|
||||
return result;
|
||||
}
|
||||
this->getAllAudioDevices();
|
||||
result = this->startDevice(n);
|
||||
|
||||
fb->hpfConfig = ma_hpf_node_config_init(CHANNELS, SAMPLE_RATE, 16, FILTER_ORDER);
|
||||
result = ma_hpf_node_init(ng, &fb->hpfConfig, NULL, &fb->hpf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init high pass filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
fb->loshelfConfig = ma_loshelf_node_config_init(CHANNELS, SAMPLE_RATE, 0.0f, 1.0f, 30);
|
||||
result = ma_loshelf_node_init(ng, &fb->loshelfConfig, NULL, &fb->loshelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init low pass filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
fb->mLowConfig = ma_peak_node_config_init(CHANNELS, SAMPLE_RATE, 0.0, 4.0, 200); // double gainDB, double q, double frequency);
|
||||
result = ma_peak_node_init(ng, &fb->mLowConfig, NULL, &fb->mLow);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init peak low filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
fb->mHighConfig = ma_peak_node_config_init(CHANNELS, SAMPLE_RATE, 0.0, 0.0, 600); // double gainDB, double q, double frequency);
|
||||
result = ma_peak_node_init(ng, &fb->mHighConfig, NULL, &fb->mHigh);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init peak high filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
fb->hishelfConfig = ma_hishelf_node_config_init(CHANNELS, SAMPLE_RATE, 0.0f, 1.0f, 20000);
|
||||
result = ma_hishelf_node_init(ng, &fb->hishelfConfig, NULL, &fb->hishelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init hi shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
ma_vumeter_node_config vuc = ma_vumeter_node_config_init(CHANNELS, FORMAT, SAMPLE_RATE);
|
||||
ma_vumeter_node_init(ng, &vuc, NULL, &fb->vumeter);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init vumeter node." << endl;
|
||||
return result;
|
||||
}
|
||||
splitterConfig.outputBusCount = m_mae.audioDevicesQty;
|
||||
result = ma_splitter_node_init(ng, &splitterConfig, NULL, &fb->output);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init output node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->input, 0, &fb->hpf, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach input node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->input, 1, &fb->vumeter, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach bypass connection." << endl;
|
||||
return result;
|
||||
}
|
||||
ma_node_set_output_bus_volume(&fb->input, 1, 0.0f);
|
||||
result = ma_node_attach_output_bus(&fb->hpf, 0, &fb->loshelf, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach high pass pass filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->loshelf, 0, &fb->mLow, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach low shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->mLow, 0, &fb->mHigh, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach low peaks filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->mHigh, 0, &fb->hishelf, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach high peaks filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->hishelf, 0, &fb->vumeter, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach high shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->vumeter, 0, &fb->output, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach high shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
if (m_mae.audioDevicesQty == 1) {
|
||||
result = ma_node_attach_output_bus(&fb->output, 0, endpoint, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach output to endpoint." << endl;
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
result = ma_node_attach_output_bus(&fb->output, 0, &m_mae.sendAuxNode[1], 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach output node to aux send 1." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&fb->output, 1, &m_mae.sendAuxNode[1], 1);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach output node to aux send 1." << endl;
|
||||
return result;
|
||||
}
|
||||
for (uint i = 2; i < m_mae.audioDevicesQty; i++) {
|
||||
result = ma_node_attach_output_bus(&fb->output, i, &m_mae.sendAuxNode[i], 1);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach output node to aux send 1." << endl;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::startDevice(int id)
|
||||
ma_result MiniAudioEngine::setNodeGraph() {
|
||||
ma_result result = MA_SUCCESS;
|
||||
|
||||
ma_node_graph *ng = ma_engine_get_node_graph(&m_mae.engines[0]);
|
||||
for (uint i = 1; i < m_mae.audioDevicesQty; i++) {
|
||||
size_t sizeInFrames = SAMPLE_RATE;
|
||||
result = ma_pcm_rb_init(FORMAT, CHANNELS, sizeInFrames, NULL, NULL, &m_mae.auxBuffers[i]);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize ring buffer.\n");
|
||||
return result;
|
||||
}
|
||||
ma_silence_pcm_frames(m_mae.auxBuffers[i].rb.pBuffer, sizeInFrames, FORMAT, CHANNELS);
|
||||
ma_writer_node_config writerConfig = ma_writer_node_config_init(CHANNELS, SAMPLE_RATE * 5, &m_mae.auxBuffers[i]);
|
||||
result = ma_writer_node_init(ng, &writerConfig, NULL, &m_mae.sendAuxNode[i]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to init writer node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&m_mae.sendAuxNode[i], 0, ma_engine_get_endpoint(&m_mae.engines[0]), 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to attach writer node." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_data_source_rb_init(&m_mae.dataSourceRB[i], &m_mae.auxBuffers[i]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to init data source ring buffer" << endl;
|
||||
return result;
|
||||
}
|
||||
ma_data_source_node_config dataSupplyNodeConfig = ma_data_source_node_config_init(&m_mae.dataSourceRB[i]);
|
||||
result = ma_data_source_node_init(ma_engine_get_node_graph(&m_mae.engines[i]), &dataSupplyNodeConfig, NULL, &m_mae.dataSupplyNode[i]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to init data source node" << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_node_attach_output_bus(&m_mae.dataSupplyNode[i], 0, ma_engine_get_endpoint(&m_mae.engines[i]), 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to attach data source rb node" << endl;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
for (uint i = 0; i < m_mae.layersQty; i++) {
|
||||
result = this->createFilterBank(i);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed creating filter bank." << endl;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::startDevices()
|
||||
{
|
||||
ma_result result;
|
||||
ma_result result = MA_SUCCESS;
|
||||
ma_device_config deviceConfig;
|
||||
ma_engine_config engineConfig;
|
||||
|
||||
deviceConfig = ma_device_config_init(ma_device_type_playback);
|
||||
deviceConfig.playback.pDeviceID = &pPlaybackDeviceInfos[id].id;
|
||||
deviceConfig.playback.format = resourceManager.config.decodedFormat;
|
||||
deviceConfig.playback.channels = 0;
|
||||
deviceConfig.sampleRate = resourceManager.config.decodedSampleRate;
|
||||
deviceConfig = ma_device_config_init(ma_device_type_duplex);
|
||||
deviceConfig.capture.format = m_mae.resourceManager.config.decodedFormat;
|
||||
deviceConfig.capture.channels = CHANNELS;
|
||||
deviceConfig.playback.channels = CHANNELS;
|
||||
deviceConfig.capture.shareMode = ma_share_mode_shared;
|
||||
deviceConfig.playback.format = m_mae.resourceManager.config.decodedFormat;
|
||||
deviceConfig.sampleRate = m_mae.resourceManager.config.decodedSampleRate;
|
||||
deviceConfig.dataCallback = audioDataCallback;
|
||||
deviceConfig.pUserData = &engine;
|
||||
result = ma_device_init(&context, &deviceConfig, &device);
|
||||
if (result != MA_SUCCESS) {
|
||||
qCritical("Failed to initialize audio device %s.", pPlaybackDeviceInfos[id].name);
|
||||
return result;
|
||||
}
|
||||
engineConfig = ma_engine_config_init();
|
||||
engineConfig.pDevice = &device;
|
||||
engineConfig.pResourceManager = &resourceManager;
|
||||
engineConfig = ma_engine_config_init();
|
||||
engineConfig.pResourceManager = &m_mae.resourceManager;
|
||||
engineConfig.defaultVolumeSmoothTimeInPCMFrames = SAMPLE_RATE / 500;
|
||||
engineConfig.noAutoStart = MA_TRUE;
|
||||
result = ma_engine_init(NULL, &engine);
|
||||
if (result != MA_SUCCESS) {
|
||||
qCritical("Failed to initialize audio engine.");
|
||||
return result;
|
||||
|
||||
for (uint internalId = 0; internalId < m_mae.audioDevicesQty; internalId++) {
|
||||
deviceConfig.capture.pDeviceID = &m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[internalId]].id;
|
||||
deviceConfig.playback.pDeviceID = &m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[internalId]].id;
|
||||
deviceConfig.pUserData = &m_mae.engines[internalId];
|
||||
result = ma_device_init(&m_mae.context, &deviceConfig, &m_mae.devices[internalId]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to initialize audio device " << m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[internalId]].name << endl;
|
||||
return result;
|
||||
}
|
||||
engineConfig.pDevice = &m_mae.devices[internalId];
|
||||
result = ma_engine_init(&engineConfig, &m_mae.engines[internalId]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error " << result << ": Failed to initialize audio engine" << endl;
|
||||
return result;
|
||||
}
|
||||
cout << "Initialized Audio Device. internalId: " << internalId << " systemId: " << m_mae.audioDevicesId[internalId] << " " << m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[internalId]].name << endl;
|
||||
}
|
||||
result = ma_engine_start(&engine);
|
||||
if (result != MA_SUCCESS) {
|
||||
qCritical("Failed to start audio engine %i.", id);
|
||||
return result;
|
||||
}
|
||||
iChosenDevice = id;
|
||||
qInfo("Initialized audio device %d: %s", id, pPlaybackDeviceInfos[id].name);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -74,19 +306,19 @@ ma_result MiniAudioEngine::startContext()
|
|||
{
|
||||
ma_result result;
|
||||
|
||||
resourceManagerConfig = ma_resource_manager_config_init();
|
||||
resourceManagerConfig.decodedFormat = ma_format_f32; /* ma_format_f32 should almost always be used as that's what the engine (and most everything else) uses for mixing. */
|
||||
resourceManagerConfig.decodedChannels = 0;
|
||||
resourceManagerConfig.decodedSampleRate = 0;
|
||||
resourceManagerConfig.jobThreadCount = 0;
|
||||
result = ma_resource_manager_init(&resourceManagerConfig, &resourceManager);
|
||||
ma_resource_manager_config resourceManagerConfig = ma_resource_manager_config_init();
|
||||
resourceManagerConfig.decodedFormat = FORMAT;
|
||||
resourceManagerConfig.decodedChannels = CHANNELS;
|
||||
resourceManagerConfig.decodedSampleRate = SAMPLE_RATE;
|
||||
resourceManagerConfig.jobThreadCount = MAX_LAYERS;
|
||||
result = ma_resource_manager_init(&resourceManagerConfig, &m_mae.resourceManager);
|
||||
if (result != MA_SUCCESS) {
|
||||
qCritical("Failed to initialize audio resource manager.");
|
||||
cout << "Error " << result << ": Failed to initialize audio resource manager." << endl;
|
||||
return result;
|
||||
}
|
||||
result = ma_context_init(NULL, 0, NULL, &context);
|
||||
result = ma_context_init(NULL, 0, NULL, &m_mae.context);
|
||||
if (result != MA_SUCCESS) {
|
||||
qCritical("Failed to initialize audio context.");
|
||||
cout << "Error " << result << ": Failed to initialize audio context." << endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -96,58 +328,68 @@ ma_result MiniAudioEngine::getAllAudioDevices()
|
|||
{
|
||||
ma_result result;
|
||||
|
||||
result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, NULL, NULL);
|
||||
result = ma_context_get_devices(&m_mae.context, &m_mae.pPlaybackDeviceInfos, &m_mae.playbackDeviceCount, NULL, NULL);
|
||||
if (result != MA_SUCCESS) {
|
||||
qWarning("Failed to enumerate playback devices.\n");
|
||||
ma_context_uninit(&context);
|
||||
cout << "Error " << result << ": Failed to enumerate playback devices." << endl;
|
||||
ma_context_uninit(&m_mae.context);
|
||||
return result;
|
||||
}
|
||||
printf("Audio devices detected in system:\n");
|
||||
for (ma_uint32 iAvailableDevice = 0; iAvailableDevice < playbackDeviceCount; iAvailableDevice += 1) {
|
||||
qInfo("%d: : %s", iAvailableDevice, pPlaybackDeviceInfos[iAvailableDevice].name);
|
||||
cout << "Audio devices available:" << endl;
|
||||
for (ma_uint32 iAvailableDevice = 0; iAvailableDevice < m_mae.playbackDeviceCount; iAvailableDevice += 1) {
|
||||
cout << iAvailableDevice << " : " << m_mae.pPlaybackDeviceInfos[iAvailableDevice].name << endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
char* MiniAudioEngine::getDeviceName(uint id)
|
||||
{
|
||||
return m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[id]].name;
|
||||
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::loadMedia(int layer, char *file)
|
||||
{
|
||||
ma_result result;
|
||||
|
||||
if (m_mediaLoaded[layer] == true)
|
||||
if (m_mae.mediaLoaded[layer] == MA_TRUE)
|
||||
{
|
||||
qInfo("removing sound %i", layer);
|
||||
ma_sound_uninit(&m_currentSound[layer]);
|
||||
m_mediaLoaded[layer] = false;
|
||||
m_mae.mediaLoaded[layer] = MA_FALSE;
|
||||
ma_sound_set_volume(&m_mae.sounds[layer], 0.0f);
|
||||
ma_sound_stop(&m_mae.sounds[layer]);
|
||||
ma_sound_uninit(&m_mae.sounds[layer]);
|
||||
}
|
||||
result = ma_sound_init_from_file(&engine, file, \
|
||||
MA_SOUND_FLAG_NO_SPATIALIZATION \
|
||||
/*| MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE \
|
||||
| MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC \
|
||||
| MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM \*/
|
||||
, NULL, NULL, &m_currentSound[layer]);
|
||||
if (result != MA_SUCCESS)
|
||||
qWarning("Failed to load file %s", file);
|
||||
else {
|
||||
m_mediaLoaded[layer] = true;
|
||||
this->volChanged(layer, 0);
|
||||
ma_sound_config soundConfig = ma_sound_config_init();
|
||||
soundConfig = ma_sound_config_init();
|
||||
soundConfig.pFilePath = file;
|
||||
soundConfig.pInitialAttachment = &m_mae.filters[layer].input;
|
||||
soundConfig.initialAttachmentInputBusIndex = 0;
|
||||
soundConfig.channelsIn = 0;
|
||||
soundConfig.channelsOut = CHANNELS;
|
||||
soundConfig.flags = MA_SOUND_FLAG_NO_SPATIALIZATION | MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT | MA_SOUND_FLAG_STREAM; //| MA_SOUND_FLAG_NO_PITCH
|
||||
result = ma_sound_init_ex(&m_mae.engines[0], &soundConfig, &m_mae.sounds[layer]);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "Error" << result << ": Failed to load file " << file << endl;
|
||||
return result;
|
||||
}
|
||||
m_mae.currentStatus[layer].media = file;
|
||||
m_mae.currentStatus[layer].updated = true;
|
||||
m_mae.mediaLoaded[layer] = MA_TRUE;
|
||||
this->refreshValues(layer);
|
||||
return result;
|
||||
}
|
||||
|
||||
float MiniAudioEngine::getDuration(int layer)
|
||||
{
|
||||
ma_result result;
|
||||
float ret = 0;
|
||||
float ret;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
result = ma_sound_get_length_in_seconds(&m_currentSound[layer], &ret);
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
qWarning("Can not get duration %i", layer);
|
||||
ret = 0;
|
||||
result = ma_sound_get_length_in_seconds(&m_mae.sounds[layer], &ret);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return ret;
|
||||
return (ret * 1000);
|
||||
}
|
||||
|
||||
float MiniAudioEngine::getCursor(int layer)
|
||||
|
@ -155,13 +397,13 @@ float MiniAudioEngine::getCursor(int layer)
|
|||
ma_result result;
|
||||
float ret = 0;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
result = ma_sound_get_cursor_in_seconds(&m_currentSound[layer], &ret);
|
||||
result = ma_sound_get_cursor_in_seconds(&m_mae.sounds[layer], &ret);
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
qWarning("Can not get cursor %i", layer);
|
||||
ret = 0;
|
||||
cout << "Error" << result << ": Can not get cursor " << layer << endl;
|
||||
ret = MA_ERROR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -172,75 +414,315 @@ ma_result MiniAudioEngine::printFormatInfo(int layer)
|
|||
ma_uint32 channels;
|
||||
ma_uint32 sampleRate;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
ma_result result = ma_sound_get_data_format(&m_currentSound[layer], &format, &channels, &sampleRate, NULL, 0);
|
||||
ma_result result = ma_sound_get_data_format(&m_mae.sounds[layer], \
|
||||
&format, &channels, &sampleRate, NULL, 0);
|
||||
if (result != MA_SUCCESS) {
|
||||
qWarning("Failed to get data format %i\n", layer);
|
||||
return MA_INVALID_DATA;
|
||||
cout << "Error " << result << ": Failed to get data format " << layer;
|
||||
cout << endl;
|
||||
} else {
|
||||
cout << "Layer:" << layer << " ";
|
||||
cout << m_mae.currentStatus[layer].media.toLatin1().data();
|
||||
cout << " samples/sec:" << sampleRate << " format:" << format;
|
||||
cout << " channels:" << channels << endl;
|
||||
}
|
||||
qInfo("samples/sec: %u format: %u channels: %u", sampleRate, format, channels);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Expects between 0 and 1 vol value
|
||||
void MiniAudioEngine::volChanged(int layer, float vol)
|
||||
// Expects between 0 and 65535 vol value
|
||||
void MiniAudioEngine::volChanged(int layer, int vol)
|
||||
{
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
m_mae.currentStatus[layer].vol = vol;
|
||||
if (m_mae.mediaLoaded[layer] == MA_FALSE && m_mae.currentStatus[layer].updated)
|
||||
return;
|
||||
ma_sound_group_set_volume(&m_currentSound[layer], vol);
|
||||
float db = ((float)vol / 771.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_sound_set_fade_in_milliseconds(&m_mae.sounds[layer], -1, db, FADE_TIME);
|
||||
}
|
||||
|
||||
void MiniAudioEngine::panChanged(int layer, float value)
|
||||
{
|
||||
float result;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
m_mae.currentStatus[layer].pan = value;
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return;
|
||||
result = (value / 128.0) - 1.0;
|
||||
ma_sound_group_set_pan(&m_currentSound[layer], result);
|
||||
ma_sound_group_set_pan(&m_mae.sounds[layer], result);
|
||||
}
|
||||
|
||||
void MiniAudioEngine::pitchChanged(int layer, float value)
|
||||
{
|
||||
float result;
|
||||
float pitch;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
m_mae.currentStatus[layer].pitch = value;
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return;
|
||||
result = value / 128.0;
|
||||
ma_sound_group_set_pitch(&m_currentSound[layer], result);
|
||||
pitch = value / 128.0;
|
||||
ma_sound_group_set_pitch(&m_mae.sounds[layer], pitch);
|
||||
}
|
||||
|
||||
void MiniAudioEngine::playbackChanged(int layer, Status status)
|
||||
ma_result MiniAudioEngine::playbackChanged(int layer, Status status)
|
||||
{
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
return;
|
||||
ma_result result = MA_SUCCESS;
|
||||
float db = 0;
|
||||
bool loop = false;
|
||||
|
||||
m_mae.currentStatus[layer].status = status;
|
||||
if (m_mae.mediaLoaded[layer] == MA_FALSE)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
m_mae.currentStatus[layer].updated = false;
|
||||
switch (status) {
|
||||
case Status::Paused:
|
||||
ma_sound_stop(&m_currentSound[layer]);
|
||||
result = ma_sound_stop_with_fade_in_milliseconds(&m_mae.sounds[layer], FADE_TIME);
|
||||
break;
|
||||
case Status::Stopped:
|
||||
ma_sound_stop(&m_currentSound[layer]);
|
||||
ma_sound_seek_to_pcm_frame(&m_currentSound[layer], 0);
|
||||
ma_sound_stop_with_fade_in_milliseconds(&m_mae.sounds[layer], 0.0f);
|
||||
result = this->seekToCursor(layer, m_mae.currentStatus[layer].cursor);
|
||||
break;
|
||||
case Status::PlayingLoop:
|
||||
ma_sound_set_looping(&m_currentSound[layer], true);
|
||||
ma_sound_start(&m_currentSound[layer]);
|
||||
break;
|
||||
loop = true;
|
||||
if (m_mae.currentStatus[layer].cursor > 0) {
|
||||
result = this->seekToCursor(layer, m_mae.currentStatus[layer].cursor);
|
||||
}
|
||||
case Status::PlayingOnce:
|
||||
ma_sound_set_looping(&m_currentSound[layer], false);
|
||||
ma_sound_start(&m_currentSound[layer]);
|
||||
case Status::PlayingFolder:
|
||||
case Status::PlayingFolderLoop:
|
||||
case Status::PlayingFolderRandom:
|
||||
ma_sound_set_looping(&m_mae.sounds[layer], loop);
|
||||
if (ma_sound_is_playing(&m_mae.sounds[layer])) break;
|
||||
ma_sound_set_stop_time_in_milliseconds(&m_mae.sounds[layer], ~(ma_uint64)0);
|
||||
db = (m_mae.currentStatus[layer].vol / 771.0f) - 85.0f;
|
||||
if (db <= -85.0f) db = 0;
|
||||
else db = ma_volume_db_to_linear(db);
|
||||
result = ma_sound_start(&m_mae.sounds[layer]);
|
||||
ma_sound_set_fade_in_milliseconds(&m_mae.sounds[layer], 0.000001f, 0.000000f, FADE_TIME);
|
||||
if (m_mae.currentStatus[layer].cursor > 0)
|
||||
usleep(FADE_TIME * 1500); // avoid glitch when load when seeking
|
||||
ma_sound_set_fade_in_milliseconds(&m_mae.sounds[layer], 0, db, FADE_TIME * 2);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_mae.currentStatus[layer].updated = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
void MiniAudioEngine::setCursor(int layer, int cursor)
|
||||
ma_result MiniAudioEngine::setRangePoint(int layer, int cursor)
|
||||
{
|
||||
ma_uint64 f;
|
||||
ma_result result = MA_SUCCESS;
|
||||
ma_uint64 end = 0, start;
|
||||
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
return;
|
||||
ma_sound_get_length_in_pcm_frames(&m_currentSound[layer], &f);
|
||||
f = (cursor * f) / 65025;
|
||||
ma_sound_seek_to_pcm_frame(&m_currentSound[layer], f);
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
if (cursor == 0)
|
||||
start = 0;
|
||||
else {
|
||||
result = ma_sound_get_length_in_pcm_frames(&m_mae.sounds[layer], &end);
|
||||
if (result != MA_SUCCESS) { return result; }
|
||||
start = (cursor * end) / 65535;
|
||||
}
|
||||
result = ma_data_source_set_range_in_pcm_frames(&m_mae.sounds[layer].pDataSource, start, end);
|
||||
if (result != MA_SUCCESS)
|
||||
cout << "ERROR " << result << " :set range point" << endl;
|
||||
return (result);
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::setLoopPoint(int layer, int cursor)
|
||||
{
|
||||
ma_result result = MA_SUCCESS;
|
||||
ma_uint64 end = 0, start;
|
||||
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
if (cursor == 0)
|
||||
start = 0;
|
||||
else {
|
||||
result = ma_sound_get_length_in_pcm_frames(&m_mae.sounds[layer], &end);
|
||||
if (result != MA_SUCCESS) { return result; }
|
||||
start = (cursor * end) / 65535;
|
||||
}
|
||||
result = ma_data_source_set_loop_point_in_pcm_frames(&m_mae.sounds[layer].pDataSource, start + 1, end - 1);
|
||||
if (result != MA_SUCCESS)
|
||||
cout << "ERROR " << result << " :set loop point" << endl;
|
||||
return (result);
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::seekToCursor(int layer, int cursor)
|
||||
{
|
||||
ma_result result = MA_SUCCESS;
|
||||
ma_uint64 end = 0, start;
|
||||
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return MA_DOES_NOT_EXIST;
|
||||
if (cursor == 0)
|
||||
start = 0;
|
||||
else {
|
||||
result = ma_sound_get_length_in_pcm_frames(&m_mae.sounds[layer], &end);
|
||||
if (result != MA_SUCCESS) { return result; }
|
||||
start = (cursor * end) / 65535;
|
||||
}
|
||||
result = ma_sound_seek_to_pcm_frame(&m_mae.sounds[layer], start);
|
||||
return (result);
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::setCursor(int layer, int cursor)
|
||||
{
|
||||
ma_result result = MA_SUCCESS;
|
||||
|
||||
m_mae.currentStatus[layer].cursor = cursor;
|
||||
result = this->seekToCursor(layer, cursor);
|
||||
return (result);
|
||||
}
|
||||
|
||||
Status MiniAudioEngine::getStatus(int layer)
|
||||
{
|
||||
return m_mae.currentStatus[layer].status;
|
||||
}
|
||||
|
||||
void MiniAudioEngine::refreshValues(int layer)
|
||||
{
|
||||
this->panChanged(layer, m_mae.currentStatus[layer].pan);
|
||||
this->pitchChanged(layer, m_mae.currentStatus[layer].pitch);
|
||||
this->playbackChanged(layer, m_mae.currentStatus[layer].status);
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::filterParamChanged(int layer, int channel, int value)
|
||||
{
|
||||
ma_result result = MA_SUCCESS;
|
||||
filterBank *fb = &m_mae.filters[layer];
|
||||
|
||||
if (channel == HP_FREQ) {
|
||||
fb->hpfConfig.hpf.cutoffFrequency = double((value * 1.31) + 16.0f); // 16 - 350
|
||||
result = ma_hpf_node_reinit(&fb->hpfConfig.hpf, &fb->hpf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set frecuency high pass filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == LOW_FREQ) {
|
||||
fb->loshelfConfig.loshelf.frequency = 30 + (value * 1.647); // 30 - 450
|
||||
result = ma_loshelf_node_reinit(&fb->loshelfConfig.loshelf, &fb->loshelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set frecuency low shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == LOW_Q) {
|
||||
fb->loshelfConfig.loshelf.shelfSlope = (double)(value / 32.0f) + 0.1f; // 0.1 - 8
|
||||
result = ma_loshelf_node_reinit(&fb->loshelfConfig.loshelf, &fb->loshelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Q low shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == LOW_GAIN) {
|
||||
fb->loshelfConfig.loshelf.gainDB = (double)(value / 21.25f) - 6.023528412f;
|
||||
result = ma_loshelf_node_reinit(&fb->loshelfConfig.loshelf, &fb->loshelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set gain low shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDLOW_FREQ) {
|
||||
fb->mLowConfig.peak.frequency = 200 + (value * 9.019607843); // 200 - 450
|
||||
result = ma_peak_node_reinit(&fb->mLowConfig.peak, &fb->mLow);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set frecuency Mid Low pass filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDLOW_Q) {
|
||||
fb->mLowConfig.peak.q = (double)( value / 64.0f) + 0.10; // 0.1 - 4
|
||||
result = ma_peak_node_reinit(&fb->mLowConfig.peak, &fb->mLow);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set Q Mid Low filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDLOW_GAIN) {
|
||||
fb->mLowConfig.peak.gainDB = (double)(value / 7.0833333333333f) - 18.0f;
|
||||
result = ma_peak_node_reinit(&fb->mLowConfig.peak, &fb->mLow);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set gain Mid Low filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDHIGH_FREQ) {
|
||||
fb->mHighConfig.peak.frequency = 600 + (value * 25.09803922); // 600 - 7000
|
||||
result = ma_peak_node_reinit(&fb->mHighConfig.peak, &fb->mHigh);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set frecuency Mid High filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDHIGH_Q) {
|
||||
fb->mHighConfig.peak.q = (double)( value / 64.0f) + 0.10; // 0.1 - 4
|
||||
result = ma_peak_node_reinit(&fb->mHighConfig.peak, &fb->mHigh);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set Q Mid High filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == MIDHIGH_GAIN) {
|
||||
fb->mHighConfig.peak.gainDB = (double)(value / 7.0833333333333f) - 18.0f;
|
||||
result = ma_peak_node_reinit(&fb->mHighConfig.peak, &fb->mHigh);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to set gain Mid High filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == HIGH_FREQ) {
|
||||
fb->hishelfConfig.hishelf.frequency = 1500 + (value * 56.8627451); // 1500 - 16000
|
||||
result = ma_hishelf_node_reinit(&fb->hishelfConfig.hishelf, &fb->hishelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed to frecuency high shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == HIGH_Q) {
|
||||
fb->hishelfConfig.hishelf.shelfSlope = (double)( value / 32.0f) + 0.1f;
|
||||
result = ma_hishelf_node_reinit(&fb->hishelfConfig.hishelf, &fb->hishelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Q high shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == HIGH_GAIN) {
|
||||
fb->hishelfConfig.hishelf.gainDB = (double)(value / 21.25) - 6.023528412f;
|
||||
result = ma_hishelf_node_reinit(&fb->hishelfConfig.hishelf, &fb->hishelf);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set gain high shelf filter node." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == SEND1) {
|
||||
float db = ((float)value / 3.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_node_set_output_bus_volume(&fb->output, 0, db);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Send 1 Volume." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == SEND2) {
|
||||
float db = ((float)value / 3.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_node_set_output_bus_volume(&fb->output, 1, db);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Send 2 Volume." << endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
bool MiniAudioEngine::setBypass(int audioDevice, int layer, bool bypass)
|
||||
{
|
||||
(void)audioDevice;
|
||||
filterBank *fb = &m_mae.filters[layer];
|
||||
|
||||
if (bypass) {
|
||||
ma_node_set_output_bus_volume(&fb->input, 1, 1.0f);
|
||||
ma_node_set_output_bus_volume(&fb->input, 0, 0.0f);
|
||||
} else {
|
||||
ma_node_set_output_bus_volume(&fb->input, 1, 0.0f);
|
||||
ma_node_set_output_bus_volume(&fb->input, 0, 1.0f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,47 +1,105 @@
|
|||
#ifndef MINIAUDIOENGINE_H
|
||||
#define MINIAUDIOENGINE_H
|
||||
|
||||
#define MA_ENABLE_ONLY_SPECIFIC_BACKENDS
|
||||
#define MA_ENABLE_JACK
|
||||
#define MA_DISABLE_PULSE
|
||||
#define MA_NO_GENERATION
|
||||
#define MA_DEBUG_OUTPUT
|
||||
#define MA_LOG_LEVEL_DEBUG DEBUG
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#include "miniaudio.h"
|
||||
#include "defines.h" // MAX_LAYERS
|
||||
#include <QDebug> // prints messages
|
||||
#include "ma_writer_node.h"
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#include "defines.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_splitter_node input;
|
||||
ma_hpf_node hpf;
|
||||
ma_hpf_node_config hpfConfig;
|
||||
ma_loshelf_node loshelf;
|
||||
ma_loshelf_node_config loshelfConfig;
|
||||
ma_peak_node mLow;
|
||||
ma_peak_node_config mLowConfig;
|
||||
ma_peak_node mHigh;
|
||||
ma_peak_node_config mHighConfig;
|
||||
ma_hishelf_node hishelf;
|
||||
ma_hishelf_node_config hishelfConfig;
|
||||
ma_vumeter_node vumeter;
|
||||
ma_splitter_node output;
|
||||
} filterBank;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ma_engine engines[MAX_AUDIODEVICES];
|
||||
ma_device devices[MAX_AUDIODEVICES];
|
||||
filterBank filters[MAX_LAYERS];
|
||||
ma_writer_node sendAuxNode[MAX_AUDIODEVICES];
|
||||
ma_pcm_rb auxBuffers[MAX_AUDIODEVICES];
|
||||
ma_node_graph ng;
|
||||
layerData currentStatus[MAX_LAYERS];
|
||||
ma_sound sounds[MAX_LAYERS];
|
||||
ma_resource_manager resourceManager;
|
||||
ma_context context;
|
||||
ma_device_info* pPlaybackDeviceInfos;
|
||||
ma_device_info pSelectedPlaybackDeviceInfos[MAX_AUDIODEVICES];
|
||||
ma_uint32 playbackDeviceCount;
|
||||
ma_uint32 devicesSelected;
|
||||
ma_bool8 mediaLoaded[MAX_LAYERS];
|
||||
uint layersQty;
|
||||
uint *audioDevicesId;
|
||||
uint audioDevicesQty;
|
||||
ma_data_source_node dataSupplyNode[MAX_AUDIODEVICES];
|
||||
ma_data_source_rb dataSourceRB[MAX_AUDIODEVICES];
|
||||
} MAE;
|
||||
|
||||
class MiniAudioEngine
|
||||
{
|
||||
friend class AudioWidget;
|
||||
friend class libreMediaServerAudio;
|
||||
|
||||
public:
|
||||
MiniAudioEngine();
|
||||
void stopEngine();
|
||||
bool startEngine(int id);
|
||||
static void audioDataCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
|
||||
|
||||
protected:
|
||||
ma_result loadMedia(int layer, char *media );
|
||||
void volChanged(int layer, float vol);
|
||||
MiniAudioEngine();
|
||||
void stopEngine();
|
||||
bool startEngine(uint layersQty, uint* audioDevicesID, uint audioDevicesQty);
|
||||
ma_result loadMedia(int layer, char *media);
|
||||
void volChanged(int layer, int vol);
|
||||
void panChanged(int layer, float pan);
|
||||
void pitchChanged(int layer, float pitch);
|
||||
void playbackChanged(int layer, Status status);
|
||||
ma_result playbackChanged(int layer, Status status);
|
||||
ma_result setCursor(int layer, int cursor);
|
||||
ma_result printFormatInfo(int layer);
|
||||
float getDuration(int layer);
|
||||
float getCursor(int layer);
|
||||
void setCursor(int layer, int cursor);
|
||||
ma_result printFormatInfo(int layer);
|
||||
Status getStatus(int layer);
|
||||
inline float getVol(int layer) {
|
||||
return ma_sound_get_volume(&m_mae.sounds[layer]);
|
||||
};
|
||||
inline bool getAtEnd(int layer) { return m_mae.sounds[layer].atEnd; }
|
||||
ma_result filterParamChanged(int layer, int channel, int value);
|
||||
bool setBypass(int audioDevice, int layer, bool bypass);
|
||||
inline float getLevel(int layer) {
|
||||
float level = ma_vumeter_node_get_level(&m_mae.filters[layer].vumeter);
|
||||
return ma_volume_linear_to_db(level) - 4.0f;
|
||||
};
|
||||
char* getDeviceName(uint id);
|
||||
|
||||
private:
|
||||
ma_resource_manager_config resourceManagerConfig;
|
||||
ma_resource_manager resourceManager;
|
||||
ma_device_info* pPlaybackDeviceInfos;
|
||||
ma_uint32 playbackDeviceCount;
|
||||
ma_uint32 iChosenDevice;
|
||||
ma_engine engine;
|
||||
ma_device device;
|
||||
ma_context context;
|
||||
ma_sound m_currentSound[MAX_LAYERS];
|
||||
ma_bool8 m_mediaLoaded[MAX_LAYERS];
|
||||
MAE m_mae;
|
||||
|
||||
ma_result startDevices();
|
||||
ma_result getAllAudioDevices();
|
||||
ma_result startDevice(int id);
|
||||
ma_result startContext();
|
||||
void refreshValues(int layer);
|
||||
ma_result seekToCursor(int layer, int cursor);
|
||||
ma_result setNodeGraph();
|
||||
ma_result createFilterBank(uint layer);
|
||||
ma_result setLoopPoint(int layer, int cursor);
|
||||
ma_result setRangePoint(int layer, int cursor);
|
||||
};
|
||||
|
||||
#endif // MINIAUDIOENGINE_H
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "olathread.h"
|
||||
|
||||
#include "libremediaserver-audio.h"
|
||||
|
||||
olaThread::olaThread(QObject *parent, int layers) :
|
||||
m_counter(0)
|
||||
, m_layers(layers)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
this->setParent(parent);
|
||||
gettimeofday(&m_last_data, NULL);
|
||||
for (int i=0; i < MAX_LAYERS; i++)
|
||||
{
|
||||
|
@ -63,42 +62,65 @@ void olaThread::stop()
|
|||
void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
||||
const ola::DmxBuffer &buffer)
|
||||
{
|
||||
bool volSent = false;
|
||||
bool entrySent = false;
|
||||
|
||||
foreach (const dmxSetting &i, m_dmxSettings) {
|
||||
if(i.universe == data.universe && i.address > -1) {
|
||||
bool volSent = false;
|
||||
bool entrySent = false;
|
||||
bool fileSent = false;
|
||||
int aux;
|
||||
for (int j = 0; j < LAYER_CHANNELS; j++){
|
||||
int value = buffer.Get((i.address) + j);
|
||||
if (m_dmx[i.layer][j] != value) {
|
||||
m_dmx[i.layer][j] = value;
|
||||
switch (j) {
|
||||
case VOLUME_COARSE:
|
||||
value = (value * 0x100) + buffer.Get(i.address + VOLUME_FINE);
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
volSent = true;
|
||||
case DMX_FOLDER:
|
||||
aux = buffer.Get(i.address + DMX_FILE);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->loadMedia(i.layer, value, aux);
|
||||
m_dmx[i.layer][DMX_FILE] = aux;
|
||||
fileSent = true;
|
||||
break;
|
||||
case ENTRY_POINT_COARSE:
|
||||
value = (value * 0x100) + buffer.Get(i.address + ENTRY_POINT_FINE);
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
entrySent = true;
|
||||
case DMX_FILE:
|
||||
if (fileSent)
|
||||
break;
|
||||
aux = buffer.Get(i.address + DMX_FOLDER);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->loadMedia(i.layer, aux, value);
|
||||
m_dmx[i.layer][DMX_FOLDER] = aux;
|
||||
fileSent = true;
|
||||
break;
|
||||
case VOLUME_FINE:
|
||||
if (volSent == false)
|
||||
{
|
||||
value = (buffer.Get(i.address + VOLUME_COARSE) * 0x100) + value;
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
}
|
||||
aux = buffer.Get(i.address + VOLUME_COARSE);
|
||||
value += (aux * 0x100);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
m_dmx[i.layer][VOLUME_COARSE] = aux;
|
||||
volSent = true;
|
||||
break;
|
||||
case VOLUME_COARSE:
|
||||
if (volSent)
|
||||
break;
|
||||
value = (value * 0x100) + buffer.Get(i.address + VOLUME_FINE);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
m_dmx[i.layer][VOLUME_FINE] = buffer.Get(i.address + VOLUME_FINE);
|
||||
volSent = true;
|
||||
break;
|
||||
case PLAYBACK:
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
break;
|
||||
case ENTRY_POINT_FINE:
|
||||
if (entrySent == false)
|
||||
{
|
||||
value = (buffer.Get(i.address + ENTRY_POINT_COARSE) * 0x100) + value;
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
}
|
||||
value = (buffer.Get(i.address + ENTRY_POINT_COARSE) * 0x100) + value;
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
m_dmx[i.layer][ENTRY_POINT_COARSE] = buffer.Get(i.address + ENTRY_POINT_COARSE);
|
||||
entrySent = true;
|
||||
break;
|
||||
case ENTRY_POINT_COARSE:
|
||||
if (entrySent)
|
||||
break;
|
||||
value = (value * 0x100) + buffer.Get(i.address + ENTRY_POINT_FINE);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
m_dmx[i.layer][ENTRY_POINT_FINE] = buffer.Get(i.address + ENTRY_POINT_FINE);
|
||||
entrySent = true;
|
||||
break;
|
||||
default:
|
||||
emit dmxOutput(i.layer,j,value);
|
||||
qobject_cast<libreMediaServerAudio *>(parent())->dmxInput(i.layer, j, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +149,7 @@ bool olaThread::CheckDataLoss() {
|
|||
|
||||
void olaThread::socketClosed()
|
||||
{
|
||||
qWarning("ola closed connection. Try reopening it... ");
|
||||
qWarning("ola daemon closed connection, reopening it... ");
|
||||
m_clientWrapper->GetSelectServer()->Terminate();
|
||||
m_client = NULL;
|
||||
m_clientWrapper = NULL;
|
||||
|
|
|
@ -20,10 +20,17 @@ class olaThread : public QThread
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QList<dmxSetting> m_dmxSettings;
|
||||
int m_dmx[MAX_LAYERS][LAYER_CHANNELS];
|
||||
ola::client::OlaClientWrapper *m_clientWrapper;
|
||||
ola::client::OlaClient *m_client;
|
||||
unsigned int m_counter;
|
||||
struct timeval m_last_data; // Last DMX frame received
|
||||
int m_layers;
|
||||
|
||||
olaThread(QObject *parent = 0, int layers = 0);
|
||||
virtual ~olaThread();
|
||||
|
||||
void run ();
|
||||
/** Retorna el valor de un canal
|
||||
*@param int layer the layer for we want the channel
|
||||
*@param int channel the channel for the value wanted
|
||||
|
@ -35,14 +42,6 @@ public:
|
|||
void resendDmx();
|
||||
|
||||
private:
|
||||
void run ();
|
||||
ola::client::OlaClientWrapper *m_clientWrapper;
|
||||
ola::client::OlaClient *m_client;
|
||||
unsigned int m_counter;
|
||||
struct timeval m_last_data; // Last DMX frame received
|
||||
int m_layers;
|
||||
int m_dmx[MAX_LAYERS][LAYER_CHANNELS];
|
||||
QList<dmxSetting> m_dmxSettings;
|
||||
/**
|
||||
* @brief Callback from ola. Control de errores en el registro de Universos en OLA
|
||||
* typedef SingleUseCallback1<void, const Result&> ola::client::SetCallback
|
||||
|
@ -53,7 +52,7 @@ private:
|
|||
if (error.Success()) {
|
||||
qDebug("Register Universe success");
|
||||
} else {
|
||||
qWarning("Register command failed: %s", error.Error().c_str());
|
||||
qCritical("Register command failed: %s", error.Error().c_str());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -67,7 +66,7 @@ private:
|
|||
* This is called one for second if there is not updated in the DMX frame.
|
||||
* emit only the channels that has been changed.
|
||||
*/
|
||||
void NewDmx(const ola::client::DMXMetadata &dmx_meta, const ola::DmxBuffer &buffer); //
|
||||
void NewDmx(const ola::client::DMXMetadata &dmx_meta, const ola::DmxBuffer &buffer);
|
||||
/**
|
||||
* @brief Sometimes the ola server closes the connection. This is a callback to handle this event an reconect to ola
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,7 @@ Settings::Settings(QObject *parent) :
|
|||
QObject(parent)
|
||||
{
|
||||
m_layersNumber = 0;
|
||||
m_ui = false;
|
||||
}
|
||||
|
||||
// Read the dmx settings for dmx.xml At the moment we need:
|
||||
|
@ -23,6 +24,7 @@ Settings::Settings(QObject *parent) :
|
|||
// - The first DMX channel of each source/layer
|
||||
// - The universe to bind in OLA
|
||||
// - Audio device id
|
||||
// - Show the Ui or not
|
||||
void Settings::readFromFile(QString file) {
|
||||
QFile* xmlFile = new QFile(file);
|
||||
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
@ -34,53 +36,54 @@ void Settings::readFromFile(QString file) {
|
|||
exit(1);
|
||||
}
|
||||
QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile);
|
||||
int counter = 0;
|
||||
//Parse the XML until we reach end of it
|
||||
while(!xmlReader->atEnd() && !xmlReader->hasError() && counter < MAX_LAYERS) {
|
||||
// Read next element
|
||||
while(!xmlReader->atEnd() && !xmlReader->hasError()) {
|
||||
QXmlStreamReader::TokenType token = xmlReader->readNext();
|
||||
//If token is just StartDocument - go to next
|
||||
if(token == QXmlStreamReader::StartDocument) {
|
||||
continue;
|
||||
}
|
||||
//If token is StartElement - read it
|
||||
if(token == QXmlStreamReader::StartElement) {
|
||||
if(xmlReader->name() == "dmxSettings") {
|
||||
int version = xmlReader->attributes().value("fileVersion").toLocal8Bit().toInt();
|
||||
if(version == 1) {
|
||||
m_layersNumber = xmlReader->attributes().value("layersNumber").toLocal8Bit().toInt();
|
||||
m_pathmedia = xmlReader->attributes().value("path").toLocal8Bit();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(xmlReader->name() == "audioDevice") {
|
||||
m_audioDeviceId = xmlReader->attributes().value("id").toLocal8Bit().toInt();
|
||||
if(xmlReader->name() == "lmsAudio") {
|
||||
m_ui = xmlReader->attributes().value("ui").toLocal8Bit().toInt();
|
||||
m_layersNumber = xmlReader->attributes().value("layersNumber").toLocal8Bit().toInt();
|
||||
m_pathmedia = xmlReader->attributes().value("path").toLocal8Bit();
|
||||
continue;
|
||||
}
|
||||
QString add = "layer";
|
||||
add.append(QString("%1").arg(counter));
|
||||
if((xmlReader->name() == add)) {
|
||||
if(xmlReader->name() == "audioDevice") {
|
||||
m_audioDeviceQty = xmlReader->attributes().value("devicesNumber").toLocal8Bit().toInt();
|
||||
for (uint i = 0; i < m_audioDeviceQty; i++)
|
||||
m_audioDeviceId[i] = xmlReader->attributes().value(QString("id%1").arg(i)).toLocal8Bit().toInt();
|
||||
}
|
||||
if(xmlReader->name() == "layer") {
|
||||
dmxSetting temp;
|
||||
temp.address = xmlReader->attributes().value("dmx").toLocal8Bit().toInt() - 1;
|
||||
temp.universe = xmlReader->attributes().value("universe").toLocal8Bit().toInt();
|
||||
temp.layer = counter;
|
||||
temp.layer = xmlReader->attributes().value("id").toLocal8Bit().toInt();
|
||||
temp.audioDevice = xmlReader->attributes().value("audioDevice").toLocal8Bit().toInt();
|
||||
m_settings.append(temp);
|
||||
if (!m_universe.contains(temp.universe)) {
|
||||
m_universe.insert(temp.universe);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(xmlReader->hasError()) {
|
||||
QMessageBox::critical(NULL,"File xml Parse Error ", xmlReader->errorString(), QMessageBox::Ok);
|
||||
qWarning("File xml Parse Error %s", xmlReader->errorString().toLatin1().constData());
|
||||
return;
|
||||
// ToDo: manage this, open a dialog to load a new file.
|
||||
}
|
||||
xmlReader->clear();
|
||||
xmlFile->close();
|
||||
delete xmlReader;
|
||||
delete xmlFile;
|
||||
this->printSettings();
|
||||
}
|
||||
|
||||
void Settings::printSettings() {
|
||||
qInfo() << "Settings readed:\nShow Ui:" << m_ui << "Layers:" << m_layersNumber << "Path:" << m_pathmedia <<"Audio Device qty:" << m_audioDeviceQty;
|
||||
for (uint i = 0; i < m_audioDeviceQty; i++)
|
||||
qInfo() << "Audio device internal id:" << i << "system id:" << m_audioDeviceId[i];
|
||||
for (int i = 0; i < m_layersNumber; i++)
|
||||
qInfo() << "Layer:" << m_settings[i].layer << "Address:" << m_settings[i].address << "Universe:" << m_settings[i].universe;
|
||||
}
|
||||
|
||||
void Settings::readFile() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QSet>
|
||||
#include <QDebug>
|
||||
|
||||
#include "medialibrary.h"
|
||||
#include "audiowidget.h"
|
||||
|
@ -15,25 +16,28 @@ class Settings : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Settings(QObject *parent = 0);
|
||||
static Settings *getInstance();
|
||||
inline QSet<int> getUniverses() { return m_universe; }
|
||||
inline QString getPathMedia() { return m_pathmedia; }
|
||||
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
||||
inline int getLayersNumber() { return m_layersNumber; }
|
||||
inline uint *getAudioDeviceId() { return m_audioDeviceId; }
|
||||
inline uint getAudioDeviceQty() { return m_audioDeviceQty; }
|
||||
inline bool getShowUi() { return m_ui; }
|
||||
void readFile();
|
||||
inline int getAudioDeviceId() { return m_audioDeviceId; }
|
||||
void readFromFile(QString file);
|
||||
void printSettings();
|
||||
|
||||
private:
|
||||
static Settings *_instance;
|
||||
QList<dmxSetting> m_settings;
|
||||
QString m_pathmedia;
|
||||
uint m_audioDeviceId;
|
||||
uint m_audioDeviceId[MAX_AUDIODEVICES];
|
||||
uint m_audioDeviceQty;
|
||||
QSet<int> m_universe;
|
||||
int m_layersNumber;
|
||||
|
||||
explicit Settings(QObject *parent = 0);
|
||||
void readFromFile(QString file);
|
||||
|
||||
bool m_ui;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
|
|
@ -1,45 +1,113 @@
|
|||
#include "slidergroup.h"
|
||||
#include <cmath>
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
SliderGroup::SliderGroup(const QString &title, \
|
||||
SliderGroup::SliderGroup(QString name,
|
||||
int min,
|
||||
int max,
|
||||
int decimals,
|
||||
QWidget *parent)
|
||||
: QGroupBox(title, parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
this->setFlat(true);
|
||||
this->setTitle(title);
|
||||
slider = new QSlider(Qt::Orientation::Vertical);
|
||||
slider->setFocusPolicy(Qt::StrongFocus);
|
||||
slider->setTickPosition(QSlider::TicksBothSides);
|
||||
slider->setTickInterval((max - min) / 11);
|
||||
slider->setSingleStep(1);
|
||||
slider->setRange(min, max);
|
||||
valueBox = new QDoubleSpinBox();
|
||||
valueBox->setFocusPolicy(Qt::NoFocus);
|
||||
valueBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
valueBox->setMaximumWidth(45);
|
||||
valueBox->setRange(min, max);
|
||||
valueBox->setDecimals(decimals);
|
||||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
|
||||
QVBoxLayout *slidersLayout = new QVBoxLayout();
|
||||
slidersLayout->addWidget(valueBox);
|
||||
slidersLayout->addWidget(slider);
|
||||
setLayout(slidersLayout);
|
||||
QBoxLayout *layout;
|
||||
if (decimals) {
|
||||
layout = new QVBoxLayout;
|
||||
slider.setOrientation(Qt::Vertical);
|
||||
}
|
||||
else {
|
||||
layout = new QHBoxLayout;
|
||||
slider.setOrientation(Qt::Horizontal);
|
||||
slider.setMaximumHeight(15);
|
||||
valueBox.setMaximumHeight(15);
|
||||
}
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
slider.setFocusPolicy(Qt::StrongFocus);
|
||||
slider.setTickPosition(QSlider::TicksBothSides);
|
||||
slider.setTickInterval((max - min) / 11);
|
||||
slider.setMinimumHeight(0);
|
||||
slider.setSingleStep(1);
|
||||
slider.setRange(min, max);
|
||||
slider.setValue(0);
|
||||
slider.setMinimumWidth(50);
|
||||
slider.setToolTip(name);
|
||||
slider.setStyleSheet("QSlider {"
|
||||
"border: 1px solid #aa8895;"
|
||||
"background: #20182d;"
|
||||
"margin: 0px;}"
|
||||
"QSlider::groove:vertical {"
|
||||
"border: 1px solid #999999;"
|
||||
"width: 25px;"
|
||||
"margin: -4px;}"
|
||||
"QSlider::handle:vertical {"
|
||||
"background: white;"
|
||||
"border: 1px solid #5c5c5c;"
|
||||
"width: 29px;"
|
||||
"height: 7px;"
|
||||
"margin: -2px;"
|
||||
"border-radius: 2px;}"
|
||||
"Qslider::tickmarks:vertical {background: white;"
|
||||
"color: white;}"
|
||||
"QSlider::add-page:vertical {background: blue;}"
|
||||
"QSlider::sub-page:vertical {background: #20182d;}");
|
||||
slider.setContentsMargins(0, 0, 0, 0);
|
||||
valueBox.setFocusPolicy(Qt::NoFocus);
|
||||
valueBox.setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
valueBox.setMinimumWidth(50);
|
||||
if (decimals) {
|
||||
valueBox.setRange(-84.0f, 0.0f);
|
||||
valueBox.setSpecialValueText("-inf");
|
||||
} else
|
||||
valueBox.setRange(min, max);
|
||||
valueBox.setValue(0);
|
||||
valueBox.setDecimals(decimals);
|
||||
valueBox.setObjectName(name);
|
||||
valueBox.setToolTip(name);
|
||||
valueBox.setAlignment(Qt::AlignHCenter);
|
||||
valueBox.setContentsMargins(0, 0, 0, 0);
|
||||
connect(&slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
|
||||
connect(&valueBox, SIGNAL(click()), this, SLOT(enableSlider()));
|
||||
layout->addWidget(&slider);
|
||||
layout->addWidget(&valueBox);
|
||||
this->setStyleSheet("border: 1px solid #aa8895;"
|
||||
"background-color: black;"
|
||||
"margin: 1px;"
|
||||
);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setLayout(layout);
|
||||
}
|
||||
|
||||
void SliderGroup::sliderValueChanged(int value)
|
||||
{
|
||||
if (valueBox->decimals() > 1)
|
||||
value /= 100.0f;
|
||||
valueBox.blockSignals(true);
|
||||
if (valueBox.decimals()) {
|
||||
float db = ((float)value / 771.0f) - 85.0f;
|
||||
if (db <= -84.5f) {
|
||||
valueBox.setSpecialValueText("-inf");
|
||||
} else
|
||||
valueBox.setValue(db);
|
||||
} else {
|
||||
valueBox.setValue(value);
|
||||
}
|
||||
valueBox.blockSignals(false);
|
||||
emit valueChanged(value);
|
||||
valueBox->setValue(value);
|
||||
};
|
||||
|
||||
void SliderGroup::setValue(float value)
|
||||
{
|
||||
if (valueBox->decimals() > 1)
|
||||
value *= 100.0f;
|
||||
slider->setValue(value);
|
||||
valueBox->setValue(value);
|
||||
float db;
|
||||
|
||||
slider.blockSignals(true);
|
||||
valueBox.blockSignals(true);
|
||||
if (int(value) != slider.value())
|
||||
slider.setValue(value);
|
||||
if (valueBox.decimals()) {
|
||||
db = (float)(value / 771.0f) - 85.0f;
|
||||
valueBox.setValue(db);
|
||||
} else
|
||||
valueBox.setValue(value);
|
||||
slider.blockSignals(false);
|
||||
valueBox.blockSignals(false);
|
||||
}
|
||||
|
|
|
@ -1,32 +1,37 @@
|
|||
#ifndef SLIDERGROUP_H
|
||||
#define SLIDERGROUP_H
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSlider>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
|
||||
class SliderGroup : public QGroupBox
|
||||
#include "clickabledoublespinbox.h"
|
||||
#include "clickableslider.h"
|
||||
|
||||
class SliderGroup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SliderGroup(const QString &title,
|
||||
int min,
|
||||
int max,
|
||||
int decimals,
|
||||
QWidget *parent = nullptr);
|
||||
SliderGroup(QString name,
|
||||
int min,
|
||||
int max,
|
||||
int decimals,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void valueChanged(float value);
|
||||
void valueChanged(int value);
|
||||
|
||||
public slots:
|
||||
void setValue(float value);
|
||||
void sliderValueChanged(int value);
|
||||
|
||||
private:
|
||||
QSlider *slider;
|
||||
QDoubleSpinBox *valueBox;
|
||||
ClickableSlider slider;
|
||||
ClickableDoubleSpinBox valueBox;
|
||||
|
||||
private slots:
|
||||
void enableSlider() { slider.setEnabled(true); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue