Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // UData.pas
- {-----------------------------------------------------------------------------}
- { procedure PlayWaveFile }
- {-----------------------------------------------------------------------------}
- procedure TSpeakerInfList.PlayWaveFile;
- var
- Config: DACONFIG;
- Ch: Integer;
- MaxSample: Integer; // Max Sample
- ChCount1: Integer; // FbiDa 1 Ch Count
- ChCount2: Integer; // FbiDa 2 Ch Count
- SetCount: Integer;
- FileName: TFileName;
- LROut: Integer;
- begin
- { Check Max Sample }
- MaxSample := FPlayTmInf[FTestStep].FMaxSample;
- if MaxSample = 0 then
- begin
- Exit;
- end;
- { Clear Use Chanel }
- for Ch := 0 to 7 do
- begin
- Config.Master.ulChNo[Ch] := 0;
- Config.Slave.ulChNo[Ch] := 0;
- end;
- { Check Chanel Count & Max Sample }
- ChCount1 := 0;
- for Ch := 1 to 8 do
- begin
- if FSpeakerInf[FTestStep, Ch].FPlayTime <> 0 then
- begin
- // Channel mapping 1~8 -> board 1 1~8
- Config.Master.ulChNo[ChCount1] := Ch;
- inc(ChCount1);
- end;
- end;
- ChCount2 := 0;
- for Ch := 9 to 12 do
- begin
- if FSpeakerInf[FTestStep, Ch].FPlayTime <> 0 then
- begin
- // Channel mapping 9~12 -> board 2 1~4
- Config.Slave.ulChNo[ChCount2] := Ch - 8;
- // Channel mapping 9~12 -> board 2 5~8
- // Config.Slave.ulChNo[ChCount2] := Ch - 4;
- inc(ChCount2);
- end;
- end;
- { Set Wave File Data }
- SetCount := 0;
- for Ch := 1 to 8 do
- begin
- FileName := FSpeakerInf[FTestStep, Ch].FFileName;
- if FileName <> '' then
- begin
- LROut := FSpeakerInf[FTestStep, Ch].FLROut;
- SetWaveFileData(FileName, LROut, MaxSample,
- ChCount1, FSmplData1[SetCount]);
- inc(SetCount);
- end;
- end;
- SetCount := 0;
- for Ch := 9 to 12 do
- begin
- FileName := FSpeakerInf[FTestStep, Ch].FFileName;
- if FileName <> '' then
- begin
- LROut := FSpeakerInf[FTestStep, Ch].FLROut;
- SetWaveFileData(FileName, LROut, MaxSample,
- ChCount2, FSmplData2[SetCount]);
- inc(SetCount);
- end;
- end;
- { スピーカ出力 }
- Config.ulSmplDataNum := MaxSample;
- Config.fSmplFreq := FPlayTmInf[FTestStep].FSamplRate;
- Config.Master.ulChCount := ChCount1;
- Config.Master.pSmplData := @FSmplData1;
- Config.Slave.ulChCount := ChCount2;
- Config.Slave.pSmplData := @FSmplData2;
- try
- DaControl.StartSampling(Config);
- except
- on E: Exception do
- begin
- MessageDlg(E.Message, mtError, [mbOK], 0);
- end;
- end;
- end;
Add Comment
Please, Sign In to add comment