%uD83C%uDFA4%uD83C%uDFB5%uD83C%uDFB6What is that?
Damn, they were emoji. 🎵Oh, haha!
Hey, pretty cool, Zach! I got by on javascript and html. Just change the path to wherever you keep your QB64 files, and, of course, the recording.wav needs to be in that folder. Just save the code below as whatever.html, in your QB64 folder, click it, and it will appear in your default browser. Click the play button to hear Zach's recording.
Did you remember to change the line: src="file:///C:\qb64\recording.wav" to whatever folder path your recording.wav is in? If so, what browser? I'm using Firefox. I'll test Opera and Edge, now...
Hey thanks for adding the sound API. Nice collection. I don't know if you have a windows persistency API, but you are welcome to test and add mine to the mix. https://www.qb64.org/forum/index.php?topic=1365.msg105588#msg105588
Please be sure to give a shout out to visionmercer, too. I got it working almost fully, except it would only work once. visionmercer pointed me to the SetWindowPos function, which I fiddle with a bit and got it to do the trick.
Done. Right now I'm adding another bit of functionality to the sound API by allowing it to show a waveform using ffmpeg :)
[ This attachment cannot be displayed inline in 'Print Page' view ]
DECLARE DYNAMIC LIBRARY "WINMM"
FUNCTION mciSendStringA% (lpstrCommand AS STRING, lpstrReturnString AS STRING, BYVAL uReturnLength AS INTEGER, BYVAL hwndCallback AS INTEGER)
' mciSendStringA function plays media files and returns the following:
' 0 = command sucessful
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' lpstrCommand is the MCI command string (and optional flags) to send.
' lpstrReturnString is a string that holds any return information.
' uReturnLength is the length of the lpstrReturnString string passed.
' NOTE: If lpstrCommand given doesn't retun a value then lpstrReturnString
' can be empty and uReturnLength can be set to 0.
' hwndCallback contains a callback window handle (only if the Notify flag used in lpstrCommand)
'====================================================================
FUNCTION mciGetErrorStringA% (BYVAL dwError AS INTEGER, lpstrBuffer AS STRING, BYVAL uLength AS INTEGER)
' mciGetErrorStringA returns error info if the mciSendStringA failed.
' dwError is the return value from the mciSendString function.
' lpstrBuffer string holds the error information returned by the function.
' uLength is the length of the lpstrBuffer string buffer.
'====================================================================
END DECLARE
DECLARE CUSTOMTYPE LIBRARY
FUNCTION FindWindow& (BYVAL ClassName AS _OFFSET, WindowName$)
END DECLARE
handle& = _NEWIMAGE(800, 600, 256)
SCREEN handle&
_TITLE "QB64 Video"
hwnd& = FindWindow(0, "QB64 Video" + CHR$(0))
ReturnString$ = SPACE$(255)
ErrorString$ = SPACE$(255)
filename$ = "c:\DavPiano.mpg" '<========== video file to play
a% = mciSendStringA%("open " + filename$ + " style popup", ReturnString$, LEN(ReturnString$), 0)
IF a% THEN
x% = mciGetErrorStringA%(a%, ErrorString$, LEN(ErrorString$))
PRINT ErrorString$
END
ELSE
a2% = mciSendStringA%("window " + filename$ + " handle " + STR$(hwnd&), ReturnString$, LEN(ReturnString$), 0)
b% = mciSendStringA%("play " + filename$, "", 0, 0)
_SCREENMOVE _MIDDLE
'=== Play video...
DO: _LIMIT 30: LOOP UNTIL INKEY$ <> ""
x% = mciSendStringA%("stop " + filename$, "", 0, 0)
x% = mciSendStringA%("close " + filename$, "", 0, 0)
END IF
Well done, glad you got it sorted out. Can you access the individual samples? Also, thats not what i thought youd sound like!