Pointers and more Pointers
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Pointers and more Pointers
Hi, PB Pointers are new to me, what am I missing here.
I wish to load the wav file and copy it from its loading buffer to a different memory location.
InitSound()
*NewBuffer =AllocateMemory(50000000)
*SoundBuffer = LoadSound (1,"D:\Smart music\New Mix Runoffs\Everyone we Told Remix With Vox (2).wav")
CopyMemory(*Soundbuffer,*NewBuffer,30000000)
Debug(*newBuffer)
I wish to load the wav file and copy it from its loading buffer to a different memory location.
InitSound()
*NewBuffer =AllocateMemory(50000000)
*SoundBuffer = LoadSound (1,"D:\Smart music\New Mix Runoffs\Everyone we Told Remix With Vox (2).wav")
CopyMemory(*Soundbuffer,*NewBuffer,30000000)
Debug(*newBuffer)
Re: Pointers and more Pointers
LoadSound does not return a pointer
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Re: Pointers and more Pointers
Thankyou.. That solves that.
Re: Pointers and more Pointers
Maybe I'm wrong, check by copying smaller data. Maybe your file is less than 30 MB.
Code: Select all
EnableExplicit
Define *NewBuffer, *SoundBuffer, fs,q, path$
InitSound()
; UseOGGSoundDecoder()
*NewBuffer =AllocateMemory(50000000)
; *SoundBuffer =AllocateMemory(50000000)
path$ = "D:\Smart music\New Mix Runoffs\Everyone we Told Remix With Vox (2).wav"
*SoundBuffer = LoadSound(1,path$)
fs = FileSize(path$)
CopyMemory(*Soundbuffer,*NewBuffer, 2331) ; fs ?
; ShowMemoryViewer(*NewBuffer , 10)
ShowMemoryViewer(*SoundBuffer , 10)
Debug *newBuffer
Debug fs
FreeMemory(*NewBuffer)
; FreeMemory(*SoundBuffer)
FreeSound(1)
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Re: Pointers and more Pointers
Well almost, Anybody know a way to do this? If I instead use a pointer to access the returned value and hopefully give me the address
of the loaded Wav. The value is incorrect. Does anybody know how to find a Loaded Soundfile ?
of the loaded Wav. The value is incorrect. Does anybody know how to find a Loaded Soundfile ?
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Re: Pointers and more Pointers
Thanks AZJIO, But the address is not where the wav file is. I am Missing something here, But I don't know what it is
I feel Like Dylans Mr Jones.
I feel Like Dylans Mr Jones.
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Re: Pointers and more Pointers
I Have also tried including wav files as Binary (includeBinary) in a Data Section, but getting above 70mgb I immediately get a POLINK Linker Error. Cannot find out why so tried to resort to LoadSound, But then I have no idea where the Wav is.
Maybe I'll load it and run a search through memory until I find the Start of the Header (RIFF)
Maybe I'll load it and run a search through memory until I find the Start of the Header (RIFF)
Re: Pointers and more Pointers
Does CatchSound() return a pointer to the sound?
Is that meant to be MB or GB?
Re: Pointers and more Pointers
Code: Select all
EnableExplicit
InitSound()
#Sound = 0
#File = 0
Define isSnd, *mem, length,q, path$, bytes
isSnd = 0
path$ = "D:\Smart music\New Mix Runoffs\Everyone we Told Remix With Vox (2).wav"
If path$
If ReadFile(#File, path$)
length = Lof(#File)
*mem = AllocateMemory(length)
If *mem
bytes = ReadData(#File, *mem, length)
If bytes
; Debug bytes
ShowMemoryViewer(*mem , 48)
isSnd = CatchSound(#Sound, *mem, bytes)
EndIf
EndIf
CloseFile(0)
EndIf
EndIf
; Debug isSnd
If isSnd
PlaySound(#Sound)
Delay(SoundLength(#Sound, #PB_Sound_Millisecond))
FreeSound(#Sound)
EndIf
FreeMemory(*mem)
Last edited by AZJIO on Sun Feb 20, 2022 7:02 am, edited 1 time in total.
-
- User
- Posts: 14
- Joined: Tue Jan 05, 2010 5:43 pm
Re: Pointers and more Pointers
Fantastic AZJIO, That works perfectly, Your a Genius.
Genuine thanks for your help you have saved my brain
I of course meant 70MB, it was late, my eyes had gone to bed...Oh imagine a 70GB Wav file. HaHa.
Genuine thanks for your help you have saved my brain
I of course meant 70MB, it was late, my eyes had gone to bed...Oh imagine a 70GB Wav file. HaHa.