Author Topic: New issues with 0.2.3  (Read 4589 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #15 on: July 23, 2019, 11:44:15 AM »

 Then i am clueless... I dont know why it doesnt produce any sounds in my PC... It just hangs there until the time my IDE allows it to tun elapses.

Thanks Charles... i will keep looking.

Charles Pegge

  • Guest
Re: New issues with 0.2.3
« Reply #16 on: July 23, 2019, 12:00:55 PM »
ResEdit shows a WAVE folder with WAV0001 resource, tagged Spanish (Mexico). Similar with the icon.

Sound.exe also executes with an empty console window.

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #17 on: July 23, 2019, 01:09:03 PM »

Hello Charles,

Well, its good to know it works... but its driving me crazy that it doesnt work in MY pc. This is the
same script in PowerBASIC... somewhat. It compiles and plays the sound fine. Mesage box displays: "Sound played"

Code: [Select]
#COMPILE EXE

#RESOURCE WAVE, WAV0001, "executing.wav"

%SND_SYNC            = &H0000
%SND_ASYNC          = &H0001
%SND_RESOURCE    = &H00040004

DECLARE FUNCTION PLAYSOUND LIB "WINMM.DLL" ALIAS "PlaySoundA" (azsSound AS ASCIIZ * 30, BYVAL hModule AS DWORD, BYVAL  Opts AS DWORD) AS LONG
DECLARE FUNCTION GetModuleHandle LIB "Kernel32.dll" ALIAS "GetModuleHandleA" (lpModuleName AS DWORD) AS DWORD

FUNCTION PBMAIN() AS LONG

    LOCAL sn AS ASCIIZ * 30
    SN = "WAV0001"

    LOCAL h AS DWORD
    H = GetModuleHandle(BYVAL 0)

    IF PlaySound(sn, h, %SND_RESOURCE OR %SND_SYNC) THEN
        ? "Sound played"
    ELSE
        ? "Could not play sound"
    END IF

END FUNCTION

 Same code compiled for oxygen, and the program just executes idle, until it runs out of execution time. :(
Im utterly bewildered, i dont even know what to look for.


Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #18 on: July 23, 2019, 01:11:36 PM »
Perhaps... a manifest thing?

jcfuller

  • Guest
Re: New issues with 0.2.3
« Reply #19 on: July 23, 2019, 02:13:32 PM »
Charles,
  How did you link a res file to the exe.
LinkRes2Exe does not work for me with WAVE.

James

Charles Pegge

  • Guest
Re: New issues with 0.2.3
« Reply #20 on: July 23, 2019, 02:36:04 PM »
There were no complaints here from LinkRes2Exe. but GORC issued a warning about WAVE as a user-defined type

A WAVE resource is a bit unusual anyway. Perhaps leave it for now and see if any other problems emerge with resources.

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #21 on: July 23, 2019, 07:01:14 PM »
 You are right Charles. I Should rest. I have been focusing in other things today.
Now is time for enjoying life. :) A nice dinner with what is left from my family.

 I believe we may need to look in another direction regarding the RC compiler or
the RC linker.

 When i open the generated executable in ResEdit, and then simply click SAVE...
the executable magically starts working. It plays sounds flawlessly. Must be some
kind of missalignment that ResEdit handles better.

 By the Way, i am using Win7, what OS are you running? I have heard Win7 is
less forgiving.

 Thanks for enduring me! cya later. :)



Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #22 on: July 23, 2019, 08:18:05 PM »
 Charles... out of curiosity i opened in ResEdit the tetris clone because it had the same issue (no sound):

https://www.oxygenbasic.org/forum/index.php?topic=1910.msg20766;topicseen#msg20766

It says there is an 'invalid resource 6' (check picture). Freshly compiled, with no resources.

 Once the resource is removed or the exe is resaved, the game plays the sounds perfectly fine.  :o

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #23 on: July 23, 2019, 11:16:37 PM »
Finally got it working. Now.. off to sleep!

jcfuller

  • Guest
Re: New issues with 0.2.3
« Reply #24 on: July 24, 2019, 06:58:13 AM »
Charles,
  My OCD would not let go :)
The issue is WAVE does not have a resource id number associated with it so LinkRes2Exe cannot add it to the exe. I wanted to make sure it was not a gorc issue so I tried the latest (1.07) 64bit FreeBasic
Created using RadAsm3.
James
'==============================================================================
FreeBasic code:
Code: [Select]
#include "windows.bi"
#include "win\mmsystem.bi"
print "hello"
PlaySoundA("#100",GetModuleHandle(0),SND_RESOURCE OR SND_ASYNC)
print "any key to end"
sleep

resource file
Code: [Select]
#define IDC_WAV 100
IDC_WAV WAVE DISCARDABLE "executing.wav"

output:
Code: [Select]
gorc /r "playwav.rc"

GoRC.Exe   Version 1.0.1.0 - Copyright Jeremy Gordon 1998-2013 - JG@JGnet.co.uk

Warning .......................

Line 3 of Resource Script (playwav.RC):-
A resource type was not recognised and assumed to be user-defined:-
WAVE

Output file: playwav.res

fbc -s console "playwav.bas"  "playwav.res"
« Last Edit: July 24, 2019, 08:13:19 AM by jcfuller »

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #25 on: July 24, 2019, 09:28:52 AM »
The issue is WAVE does not have a resource id number associated with it...

This is a working RC file (sound splays OK now), apparently WAVE can have an ID. Its just that, as Charles said, GoRc bites one character off of it...

Code: [Select]
xWAV0001 WAVE "C:\\Users\\Diamante\\Documents\\PluriBASIC\\Clean\\executing.wav"
Since i want WAV0001, i need to prepend a character... x.

Charles Pegge

  • Guest
Re: New issues with 0.2.3
« Reply #26 on: July 24, 2019, 10:25:02 AM »
I've removed the o2 resource section stub. So you will have clean binaries before adding resources.

All you need is the updated OxygenProgress.zip for oxygen.dll

I've also discovered that GORC compiles the symbol names correctly, therefore the 1st character is being snipped off by LinkRes2Exe. We have the source code and I will see if this can be fixed.

Brian Alvarez

  • Guest
Re: New issues with 0.2.3
« Reply #27 on: July 24, 2019, 10:29:46 AM »

 Charles, speaking of that... i dont know BCX, but if you convert LinkRes2Exe to Oxygen, i can implement it
in my oxygen caller and make one seamless call to perform all tasks at once.

jcfuller

  • Guest
Re: New issues with 0.2.3
« Reply #28 on: July 24, 2019, 11:17:31 AM »
Charles,
   This will let us use LinkRes2Exe with imbedded wav files as RCDATA instead of WAVE.
James
 
Code: [Select]
use rtl64
use corewin         
% SND_MEMORY   = 4       
DECLARE FUNCTION sndPlaySound LIB "WINMM.DLL" ALIAS "sndPlaySoundA" (azsSound AS ASCIIZ,BYVAL  Opts AS DWORD)AS INT
DECLARE FUNCTION PBMAIN() AS INT
'==============================================================================
Function PlayRcSound (hInst as sys,  SndName As sys) As Integer
    Dim As sys hr,hg,id,lpSndData
    id = 10
    hr = FindResource (hInst, (char*)SndName, (char*)id)
    If hr <> 0 Then
        hg = LoadResource (hInst, hr)
        If hg <> 0 Then
            lpSndData = LockResource (hg)
            If lpSndData <> 0 Then
                sndPlaySound ((char*)lpSndData, SND_MEMORY)
                return 1
            Else
                return 0   
            End If
        Else
            return 0   
        End If
    Else
        return 0
    End If
Function = 0
End Function
'==============================================================================
Sub main()
       If PlayRcSound(GetModuleHandle(0),100)
           Print "Sound Played"
       Else
           Print "No Sound"
       End If   
End Sub
main()
'==============================================================================
Resource File
Code: [Select]
#define IDC_WAV 100

IDC_WAV RCDATA DISCARDABLE "executing.wav"


jcfuller

  • Guest
Re: New issues with 0.2.3
« Reply #29 on: July 24, 2019, 11:52:52 AM »
Charles,
  I looked at LinkRes2Exe source and I don't think it's possible to fix.
It looks for the resource type id (manifest = 24, rcdata = 10 ...) and WAVE was never assigned an id by Microsoft that I could find.

James