Page 1 of 1
waveaudio and MSSQL

Posted:
March 21st, 2007, 7:55 pm
by Koltron
How would I record and playback waves files using waveaudio and storing them in a MSSQL table?
Thanks

Posted:
March 21st, 2007, 8:44 pm
by Kambiz
1. Look at TWaveStreamAdapter class in the latest release of the Wave Audio package.
2. Look at TBlobStream in Delphi's help.

Posted:
March 21st, 2007, 8:47 pm
by Koltron
i'm new in delphi. Would there by chance be a example out of how the use it.

Posted:
March 22nd, 2007, 7:21 pm
by Johnny_Bit
If my memory does not deceive me, I'm pretty sure, that you ought to find what you are looking for on your hard drive IF you installed full Delphi.

Posted:
March 22nd, 2007, 7:23 pm
by Koltron
I can handle the blob part, but using the Adapter is my concern

Posted:
March 24th, 2007, 12:18 am
by Kambiz
Suppose you have a blob field and it is associated with a TBlobField object named MyBlobField.
Playing the blob:
- Code: Select all
var
BlobStream: TBlobStream;
procedure TForm1.FormCreate(Sender: TObject);
begin
BlobStream := TBlobStream.Create(MyBlobField, bmRead);
StockAudioPlayer1.PlayStream(BlobStream);
end;
procedure TForm1.StockAudioPlayer1Deactivate(Sender: TObject);
begin
BlobStream.Free;
end;
Recording in to the blob:
- Code: Select all
var
BlobStream: TBlobStream;
procedure TForm1.FormCreate(Sender: TObject);
begin
BlobStream := TBlobStream.Create(MyBlobField, bmWrite);
StockAudioRecorder1.RecordToStream(BlobStream);
end;
procedure TForm1.StockAudioRecorder1Deactivate(Sender: TObject);
begin
BlobStream.Free;
end;
Accessing wave audio details stored in the blob:
- Code: Select all
var
Wave: TWaveStreamAdapter;
begin
Wave := TWaveStreamAdapter.Create(TBlobStream.Create(MyBlobField, bmRead), soOwned);
try
ShowMessage(Wave.AudioFormat);
finally
Wave.Free;
end;
end;

Posted:
March 26th, 2007, 4:30 pm
by Koltron
thank you so much
//EDIT:
can multiple wav files be stored in the same blob field?
//mod edit: EDIT!

Posted:
March 27th, 2007, 12:11 am
by Kambiz
Although it is not a good idea, but the answer is yes. Remember that you have to save somewhere starting position and length of each wave.