Page 1 of 1

How to launch an audio file for performance without an external player

Posted: Sat Dec 17, 2022 3:57 am
by Eugene Lutsenko
How can I launch an audio file for performance without an external player? How can I launch an audio file for performance without an external player ? I want to voice ogg files, but without running the installed player

Re: How to launch an audio file for performance without an external player

Posted: Sat Dec 17, 2022 5:58 am
by skiman
Hi,

I have used this in the past.

Code: Select all

Function PlayASound(cWaveFile)
cWaveFile := alltrim(cWaveFile)
DllCall("WINMM.DLL",32,"PlaySoundA",cWaveFile,0,0x00020000+0x0001)
RETURN (NIL)

Re: How to launch an audio file for performance without an external player

Posted: Sat Dec 17, 2022 7:39 am
by Auge_Ohr
hi,

for OOG Files you need a Audio CODEX which is NOT include in Windows
API PlaySound function are for *.WAV only so it is not a Solution

for WMP you have to add Directshow Audio "Filter" as CODEC
VLC have many CODEC "build-in" and can play *.OOG Files

i would try VLC ActiveX

Re: How to launch an audio file for performance without an external player

Posted: Sat Dec 17, 2022 10:59 am
by Eugene Lutsenko
Hi! Thanks! Of course WAV is not the best option, but in principle acceptable, because it can also be converted online too.

Re: How to launch an audio file for performance without an external player

Posted: Wed Dec 21, 2022 10:30 am
by Eugene Lutsenko
Everything worked out. Very cool.

Code: Select all

FUNCTION ProfessorAdvises()

  *********************************************************************************************************************
  // Скачивание советов профессора из "Заработало" с сайт: http://aidos.byethost5.com/Sounds/*.wav
  *********************************************************************************************************************
  n=0
  IF .NOT. InternetGetConnectedState( @n, 0 ) == 0

*    cFile := LoadFromURL('http://aidos.byethost5.com/index.php')                              // Считывает страницу сайта в текстовую переменную

     **********************************************************************************************************
     Xb2NetKey()
     cFtpServer:="ftp.byethost5.com"                            // Это везде одинаково <<<===############
     oFtp := FTPClient():new( cFtpServer, Ftp_User, Ftp_Passw ) // Соединение с моим сайтом и авторизация
     IF oFtp:connect()                                          // Есть соединение с моим сайтом и авторизация?
     **********************************************************************************************************
     
        **** Сделать текущей папку: ftp://ftp.byethost5.com/htdocs/Sounds/
     
*       MsgBox('2. Исходная директория: '+oFtp:curDir())
        oFtp:curDir("htdocs/Sounds/")
*       MsgBox('2. Должна быть директория: "htdocs\Sounds", а фактически: '+oFtp:curDir())
     
*       IF oFtp:curDir("htdocs/Sounds/")
*          LB_Warning(L('Не удалось сделать текущей директорию: "Sounds"'), L('(C) Система "Эйдос-Х++"' ))
*          RETURN NIL
*       ENDIF
     
        aWaveFile := oFtp:Directory("*.WAV")

*       LB_Warning(aWaveFile[1,F_NAME])
*       DC_DebugQout( aWaveFile[1,F_NAME] )             // Отладка   Имя             Размер    Дата       Время
*       wtf oFtp:Directory("*.WAV")                     // VALUE: {{"Downloads.exe", 10242016, 20201202, "07:57:00", "N", 0,         , "00:00:00",         , "00:00:00"}}
*       DC_MsgBox(10,10,aWaveFile[1,F_NAME])
*       MsgBox('Имя файла: '+aWaveFile[1,F_NAME]+', размер: '+STR(aWaveFile[1,F_SIZE])+' байт, дата создания: '+DTOC(aWaveFile[1,F_WRITE_DATE])+', время создания: '+aWaveFile[1,F_WRITE_TIME])
        
*       mSizeUpd = aFileUpd[1,F_SIZE] / (1024^2)        // Мб
*       mDateUpd = aFileUpd[1,F_WRITE_DATE]
*       mTimeUpd = aFileUpd[1,F_WRITE_TIME]
        
        *** Скачать случайный звуковой файл для вопроизведения *******
        
        cWaveFile = 1+INT(RANDOM()%LEN(aWaveFile))

*       MsgBox(aWaveFile[cWaveFile,F_NAME])
        IF oFtp:GetFile(aWaveFile[cWaveFile,F_NAME])
*          LB_Warning(L('Скачивание файла: "')+aWaveFile[1,F_NAME]+L('" с FTP-сервера завершено успешно'), L('(C) Система "Эйдос-Х++"' ))
        ENDIF
        
        PlayASound(aWaveFile[cWaveFile,F_NAME])
        
        ERASE(aWaveFile[cWaveFile,F_NAME])
     
     ELSE
        LB_Warning(L('Нет соединения с FTP-сервером'), L('(C) Система "Эйдос-Х++"'))
        RETURN NIL
     ENDIF

  ENDIF

RETURN NIL