Var
St: tmemorystream;
The begin
Aq1. SQL. Text:='select id, wav from wen where id=1'.
Aq1. Active:=true;
If aq1. FieldValues [' id ']=null then aq1. Insert the else aq1. Edit;
St:=tmemorystream. Create;
St. The Clear;
St. LoadFromFile (ExtractFilePath (paramstr (0)) + '1. Wav');
Tblobfield (Aq1 FieldByName (' wav). LoadFromStream (st);//write audio stream to the database
St. Free;
Aq1. Post;
end;
Procedure TForm1. Button2Click (Sender: TObject);
Var
St: tmemorystream;
The begin
St:=tmemorystream. Create;//
St. The Clear;
Aq1. SQL. Text:='select wav from wen where id=1'.
Aq1. Active:=true;
Tblobfield (Aq1 FieldByName (' wav). SaveToStream (st);//read the audio data to flow
//my question here to start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sndplaysound (pchar (st), SND_MEMORY and SND_ASYNC);
//how to play? How do you play? How do you play? It's driving me crazy!!!!!!
//don't write to the temporary file, of course, in the memory can also play in other methods, please!!!!!!
//end of my problem, thank you -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
St. Free;
end;
CodePudding user response:
Only a little advice, pchar (st) this usage is the building of her own, don't feel strangeCodePudding user response:
Yes yes, the problem is here, how can I describe st pointer?CodePudding user response:
Char (st) a try?CodePudding user response:
//referenceVar hFind hRes: THandle;
Song: PChar;
The begin
HFind:=FindResource (HLib, PChar (SoundName), 'WAVE');
If (hFind & lt;> 0) then the begin
HRes:=LoadResource (HLib hFind);
If (hRes & lt;> 0) then the begin
Song:=LockResource (hRes);
If Assigned (Song) then SndPlaySound (Song, snd_ASync or snd_Memory);
UnlockResource (hRes);
end;
FreeResource (hFind);
end;
CodePudding user response: