Hi, I'm trying to get the sound memory address from LoadSound function.
the function returns a number, is that the address or something else. I just need to know where in memory is the sound data.
Please help
Is it possible to get sound memory address from LoadSound??
- Zebuddi123
- Enthusiast
- Posts: 796
- Joined: Wed Feb 01, 2012 3:30 pm
- Location: Nottinghamshire UK
- Contact:
Re: Is it possible to get sound memory address from LoadSou
Hi dman10001
LoadSound() returns 0 if file failed to load or a positive Integer for success.
Make sure your in debug mode to see ShowMemViewer() to see the sound file start and end address etc.
Zebuddi.
LoadSound() returns 0 if file failed to load or a positive Integer for success.
Make sure your in debug mode to see ShowMemViewer() to see the sound file start and end address etc.
Zebuddi.

Code: Select all
EnableExplicit
EnableDebugger ; personally I use the stand alone debugger
InitSound() ; Initialize Sound system
UseOGGSoundDecoder() ; Use ogg files
#filename$ = #PB_Compiler_Home +"Examples\3D\Data\Siren.ogg"
Define iFileLength.i, iSoundFileLoaded.i
If ReadFile(0, #filename$)
iFileLength.i = Lof(0)
iSoundFileLoaded = CatchSound(0, ?MemAddressSoundStart, Lof(0), #PB_Sound_Streaming)
If iSoundFileLoaded
PlaySound(0, #PB_Sound_Loop)
Delay(3000)
FreeSound(0) ; The sound is freed
ShowMemoryViewer(?MemAddressSoundStart , ?MemAddressSoundEnd-?MemAddressSoundStart) ; of use lof(0) for file size/bytes
MessageRequester("Sound File Info", "Start Address:" + Str(?MemAddressSoundStart) + #CRLF$ + " End Address:" + Str(?MemAddressSoundEnd) )
EndIf
CloseFile(0)
EndIf
End
DataSection
MemAddressSoundStart:
IncludeBinary #filename$
MemAddressSoundEnd:
EndDataSection
malleo, caput, bang. Ego, comprehendunt in tempore
Re: Is it possible to get sound memory address from LoadSou
Btw. where is the Tipp or the Trick?
It is more a coding question.
It is more a coding question.
Re: Is it possible to get sound memory address from LoadSou
Yes it is. thank you for your response, but I already knew that and it didn't answer my question.
I was referring to the LOADSOUND function and its numbers it returns.
I was referring to the LOADSOUND function and its numbers it returns.
Re: Is it possible to get sound memory address from LoadSou
Will a Moderator please move the contents of this topic over to the duplicate thread and delete this one, or just move this one to the correct forum and delete the duplicate?
Duplicate thread: How can I get the sound address from the LoadSound function
Duplicate thread: How can I get the sound address from the LoadSound function
Re: Is it possible to get sound memory address from LoadSou
topic moved, duplicated topic deleted .
SPAMINATOR NR.1
Re: Is it possible to get sound memory address from LoadSou
Code: Select all
Structure LOADSOUND_STRUCT
Unknown.b[$40]
*Buffer
EndStructure
Global *SoundBuffer.LOADSOUND_STRUCT
InitSound()
UseOGGSoundDecoder()
*SoundBuffer = LoadSound(#PB_Any,"Siren.ogg")
If *SoundBuffer
ShowMemoryViewer(*SoundBuffer\Buffer,1024)
EndIf
Re: Is it possible to get sound memory address from LoadSou
Hi, I didn't think it was there. I thank you for responding.
I tried the code but It did not work, it returned this message.
The specified memory location is not valid for reading.
I did put debug on, or is it something else I have to do??
I tried the code but It did not work, it returned this message.
The specified memory location is not valid for reading.
I did put debug on, or is it something else I have to do??
Re: Is it possible to get sound memory address from LoadSou
Seems to be some OS specific problem...
Runs fine for me on Win7 x64 but not on Win10 x64 (PB 5.60)
On Win10 it only works with this trick:
Would be nice if there was a inbuild command...
Im not sure how usable this hackish approach is.
Mby someone has time to do some investegating.
Coding a custom loader might be the best solution.
Runs fine for me on Win7 x64 but not on Win10 x64 (PB 5.60)
On Win10 it only works with this trick:
Code: Select all
Structure LOADSOUND_STRUCT
Unknown.b[$40]
*Buffer
EndStructure
Global *SoundBuffer.LOADSOUND_STRUCT
InitSound()
UseOGGSoundDecoder()
*SoundBuffer = LoadSound(#PB_Any,"Siren.ogg")
FreeSound(*SoundBuffer)
*SoundBuffer = LoadSound(#PB_Any,"Siren.ogg")
ShowMemoryViewer(*SoundBuffer\Buffer,1024)
Im not sure how usable this hackish approach is.
Mby someone has time to do some investegating.
Coding a custom loader might be the best solution.