Changeset 353 for CoolAudio


Ignore:
Timestamp:
Apr 23, 2012, 2:57:12 PM (13 years ago)
Author:
chronos
Message:
  • Modified: TPlayList is now registred as component in group CoolAudio in Component pallete.
  • Added: Created placeholder component TMediaPlayer which can be switched to different audio systems in runtime without destruction/construction.
Location:
CoolAudio
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • CoolAudio/CoolAudio.lpk

    r352 r353  
    1919      </Other>
    2020    </CompilerOptions>
    21     <Description Value="CoolAudio"/>
     21    <Description Value="Features:
     22- TMediaPlayer for playing sound files using different audio systems
     23- TPlayList for song list management"/>
    2224    <License Value="GNU/GPL"/>
    23     <Version Minor="1"/>
     25    <Version Minor="2"/>
    2426    <Files Count="10">
    2527      <Item1>
    2628        <Filename Value="UCoolAudio.pas"/>
     29        <HasRegisterProc Value="True"/>
    2730        <UnitName Value="UCoolAudio"/>
    2831      </Item1>
     
    6164      <Item10>
    6265        <Filename Value="UCoolAudioConfig.inc"/>
     66        <UnitName Value="UCoolAudioConfig"/>
    6367      </Item10>
    6468    </Files>
  • CoolAudio/CoolAudio.pas

    r352 r353  
    1616procedure Register;
    1717begin
     18  RegisterUnit('UCoolAudio', @UCoolAudio.Register);
    1819end;
    1920
  • CoolAudio/Demo/Demo.lpi

    r352 r353  
    3838      </Item2>
    3939    </RequiredPackages>
    40     <Units Count="31">
     40    <Units Count="45">
    4141      <Unit0>
    4242        <Filename Value="Demo.lpr"/>
    4343        <IsPartOfProject Value="True"/>
    4444        <UnitName Value="Demo"/>
    45         <EditorIndex Value="14"/>
     45        <EditorIndex Value="15"/>
    4646        <WindowIndex Value="0"/>
    4747        <TopLine Value="1"/>
    4848        <CursorPos X="34" Y="10"/>
    49         <UsageCount Value="83"/>
     49        <UsageCount Value="85"/>
    5050        <Loaded Value="True"/>
    5151      </Unit0>
     
    5959        <EditorIndex Value="0"/>
    6060        <WindowIndex Value="0"/>
    61         <TopLine Value="142"/>
    62         <CursorPos X="28" Y="150"/>
    63         <UsageCount Value="83"/>
     61        <TopLine Value="1"/>
     62        <CursorPos X="47" Y="9"/>
     63        <UsageCount Value="85"/>
    6464        <Loaded Value="True"/>
    6565        <LoadedDesigner Value="True"/>
     
    7070        <EditorIndex Value="12"/>
    7171        <WindowIndex Value="0"/>
    72         <TopLine Value="27"/>
    73         <CursorPos X="20" Y="19"/>
    74         <UsageCount Value="35"/>
     72        <TopLine Value="22"/>
     73        <CursorPos X="34" Y="37"/>
     74        <UsageCount Value="36"/>
    7575        <Loaded Value="True"/>
    7676      </Unit2>
     
    8686        <Filename Value="../UPlaylist.pas"/>
    8787        <UnitName Value="UPlaylist"/>
    88         <EditorIndex Value="2"/>
    89         <WindowIndex Value="0"/>
    90         <TopLine Value="10"/>
    91         <CursorPos X="20" Y="26"/>
    92         <UsageCount Value="17"/>
     88        <EditorIndex Value="4"/>
     89        <WindowIndex Value="0"/>
     90        <TopLine Value="23"/>
     91        <CursorPos X="31" Y="35"/>
     92        <UsageCount Value="18"/>
    9393        <Loaded Value="True"/>
    9494      </Unit4>
     
    120120        <Filename Value="../CoolAudio.pas"/>
    121121        <UnitName Value="CoolAudio"/>
     122        <EditorIndex Value="13"/>
    122123        <WindowIndex Value="0"/>
    123124        <TopLine Value="1"/>
    124         <CursorPos X="1" Y="1"/>
    125         <UsageCount Value="4"/>
     125        <CursorPos X="45" Y="19"/>
     126        <UsageCount Value="10"/>
     127        <Loaded Value="True"/>
    126128      </Unit8>
    127129      <Unit9>
    128130        <Filename Value="../Systems/UAudioSystem.pas"/>
    129131        <UnitName Value="UAudioSystem"/>
    130         <EditorIndex Value="11"/>
    131         <WindowIndex Value="0"/>
    132         <TopLine Value="217"/>
    133         <CursorPos X="1" Y="230"/>
    134         <UsageCount Value="50"/>
     132        <EditorIndex Value="5"/>
     133        <WindowIndex Value="0"/>
     134        <TopLine Value="27"/>
     135        <CursorPos X="15" Y="40"/>
     136        <UsageCount Value="51"/>
    135137        <Loaded Value="True"/>
    136138      </Unit9>
     
    183185      <Unit16>
    184186        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/lcl/include/control.inc"/>
    185         <EditorIndex Value="8"/>
    186187        <WindowIndex Value="0"/>
    187188        <TopLine Value="2275"/>
    188189        <CursorPos X="1" Y="2287"/>
    189190        <UsageCount Value="34"/>
    190         <Loaded Value="True"/>
    191191      </Unit16>
    192192      <Unit17>
     
    216216        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/packages/winunits-base/src/mmsystem.pp"/>
    217217        <UnitName Value="mmsystem"/>
    218         <EditorIndex Value="9"/>
    219218        <WindowIndex Value="0"/>
    220219        <TopLine Value="1781"/>
    221220        <CursorPos X="52" Y="1791"/>
    222221        <UsageCount Value="36"/>
    223         <Loaded Value="True"/>
    224222      </Unit20>
    225223      <Unit21>
     
    240238      <Unit23>
    241239        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/objpas/sysutils/osutilsh.inc"/>
    242         <EditorIndex Value="13"/>
     240        <EditorIndex Value="14"/>
    243241        <WindowIndex Value="0"/>
    244242        <TopLine Value="23"/>
    245243        <CursorPos X="10" Y="23"/>
    246         <UsageCount Value="34"/>
     244        <UsageCount Value="35"/>
    247245        <Loaded Value="True"/>
    248246      </Unit23>
    249247      <Unit24>
    250248        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/win/wininc/base.inc"/>
    251         <EditorIndex Value="10"/>
    252249        <WindowIndex Value="0"/>
    253250        <TopLine Value="148"/>
    254251        <CursorPos X="6" Y="159"/>
    255252        <UsageCount Value="11"/>
    256         <Loaded Value="True"/>
    257253      </Unit24>
    258254      <Unit25>
     
    260256        <IsPartOfProject Value="True"/>
    261257        <ComponentName Value="FormPlaylist"/>
     258        <HasResources Value="True"/>
    262259        <ResourceBaseClass Value="Form"/>
    263260        <UnitName Value="UFormPlaylist"/>
     
    266263        <TopLine Value="155"/>
    267264        <CursorPos X="28" Y="168"/>
    268         <UsageCount Value="23"/>
     265        <UsageCount Value="25"/>
    269266        <Loaded Value="True"/>
    270267        <LoadedDesigner Value="True"/>
     
    273270        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    274271        <UnitName Value="UAudioSystemWindows"/>
    275         <EditorIndex Value="5"/>
    276         <WindowIndex Value="0"/>
    277         <TopLine Value="62"/>
    278         <CursorPos X="35" Y="75"/>
     272        <IsVisibleTab Value="True"/>
     273        <EditorIndex Value="6"/>
     274        <WindowIndex Value="0"/>
     275        <TopLine Value="163"/>
     276        <CursorPos X="3" Y="167"/>
    279277        <UsageCount Value="11"/>
    280278        <Loaded Value="True"/>
     
    282280      <Unit27>
    283281        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/customform.inc"/>
    284         <EditorIndex Value="1"/>
    285282        <WindowIndex Value="0"/>
    286283        <TopLine Value="934"/>
    287284        <CursorPos X="1" Y="947"/>
    288         <UsageCount Value="11"/>
    289         <Loaded Value="True"/>
     285        <UsageCount Value="10"/>
    290286      </Unit27>
    291287      <Unit28>
    292288        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/listitem.inc"/>
    293         <EditorIndex Value="4"/>
    294289        <WindowIndex Value="0"/>
    295290        <TopLine Value="725"/>
    296291        <CursorPos X="1" Y="738"/>
    297292        <UsageCount Value="10"/>
    298         <Loaded Value="True"/>
    299293      </Unit28>
    300294      <Unit29>
    301295        <Filename Value="../UCoolAudioConfig.inc"/>
    302         <EditorIndex Value="6"/>
    303296        <WindowIndex Value="0"/>
    304297        <TopLine Value="1"/>
    305298        <CursorPos X="1" Y="5"/>
    306299        <UsageCount Value="10"/>
    307         <Loaded Value="True"/>
    308300      </Unit29>
    309301      <Unit30>
    310302        <Filename Value="../Systems/FMOD/fmoddyn.pas"/>
    311303        <UnitName Value="fmoddyn"/>
    312         <IsVisibleTab Value="True"/>
     304        <WindowIndex Value="0"/>
     305        <TopLine Value="576"/>
     306        <CursorPos X="20" Y="594"/>
     307        <UsageCount Value="10"/>
     308      </Unit30>
     309      <Unit31>
     310        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/stdctrls.pp"/>
     311        <UnitName Value="StdCtrls"/>
     312        <WindowIndex Value="0"/>
     313        <TopLine Value="1081"/>
     314        <CursorPos X="3" Y="1085"/>
     315        <UsageCount Value="10"/>
     316      </Unit31>
     317      <Unit32>
     318        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/buttons.inc"/>
     319        <WindowIndex Value="0"/>
     320        <TopLine Value="280"/>
     321        <CursorPos X="3" Y="285"/>
     322        <UsageCount Value="10"/>
     323      </Unit32>
     324      <Unit33>
     325        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/buttoncontrol.inc"/>
     326        <WindowIndex Value="0"/>
     327        <TopLine Value="59"/>
     328        <CursorPos X="3" Y="61"/>
     329        <UsageCount Value="10"/>
     330      </Unit33>
     331      <Unit34>
     332        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/widgetset/wsstdctrls.pp"/>
     333        <UnitName Value="WSStdCtrls"/>
     334        <WindowIndex Value="0"/>
     335        <TopLine Value="212"/>
     336        <CursorPos X="3" Y="225"/>
     337        <UsageCount Value="10"/>
     338      </Unit34>
     339      <Unit35>
     340        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/widgetset/wsfactory.pas"/>
     341        <UnitName Value="WSFactory"/>
     342        <WindowIndex Value="0"/>
     343        <TopLine Value="42"/>
     344        <CursorPos X="1" Y="55"/>
     345        <UsageCount Value="10"/>
     346      </Unit35>
     347      <Unit36>
     348        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/controls.pp"/>
     349        <UnitName Value="Controls"/>
     350        <EditorIndex Value="2"/>
     351        <WindowIndex Value="0"/>
     352        <TopLine Value="1309"/>
     353        <CursorPos X="15" Y="1310"/>
     354        <UsageCount Value="10"/>
     355        <Loaded Value="True"/>
     356      </Unit36>
     357      <Unit37>
     358        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/control.inc"/>
     359        <EditorIndex Value="1"/>
     360        <WindowIndex Value="0"/>
     361        <TopLine Value="3633"/>
     362        <CursorPos X="47" Y="3641"/>
     363        <UsageCount Value="10"/>
     364        <Loaded Value="True"/>
     365      </Unit37>
     366      <Unit38>
     367        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/lclclasses.pp"/>
     368        <UnitName Value="LCLClasses"/>
     369        <WindowIndex Value="0"/>
     370        <TopLine Value="37"/>
     371        <CursorPos X="13" Y="41"/>
     372        <UsageCount Value="10"/>
     373      </Unit38>
     374      <Unit39>
     375        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/widgetset/wslclclasses.pp"/>
     376        <UnitName Value="WSLCLClasses"/>
     377        <WindowIndex Value="0"/>
     378        <TopLine Value="61"/>
     379        <CursorPos X="3" Y="74"/>
     380        <UsageCount Value="10"/>
     381      </Unit39>
     382      <Unit40>
     383        <Filename Value="../Systems/FMOD/UAudioSystemFMOD.pas"/>
     384        <UnitName Value="UAudioSystemFMOD"/>
     385        <EditorIndex Value="9"/>
     386        <WindowIndex Value="0"/>
     387        <TopLine Value="66"/>
     388        <CursorPos X="25" Y="68"/>
     389        <UsageCount Value="10"/>
     390        <Loaded Value="True"/>
     391      </Unit40>
     392      <Unit41>
     393        <Filename Value="../Systems/mplayer/UAudioSystemMPlayer.pas"/>
     394        <UnitName Value="UAudioSystemMPlayer"/>
    313395        <EditorIndex Value="7"/>
    314396        <WindowIndex Value="0"/>
    315         <TopLine Value="588"/>
    316         <CursorPos X="5" Y="589"/>
    317         <UsageCount Value="10"/>
    318         <Loaded Value="True"/>
    319       </Unit30>
     397        <TopLine Value="130"/>
     398        <CursorPos X="1" Y="134"/>
     399        <UsageCount Value="10"/>
     400        <Loaded Value="True"/>
     401      </Unit41>
     402      <Unit42>
     403        <Filename Value="../../../../Lazarus/1.1_2.6.0/fpc/2.6.0/source/rtl/objpas/classes/classesh.inc"/>
     404        <EditorIndex Value="11"/>
     405        <WindowIndex Value="0"/>
     406        <TopLine Value="1919"/>
     407        <CursorPos X="11" Y="1932"/>
     408        <UsageCount Value="10"/>
     409        <Loaded Value="True"/>
     410      </Unit42>
     411      <Unit43>
     412        <Filename Value="../Systems/DSP/UAudioSystemDSP.pas"/>
     413        <UnitName Value="UAudioSystemDSP"/>
     414        <EditorIndex Value="8"/>
     415        <WindowIndex Value="0"/>
     416        <TopLine Value="64"/>
     417        <CursorPos X="25" Y="78"/>
     418        <UsageCount Value="10"/>
     419        <Loaded Value="True"/>
     420      </Unit43>
     421      <Unit44>
     422        <Filename Value="../Systems/MAD/UAudioSystemMAD.pas"/>
     423        <UnitName Value="UAudioSystemMAD"/>
     424        <EditorIndex Value="10"/>
     425        <WindowIndex Value="0"/>
     426        <TopLine Value="23"/>
     427        <CursorPos X="23" Y="37"/>
     428        <UsageCount Value="10"/>
     429        <Loaded Value="True"/>
     430      </Unit44>
    320431    </Units>
    321432    <JumpHistory Count="30" HistoryIndex="29">
    322433      <Position1>
    323         <Filename Value="UFormPlaylist.pas"/>
    324         <Caret Line="97" Column="25" TopLine="90"/>
     434        <Filename Value="../Systems/UAudioSystem.pas"/>
     435        <Caret Line="240" Column="1" TopLine="227"/>
    325436      </Position1>
    326437      <Position2>
    327         <Filename Value="UFormPlaylist.pas"/>
    328         <Caret Line="96" Column="3" TopLine="94"/>
     438        <Filename Value="../Systems/UAudioSystem.pas"/>
     439        <Caret Line="241" Column="1" TopLine="227"/>
    329440      </Position2>
    330441      <Position3>
    331         <Filename Value="UFormPlaylist.pas"/>
    332         <Caret Line="161" Column="24" TopLine="142"/>
     442        <Filename Value="../Systems/UAudioSystem.pas"/>
     443        <Caret Line="381" Column="1" TopLine="368"/>
    333444      </Position3>
    334445      <Position4>
    335         <Filename Value="UFormPlaylist.pas"/>
    336         <Caret Line="146" Column="19" TopLine="144"/>
     446        <Filename Value="UFormMain.pas"/>
     447        <Caret Line="121" Column="10" TopLine="111"/>
    337448      </Position4>
    338449      <Position5>
    339         <Filename Value="UFormPlaylist.pas"/>
    340         <Caret Line="161" Column="20" TopLine="155"/>
     450        <Filename Value="UFormMain.pas"/>
     451        <Caret Line="125" Column="28" TopLine="112"/>
    341452      </Position5>
    342453      <Position6>
    343454        <Filename Value="UFormMain.pas"/>
    344         <Caret Line="77" Column="53" TopLine="67"/>
     455        <Caret Line="122" Column="28" TopLine="112"/>
    345456      </Position6>
    346457      <Position7>
    347458        <Filename Value="UFormMain.pas"/>
    348         <Caret Line="136" Column="1" TopLine="132"/>
     459        <Caret Line="164" Column="30" TopLine="159"/>
    349460      </Position7>
    350461      <Position8>
    351         <Filename Value="UFormPlaylist.pas"/>
    352         <Caret Line="151" Column="30" TopLine="145"/>
     462        <Filename Value="UFormMain.pas"/>
     463        <Caret Line="51" Column="49" TopLine="27"/>
    353464      </Position8>
    354465      <Position9>
    355         <Filename Value="UFormMain.pas"/>
    356         <Caret Line="136" Column="1" TopLine="132"/>
     466        <Filename Value="../UPlaylist.pas"/>
     467        <Caret Line="30" Column="1" TopLine="10"/>
    357468      </Position9>
    358469      <Position10>
    359         <Filename Value="UFormMain.pas"/>
    360         <Caret Line="150" Column="28" TopLine="142"/>
     470        <Filename Value="../UPlaylist.pas"/>
     471        <Caret Line="35" Column="3" TopLine="15"/>
    361472      </Position10>
    362473      <Position11>
    363         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    364         <Caret Line="198" Column="7" TopLine="186"/>
     474        <Filename Value="../UPlaylist.pas"/>
     475        <Caret Line="18" Column="10" TopLine="7"/>
    365476      </Position11>
    366477      <Position12>
    367         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    368         <Caret Line="190" Column="1" TopLine="185"/>
     478        <Filename Value="../Systems/UAudioSystem.pas"/>
     479        <Caret Line="120" Column="68" TopLine="104"/>
    369480      </Position12>
    370481      <Position13>
    371         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    372         <Caret Line="191" Column="1" TopLine="185"/>
     482        <Filename Value="../Systems/UAudioSystem.pas"/>
     483        <Caret Line="318" Column="3" TopLine="313"/>
    373484      </Position13>
    374485      <Position14>
    375         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    376         <Caret Line="192" Column="1" TopLine="185"/>
     486        <Filename Value="../UCoolAudio.pas"/>
     487        <Caret Line="18" Column="49" TopLine="10"/>
    377488      </Position14>
    378489      <Position15>
    379         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    380         <Caret Line="196" Column="1" TopLine="185"/>
     490        <Filename Value="../UCoolAudio.pas"/>
     491        <Caret Line="40" Column="1" TopLine="22"/>
    381492      </Position15>
    382493      <Position16>
    383         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    384         <Caret Line="197" Column="1" TopLine="185"/>
     494        <Filename Value="../Systems/UAudioSystem.pas"/>
     495        <Caret Line="122" Column="39" TopLine="104"/>
    385496      </Position16>
    386497      <Position17>
    387         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    388         <Caret Line="202" Column="1" TopLine="185"/>
     498        <Filename Value="../UCoolAudio.pas"/>
     499        <Caret Line="40" Column="1" TopLine="22"/>
    389500      </Position17>
    390501      <Position18>
    391         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    392         <Caret Line="204" Column="19" TopLine="186"/>
     502        <Filename Value="UFormMain.pas"/>
     503        <Caret Line="29" Column="32" TopLine="18"/>
    393504      </Position18>
    394505      <Position19>
    395         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    396         <Caret Line="75" Column="1" TopLine="62"/>
     506        <Filename Value="UFormMain.pas"/>
     507        <Caret Line="27" Column="18" TopLine="18"/>
    397508      </Position19>
    398509      <Position20>
    399510        <Filename Value="UFormPlaylist.pas"/>
    400         <Caret Line="168" Column="59" TopLine="156"/>
     511        <Caret Line="168" Column="28" TopLine="155"/>
    401512      </Position20>
    402513      <Position21>
    403         <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/listitem.inc"/>
    404         <Caret Line="738" Column="1" TopLine="725"/>
     514        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     515        <Caret Line="86" Column="48" TopLine="73"/>
    405516      </Position21>
    406517      <Position22>
    407         <Filename Value="UFormPlaylist.pas"/>
    408         <Caret Line="168" Column="28" TopLine="155"/>
     518        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     519        <Caret Line="213" Column="1" TopLine="200"/>
    409520      </Position22>
    410521      <Position23>
    411         <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    412         <Caret Line="75" Column="1" TopLine="62"/>
     522        <Filename Value="../Systems/UAudioSystem.pas"/>
     523        <Caret Line="422" Column="1" TopLine="409"/>
    413524      </Position23>
    414525      <Position24>
    415526        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    416         <Caret Line="202" Column="1" TopLine="183"/>
     527        <Caret Line="213" Column="1" TopLine="200"/>
    417528      </Position24>
    418529      <Position25>
    419         <Filename Value="../Systems/UAudioSystem.pas"/>
    420         <Caret Line="231" Column="39" TopLine="217"/>
     530        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     531        <Caret Line="86" Column="1" TopLine="73"/>
    421532      </Position25>
    422533      <Position26>
    423534        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    424         <Caret Line="216" Column="1" TopLine="203"/>
     535        <Caret Line="213" Column="1" TopLine="200"/>
    425536      </Position26>
    426537      <Position27>
    427538        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    428         <Caret Line="202" Column="1" TopLine="189"/>
     539        <Caret Line="86" Column="1" TopLine="73"/>
    429540      </Position27>
    430541      <Position28>
    431542        <Filename Value="../Systems/UAudioSystem.pas"/>
    432         <Caret Line="230" Column="1" TopLine="217"/>
     543        <Caret Line="422" Column="1" TopLine="409"/>
    433544      </Position28>
    434545      <Position29>
    435546        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
    436         <Caret Line="202" Column="1" TopLine="189"/>
     547        <Caret Line="227" Column="1" TopLine="214"/>
    437548      </Position29>
    438549      <Position30>
    439         <Filename Value="../UCoolAudioConfig.inc"/>
    440         <Caret Line="5" Column="1" TopLine="1"/>
     550        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     551        <Caret Line="102" Column="3" TopLine="98"/>
    441552      </Position30>
    442553    </JumpHistory>
  • CoolAudio/Demo/UFormMain.lfm

    r352 r353  
    99  OnCreate = FormCreate
    1010  OnDestroy = FormDestroy
     11  OnShow = FormShow
    1112  LCLVersion = '1.1'
    1213  object ButtonOpen: TButton
     
    4243    TabOrder = 3
    4344  end
    44   object TrackBar1: TTrackBar
     45  object TrackBarPosition: TTrackBar
    4546    Left = 0
    4647    Height = 33
     
    4849    Width = 432
    4950    Max = 100
    50     OnChange = TrackBar1Change
     51    OnChange = TrackBarPositionChange
    5152    Position = 0
    5253    Anchors = [akTop, akLeft, akRight]
     
    103104    TabOrder = 8
    104105  end
     106  object TrackBarVolume: TTrackBar
     107    Left = 352
     108    Height = 25
     109    Top = 80
     110    Width = 75
     111    Max = 100
     112    OnChange = TrackBarVolumeChange
     113    Position = 0
     114    TabOrder = 9
     115  end
     116  object Label2: TLabel
     117    Left = 312
     118    Height = 14
     119    Top = 87
     120    Width = 39
     121    Caption = 'Volume:'
     122    ParentColor = False
     123  end
    105124  object OpenDialog1: TOpenDialog
    106125    Filter = 'Any file (*.*)|*.*|MP3 (*.mp3)|*.mp3|WAV (*.wav)|*.wav'
    107     left = 272
    108     top = 96
     126    left = 168
    109127  end
    110128  object TimerPlayback: TTimer
    111129    OnTimer = TimerPlaybackTimer
    112     left = 328
    113     top = 88
     130    left = 240
    114131  end
    115132  object ActionList1: TActionList
    116     left = 208
    117     top = 96
     133    left = 104
    118134    object APlayNext: TAction
    119135      Caption = 'Next'
     
    145161    end
    146162  end
     163  object MediaPlayer: TMediaPlayer
     164    Volume = 0
     165    Muted = False
     166    Active = True
     167    left = 312
     168  end
     169  object PlayList: TPlayList
     170    RandomOrder = False
     171    RepeatInfinitely = False
     172    left = 375
     173    top = 2
     174  end
    147175end
  • CoolAudio/Demo/UFormMain.pas

    r352 r353  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, ExtCtrls, ActnList, UAudioSystem, UAudioSystemFMOD,
    10   UAudioSystemMPlayer, UCoolAudio, UPlaylist;
     9  ComCtrls, ExtCtrls, ActnList, UAudioSystem,
     10  UCoolAudio, UPlaylist;
    1111
    1212type
     
    3232    ComboBoxBackend: TComboBox;
    3333    Label1: TLabel;
     34    Label2: TLabel;
    3435    LabelPosition: TLabel;
     36    MediaPlayer: TMediaPlayer;
    3537    OpenDialog1: TOpenDialog;
     38    PlayList: TPlayList;
    3639    TimerPlayback: TTimer;
    37     TrackBar1: TTrackBar;
     40    TrackBarPosition: TTrackBar;
     41    TrackBarVolume: TTrackBar;
    3842    procedure AOpenExecute(Sender: TObject);
    3943    procedure APauseExecute(Sender: TObject);
     
    4650    procedure FormCreate(Sender: TObject);
    4751    procedure FormDestroy(Sender: TObject);
     52    procedure FormShow(Sender: TObject);
    4853    procedure TimerPlaybackTimer(Sender: TObject);
    49     procedure TrackBar1Change(Sender: TObject);
     54    procedure TrackBarPositionChange(Sender: TObject);
     55    procedure TrackBarVolumeChange(Sender: TObject);
    5056  private
    51     { private declarations }
    5257  public
    53     AudioSystem: TAudioSystem;
    54     Player: TPlayer;
    55     Playlist: TPlaylist;
    5658    procedure UpdateInterface;
    5759  end;
     
    7476procedure TFormMain.FormCreate(Sender: TObject);
    7577begin
    76   Playlist := TPlaylist.Create(nil);
     78  PlayList := TPlayList.Create(nil);
    7779  AudioSystemManager.FillStringList(ComboBoxBackend.Items);
    7880  if ComboBoxBackend.Items.Count > 0 then
     
    8385procedure TFormMain.FormDestroy(Sender: TObject);
    8486begin
    85   FreeAndNil(Player);
    86   FreeAndNil(AudioSystem);
    87   FreeAndNil(Playlist);
     87  FreeAndNil(PlayList);
     88end;
     89
     90procedure TFormMain.FormShow(Sender: TObject);
     91begin
     92  UpdateInterface;
    8893end;
    8994
    9095procedure TFormMain.TimerPlaybackTimer(Sender: TObject);
    9196begin
    92   if Assigned(Player) and Player.Playing then begin
    93     TrackBar1.OnChange := nil;
    94     TrackBar1.Position := Trunc(Player.Position / Player.Length * TrackBar1.Max);
     97  if Assigned(MediaPlayer) and MediaPlayer.Playing then begin
     98    TrackBarPosition.OnChange := nil;
     99    TrackBarPosition.Position := Trunc(MediaPlayer.Position / MediaPlayer.Length * TrackBarPosition.Max);
     100    TrackBarVolume.OnChange := nil;
     101    TrackBarVolume.Position := Trunc(MediaPlayer.Volume * TrackBarVolume.Max);
    95102    Application.ProcessMessages;
    96     TrackBar1.OnChange := TrackBar1Change;
    97     LabelPosition.Caption := 'Position: ' + TimeToStr(Player.Position) + ' / ' + TimeToStr(Player.Length);
     103    TrackBarPosition.OnChange := TrackBarPositionChange();
     104    TrackBarVolume.OnChange := TrackBarVolumeChange();
     105    LabelPosition.Caption := 'Position: ' + TimeToStr(MediaPlayer.Position) + ' / ' + TimeToStr(MediaPlayer.Length);
    98106  end;
    99107end;
    100108
    101 procedure TFormMain.TrackBar1Change(Sender: TObject);
     109procedure TFormMain.TrackBarPositionChange(Sender: TObject);
    102110begin
    103   Player.Position := TrackBar1.Position / TrackBar1.Max * Player.Length;
     111  MediaPlayer.Position := TrackBarPosition.Position / TrackBarPosition.Max * MediaPlayer.Length;
     112end;
     113
     114procedure TFormMain.TrackBarVolumeChange(Sender: TObject);
     115begin
     116  MediaPlayer.Volume := TrackBarVolume.Position / TrackBarVolume.Max;
    104117end;
    105118
    106119procedure TFormMain.UpdateInterface;
    107120begin
     121  APlay.Enabled := not MediaPlayer.Playing;
     122  APause.Enabled := MediaPlayer.Playing;
     123  AStop.Enabled := MediaPlayer.Playing;
    108124  Caption := ApplicationTitle;
    109   if Assigned(Player) then Caption := Player.FileName + ' - ' + Caption;
     125  if Assigned(MediaPlayer) then Caption := MediaPlayer.FileName + ' - ' + Caption;
    110126end;
    111127
    112128procedure TFormMain.ComboBoxBackendChange(Sender: TObject);
    113129begin
    114   FreeAndNil(Player);
    115   FreeAndNil(AudioSystem);
    116130  if ComboBoxBackend.ItemIndex <> - 1 then begin
    117131    with TAudioSystemManagerItem(ComboBoxBackend.Items.Objects[ComboBoxBackend.ItemIndex]) do begin
    118       AudioSystem := SystemClass.Create(nil);
    119       Player := PlayerClass.Create(nil);
    120       Player.AudioSystem := AudioSystem;
    121       Playlist.Player := Player;
    122       //Player.Active := True;
     132      DefaultAudioSystem := SystemClass.Create(nil);
     133      MediaPlayer.AudioSystem := DefaultAudioSystem;
     134      PlayList.Player := MediaPlayer;
     135      //MediaPlayer.Active := True;
    123136    end;
    124137  end;
     
    127140procedure TFormMain.APlayExecute(Sender: TObject);
    128141begin
    129   Player.Play;
     142  MediaPlayer.Play;
     143  UpdateInterface;
    130144end;
    131145
    132146procedure TFormMain.APlayNextExecute(Sender: TObject);
    133147begin
    134   Playlist.PlayNext;
     148  PlayList.PlayNext;
    135149  FormPlaylist.ReloadList;
    136150end;
     
    138152procedure TFormMain.APlayPreviousExecute(Sender: TObject);
    139153begin
    140   Playlist.PlayPrevious;
     154  PlayList.PlayPrevious;
    141155end;
    142156
     
    148162procedure TFormMain.AStopExecute(Sender: TObject);
    149163begin
    150   Player.Stop;
     164  MediaPlayer.Stop;
     165  UpdateInterface;
    151166end;
    152167
    153168procedure TFormMain.APauseExecute(Sender: TObject);
    154169begin
    155   Player.Pause;
     170  MediaPlayer.Pause;
     171  UpdateInterface;
    156172end;
    157173
     
    159175begin
    160176  if OpenDialog1.Execute then begin
    161     Player.FileName := OpenDialog1.FileName;
    162     Playlist.AddFile(OpenDialog1.FileName);
    163     Player.Play;
     177    MediaPlayer.FileName := OpenDialog1.FileName;
     178    PlayList.AddFile(OpenDialog1.FileName);
     179    MediaPlayer.Play;
     180    UpdateInterface;
    164181  end;
    165182end;
  • CoolAudio/Demo/UFormPlaylist.lfm

    r352 r353  
    11object FormPlaylist: TFormPlaylist
    2   Left = 310
    3   Height = 394
    4   Top = 73
     2  Left = 331
     3  Height = 400
     4  Top = 119
    55  Width = 516
    66  Caption = 'Playlist'
    7   ClientHeight = 394
     7  ClientHeight = 400
    88  ClientWidth = 516
    99  OnCreate = FormCreate
     
    1414    Left = 160
    1515    Height = 25
    16     Top = 360
     16    Top = 366
    1717    Width = 49
    1818    Action = AItemDelete
     
    2323    Left = 80
    2424    Height = 25
    25     Top = 360
     25    Top = 366
    2626    Width = 73
    2727    Action = AAddDirectory
     
    3232    Left = 8
    3333    Height = 25
    34     Top = 360
     34    Top = 366
    3535    Width = 65
    3636    Action = AAddFile
     
    4040  object ListView1: TListView
    4141    Left = 8
    42     Height = 344
     42    Height = 350
    4343    Top = 8
    4444    Width = 505
     
    6565    Left = 216
    6666    Height = 25
    67     Top = 360
     67    Top = 366
    6868    Width = 49
    6969    Action = AClearAll
     
    7474    Left = 328
    7575    Height = 17
    76     Top = 360
     76    Top = 366
    7777    Width = 88
    7878    Anchors = [akLeft, akBottom]
     
    8383    Left = 432
    8484    Height = 17
    85     Top = 360
     85    Top = 366
    8686    Width = 55
     87    Anchors = [akLeft, akBottom]
    8788    Caption = 'Repeat'
    8889    TabOrder = 6
     
    9192    Left = 272
    9293    Height = 25
    93     Top = 360
     94    Top = 366
    9495    Width = 51
    9596    Action = AItemPlay
     97    Anchors = [akLeft, akBottom]
    9698    TabOrder = 7
    9799  end
  • CoolAudio/Demo/UFormPlaylist.pas

    r352 r353  
    7676procedure TFormPlaylist.AClearAllExecute(Sender: TObject);
    7777begin
    78   FormMain.Playlist.Items.Clear;
     78  FormMain.PlayList.Items.Clear;
    7979  ReloadList;
    8080end;
     
    8484  I: Integer;
    8585begin
    86   with FormMain.Playlist, Items do begin
     86  with FormMain.PlayList, Items do begin
    8787    for I := Count - 1 downto 0 do
    8888      if ListView1.Items[I].Selected then Delete(I);
     
    9494procedure TFormPlaylist.AItemPlayExecute(Sender: TObject);
    9595begin
    96   FormMain.Playlist.CurrentIndex := ListView1.Selected.Index;
    97   FormMain.Playlist.Play;
     96  FormMain.PlayList.CurrentIndex := ListView1.Selected.Index;
     97  FormMain.PlayList.Play;
    9898end;
    9999
     
    112112          NewItem := TPlaylistItem.Create;
    113113          NewItem.FileName := Dir + DirectorySeparator + sr.Name;
    114           FormMain.Playlist.Items.Add(NewItem);
     114          FormMain.PlayList.Items.Add(NewItem);
    115115        end;
    116116      until FindNext(sr) <> 0;
     
    124124begin
    125125  if OpenDialog1.Execute then begin
    126     FormMain.Playlist.AddFile(OpenDialog1.FileName);
     126    FormMain.PlayList.AddFile(OpenDialog1.FileName);
    127127    ReloadList;
    128128  end;
     
    145145procedure TFormPlaylist.ListView1Data(Sender: TObject; Item: TListItem);
    146146begin
    147   if (Item.Index >= 0) and (Item.Index < FormMain.Playlist.Items.Count) then
    148   with TPlaylistItem(FormMain.Playlist.Items[Item.Index]) do begin
     147  if (Item.Index >= 0) and (Item.Index < FormMain.PlayList.Items.Count) then
     148  with TPlaylistItem(FormMain.PlayList.Items[Item.Index]) do begin
    149149    Item.Caption := FileName;
    150     Item.Data := FormMain.Playlist.Items[Item.Index];
     150    Item.Data := FormMain.PlayList.Items[Item.Index];
    151151  end;
    152152end;
     
    164164procedure TFormPlaylist.ReloadList;
    165165begin
    166   ListView1.Items.Count := FormMain.Playlist.Items.Count;
     166  ListView1.Items.Count := FormMain.PlayList.Items.Count;
    167167  ListView1.Refresh;
    168168  ListView1.Selected := nil;
    169   if (FormMain.Playlist.CurrentIndex >= 0) and
    170     (FormMain.Playlist.CurrentIndex < ListView1.Items.Count) then
    171     ListView1.Items[FormMain.Playlist.CurrentIndex].Selected := True;
     169  if (FormMain.PlayList.CurrentIndex >= 0) and
     170    (FormMain.PlayList.CurrentIndex < ListView1.Items.Count) then
     171    ListView1.Items[FormMain.PlayList.CurrentIndex].Selected := True;
    172172  UpdateInterface;
    173173end;
     
    178178  AItemPlay.Enabled := Assigned(ListView1.Selected);
    179179  AClearAll.Enabled := ListView1.Items.Count > 0;
    180   CheckBoxRandom.Checked := FormMain.Playlist.RandomOrder;
    181   CheckBoxRepeat.Checked := FormMain.Playlist.RepeatInfinitely;
     180  CheckBoxRandom.Checked := FormMain.PlayList.RandomOrder;
     181  CheckBoxRepeat.Checked := FormMain.PlayList.RepeatInfinitely;
    182182end;
    183183
  • CoolAudio/Systems/DSP/UAudioSystemDSP.pas

    r352 r353  
    2121    SampleRate: Integer; // Hz
    2222    BitsPerSample: Integer;
     23    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    2324    procedure OpenDevice;
    2425    procedure CloseDevice;
     
    7475
    7576{ TAudioSystemDSP }
     77
     78function TAudioSystemDSP.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     79begin
     80  Result := TPlayerDSP;
     81end;
    7682
    7783procedure TAudioSystemDSP.OpenDevice;
  • CoolAudio/Systems/FMOD/UAudioSystemFMOD.pas

    r352 r353  
    1818    procedure SetOutputMode(AValue: TOutputDriver); override;
    1919  public
     20    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    2021    constructor Create(AOwner: TComponent); override;
    2122    destructor Destroy; override;
     
    2425  { TPlayerFMOD }
    2526
    26   TPlayerFMOD = class(TPlayer)
     27  TPlayerFMOD = class(TMediaPlayerDriver)
    2728  private
    2829    FHandle: PFSoundStream;
     
    6162    end else raise EOpenOutputFailed.Create(SOpenOutputFailed);
    6263  {$endif}
     64end;
     65
     66function TAudioSystemFMOD.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     67begin
     68  Result := TPlayerFMOD;
    6369end;
    6470
  • CoolAudio/Systems/MAD/UAudioSystemMAD.pas

    r352 r353  
    1313  TAudioSystemMAD = class(TAudioSystem)
    1414  public
     15    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    1516  end;
    1617
     
    2930
    3031{$IFDEF AudioSystemMAD}
     32
     33{ TAudioSystemMAD }
     34
     35function TAudioSystemMAD.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     36begin
     37  Result := TPlayerMAD;
     38end;
    3139
    3240{ TPlayerMAD }
  • CoolAudio/Systems/UAudioSystem.pas

    r352 r353  
    99
    1010type
     11  TMediaPlayerDriverClass = class of TMediaPlayerDriver;
    1112  TOutputDriver = (omAlsa, omOSS, omDirectX, omWin32);
    1213
     
    2223    constructor Create(AOwner: TComponent); override;
    2324    destructor Destroy; override;
     25    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; virtual;
    2426    property OutputMode: TOutputDriver read FOutputDriver write SetOutputMode;
    2527  end;
     
    2729  TAudioSystemClass = class of TAudioSystem;
    2830
    29   { TPlayer }
    30 
    31   TPlayer = class(TComponent)
     31  { TMediaPlayerDriver }
     32
     33  TMediaPlayerDriver = class
    3234  private
    3335  protected
     
    6062    property Playing: Boolean read FPlaying write SetPlaying;
    6163    property Active: Boolean read FActive write SetActive;
     64    constructor Create; virtual;
     65    destructor Destroy; override;
     66  end;
     67
     68  TMediaPlayer = class(TComponent)
     69  private
     70    procedure CheckDriver;
     71    function GetActive: Boolean;
     72    function GetAudioSystem: TAudioSystem;
     73    function GetFileName: string;
     74    function GetLength: TDateTime;
     75    function GetMuted: Boolean;
     76    function GetPlaying: Boolean;
     77    function GetPosition: TDateTime;
     78    function GetVolume: Real;
     79    procedure SetActive(AValue: Boolean);
     80    procedure SetAudioSystem(AValue: TAudioSystem);
     81    procedure SetFileName(AValue: string);
     82    procedure SetMuted(AValue: Boolean);
     83    procedure SetPlaying(AValue: Boolean);
     84    procedure SetPosition(AValue: TDateTime);
     85    procedure SetVolume(AValue: Real);
     86  public
     87    Driver: TMediaPlayerDriver;
     88    procedure Play;
     89    procedure Pause;
     90    procedure Stop;
     91    procedure Open;
     92    procedure Close;
     93    property Position: TDateTime read GetPosition write SetPosition;
     94    property Length: TDateTime read GetLength;
     95    property Playing: Boolean read GetPlaying write SetPlaying;
     96  published
     97    property Volume: Real read GetVolume write SetVolume; // 0..1
     98    property Muted: Boolean read GetMuted write SetMuted;
     99    property AudioSystem: TAudioSystem read GetAudioSystem write SetAudioSystem;
     100    property FileName: string read GetFileName write SetFileName;
     101    property Active: Boolean read GetActive write SetActive;
    62102    constructor Create(AOwner: TComponent); override;
    63103    destructor Destroy; override;
    64104  end;
    65105
    66   TPlayerClass = class of TPlayer;
     106  TPlayerClass = class of TMediaPlayerDriver;
    67107
    68108  { TAudioSystemManagerItem }
     
    71111    Name: string;
    72112    SystemClass: TAudioSystemClass;
    73     PlayerClass: TPlayerClass;
     113    Supported: Boolean;
    74114  end;
    75115
     
    78118  TAudioSystemManager = class(TComponent)
    79119    Systems: TObjectList; // TListObject<TAudioSystem>
    80     procedure Register(Name: string; SystemClass: TAudioSystemClass;
    81       PlayerClass: TPlayerClass);
     120    procedure Register(Name: string; SystemClass: TAudioSystemClass);
    82121    procedure FillStringList(StringList: TStrings);
    83     function SearchByName(Name: string): TAudioSystemManagerItem;
     122    function SearchByName(Name: string; SupportedOnly: Boolean = True): TAudioSystemManagerItem;
    84123    constructor Create(AOwner: TComponent); override;
    85124    destructor Destroy; override;
     
    90129  Mp3FileExt = '.mp3';
    91130
     131var
     132  DefaultAudioSystem: TAudioSystem;
     133
    92134resourcestring
    93135  SOpenOutputFailed = 'Failed opening audio output';
     136  SDefaultAudioSystemNotSet = 'Default audio system not set';
     137  SMediaPlayerDriverNotAssigned = 'Media player driver not assigned';
    94138
    95139
    96140implementation
     141
     142{ TMediaPlayer }
     143
     144function TMediaPlayer.GetLength: TDateTime;
     145begin
     146  CheckDriver;
     147  Result := Driver.Length;
     148end;
     149
     150procedure TMediaPlayer.CheckDriver;
     151begin
     152  if not Assigned(Driver) then
     153    raise Exception.Create(SMediaPlayerDriverNotAssigned);
     154end;
     155
     156function TMediaPlayer.GetActive: Boolean;
     157begin
     158  CheckDriver;
     159  Result := Driver.Active;
     160end;
     161
     162function TMediaPlayer.GetAudioSystem: TAudioSystem;
     163begin
     164  CheckDriver;
     165  Result := Driver.AudioSystem;
     166end;
     167
     168function TMediaPlayer.GetFileName: string;
     169begin
     170  CheckDriver;
     171  Result := Driver.FileName;
     172end;
     173
     174function TMediaPlayer.GetMuted: Boolean;
     175begin
     176  CheckDriver;
     177  Result := Driver.Muted;
     178end;
     179
     180function TMediaPlayer.GetPlaying: Boolean;
     181begin
     182  CheckDriver;
     183  Result := Driver.Playing;
     184end;
     185
     186function TMediaPlayer.GetPosition: TDateTime;
     187begin
     188  CheckDriver;
     189  Result := Driver.Position;
     190end;
     191
     192function TMediaPlayer.GetVolume: Real;
     193begin
     194  CheckDriver;
     195  Result := Driver.Volume;
     196end;
     197
     198procedure TMediaPlayer.SetActive(AValue: Boolean);
     199begin
     200  CheckDriver;
     201  Driver.Active := True;
     202end;
     203
     204procedure TMediaPlayer.SetAudioSystem(AValue: TAudioSystem);
     205var
     206  DriverClass: TMediaPlayerDriverClass;
     207begin
     208  FreeAndNil(Driver);
     209  DriverClass := AValue.GetMediaPlayerDriverClass;
     210  Driver := DriverClass.Create;
     211  Driver.AudioSystem := DefaultAudioSystem;
     212end;
     213
     214procedure TMediaPlayer.SetFileName(AValue: string);
     215begin
     216  CheckDriver;
     217  Driver.FileName := AValue;
     218end;
     219
     220procedure TMediaPlayer.SetMuted(AValue: Boolean);
     221begin
     222  CheckDriver;
     223  Driver.Muted := AValue;
     224end;
     225
     226procedure TMediaPlayer.SetPlaying(AValue: Boolean);
     227begin
     228  CheckDriver;
     229  Driver.Playing := AValue;
     230end;
     231
     232procedure TMediaPlayer.SetPosition(AValue: TDateTime);
     233begin
     234  CheckDriver;
     235  Driver.Position := AValue;
     236end;
     237
     238procedure TMediaPlayer.SetVolume(AValue: Real);
     239begin
     240  CheckDriver;
     241  Driver.Volume := AValue;
     242end;
     243
     244procedure TMediaPlayer.Play;
     245begin
     246  CheckDriver;
     247  Driver.Play;
     248end;
     249
     250procedure TMediaPlayer.Pause;
     251begin
     252  CheckDriver;
     253  Driver.Pause;
     254end;
     255
     256procedure TMediaPlayer.Stop;
     257begin
     258  CheckDriver;
     259  Driver.Stop;
     260end;
     261
     262procedure TMediaPlayer.Open;
     263begin
     264  CheckDriver;
     265  Driver.Open;
     266end;
     267
     268procedure TMediaPlayer.Close;
     269begin
     270  CheckDriver;
     271  Driver.Close;
     272end;
     273
     274constructor TMediaPlayer.Create(AOwner: TComponent);
     275begin
     276  inherited Create(AOwner);
     277  if not Assigned(DefaultAudioSystem) then
     278    raise Exception.Create(SDefaultAudioSystemNotSet);
     279  AudioSystem := DefaultAudioSystem;
     280end;
     281
     282destructor TMediaPlayer.Destroy;
     283begin
     284  FreeAndNil(Driver);
     285  inherited Destroy;
     286end;
    97287
    98288{ TAudioSystemManagerItem }
     
    111301end;
    112302
    113 function TAudioSystemManager.SearchByName(Name: string): TAudioSystemManagerItem;
     303function TAudioSystemManager.SearchByName(Name: string; SupportedOnly: Boolean = True):
     304  TAudioSystemManagerItem;
    114305var
    115306  I: Integer;
    116307begin
    117308  I := 0;
    118   while (I < Systems.Count) and (TAudioSystemManagerItem(Systems[I]).Name <> Name) do Inc(I);
     309  while (I < Systems.Count) and
     310    ((TAudioSystemManagerItem(Systems[I]).Name <> Name) or
     311    (not TAudioSystemManagerItem(Systems[I]).Supported and SupportedOnly)) do Inc(I);
    119312  if I < Systems.Count then Result := TAudioSystemManagerItem(Systems[I])
    120313    else Result := nil;
     
    122315
    123316procedure TAudioSystemManager.Register(Name: string;
    124   SystemClass: TAudioSystemClass; PlayerClass: TPlayerClass);
     317  SystemClass: TAudioSystemClass);
    125318var
    126319  NewItem: TAudioSystemManagerItem;
     
    129322  NewItem.Name := Name;
    130323  NewItem.SystemClass := SystemClass;
    131   NewItem.PlayerClass := PlayerClass;
    132324  Systems.Add(NewItem);
    133325end;
     
    145337end;
    146338
    147 { TPlayer }
    148 
    149 procedure TPlayer.SetActive(AValue: Boolean);
     339{ TMediaPlayerDriver }
     340
     341procedure TMediaPlayerDriver.SetActive(AValue: Boolean);
    150342begin
    151343  if FActive = AValue then Exit;
     
    153345end;
    154346
    155 procedure TPlayer.SetPlaying(AValue: Boolean);
     347procedure TMediaPlayerDriver.SetPlaying(AValue: Boolean);
    156348begin
    157349  if FPlaying = AValue then Exit;
     
    159351end;
    160352
    161 function TPlayer.GetMuted: Boolean;
     353function TMediaPlayerDriver.GetMuted: Boolean;
    162354begin
    163355  Result := False;
    164356end;
    165357
    166 procedure TPlayer.SetMuted(AValue: Boolean);
    167 begin
    168 end;
    169 
    170 function TPlayer.GetLength: TDateTime;
     358procedure TMediaPlayerDriver.SetMuted(AValue: Boolean);
     359begin
     360end;
     361
     362function TMediaPlayerDriver.GetLength: TDateTime;
    171363begin
    172364  Result := 0;
    173365end;
    174366
    175 function TPlayer.GetPosition: TDateTime;
     367function TMediaPlayerDriver.GetPosition: TDateTime;
    176368begin
    177369  Result := 0;
    178370end;
    179371
    180 function TPlayer.GetVolume: Real;
     372function TMediaPlayerDriver.GetVolume: Real;
    181373begin
    182374  Result := 0;
    183375end;
    184376
    185 procedure TPlayer.SetPosition(AValue: TDateTime);
    186 begin
    187 end;
    188 
    189 procedure TPlayer.SetVolume(AValue: Real);
    190 begin
    191 end;
    192 
    193 procedure TPlayer.SetFileName(AValue: string);
     377procedure TMediaPlayerDriver.SetPosition(AValue: TDateTime);
     378begin
     379end;
     380
     381procedure TMediaPlayerDriver.SetVolume(AValue: Real);
     382begin
     383end;
     384
     385procedure TMediaPlayerDriver.SetFileName(AValue: string);
    194386begin
    195387  if AValue = FFileName then Exit;
     
    199391end;
    200392
    201 procedure TPlayer.Play;
    202 begin
    203 end;
    204 
    205 procedure TPlayer.Pause;
    206 begin
    207 end;
    208 
    209 procedure TPlayer.Stop;
    210 begin
    211 end;
    212 
    213 procedure TPlayer.Open;
     393procedure TMediaPlayerDriver.Play;
     394begin
     395end;
     396
     397procedure TMediaPlayerDriver.Pause;
     398begin
     399end;
     400
     401procedure TMediaPlayerDriver.Stop;
     402begin
     403end;
     404
     405procedure TMediaPlayerDriver.Open;
    214406begin
    215407  Active := True;
    216408end;
    217409
    218 procedure TPlayer.Close;
     410procedure TMediaPlayerDriver.Close;
    219411begin
    220412  Active := False;
    221413end;
    222414
    223 constructor TPlayer.Create(AOwner: TComponent);
     415constructor TMediaPlayerDriver.Create;
    224416begin
    225417  inherited;
    226418end;
    227419
    228 destructor TPlayer.Destroy;
     420destructor TMediaPlayerDriver.Destroy;
    229421begin
    230422  Stop;
     
    257449end;
    258450
     451function TAudioSystem.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     452begin
     453  Result := TMediaPlayerDriver;
     454end;
     455
     456initialization
     457
     458DefaultAudioSystem := TAudioSystem.Create(nil);
     459
     460finalization
     461
     462FreeAndNil(DefaultAudioSystem);
     463
    259464end.
    260465
  • CoolAudio/Systems/WinAPI/UAudioSystemWindows.pas

    r352 r353  
    1111
    1212type
     13
     14  { TAudioSystemWindows }
     15
    1316  TAudioSystemWindows = class(TAudioSystem)
    1417  public
    1518    PlayerIndex: Integer;
     19    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    1620  end;
    1721
     
    2125  { TPlayerWindows }
    2226
    23   TPlayerWindows = class(TPlayer)
     27  TPlayerWindows = class(TMediaPlayerDriver)
    2428  private
    2529    FHandle: HWND;
     
    4751    procedure Pause; override;
    4852    procedure Stop; override;
    49     constructor Create(AOwner: TComponent); override;
     53    constructor Create; override;
    5054    destructor Destroy; override;
    5155    property DeviceType: TMPDeviceTypes read FDeviceType write SetDeviceType;
     
    6064
    6165implementation
     66
     67{ TAudioSystemWindows }
     68
     69function TAudioSystemWindows.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     70begin
     71  Result := TPlayerWindows;
     72end;
    6273
    6374{$IFDEF Windows}
     
    175186  Parm: TMCI_Generic_Parms;
    176187begin
    177   if FPlaying then begin
    178     CheckError(mciSendCommand(FDeviceID, mci_Pause, FFlags, Longint(@Parm)));
    179     FPlaying := False;
    180   end else begin
    181     CheckError(mciSendCommand(FDeviceID, mci_Resume, FFlags, Longint(@Parm)));
    182     FPlaying := True;
     188  if FActive then  begin
     189    if FPlaying then begin
     190      CheckError(mciSendCommand(FDeviceID, mci_Pause, FFlags, Longint(@Parm)));
     191      FPlaying := False;
     192    end else begin
     193      CheckError(mciSendCommand(FDeviceID, mci_Resume, FFlags, Longint(@Parm)));
     194      FPlaying := True;
     195    end;
    183196  end;
    184197end;
     
    188201  Parm: TMCI_Generic_Parms;
    189202begin
    190   if FPlaying then begin
     203  if FActive and FPlaying then begin
    191204    FFlags := 0;
    192205    if FUseNotify then
     
    206219end;
    207220
    208 constructor TPlayerWindows.Create(AOwner: TComponent);
     221constructor TPlayerWindows.Create;
    209222begin
    210223  inherited;
  • CoolAudio/Systems/mplayer/UAudioSystemMPlayer.pas

    r352 r353  
    3030    constructor Create(AOwner: TComponent); override;
    3131    destructor Destroy; override;
     32    function GetMediaPlayerDriverClass: TMediaPlayerDriverClass; override;
    3233    property Path: string read FPath write FPath;
    3334  end;
     
    3536  { TPlayerMPlayer }
    3637
    37   TPlayerMPlayer = class(TPlayer)
     38  TPlayerMPlayer = class(TMediaPlayerDriver)
    3839  private
    3940    FProcess: TProcess;
     
    5354    procedure Pause; override;
    5455    procedure Stop; override;
    55     constructor Create(AOwner: TComponent); override;
     56    constructor Create; override;
    5657    destructor Destroy; override;
    5758  end;
     
    127128end;
    128129
     130function TAudioSystemMPlayer.GetMediaPlayerDriverClass: TMediaPlayerDriverClass;
     131begin
     132  Result := TPlayerMPlayer;
     133end;
     134
    129135{ TPlayerMPlayer }
    130136
     
    291297end;
    292298
    293 constructor TPlayerMPlayer.Create(AOwner: TComponent);
     299constructor TPlayerMPlayer.Create;
    294300begin
    295301  inherited;
  • CoolAudio/UCoolAudio.pas

    r352 r353  
    1818  AudioSystemManager: TAudioSystemManager;
    1919
     20procedure Register;
     21
     22
    2023implementation
     24
     25uses
     26  UPlayList;
     27
     28procedure Register;
     29begin
     30  RegisterComponents('CoolAudio', [TMediaPlayer, TPlayList]);
     31end;
    2132
    2233initialization
    2334
    2435AudioSystemManager := TAudioSystemManager.Create(nil);
    25 {$IFDEF AudioSystemWindows}AudioSystemManager.Register('Windows', TAudioSystemWindows, TPlayerWindows);{$ENDIF}
    26 {$IFDEF AudioSystemMPlayer}AudioSystemManager.Register('MPlayer', TAudioSystemMPlayer, TPlayerMPlayer);{$ENDIF}
    27 {$IFDEF AudioSystemFMOD}AudioSystemManager.Register('FMOD', TAudioSystemFMOD, TPlayerFMOD);{$ENDIF}
    28 {$IFDEF AudioSystemMAD}AudioSystemManager.Register('MAD', TAudioSystemMAD, TPlayerMAD);{$ENDIF}
    29 {$IFDEF AudioSystemDSP}AudioSystemManager.Register('DSP', TAudioSystemDSP, TPlayerDSP);{$ENDIF}
     36{$IFDEF AudioSystemWindows}AudioSystemManager.Register('Windows', TAudioSystemWindows);{$ENDIF}
     37{$IFDEF AudioSystemMPlayer}AudioSystemManager.Register('MPlayer', TAudioSystemMPlayer);{$ENDIF}
     38{$IFDEF AudioSystemFMOD}AudioSystemManager.Register('FMOD', TAudioSystemFMOD);{$ENDIF}
     39{$IFDEF AudioSystemMAD}AudioSystemManager.Register('MAD', TAudioSystemMAD);{$ENDIF}
     40{$IFDEF AudioSystemDSP}AudioSystemManager.Register('DSP', TAudioSystemDSP);{$ENDIF}
    3041
    3142finalization
  • CoolAudio/UPlaylist.pas

    r352 r353  
    1313  end;
    1414
    15   { TPlaylist }
     15  { TPlayList }
    1616
    17   TPlaylist = class(TComponent)
     17  TPlayList = class(TComponent)
     18  private
     19    FRandomOrder: Boolean;
     20    FRepeatInfinitely: Boolean;
    1821  public
    19     Player: TPlayer;
    20     Items: TObjectList; // TObjectList<TPlaylistItem>
    21     RandomOrder: Boolean;
    22     RepeatInfinitely: Boolean;
    2322    CurrentIndex: Integer;
    2423    procedure AddFile(FileName: string);
     
    2928    constructor Create(AOwner: TComponent);
    3029    destructor Destroy; override;
     30  published
     31    Player: TMediaPlayer;
     32    Items: TObjectList; // TObjectList<TPlaylistItem>
     33    property RandomOrder: Boolean read FRandomOrder write FRandomOrder;
     34    property RepeatInfinitely: Boolean read FRepeatInfinitely
     35      write FRepeatInfinitely;
    3136  end;
    3237
     
    3439implementation
    3540
    36 { TPlaylist }
     41{ TPlayList }
    3742
    38 procedure TPlaylist.AddFile(FileName: string);
     43procedure TPlayList.AddFile(FileName: string);
    3944var
    4045  NewItem: TPlaylistItem;
     
    4550end;
    4651
    47 procedure TPlaylist.Shuffle;
     52procedure TPlayList.Shuffle;
    4853begin
    4954
    5055end;
    5156
    52 procedure TPlaylist.Play;
     57procedure TPlayList.Play;
    5358begin
    5459  Player.FileName := TPlaylistItem(Items[CurrentIndex]).FileName;
     
    5661end;
    5762
    58 procedure TPlaylist.PlayNext;
     63procedure TPlayList.PlayNext;
    5964begin
    6065  Inc(CurrentIndex);
     
    6772end;
    6873
    69 procedure TPlaylist.PlayPrevious;
     74procedure TPlayList.PlayPrevious;
    7075begin
    7176  Dec(CurrentIndex);
     
    7681end;
    7782
    78 constructor TPlaylist.Create(AOwner: TComponent);
     83constructor TPlayList.Create(AOwner: TComponent);
    7984begin
    8085  inherited;
     
    8287end;
    8388
    84 destructor TPlaylist.Destroy;
     89destructor TPlayList.Destroy;
    8590begin
    8691  Items.Free;
Note: See TracChangeset for help on using the changeset viewer.