Changeset 352 for CoolAudio


Ignore:
Timestamp:
Apr 23, 2012, 1:32:52 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Supported AudioSystems is configured using include config file.
  • Added: Added playlist demo to Demo player.
  • Added: Working DSP audiosystem for playing using linux /dev/dsp device. DSP backend support only WAV file so far.
Location:
CoolAudio
Files:
6 added
3 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • CoolAudio/CoolAudio.lpk

    r349 r352  
    77      <Version Value="11"/>
    88      <SearchPaths>
    9         <OtherUnitFiles Value="fmodintf;Systems;Systems/DSP"/>
     9        <OtherUnitFiles Value="fmodintf;Systems;Systems/DSP;Systems/FMOD;Systems/MAD;Systems/WinAPI;Systems/mplayer"/>
    1010        <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    1111      </SearchPaths>
     
    2222    <License Value="GNU/GPL"/>
    2323    <Version Minor="1"/>
    24     <Files Count="8">
     24    <Files Count="10">
    2525      <Item1>
    2626        <Filename Value="UCoolAudio.pas"/>
     
    3232      </Item2>
    3333      <Item3>
    34         <Filename Value="Systems/UAudioSystemFMOD.pas"/>
    35         <UnitName Value="UAudioSystemFMOD"/>
     34        <Filename Value="Systems/UAudioSystem.pas"/>
     35        <UnitName Value="UAudioSystem"/>
    3636      </Item3>
    3737      <Item4>
    38         <Filename Value="Systems/UAudioSystemMPlayer.pas"/>
    39         <UnitName Value="UAudioSystemMPlayer"/>
     38        <Filename Value="Systems/DSP/UAudioSystemDSP.pas"/>
     39        <UnitName Value="UAudioSystemDSP"/>
    4040      </Item4>
    4141      <Item5>
    42         <Filename Value="Systems/UAudioSystemWindows.pas"/>
    43         <UnitName Value="UAudioSystemWindows"/>
     42        <Filename Value="Systems/FMOD/UAudioSystemFMOD.pas"/>
     43        <UnitName Value="UAudioSystemFMOD"/>
    4444      </Item5>
    4545      <Item6>
    46         <Filename Value="Systems/UAudioSystem.pas"/>
    47         <UnitName Value="UAudioSystem"/>
     46        <Filename Value="Systems/MAD/UAudioSystemMAD.pas"/>
     47        <UnitName Value="UAudioSystemMAD"/>
    4848      </Item6>
    4949      <Item7>
    50         <Filename Value="Systems/UAudioSystemMAD.pas"/>
    51         <UnitName Value="UAudioSystemMAD"/>
     50        <Filename Value="Systems/WinAPI/UAudioSystemWindows.pas"/>
     51        <UnitName Value="UAudioSystemWindows"/>
    5252      </Item7>
    5353      <Item8>
    54         <Filename Value="Systems/DSP/UAudioSystemDSP.pas"/>
    55         <UnitName Value="UAudioSystemDSP"/>
     54        <Filename Value="Systems/mplayer/UAudioSystemMPlayer.pas"/>
     55        <UnitName Value="UAudioSystemMPlayer"/>
    5656      </Item8>
     57      <Item9>
     58        <Filename Value="Systems/UWavFile.pas"/>
     59        <UnitName Value="UWavFile"/>
     60      </Item9>
     61      <Item10>
     62        <Filename Value="UCoolAudioConfig.inc"/>
     63      </Item10>
    5764    </Files>
    5865    <Type Value="RunAndDesignTime"/>
  • CoolAudio/CoolAudio.pas

    r349 r352  
    88
    99uses
    10   UCoolAudio, UPlaylist, UAudioSystemFMOD, UAudioSystemMPlayer,
    11   UAudioSystemWindows, UAudioSystem, UAudioSystemMAD, UAudioSystemDSP,
     10  UCoolAudio, UPlaylist, UAudioSystem, UAudioSystemDSP, UAudioSystemFMOD,
     11  UAudioSystemMAD, UAudioSystemWindows, UAudioSystemMPlayer, UWavFile,
    1212  LazarusPackageIntf;
    1313
  • CoolAudio/Demo/Demo.lpi

    r285 r352  
    3838      </Item2>
    3939    </RequiredPackages>
    40     <Units Count="25">
     40    <Units Count="31">
    4141      <Unit0>
    4242        <Filename Value="Demo.lpr"/>
    4343        <IsPartOfProject Value="True"/>
    4444        <UnitName Value="Demo"/>
    45         <EditorIndex Value="11"/>
     45        <EditorIndex Value="14"/>
    4646        <WindowIndex Value="0"/>
    4747        <TopLine Value="1"/>
    48         <CursorPos X="19" Y="10"/>
    49         <UsageCount Value="80"/>
     48        <CursorPos X="34" Y="10"/>
     49        <UsageCount Value="83"/>
    5050        <Loaded Value="True"/>
    5151      </Unit0>
    5252      <Unit1>
    53         <Filename Value="UMainForm.pas"/>
     53        <Filename Value="UFormMain.pas"/>
    5454        <IsPartOfProject Value="True"/>
    55         <ComponentName Value="MainForm"/>
     55        <ComponentName Value="FormMain"/>
     56        <HasResources Value="True"/>
    5657        <ResourceBaseClass Value="Form"/>
    57         <UnitName Value="UMainForm"/>
     58        <UnitName Value="UFormMain"/>
    5859        <EditorIndex Value="0"/>
    5960        <WindowIndex Value="0"/>
    60         <TopLine Value="97"/>
    61         <CursorPos X="26" Y="95"/>
    62         <UsageCount Value="80"/>
     61        <TopLine Value="142"/>
     62        <CursorPos X="28" Y="150"/>
     63        <UsageCount Value="83"/>
    6364        <Loaded Value="True"/>
    6465        <LoadedDesigner Value="True"/>
     
    6768        <Filename Value="../UCoolAudio.pas"/>
    6869        <UnitName Value="UCoolAudio"/>
    69         <EditorIndex Value="6"/>
     70        <EditorIndex Value="12"/>
    7071        <WindowIndex Value="0"/>
    7172        <TopLine Value="27"/>
    7273        <CursorPos X="20" Y="19"/>
    73         <UsageCount Value="34"/>
     74        <UsageCount Value="35"/>
    7475        <Loaded Value="True"/>
    7576      </Unit2>
     
    7778        <Filename Value="../Systems/UAudioSystemFMOD.pas"/>
    7879        <UnitName Value="UAudioSystemFMOD"/>
    79         <EditorIndex Value="9"/>
    8080        <WindowIndex Value="0"/>
    8181        <TopLine Value="47"/>
    8282        <CursorPos X="1" Y="61"/>
    8383        <UsageCount Value="39"/>
    84         <Loaded Value="True"/>
    8584      </Unit3>
    8685      <Unit4>
    8786        <Filename Value="../UPlaylist.pas"/>
    8887        <UnitName Value="UPlaylist"/>
    89         <WindowIndex Value="0"/>
    90         <TopLine Value="1"/>
    91         <CursorPos X="29" Y="8"/>
    92         <UsageCount Value="16"/>
     88        <EditorIndex Value="2"/>
     89        <WindowIndex Value="0"/>
     90        <TopLine Value="10"/>
     91        <CursorPos X="20" Y="26"/>
     92        <UsageCount Value="17"/>
     93        <Loaded Value="True"/>
    9394      </Unit4>
    9495      <Unit5>
    9596        <Filename Value="../fmodintf/fmoddyn.pas"/>
    9697        <UnitName Value="fmoddyn"/>
    97         <EditorIndex Value="10"/>
    9898        <WindowIndex Value="0"/>
    9999        <TopLine Value="579"/>
    100100        <CursorPos X="19" Y="593"/>
    101101        <UsageCount Value="34"/>
    102         <Loaded Value="True"/>
    103102      </Unit5>
    104103      <Unit6>
     
    113112        <Filename Value="../Systems/UAudioSystemMPlayer.pas"/>
    114113        <UnitName Value="UAudioSystemMPlayer"/>
    115         <EditorIndex Value="7"/>
    116114        <WindowIndex Value="0"/>
    117115        <TopLine Value="243"/>
    118116        <CursorPos X="114" Y="258"/>
    119117        <UsageCount Value="39"/>
    120         <Loaded Value="True"/>
    121118      </Unit7>
    122119      <Unit8>
     
    131128        <Filename Value="../Systems/UAudioSystem.pas"/>
    132129        <UnitName Value="UAudioSystem"/>
    133         <EditorIndex Value="5"/>
    134         <WindowIndex Value="0"/>
    135         <TopLine Value="177"/>
    136         <CursorPos X="34" Y="188"/>
    137         <UsageCount Value="49"/>
     130        <EditorIndex Value="11"/>
     131        <WindowIndex Value="0"/>
     132        <TopLine Value="217"/>
     133        <CursorPos X="1" Y="230"/>
     134        <UsageCount Value="50"/>
    138135        <Loaded Value="True"/>
    139136      </Unit9>
     
    186183      <Unit16>
    187184        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/lcl/include/control.inc"/>
    188         <EditorIndex Value="1"/>
     185        <EditorIndex Value="8"/>
    189186        <WindowIndex Value="0"/>
    190187        <TopLine Value="2275"/>
    191188        <CursorPos X="1" Y="2287"/>
    192         <UsageCount Value="33"/>
     189        <UsageCount Value="34"/>
    193190        <Loaded Value="True"/>
    194191      </Unit16>
     
    219216        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/packages/winunits-base/src/mmsystem.pp"/>
    220217        <UnitName Value="mmsystem"/>
    221         <EditorIndex Value="3"/>
     218        <EditorIndex Value="9"/>
    222219        <WindowIndex Value="0"/>
    223220        <TopLine Value="1781"/>
    224221        <CursorPos X="52" Y="1791"/>
    225         <UsageCount Value="35"/>
     222        <UsageCount Value="36"/>
    226223        <Loaded Value="True"/>
    227224      </Unit20>
     
    229226        <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    230227        <UnitName Value="UAudioSystemWindows"/>
    231         <IsVisibleTab Value="True"/>
    232         <EditorIndex Value="2"/>
    233228        <WindowIndex Value="0"/>
    234229        <TopLine Value="212"/>
    235230        <CursorPos X="50" Y="224"/>
    236231        <UsageCount Value="45"/>
    237         <Loaded Value="True"/>
    238232      </Unit21>
    239233      <Unit22>
     
    246240      <Unit23>
    247241        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/objpas/sysutils/osutilsh.inc"/>
    248         <EditorIndex Value="8"/>
     242        <EditorIndex Value="13"/>
    249243        <WindowIndex Value="0"/>
    250244        <TopLine Value="23"/>
    251245        <CursorPos X="10" Y="23"/>
    252         <UsageCount Value="33"/>
     246        <UsageCount Value="34"/>
    253247        <Loaded Value="True"/>
    254248      </Unit23>
    255249      <Unit24>
    256250        <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/win/wininc/base.inc"/>
    257         <EditorIndex Value="4"/>
     251        <EditorIndex Value="10"/>
    258252        <WindowIndex Value="0"/>
    259253        <TopLine Value="148"/>
    260254        <CursorPos X="6" Y="159"/>
     255        <UsageCount Value="11"/>
     256        <Loaded Value="True"/>
     257      </Unit24>
     258      <Unit25>
     259        <Filename Value="UFormPlaylist.pas"/>
     260        <IsPartOfProject Value="True"/>
     261        <ComponentName Value="FormPlaylist"/>
     262        <ResourceBaseClass Value="Form"/>
     263        <UnitName Value="UFormPlaylist"/>
     264        <EditorIndex Value="3"/>
     265        <WindowIndex Value="0"/>
     266        <TopLine Value="155"/>
     267        <CursorPos X="28" Y="168"/>
     268        <UsageCount Value="23"/>
     269        <Loaded Value="True"/>
     270        <LoadedDesigner Value="True"/>
     271      </Unit25>
     272      <Unit26>
     273        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     274        <UnitName Value="UAudioSystemWindows"/>
     275        <EditorIndex Value="5"/>
     276        <WindowIndex Value="0"/>
     277        <TopLine Value="62"/>
     278        <CursorPos X="35" Y="75"/>
     279        <UsageCount Value="11"/>
     280        <Loaded Value="True"/>
     281      </Unit26>
     282      <Unit27>
     283        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/customform.inc"/>
     284        <EditorIndex Value="1"/>
     285        <WindowIndex Value="0"/>
     286        <TopLine Value="934"/>
     287        <CursorPos X="1" Y="947"/>
     288        <UsageCount Value="11"/>
     289        <Loaded Value="True"/>
     290      </Unit27>
     291      <Unit28>
     292        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/listitem.inc"/>
     293        <EditorIndex Value="4"/>
     294        <WindowIndex Value="0"/>
     295        <TopLine Value="725"/>
     296        <CursorPos X="1" Y="738"/>
    261297        <UsageCount Value="10"/>
    262298        <Loaded Value="True"/>
    263       </Unit24>
     299      </Unit28>
     300      <Unit29>
     301        <Filename Value="../UCoolAudioConfig.inc"/>
     302        <EditorIndex Value="6"/>
     303        <WindowIndex Value="0"/>
     304        <TopLine Value="1"/>
     305        <CursorPos X="1" Y="5"/>
     306        <UsageCount Value="10"/>
     307        <Loaded Value="True"/>
     308      </Unit29>
     309      <Unit30>
     310        <Filename Value="../Systems/FMOD/fmoddyn.pas"/>
     311        <UnitName Value="fmoddyn"/>
     312        <IsVisibleTab Value="True"/>
     313        <EditorIndex Value="7"/>
     314        <WindowIndex Value="0"/>
     315        <TopLine Value="588"/>
     316        <CursorPos X="5" Y="589"/>
     317        <UsageCount Value="10"/>
     318        <Loaded Value="True"/>
     319      </Unit30>
    264320    </Units>
    265     <JumpHistory Count="30" HistoryIndex="27">
     321    <JumpHistory Count="30" HistoryIndex="29">
    266322      <Position1>
    267         <Filename Value="UMainForm.pas"/>
    268         <Caret Line="115" Column="66" TopLine="96"/>
     323        <Filename Value="UFormPlaylist.pas"/>
     324        <Caret Line="97" Column="25" TopLine="90"/>
    269325      </Position1>
    270326      <Position2>
    271         <Filename Value="UMainForm.pas"/>
    272         <Caret Line="85" Column="13" TopLine="83"/>
     327        <Filename Value="UFormPlaylist.pas"/>
     328        <Caret Line="96" Column="3" TopLine="94"/>
    273329      </Position2>
    274330      <Position3>
    275         <Filename Value="../Systems/UAudioSystem.pas"/>
    276         <Caret Line="59" Column="58" TopLine="47"/>
     331        <Filename Value="UFormPlaylist.pas"/>
     332        <Caret Line="161" Column="24" TopLine="142"/>
    277333      </Position3>
    278334      <Position4>
    279         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    280         <Caret Line="228" Column="55" TopLine="215"/>
     335        <Filename Value="UFormPlaylist.pas"/>
     336        <Caret Line="146" Column="19" TopLine="144"/>
    281337      </Position4>
    282338      <Position5>
    283         <Filename Value="../Systems/UAudioSystemMPlayer.pas"/>
    284         <Caret Line="258" Column="114" TopLine="243"/>
     339        <Filename Value="UFormPlaylist.pas"/>
     340        <Caret Line="161" Column="20" TopLine="155"/>
    285341      </Position5>
    286342      <Position6>
    287         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    288         <Caret Line="74" Column="6" TopLine="62"/>
     343        <Filename Value="UFormMain.pas"/>
     344        <Caret Line="77" Column="53" TopLine="67"/>
    289345      </Position6>
    290346      <Position7>
    291         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    292         <Caret Line="228" Column="1" TopLine="219"/>
     347        <Filename Value="UFormMain.pas"/>
     348        <Caret Line="136" Column="1" TopLine="132"/>
    293349      </Position7>
    294350      <Position8>
    295         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    296         <Caret Line="230" Column="1" TopLine="219"/>
     351        <Filename Value="UFormPlaylist.pas"/>
     352        <Caret Line="151" Column="30" TopLine="145"/>
    297353      </Position8>
    298354      <Position9>
    299         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    300         <Caret Line="232" Column="1" TopLine="219"/>
     355        <Filename Value="UFormMain.pas"/>
     356        <Caret Line="136" Column="1" TopLine="132"/>
    301357      </Position9>
    302358      <Position10>
    303         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    304         <Caret Line="228" Column="1" TopLine="219"/>
     359        <Filename Value="UFormMain.pas"/>
     360        <Caret Line="150" Column="28" TopLine="142"/>
    305361      </Position10>
    306362      <Position11>
    307         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    308         <Caret Line="230" Column="1" TopLine="219"/>
     363        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     364        <Caret Line="198" Column="7" TopLine="186"/>
    309365      </Position11>
    310366      <Position12>
    311         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    312         <Caret Line="228" Column="1" TopLine="219"/>
     367        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     368        <Caret Line="190" Column="1" TopLine="185"/>
    313369      </Position12>
    314370      <Position13>
    315         <Filename Value="UMainForm.pas"/>
    316         <Caret Line="86" Column="14" TopLine="83"/>
     371        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     372        <Caret Line="191" Column="1" TopLine="185"/>
    317373      </Position13>
    318374      <Position14>
    319         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    320         <Caret Line="228" Column="1" TopLine="215"/>
     375        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     376        <Caret Line="192" Column="1" TopLine="185"/>
    321377      </Position14>
    322378      <Position15>
    323         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    324         <Caret Line="229" Column="1" TopLine="215"/>
     379        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     380        <Caret Line="196" Column="1" TopLine="185"/>
    325381      </Position15>
    326382      <Position16>
    327         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    328         <Caret Line="227" Column="42" TopLine="215"/>
     383        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     384        <Caret Line="197" Column="1" TopLine="185"/>
    329385      </Position16>
    330386      <Position17>
    331         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    332         <Caret Line="228" Column="1" TopLine="215"/>
     387        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     388        <Caret Line="202" Column="1" TopLine="185"/>
    333389      </Position17>
    334390      <Position18>
    335         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    336         <Caret Line="226" Column="39" TopLine="215"/>
     391        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     392        <Caret Line="204" Column="19" TopLine="186"/>
    337393      </Position18>
    338394      <Position19>
    339         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    340         <Caret Line="74" Column="1" TopLine="63"/>
     395        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     396        <Caret Line="75" Column="1" TopLine="62"/>
    341397      </Position19>
    342398      <Position20>
    343         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    344         <Caret Line="228" Column="47" TopLine="217"/>
     399        <Filename Value="UFormPlaylist.pas"/>
     400        <Caret Line="168" Column="59" TopLine="156"/>
    345401      </Position20>
    346402      <Position21>
    347         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    348         <Caret Line="74" Column="1" TopLine="63"/>
     403        <Filename Value="../../../../Lazarus/1.1_2.6.0/lcl/include/listitem.inc"/>
     404        <Caret Line="738" Column="1" TopLine="725"/>
    349405      </Position21>
    350406      <Position22>
    351         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    352         <Caret Line="255" Column="1" TopLine="217"/>
     407        <Filename Value="UFormPlaylist.pas"/>
     408        <Caret Line="168" Column="28" TopLine="155"/>
    353409      </Position22>
    354410      <Position23>
    355         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    356         <Caret Line="228" Column="1" TopLine="217"/>
     411        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     412        <Caret Line="75" Column="1" TopLine="62"/>
    357413      </Position23>
    358414      <Position24>
    359         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    360         <Caret Line="255" Column="37" TopLine="238"/>
     415        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     416        <Caret Line="202" Column="1" TopLine="183"/>
    361417      </Position24>
    362418      <Position25>
    363         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    364         <Caret Line="228" Column="1" TopLine="209"/>
     419        <Filename Value="../Systems/UAudioSystem.pas"/>
     420        <Caret Line="231" Column="39" TopLine="217"/>
    365421      </Position25>
    366422      <Position26>
    367         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    368         <Caret Line="230" Column="1" TopLine="211"/>
     423        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     424        <Caret Line="216" Column="1" TopLine="203"/>
    369425      </Position26>
    370426      <Position27>
    371         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    372         <Caret Line="74" Column="1" TopLine="63"/>
     427        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     428        <Caret Line="202" Column="1" TopLine="189"/>
    373429      </Position27>
    374430      <Position28>
    375431        <Filename Value="../Systems/UAudioSystem.pas"/>
    376         <Caret Line="182" Column="5" TopLine="177"/>
     432        <Caret Line="230" Column="1" TopLine="217"/>
    377433      </Position28>
    378434      <Position29>
    379         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    380         <Caret Line="228" Column="1" TopLine="212"/>
     435        <Filename Value="../Systems/WinAPI/UAudioSystemWindows.pas"/>
     436        <Caret Line="202" Column="1" TopLine="189"/>
    381437      </Position29>
    382438      <Position30>
    383         <Filename Value="../Systems/UAudioSystemWindows.pas"/>
    384         <Caret Line="75" Column="1" TopLine="64"/>
     439        <Filename Value="../UCoolAudioConfig.inc"/>
     440        <Caret Line="5" Column="1" TopLine="1"/>
    385441      </Position30>
    386442    </JumpHistory>
    387443  </ProjectOptions>
    388444  <CompilerOptions>
    389     <Version Value="10"/>
     445    <Version Value="11"/>
    390446    <Target>
    391447      <Filename Value="Demo"/>
     
    397453    <Linking>
    398454      <Debugging>
    399         <GenerateDebugInfo Value="True"/>
     455        <DebugInfoType Value="dsStabs"/>
    400456      </Debugging>
    401457      <Options>
  • CoolAudio/Demo/Demo.lpr

    r280 r352  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UMainForm;
     10  Forms, UFormMain, UFormPlaylist;
    1111
    1212{$R *.res}
     
    1515  RequireDerivedFormResource := True;
    1616  Application.Initialize;
    17   Application.CreateForm(TMainForm, MainForm);
     17  Application.CreateForm(TFormMain, FormMain);
     18  Application.CreateForm(TFormPlaylist, FormPlaylist);
    1819  Application.Run;
    1920end.
  • CoolAudio/Systems/DSP/UAudioSystemDSP.pas

    r348 r352  
    11unit UAudioSystemDSP;
    22
     3{$I UCoolAudioConfig.inc}
    34{$mode delphi}{$H+}
    45
    56interface
    67
    7 //{$IFDEF AudioSystemDSP}
     8{$IFDEF AudioSystemDSP}
    89uses
    9   Classes, SysUtils, UAudioSystem, BaseUnix;
     10  Classes, SysUtils, UAudioSystem, BaseUnix, UWavFile, StdCtrls, ExtCtrls;
    1011
    1112type
     
    1718    FDeviceId: Integer;
    1819  public
     20    Channels: Integer;
     21    SampleRate: Integer; // Hz
     22    BitsPerSample: Integer;
    1923    procedure OpenDevice;
     24    procedure CloseDevice;
     25    constructor Create(AOwner: TComponent); override;
     26    destructor Destroy; override;
    2027  end;
    2128
     
    2330
    2431  TPlayerDSP = class(TPlayer)
     32  private
     33    FTimer: TTimer;
     34    procedure TimerExecute(Sender: TObject);
    2535  public
     36    WavFile: TWAVFile;
    2637    procedure Play; override;
    2738    procedure Pause; override;
    2839    procedure Stop; override;
     40    procedure Open; override;
     41    procedure Close; override;
     42    constructor Create(AOwner: TComponent); override;
     43    destructor Destroy; override;
    2944  end;
    3045
    31 //{$ENDIF}
     46const
     47  BUFFERLEN = 1024;
     48
     49const
     50  { Values obtained from a C program - These are complex (!) C macros }
     51  SNDCTL_DSP_STEREO = -1073459197;
     52  SNDCTL_DSP_RESET = 20480;
     53  SNDCTL_DSP_SYNC = 20481;
     54  SOUND_PCM_WRITE_BITS = -1073459195;
     55  SOUND_PCM_WRITE_CHANNELS = -1073459194;
     56  SOUND_PCM_WRITE_RATE = -1073459198;
     57
     58resourcestring
     59  SPlaying = 'Playing : ';
     60  SErrChannels = 'Error : Number of channels not supported: ';
     61  SErrOpeningDevice = 'Could not open sound device';
     62  SErrSettingStereo = 'Could not set stereo';
     63  SErrResettingDevice = 'Could not reset DSP device';
     64  SErrSetWriteBits = 'Could not set write bits to 16';
     65  SErrSetChannels = 'Could not set channels';
     66  SErrSetSampleRate = 'Could not set sync mode';
     67  SErrSetSyncMode = 'Could not set sync mode';
     68
     69{$ENDIF}
    3270
    3371implementation
     72
     73{$IFDEF AudioSystemDSP}
    3474
    3575{ TAudioSystemDSP }
     
    3777procedure TAudioSystemDSP.OpenDevice;
    3878var
    39   fd, Stereo, Temp, Error: Longint;
     79  Stereo, Error: Longint;
    4080begin
    41   fd := fpOpen('/dev/dsp', O_WRONLY, 0);
    42   if fd < 0 then
    43     PlayError(SErrOpeningDevice);
     81  Write('Openning /dev/dsp');
     82  FDeviceId := fpOpen('/dev/dsp', O_WRONLY, 0);
     83  if FDeviceId < 0 then
     84    raise Exception.Create(SErrOpeningDevice);
    4485  Stereo := 0;
    45   if not (FpIOCtl(fd, SNDCTL_DSP_STEREO, @Stereo) <> -1) then
    46     PlayError(SErrSettingStereo);
    47   if not (FpIOCtl(fd, SNDCTL_DSP_RESET, nil) <> -1) then
    48     PlayError(SErrResettingDevice);
    49   Temp := 16;
    50   if not (FpIOCtl(fd, SOUND_PCM_WRITE_BITS, @Temp) <> -1) then
    51     PlayError(SErrSetWriteBits);
    52   if not (FpIOCtl(fd, SOUND_PCM_WRITE_CHANNELS, @Channels) <> -1) then
    53     PlayError(SErrSetChannels);
    54   if not (FpIOCtl(fd, SOUND_PCM_WRITE_RATE, @SampleRate) <> -1) then
    55     PlayError(SErrSetSampleRate);
    56   if not (FpIOCtl(fd, SNDCTL_DSP_SYNC, nil) <> -1) then
    57     PlayError(SErrSetSyncMode);
    58   FDeviceId := Fd;
     86  if not (FpIOCtl(FDeviceId, SNDCTL_DSP_STEREO, @Stereo) <> -1) then
     87    raise Exception.Create(SErrSettingStereo);
     88  if not (FpIOCtl(FDeviceId, SNDCTL_DSP_RESET, nil) <> -1) then
     89    raise Exception.Create(SErrResettingDevice);
     90  if not (FpIOCtl(FDeviceId, SOUND_PCM_WRITE_BITS, @BitsPerSample) <> -1) then
     91    raise Exception.Create(SErrSetWriteBits);
     92  if not (FpIOCtl(FDeviceId, SOUND_PCM_WRITE_CHANNELS, @Channels) <> -1) then
     93    raise Exception.Create(SErrSetChannels);
     94  if not (FpIOCtl(FDeviceId, SOUND_PCM_WRITE_RATE, @SampleRate) <> -1) then
     95    raise Exception.Create(SErrSetSampleRate);
     96  if not (FpIOCtl(FDeviceId, SNDCTL_DSP_SYNC, nil) <> -1) then
     97    raise Exception.Create(SErrSetSyncMode);
     98  WriteLn(' device: ' + IntToStr(FDeviceId));
    5999end;
    60100
    61 //{$IFDEF AudioSystemDSP}
     101procedure TAudioSystemDSP.CloseDevice;
     102begin
     103  if FDeviceId >= 0 then FpClose(FDeviceId);
     104end;
     105
     106constructor TAudioSystemDSP.Create(AOwner: TComponent);
     107begin
     108  inherited;
     109  BitsPerSample := 16;
     110  Channels := 2;
     111  SampleRate := 44000;
     112end;
     113
     114destructor TAudioSystemDSP.Destroy;
     115begin
     116  inherited Destroy;
     117end;
    62118
    63119{ TPlayerMAD }
    64120
     121procedure TPlayerDSP.TimerExecute(Sender: TObject);
     122var
     123  Buffer: array of Byte;
     124  Size: Integer;
     125begin
     126  SetLength(Buffer, 10000);
     127  Size := WavFile.SourceFile.Read(PByte(Buffer)^, System.Length(Buffer));
     128  Write('Buf: ' + IntToStr(Size) + ', ');
     129  fpWrite(TAudioSystemDSP(AudioSystem).FDeviceId, PByte(Buffer)^, Size);
     130  FTimer.Interval := 100;
     131end;
     132
    65133procedure TPlayerDSP.Play;
    66134begin
    67   inherited Play;
    68 
     135  WriteLn('Stop');
     136  Stop;
     137  TAudioSystemDSP(AudioSystem).SampleRate := WavFile.SampleRate;
     138  TAudioSystemDSP(AudioSystem).Channels := WavFile.ChannelModeID;
     139  TAudioSystemDSP(AudioSystem).BitsPerSample := WavFile.BitsPerSample;
     140  TAudioSystemDSP(AudioSystem).OpenDevice;
     141  WriteLn('seek');
     142  WavFile.SourceFile.Seek(SizeOf(TWAVRecord), soFromBeginning);
     143  while WavFile.SourceFile.Position < WavFile.SourceFile.Size do
     144    TimerExecute(nil);
     145  WriteLn('int');
     146  FTimer.Interval := 10;
     147  FTimer.OnTimer := TimerExecute;
     148  WriteLn('ena');
     149  //FTimer.Enabled := True;
     150  WriteLn('true');
    69151end;
    70152
    71153procedure TPlayerDSP.Pause;
    72154begin
    73   inherited Pause;
     155  if FActive then FTimer.Enabled := not FTimer.Enabled;
    74156end;
    75157
     
    77159begin
    78160  inherited Stop;
     161  FTimer.Enabled := False;
     162  TAudioSystemDSP(AudioSystem).CloseDevice;
    79163end;
    80164
    81 //{$ENDIF}
     165procedure TPlayerDSP.Open;
     166begin
     167  inherited;
     168  WavFile.OpenFile(FFileName);
     169end;
    82170
     171procedure TPlayerDSP.Close;
     172begin
     173  inherited Close;
     174end;
     175
     176constructor TPlayerDSP.Create(AOwner: TComponent);
     177begin
     178  inherited;
     179  WavFile := TWAVFile.Create;
     180  FTimer := TTimer.Create(nil);
     181end;
     182
     183destructor TPlayerDSP.Destroy;
     184begin
     185  FreeAndNil(FTimer);
     186  FreeAndNil(WavFile);
     187  inherited Destroy;
     188end;
     189
     190{$ENDIF}
    83191
    84192end.
    85 
  • CoolAudio/Systems/FMOD/UAudioSystemFMOD.pas

    r351 r352  
    11unit UAudioSystemFMOD;
    22
    3 {$mode objfpc}{$H+}
     3{$I UCoolAudioConfig.inc}
     4{$mode delphi}{$H+}
    45
    56interface
    67
     8{$IFDEF AudioSystemFMOD}
    79uses
    810  Classes, SysUtils, fmoddyn, fmodtypes, UAudioSystem, DateUtils;
     
    3941  end;
    4042
     43{$ENDIF}
     44
     45
    4146implementation
     47
     48{$IFDEF AudioSystemFMOD}
    4249
    4350{ TAudioSystemFMOD }
     
    129136end;
    130137
     138{$ENDIF}
     139
    131140end.
    132141
  • CoolAudio/Systems/MAD/UAudioSystemMAD.pas

    r351 r352  
    11unit UAudioSystemMAD;
    22
     3{$I UCoolAudioConfig.inc}
    34{$mode delphi}{$H+}
    45
  • CoolAudio/Systems/UAudioSystem.pas

    r347 r352  
    8686  end;
    8787
     88const
     89  WavFileExt = '.wav';
     90  Mp3FileExt = '.mp3';
     91
    8892resourcestring
    8993  SOpenOutputFailed = 'Failed opening audio output';
     
    224228destructor TPlayer.Destroy;
    225229begin
     230  Stop;
    226231  Active := False;
    227232  inherited Destroy;
  • CoolAudio/Systems/WinAPI/UAudioSystemWindows.pas

    r351 r352  
    11unit UAudioSystemWindows;
    22
    3 {$mode objfpc}{$H+}
     3{$I UCoolAudioConfig.inc}
     4{$mode delphi}{$H+}
    45
    56interface
     
    187188  Parm: TMCI_Generic_Parms;
    188189begin
    189   FFlags := 0;
    190   if FUseNotify then
    191   begin
    192     if FNotify then FFlags := mci_Notify;
    193     FUseNotify := False;
    194   end else FFlags := mci_Notify;
    195   if FUseWait then
    196   begin
    197     if FWait then FFlags := FFlags or mci_Wait;
    198     FUseWait := False;
    199   end;
    200   CheckError(mciSendCommand(FDeviceID, mci_Stop, FFlags, Longint(@Parm)));
    201   FPlaying := False;
     190  if FPlaying then begin
     191    FFlags := 0;
     192    if FUseNotify then
     193    begin
     194      if FNotify then FFlags := mci_Notify;
     195      FUseNotify := False;
     196    end else FFlags := mci_Notify;
     197    if FUseWait then
     198    begin
     199      if FWait then FFlags := FFlags or mci_Wait;
     200      FUseWait := False;
     201    end;
     202    CheckError(mciSendCommand(FDeviceID, mci_Stop, FFlags, Longint(@Parm)));
     203    FPlaying := False;
     204    Position := 0;
     205  end;
    202206end;
    203207
  • CoolAudio/Systems/mplayer/UAudioSystemMPlayer.pas

    r351 r352  
    33unit UAudioSystemMPlayer;
    44
     5{$I UCoolAudioConfig.inc}
    56{$mode Delphi}{$H+}
    67
  • CoolAudio/UCoolAudio.pas

    r348 r352  
    11unit UCoolAudio;
    22
     3{$I UCoolAudioConfig.inc}
    34{$mode Delphi}{$H+}
    4 
    5 {$IFDEF Windows}
    6   {$DEFINE AudioSystemWindows}
    7 {$ENDIF}
    8 //{$DEFINE AudioSystemMPlayer}
    9 //{$DEFINE AudioSystemFMOD}
    10 //{$DEFINE AudioSystemDSP}
    11 {$IFDEF Linux}
    12   //{$DEFINE AudioSystemMAD}
    13 {$ENDIF}
    145
    156interface
     
    3223
    3324AudioSystemManager := TAudioSystemManager.Create(nil);
    34 {$IFDEF AudioSystemWindows}
    35 AudioSystemManager.Register('Windows', TAudioSystemWindows, TPlayerWindows);
    36 {$ENDIF}
    37 {$IFDEF AudioSystemMPlayer}
    38 AudioSystemManager.Register('MPlayer', TAudioSystemMPlayer, TPlayerMPlayer);
    39 {$ENDIF}
    40 {$IFDEF AudioSystemFMOD}
    41 AudioSystemManager.Register('FMOD', TAudioSystemFMOD, TPlayerFMOD);
    42 {$ENDIF}
    43 {$IFDEF AudioSystemMAD}
    44 AudioSystemManager.Register('MAD', TAudioSystemMAD, TPlayerMAD);
    45 {$ENDIF}
    46 {$IFDEF AudioSystemDSP}
    47 AudioSystemManager.Register('DSP', TAudioSystemDSP, TPlayerDSP);
    48 {$ENDIF}
     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}
    4930
    5031finalization
  • CoolAudio/UPlaylist.pas

    r347 r352  
    66
    77uses
    8   Classes, SysUtils, Contnrs;
     8  Classes, SysUtils, Contnrs, UAudioSystem;
    99
    1010type
    1111  TPlaylistItem = class
    12 
     12    FileName: string;
    1313  end;
    1414
     
    1616
    1717  TPlaylist = class(TComponent)
     18  public
     19    Player: TPlayer;
    1820    Items: TObjectList; // TObjectList<TPlaylistItem>
     21    RandomOrder: Boolean;
     22    RepeatInfinitely: Boolean;
     23    CurrentIndex: Integer;
     24    procedure AddFile(FileName: string);
     25    procedure Shuffle;
     26    procedure Play;
     27    procedure PlayNext;
     28    procedure PlayPrevious;
    1929    constructor Create(AOwner: TComponent);
    2030    destructor Destroy; override;
     
    2535
    2636{ TPlaylist }
     37
     38procedure TPlaylist.AddFile(FileName: string);
     39var
     40  NewItem: TPlaylistItem;
     41begin
     42  NewItem := TPlaylistItem.Create;
     43  NewItem.FileName := FileName;
     44  Items.Add(NewItem);
     45end;
     46
     47procedure TPlaylist.Shuffle;
     48begin
     49
     50end;
     51
     52procedure TPlaylist.Play;
     53begin
     54  Player.FileName := TPlaylistItem(Items[CurrentIndex]).FileName;
     55  Player.Play;
     56end;
     57
     58procedure TPlaylist.PlayNext;
     59begin
     60  Inc(CurrentIndex);
     61  if CurrentIndex >= Items.Count then begin
     62    CurrentIndex := 0;
     63    if RandomOrder then Shuffle;
     64    if not RepeatInfinitely then Player.Stop;
     65  end;
     66  Play;
     67end;
     68
     69procedure TPlaylist.PlayPrevious;
     70begin
     71  Dec(CurrentIndex);
     72  if CurrentIndex < 0 then begin
     73    CurrentIndex := Items.Count - 1;
     74  end;
     75  Play;
     76end;
    2777
    2878constructor TPlaylist.Create(AOwner: TComponent);
Note: See TracChangeset for help on using the changeset viewer.