Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 8 Jahren, 4 Monaten
Letzter Beitrag:
vor 11 Monaten, 3 Wochen
Beteiligte Autoren:
Alexandre Leclerc, Arekusei Timakobu, Peter M.

soundfile in memo

Startbeitrag von Peter M. am 14.04.2009 14:26

hi,

i'm looking for a possibility to play a sound (mp3) which is in a memofile
without save the sound file on disk. Is there a chance to do this ?

thanks peter

Antworten:

Does anybody knows?

von Arekusei Timakobu - am 29.08.2016 06:38
Hi guys,

In WinDev, out of the box, you have limited options. A wave file you can play directly from a HFSQL memo with Sound (). Otherwise you have the MCIOpen() function for big files and mp3, but the file must be on disk.

The other solution is to do it “the old way” using Windows API, or an external DLL that can play mp3. That way you have to handle yourself the data in memory and pass it to the player. This will be somewhat more work depending on your knowledge of the system API and data format for mp3, but will allow you to do what you want. The API will be that hard way for you. Try to find a DLL that already offers these functions.

You can also use the .Net capability of WinDev to use components (such as http://alvas.net/alvas.audio.aspx) to load a data stream in memory and play it. There are many options available in this field too.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 29.08.2016 12:26
Hi, Alxandre!

Thank you for answer. In my task I need to read the audio stream from some API that is sent via HTTP. I generated the WAV file on fly (from stream parts) and I thought I can play it using Sound statement:

WAVFile is WAVFile(...)
SoundBuffer is Buffer = WAVFile.SaveToMemory(SoundData)
Sound()

but I was failed. I thought I can play sound from memory as if the sound data was in HFSQL memo. Now I use clumsy method - place sound data into temp WAV file on HDD and play it using its name.

P.S. I can't use 3rdparty components or all the more so .Net ones...

von Arekusei Timakobu - am 30.08.2016 14:40
Hi Arekusei,

It should work just well with a HF memo of sound type. Just make a dummy HF file with a "sound" memo type field. Then load your on-the-fly WAV file (provided it has good header and data stream) and put it in the buffer (without saving) and pass it to the Sound() function.


HReset(file)
file.Buf = fLoadBuffer("C:\Windows\Media\Alarm01.wav")
Sound(file.Buf)


I'm loading a file from disk in the buffer, but it can come from any other source.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 30.08.2016 15:26
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.