Author Topic: MasmBasic  (Read 345209 times)

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #495 on: May 02, 2020, 08:10:35 PM »
Speaking of source code, literally.  :cool:
Creative coders use backward thinking techniques as a strategy.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 11549
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #496 on: May 02, 2020, 09:29:58 PM »
Exactly :tongue:

Here is another one for you: it reads the Say macro source for you :bgrin:

include \masm32\MasmBasic\MasmBasic.inc
  Init
  Say wRec$(Extract$(FileRead$("\masm32\MasmBasic\MasmBasic.inc"), "Say MACRO", "ENDM", xsIncL or xsIncR, 99))
EndOfCode


Obviously, you need the last MB installation to extract the macro from the inc file, otherwise Extract$(..) will only return a question mark.

Another variant, reading a very old short source:
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc
  Init
  Recall "\Masm32\examples\Tut17\2\USEDLL.ASM", L$()
  For_ each ecx in L$()
PrintLine ecx
Say wRec$(ecx), SetRate(5)
  Next
EndOfCode

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #497 on: May 02, 2020, 11:01:00 PM »
Couldn't read MasmBasic.inc ( I haven't installed MasmBasic )
Creative coders use backward thinking techniques as a strategy.

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #498 on: May 02, 2020, 11:11:54 PM »
I had a plan ( never came so far to try it ) to write something with SAPI to copy speech to memory as a wav file.
I'm not sure anymore, think it should be possible with SAPI...
Creative coders use backward thinking techniques as a strategy.



jj2007

  • Moderator
  • Member
  • *****
  • Posts: 11549
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #501 on: May 03, 2020, 08:32:08 PM »
Obviously, you need the last MB installation to extract the macro from the inc file, otherwise Extract$(..) will only return a question mark.
Couldn't read MasmBasic.inc ( I haven't installed MasmBasic )

No problem, Marinus - you just wanted to demonstrate that you would never, ever install MasmBasic. That's fine for me :tongue:

Has anybody at least tried to use SpCreateBestObject?

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #502 on: May 04, 2020, 12:56:14 AM »
 :tongue:
What SAPI 5 version do you have?
I have 5.1.
I could find SpCreateBestObject in the Help file but not in the includes. ( could be I'm missing some files )
Is it a helper function from a lib?
I can't remember if there was also a lib included in the SAPI5.1 SDK.
Why not enumerate all the voices yourself and pick the one you want to use, or is there more to the SpCreateBestObject?
Creative coders use backward thinking techniques as a strategy.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 11549
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #503 on: May 04, 2020, 01:16:47 AM »
I have 5.3, which should have it: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms717500(v%3Dvs.85)

Code: [Select]
invoke LoadLibrary, Chr$("C:\Windows\System32\Speech\Common\sapi.dll")
fdeb 4, "LL", eax
.if eax
push eax
invoke GetProcAddress, eax, Chr$("SpCreateBestObject")
fdeb 4, "GPA", eax
call FreeLibrary
Inkey
Exit
.endif

NOT FOUND.

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #504 on: May 04, 2020, 01:31:11 AM »
Just had a look in the Windows v7.1 SDK,
There I found the sapi.lib and the sapi51 and sapi53 includes, no SpCreateBestObject ( also not in the sapi.lib )  :sad:
Creative coders use backward thinking techniques as a strategy.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 11549
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #505 on: May 04, 2020, 01:38:25 AM »
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\sphelper.h
Code: [Select]
template<class T>
HRESULT SpCreateBestObject(
    const WCHAR * pszCategoryId,
    const WCHAR * pszReqAttribs,
    const WCHAR * pszOptAttribs,
    T ** ppObject,
    IUnknown * pUnkOuter = NULL,
    DWORD dwClsCtxt = CLSCTX_ALL)
{
    HRESULT hr;

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #506 on: May 04, 2020, 01:50:49 AM »
Looks like a function.
Do you have the Sapi5.3 SDK installed? Maybe there is a lib....
Creative coders use backward thinking techniques as a strategy.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 11549
  • Assembler is fun ;-)
    • MasmBasic
Re: MasmBasic
« Reply #507 on: May 04, 2020, 01:55:03 AM »
I have over 3GB of Visual Studio 14.0 hanging around in C:\Program Files (x86)\Microsoft Visual Studio 14.0 - no SpHelper found in 7789 folders, but 224 lib files. None of them has SpCreate*

I wonder if it's Windows CE only: https://docs.microsoft.com/en-us/previous-versions/ms937518(v%3Dmsdn.10)

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms717321(v%3Dvs.85)
Quote
Microsoft Speech API 5.3

Helper Functions
Helper functions are available as a convenience to programming. Since many of the procedures use the same few methods or calls in the same sequence each time, these functions are available to consolidate those standard sequences. In all cases, the functions represent nothing more than the individual steps combined into one call; no additional features have been added or removed. Programmers are free to either use these functions or include the original lines of code. The function name attempts to clearly identify the purpose of the function itself.

The following helper functions are used with SAPI 5.

Token Helpers
SpCreateBestObject
SpCreateDefaultObjectFromCategoryId
SpCreateNewToken (by category ID)
SpCreateNewToken (by token ID)
SpCreateNewTokenEx (by category ID)
SpCreateNewTokenEx (by token ID)
SpCreateObjectFromSubToken
SpCreateObjectFromToken
SpCreateObjectFromTokenId
SpCreatePhoneConverter
SpEnumTokens
SpFindBestToken
SpGetCategoryFromId
SpGetDefaultTokenFromCategoryId
SpGetDefaultTokenIdFromCategoryId
SpGetDescription
SpGetSubTokenFromToken
SpGetTokenFromId
SpGetUserDefaultUILanguage
SpSetCommonTokenData
SpSetDefaultTokenForCategoryId
SpSetDefaultTokenIdForCategoryId
SpSetDescription

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #508 on: May 04, 2020, 02:03:04 AM »
I have searched on my computer, found nothing.
Creative coders use backward thinking techniques as a strategy.

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: MasmBasic
« Reply #509 on: May 04, 2020, 02:12:22 AM »
Maybe you have succes with: IID_ISpObjectTokenCategory EnumTokens ?
Creative coders use backward thinking techniques as a strategy.