![]() |
#136 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
![]() I could probably manage the buffer more sensibly but I'm seeing if I can just shoehorn something together in the short term. It was a real warm feeling wandering around with my newly converted movies running sound. That said, I still think the audio format needs looking at. Wav @ 16k - 20k produces files that are as large as the movie info ![]() So assuming we have a microbe of performance left later on some IP free compression might not go amiss in the mix. It's a learning curve for me right now on the Alsa implementation but I'm giving it my best shot. Far too much (prepare_buffer) this and (snd_pcm_avail_update(handle)) that, for my liking, I'm more a scrunching up numbers to make sounds man myself. But slowly slowly catchee monkee, I suspect if you put your mind to it you could implement it first. In the absence of that I shall rumble on ![]() |
|
![]() |
![]() |
![]() |
#137 | |||
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Umm... Shouldn't there be an OFF in that sentence?
![]() Quote:
Quote:
![]() Quote:
![]() Last edited by geekmaster; 07-12-2012 at 02:17 PM. |
|||
![]() |
![]() |
Advert | |
|
![]() |
#138 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
scroobius wanglage.
Quote:
my current toying around is NOT a complete solution. an interleaved format to allow for slip estimation is required. All I'm doing is preloading the wave and then slipping it through to the pcm amidst the video noise at the appropriate time... Kids stuff really while I get my hand in at ALSA developing. I don't think that final solution will be too ugly TBH. There appear to be several shortcuts in initialising a card. I can maybe get it down to 6 or 7 lines with some scroobius wanglage. Have to see. |
|
![]() |
![]() |
![]() |
#139 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
|
![]() |
![]() |
![]() |
#140 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
|
![]() |
![]() |
Advert | |
|
![]() |
#141 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
It helps to use two-letter variable names, and remove all unnecessary whitespace, and use complex logical expressions instead of conditional branches (just look at my code).
![]() The logical expressions actually run a LOT faster on modern processors -- just look at the "Aggregate Magic Algorithms" for examples: http://aggregate.org/MAGIC/ It also helps to keep your sonic screwdriver handy: Last edited by geekmaster; 07-12-2012 at 02:40 PM. |
![]() |
![]() |
![]() |
#142 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Get going in 6 lines. No error handling GM style ;)
Code:
See Updated Code below for easier reading EDIT: Checked - it works Last edited by twobob; 07-12-2012 at 05:08 PM. Reason: Added that this is untested. missed a } |
![]() |
![]() |
![]() |
#143 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
You do not need error handling to tell you that you are stupid. It is not mission-critical or life-critical code after all. If it does not work, go RTFM, and fix it.
![]() The code posted above is less likely to send the reader away screaming in horror. ![]() EDIT: Actually, I do START with error handling code (until I get it working), then I strip that out of the working parts that no longer need it. By the time I publish it, any residual error handling code is only there as a fallback to workaround hardware for firmware issues. ![]() EDIT2: Of course, in my PROFESSIONAL code, in some places there is much more "error handling" than algorithm. And when deviating from "standard methodology", I include a rationale commentary for why that deviation was needed and what are the consequences of altering it. I also include embedded references throughout my code showing WHERE I got my ideas, to prove that they are unencumbered by patents or viral licensing. But I still minimize white space though (maximum "above the fold" content for readers who rarely use scrollbars or cursor keys). EDIT3: Now that K5 sound works, it is time for the "Touchscreen Stylophone" I mentioned earlier. ![]() Last edited by geekmaster; 07-12-2012 at 03:20 PM. |
![]() |
![]() |
![]() |
#144 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Initialising Alsa - the Long and Short of it.
This is a reinterpretation of the demo here:
http://equalarea.com/paul/alsa-audio.html#playex There is a useful overview of the PCM interface that is a bit scary but not a terrible read here http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html EDIT: Here is the Astlye compliant version of the code with additional notes and highlighting of important areas: (In the preferred style of Knc1) Spoiler:
The Original thrust of the thread continues below. Quote:
Here is the completed basic init code: (In GM's preferred compressed style) Spoiler:
The 'buf' is just to demonstrate something being pushed PCMwards. Obviously it's not required. Hacked and slashed demos. That's the best I can do with my current knowledge. See what tomorrow brings perhaps there is a quicker way. But I doubt it. (I'll go fix the code in the post above, just in case someone tries it) Last edited by twobob; 07-12-2012 at 08:48 PM. Reason: Made it more GM friendly - added syntax color highlighting |
|
![]() |
![]() |
![]() |
#145 | |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,016
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
universal tones
Quote:
![]() |
|
![]() |
![]() |
![]() |
#146 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
It is actually "twobob's tones". All I did is figure out how to build it so it works on more kindle (and non-kindle!) models. ![]() Last edited by geekmaster; 07-12-2012 at 05:30 PM. |
|
![]() |
![]() |
![]() |
#147 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
![]() I have two sonic screwdrivers in my house. the beauty of kids. ( and a sonic lipstick might I add) although none of mine have IR skills. meh. I will be happy to simply have the init code running with your vid and some striped audio ![]() |
|
![]() |
![]() |
![]() |
#148 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Yes reader, you read that correctly, that is a criticism. - - - - Allow me a few words in support of my opinion to any one posting example code at this site - - * Consider the audience here; With a few dozen exceptions, the readership here has little technical knowledge and little or no programming experience. * Consider the image you project; Does not all of those hours, over all of those years, learning the art and science of programming, deserve a better representation? * Consider the society that gathers around a hobbyist forum; Members of a society, even an electronic society, form a community of like-wise behaving members. So like it or not, publishing here puts a person in the role of "Leadership by Example". Does not the time and effort that goes into solving a problem and presenting a solution earn itself a more professional example? * If personal considerations require an extremely compact representation of program code, is that any excuse for not running the result of your hours of long, hard, work through any one of many source formatting routines before publication? Let the glory of your solution shine in comprehensible code. Do not publish for bragging rights to how much whitespace you can eliminate or how many statements you can squeeze on a line. Publish in a style that you can be proud of, for others to see how much pride you take in your own efforts. * There are specialized sites for this style of programming, such as: http://www.ioccc.org/ and their list of winners (with the *.c files posted): http://www.ioccc.org/winners.html go post your obfuscated code on their site. |
|
![]() |
![]() |
![]() |
#149 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
So run it through AStyle then... ![]() I grew up programming in MACHINE LANGUAGE, with front panel switches and neon lights. We did not need to wait a day for the keypunch ladys to punch our cards (or wait for them to go home so we could punch our own cards). Although my code is condensed, it is NOT obfuscated. I write it for myself, and I need to see as much code as I can to absorb its patterns without cumbersome scrolling. Mousing breaks the coding trance. For clients, I just feed it through AStyle to reformat it to their choice of style before delivery. I can post counterexamples of what I consider to be the most valuable code from others, and it is also coded in a very condensed style. I am not alone. You are welcome to your own opinions, and I am welcome to mine. EDIT: As I pointed out before, there is a HUGE readership that only reads "above the fold" content. I do the same for web page layout. Fit all the important stuff "above the fold". You can write fluffy popcorn code all you want, and I will write solid condensed code all I want. And just why should I run MY code through a source code formatter for you, when I do not know which of dozens of popular formats will make you happy (if any)? You can do that yourself. Have you even EXPERIENCED a coding trance? Now, which of YOUR personal pieces of self-written code would you like to show us as representative of YOUR "vastly superior" coding style? Last edited by geekmaster; 07-12-2012 at 06:39 PM. |
|
![]() |
![]() |
![]() |
#150 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
As for obfuscated. I swear that is an un-obfuscated as using alsa gets. I was simply aiming to demonstrate that GM could - in his style - incorporate ALSA code in circa 10 lines. (init in about 7.) After the last few pages smeared in reference to what these values refer to - and lets face it "snd_pcm_hw_params_any (playback_handle, hw_params);" is pretty bloody obscure - I would hope there is enough x-ref to make sense of these lines. In the end this does not serve as a fantastically beautiful demonstration of the perfect alsa init sequence. It did meet the needs of it's purpose though. My apologies if posting the code here offended you in some way? I'll take that under advisement. Last edited by twobob; 07-12-2012 at 06:43 PM. Reason: changed one letter |
|
![]() |
![]() |