BBC BASIC
« wav files »

Welcome Guest. Please Login or Register.
Mar 31st, 2018, 10:42pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Cross-platform BBC BASIC (Windows, Linux x86, Mac OS-X, Android, iOS, Raspberry Pi)
BBC BASIC Resources
BBC BASIC Help Documentation
BBC BASIC for Windows Home Page
BBC BASIC Programmers' Reference
BBC BASIC Beginners' Tutorial
BBC BASIC for SDL 2.0 Home Page
BBC BASIC Discussion Group

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: wav files  (Read 395 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: wav files
« Reply #15 on: Mar 8th, 2018, 1:09pm »

on Mar 8th, 2018, 09:59am, vbi wrote:
In case it is useful to you, or indeed others, here in an example based on Richards's original code that works for me

Roy claims to have tried that code already and to have found that it doesn't work (the only difference between your most recent code and what he tried is that you have renamed the structure temp{} to AudioSpecObtained{} and made it global).

So the question remains, why is it working for you (and me) and not for Roy? Unless he made some mistake, I can only assume that there is indeed a difference in the functionality of the SDL_*Audio* functions between Windows and Android. That would not be so surprising, for example it's entirely possible that Android cannot accept as wide a range of WAV formats as Windows can.

I would suggest to Roy that he first tests your code in Windows to confirm that it is working for him too, and then to try it on Android to confirm, or otherwise, that it is behaving differently.

Richard.
« Last Edit: Mar 8th, 2018, 1:13pm by Richard Russell » User IP Logged

vbi
Guest
xx Re: wav files
« Reply #16 on: Mar 8th, 2018, 1:35pm »

Hello Richard,

Yes, I agree, the majority of the changes made in that example are to allow for a verbose display of what is going on, to hopefully make any failures that occur clearer.

However, there is one important change, which is the addition of the line in PROCCleanup to force @hwo% to FALSE, therefore ensuring that the SDL_OpenAudioDevice gets re-run the next time around to take account of any changes in AudioSpecRequired{} structure.

This point was why I added the note to highlight that changes had been made to all FN/PROCs.

Over to you, Roy!
User IP Logged

roy
New Member
Image


member is offline

Avatar




PM


Posts: 44
xx Re: wav files
« Reply #17 on: Mar 8th, 2018, 3:14pm »

Hi Richard

Thanks for the link. Believe it or not I did look on Google, but found nothing that help me!

Hi vbi

Thanks for the modified code. It works very well on the laptop and on my tablet

So it's a wow.wav from me.

Many thanks to both of you
Regards Roy
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: wav files
« Reply #18 on: Mar 8th, 2018, 7:09pm »

on Mar 8th, 2018, 1:35pm, vbi wrote:
However, there is one important change, which is the addition of the line in PROCCleanup to force @hwo% to FALSE, therefore ensuring that the SDL_OpenAudioDevice gets re-run the next time around

This question appeared on the SDL forum today. Assuming that it wasn't posted by you (!) it appears to be relevant to this discussion.

What I don't understand, and hopefully it may be explained there, is that in all the examples I have seen AudioSpecObtained{} is identical to AudioSpecRequired{}. I had assumed that if you don't close-and-re-open the audio device (which is undesirable because of the potential for clicks etc.) it would automatically convert the supplied format into whatever the output requires. This would also be important if the OS doesn't accept the source format without conversion.

It's not even clear that the initialisation of AudioSpecRequired{} has any effect at all!

Richard.
« Last Edit: Mar 8th, 2018, 7:13pm by Richard Russell » User IP Logged

vbi
Guest
xx Re: wav files
« Reply #19 on: Mar 8th, 2018, 10:37pm »

Hello Richard,

Quote:
This question appeared on the SDL forum today. Assuming that it wasn't posted by you (!)

No, it wasn't me - I'm just a dabbler, utilising Roy's problem as my daily brain teaser. It's a good question though!

From my limited observations, I could believe that the understanding that the poster has set out seems to be entirely plausible. However, my lack of experience in these things led me not even to consider the potential for clicks to be generated on opening and closing the audio device more than is necessary (the benefits of ignorance, perhaps?!).

Quote:
It's not even clear that the initialisation of AudioSpecRequired{} has any effect at all!

I assume you are referring to placing any parameters into AudioSpecRequired{} before calling SDL_LoadWAV_RW? If so I would agree. In fact I did take those lines out at one point, but put them back in a moment of self doubt because I thought that you must have put them there originally for a reason beyond my limited understanding of the SDL API.

It will be interesting to see what answer(s) come back to that question.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls