Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: testaevisual on June 17, 2012, 06:16:10 AM

Title: 600D Audio Controls?
Post by: testaevisual on June 17, 2012, 06:16:10 AM
Hi,

First of all, thanks for such a wonderful addition to these cameras! Currently, my only major problem is I don't see 600D audio controls listed anywhwere on the planned or not possible features list, which gets me thinking... is this coming? I'm sure this would be a very welcome addition, and it sure would make life a lot easier for me and likely a lot of other t3i users. I am especially waiting out for audio monitoring through headphones.

I guess I am mainly hoping that the newer 650D or 5D mkIII has the same 'different' sound card the 600D has which the 550D and 60D didn't have, which should mean audio control development for the 600D is a lot easier.

Basically I'm asking if Audio Controls and monitoring on the 600D are possible and, if they are, when we can expect to see them. I am willing to offer my 600D for some user-end bug testing if need be.
Title: Re: 600D Audio Controls?
Post by: bart on June 17, 2012, 09:55:07 AM
Hi,

I have a 600d and like that as well. But the audio chip in the 600d is different from the others. It's model is unknown and undocumented as far as we know. We also hope to find out more through the 650D and 5DmkIII.
Title: Re: 600D Audio Controls?
Post by: a1ex on June 18, 2012, 06:55:02 PM
We have understood what most audio registers do, but reconfiguring the chip seems a very difficult task. The only success was enabling audio remote shot, but it breaks video recording.
Title: Re: 600D Audio Controls?
Post by: testaevisual on June 19, 2012, 05:56:32 AM
Ok... Thanks for the information update! Maybe the sound chip is unique to the 600D. Maybe something similar is present in models released after the 600D. Probably pretty hard to diagnose... Maybe it became the new canon standard.
Title: Re: 600D Audio Controls?
Post by: mexicodirk on June 30, 2012, 06:01:15 AM
 ;)
yes this its somefing wath i missin g on the 600d!
i hope in the future audio via hdmi or usb output recording!
i use a hdmi (lilliput) monitor with audio, only recording via hdmi no audio!

have fun

dirk
Title: Re: 600D Audio Controls?
Post by: 1% on June 30, 2012, 05:40:09 PM
What is holding back headphone? Registers are changed and chip does nothing? Any way to reset the audio chip... maybe it only  reads registers at start? It seems we have some control through the regular canon menus in manual... just I can't monitor and that makes audio REALLY useless.  Any way to  help on this? Log something... do tests, etc?
Title: Re: 600D Audio Controls?
Post by: a1ex on June 30, 2012, 06:16:08 PM
You can play with them; scrax reported that registers were changed (new value could be read) but the audio meters stayed the same.
Title: Re: 600D Audio Controls?
Post by: 1% on June 30, 2012, 06:34:10 PM
Is there any framework to go by? I'm OK at modifying but writing fresh functions not so much. Can you send commands to change registers through the console?
Title: Re: 600D Audio Controls?
Post by: a1ex on June 30, 2012, 06:37:04 PM
Audio.c and http://magiclantern.wikia.com/wiki/600D/Audio
Title: Re: 600D Audio Controls?
Post by: 1% on July 01, 2012, 04:37:16 AM
Ok, I looked at audio.c and .h

The addresses in the .h file don't correspond to what is in the wiki but audio meters do work so some must be the same.

I.e for TurnAVLineMuteOff=
0x5703                           0x2210

I do not see the 2210 address anywhere nor the function. In audio.c I only see it checking if the usb is detected and forcing display to stay on. I never found it sending ic_writes to anything.

I see it setting gain by sending write to AUDIO_IC_SIG2/1 but I'm not sure what is actually changing after data is read from addresses... I guess I can google that part and how to read/flip registers correctly but I'm still confused.


*I do see the regular flip a register function but not sure what to set the address to or do
msleep(0x1fe)
R0, R0, #0x6B00
Title: Re: 600D Audio Controls?
Post by: funkysound on July 01, 2012, 07:49:18 PM
I´m using the 600d for most of my professional film work here in germany instead of the 5d mark2 which I use too from time to time. The quality of the pictures the 600d offers is far good enough for around 90% of all my filming situations.
The 600d is still much more flexible and faster with it´s great monitor - the 5d is only usable in studio situations or with much more afford like external monitors and so on. Very strange that canon still didn´t use this system for the mark3! Seems like it´s not professional to be flexible.
So the daily work goes on with my baby the 600d.

But the only problem ist still that I can´t hear and control what the audio side does. If you ever get this done ... Great, Great!!! ... and the 5d will always stay where it should be - in the studio.
Anyway, many thanks for what you did till now for all canon filmers and please don´t stop working on the 600d audio. I´m shure you´ll find a solution soon.
All the best!
Title: Re: 600D Audio Controls?
Post by: 1% on July 01, 2012, 07:57:24 PM
I think the screen and the crop mode are good. 5d has full frame, more power and better HDMI output.

I wish I could find a solution soon but I'm a shitty programmer and alex has no 600D.
Title: Re: 600D Audio Controls?
Post by: funkysound on July 02, 2012, 11:18:39 AM
I would wish that the ML community would support alex with one piece of every canon model - this would make things easier for him and help the whole canon filmer/user community.
Let´s see it this way - for example with a 600d:
If every 600d user who uses ML gives him 10 $ or € it needs only around 70 people to solve this problem. This could work for every model.
I would go with it immediately ...
So, is there anybody around who´s interested?
Title: Re: 600D Audio Controls?
Post by: nanomad on July 02, 2012, 04:08:20 PM
I also suggest
I would wish that the ML community would support alex with one piece of every canon model - this would make things easier for him and help the whole canon filmer/user community.
Let´s see it this way - for example with a 600d:
If every 600d user who uses ML gives him 10 $ or € it needs only around 70 people to solve this problem. This could work for every model.
I would go with it immediately ...
So, is there anybody around who´s interested?

The donation feature is in the works, don't worry  8)
Title: Re: 600D Audio Controls?
Post by: mexicodirk on July 03, 2012, 02:37:02 AM
 :) yes
i use the 600D and 10 or 15 Bux its  not a problem for this great work what you guys making!

 in the Download Page you can Donate !
and i put something in!

Dirk

@ nanomad nice pice of Canon History you have ( EOS650 without D)
Title: Re: 600D Audio Controls?
Post by: nanomad on July 03, 2012, 10:49:31 AM
@ nanomad nice pice of Canon History you have ( EOS650 without D)

It's a great piece of hardware. 24 years old and it still works like it was its first day. The same goes for the lenses (altough I had to clean the tele since it had dust in it)
Title: Re: 600D Audio Controls?
Post by: scrax on July 05, 2012, 02:00:12 AM
1%
For audio on 600D if have not changed it only enabled in TL you can have metering working at first start if you set the Output volume to 4 or 6 (I'm not sure if audio need to be on manual or in canon menu). After a movie record it will not work anymore.This can make sound trigger usable but only if movie mode is disabled or camera is restarted before using it (if you switch or star up in video mode it will not work anymore).
Title: Re: 600D Audio Controls?
Post by: 1% on July 07, 2012, 06:18:35 PM
When not recording I can only get the meters to come on for a second when first enabling audio and then they fall. Maybe one of the other settings is set? Or do you need headphone to be on too for output volume?

I've got a slightly better understanding on how this works after some research. I have the console going, just need to decrypt .fr so I can load it. Wonder if you could do a detailed cross analysis between all available firmware and if that would help any.

I want to try:
call("TurnAVLineMuteOff");

with don't click me button... maybe while recording and while not with headphone connected and on.. I think I have to disassemble FW and find entry address and put it in the stubs? I can't just call it without that, right?

****
I've tried setting

7e ->  04
7f  -> 04
(On is 07)
to turn off wind filter. register changes but setting doesn't... at least I'm starting to know what is what. I'll try to find record volume next.
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 04:28:42 AM
I played this function via audio writes and I can hear clicks then always a click when I start/stop recording.

On playback if I hit play fast enough after running the function I can hear audio from file in headphones.

TurnAVLineMuteOff=
0x5703   -< Disable Something else?                       
0x4903   -< This is disable amp?                         
0x4B00                           
0x3F33                         
0x2502                           
0x27A0
0x2126 -< I think this reboots IC.
msleep(0x1fe) <-  msleep(501ms)
0x4901 -< turn on audio amp
R0, R0, #0x6B00 -<< Send 10 to register ( off is 00)

When I play I think monitoring is on for few ms or completely but output is low or something is muting it?

Also when I run function I see audio meters fall while IC reboots and you can hear it in the video file on playback  [ now over headphones :) ]

Title: Re: 600D Audio Controls?
Post by: a1ex on July 08, 2012, 11:48:47 AM
Here are my guesses from dumping the registers:
Code: [Select]
68,68, 6e, 6f: auto/manual?

7e/7f: 04 = WF off, 07 = WF on

audio gain:
32/33
38/39
6e/6f

68/69 agc

Some background: audio registers have two digits (let's say 0xAB).

To read a register: int value = audio_ic_read(0xAB00);
To write to a register: if value is 0x12, you call audio_ic_write(0xAB12).
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 04:26:53 PM
I was doing too much work naming the registers. Wonder what is resetting things after register is changed. Maybe some process controls audio and has to be shut off? Or specific order needs to be followed? I'll have to try more stuff.

Here are some of the guesses/logs from trying if you didn't see it before:

https://bitbucket.org/OtherOnePercent/tragic-lantern/changeset/810be8d0edb6#comments


Also, have to say many of the registers from 7k0r guide are the same or very similar.

Also i think setting 1 of the register pairs is enough... that seems to be what cannon fw does.
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 06:48:51 PM
I wish I could look for more but I can't decrypt the firmware ( no keys) and I don't know how the dumper works for 600D or if it works. Only other option is trial and error? How can I make reg dump in play mode? Set msleep to some number then go into play? I'll look at take SS in 10sec.

Code: [Select]
Lets Annotate the functions!
May not be 100%

DisableAudioIC
2100     - 00 Disabled 26 While Record - 06 Stop                       
0d00   - 0f while on


PowerMicAmp
230a     - 0A while recording 00 While stop input power?                       
2f02     - 00 Stopped 02 Recording Power Save?                       
SelectMic(0) ?
1512  - Always 12
1311  - 11 while recording 00 stop


UnpowerMicAmp
4903  - Mute/off amp 01 is on                           
1300  - rec switch off                           
2300  - Input power? off                           
SetFilterRecOff -?


TurnAVLineMuteOn()=
0x4903 - Mute/off amp 01 is on                 
0x693E - Vol Control Disable: 2c is enable

TurnAVLineMuteOff=
0x5703   - Disable Something sometimes 00                   
0x4903   - This is disable amp?                         
0x4B00   - fader? only see 00                       
0x3F33   - Unkn Alsways See 33                     
0x2502   - Dac power? See 02 and 00 Only                       
0x27A0   - Power Management? Set to 00 by mystery
0x2126 - I think this reboots IC.
msleep(0x1fe) -  msleep(501ms)
0x4901 - turn on audio amp
R0, R0, #0x6B00 - Send 10 to register ( off is 00)

Registers stay after reboot until something changes them.


UnpowerSpeakerForWAV()=
0x4903  - Disable Amp - common theme when changing settings         
0x2713  - Power MGMT? 00 or A0         
0x2700  - Same?         
ORR     R0, R0, #0x6B00 (wr) - Send 10 to register ( off is 00)   
0x5500 - Speaker amp out? Always see 00
0x3B1B - Speaker amp vol? see 1b always

PowerSpeakerForWAV=
0x5507 - Speaker amp out 07 on?   Maybe SPKR on/off                       
0x4903 - Disable amp                         
0x4B00 - Fader?                         
0x2713 - Power MGMT to 13                         
0x271F - New setting 1F?
0x4901 - Power AMP
ORR     R0, R0, #0x6B00 - Send 10 to reg

SetFilterPlayOff=
UnpowerSpeakerForWAV
TurnAVLineMuteOn
0x1300 - rec off
0x2106 - Audio IC to stop mode
msleep
0x2700 - Power MGMT?
0x5700 - Often see 03 while recording
0x2500 - dac power? see 03 and 00
0x6700 - Filters? See 0f or 00
0xAD00 - doc says eq? always see 00

SetFilterPlay=                   
0xADBD     - Here it is again with new setting.  Is this EQ on/off?                   
0x673F     - Filters to 3f?
0x7F00     - Disable wind screen/hpf why?
0x8175     - EQ? Normally 0d
0x832A     - EQ? Normally db
0x85A1     - EQ? Normally 0c
0x8795     - EQ? Normally 1b
0x896D     - EQ? Normally 6d
0x8B08     - EQ? Normally 08
0x8D16     - EQ? Normally 41
0x8FBD     - EQ? Normally ed
0x9146     -<
0x93EA These are 0 in other modes
0x959C
0x9724
0x996D
0x9B08
0x9DCA         
0x9FDB    -<
0xA100     >
0xA300 0 in other modes eq?
0xA500
0xA700     >
0x75D5     - Normally DD
0x77F4     - Normally DD
0x79F1     - Normally E7
0x7BF0     - Normally E7
0x7D00     - Normally E7
0xA95A     - Normally 00


Second Set filter play:

Are these 2 different modes?


0xAD85  - EQ to 85 now?
0x7F00  - Disable HPF/Wind we didn't set filters this time?
0x8300  - Normally DB
0x8500  - Normally 0C
0x8700  - Normally 1B
0x8900  - Normally 6D
0x8B00  - Normally 08
0x8D00  - Normally 41
0x8F00  - Normally ED
0x9100  - Second function Sets these to 0
0x9300
0x9500
0x9700
0x9900
0x9B00
0x9D00
0x9F00  < End
0xA100 - Zero these again
0xA300
0xA500
0xA700  < END
0x75E7 Now we set all these how they usually are.
0x77E7
0x79E7
0x7BE7
0x7DE7
0xA900


FF06A420 wav_volume_out_maybe=   
ORR     R0, R0, #0x3B00       Normally 1B so what is the flip?  Guide says speaker amp volume
ORR     R0, R5, #0x7100       Normally ff Guide says play digital volume



Title: Re: 600D Audio Controls?
Post by: a1ex on July 08, 2012, 06:52:23 PM
No need to decrypt the firmware once you run ML - see the FAQ.

You can put the reg dump on "don't click me" and maybe you can use some delay. Or call fake_simple_button(BGMT_PLAY) to force playback mode after ML menu is closed.
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 07:01:35 PM

One of those might be what is flipping/ignoring registers? Or you need to unpower amp to switch wind screen?

No way to send audio writes real time so I don't have to recompile and run every time? SD reader is on my render box and compiling machine is an extra laptop with no slot.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 08, 2012, 07:15:39 PM
You can use PTP for that: http://magiclantern.wikia.com/wiki/PTP-CHDK

But I think you need some custom handlers.
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 08:00:45 PM
That seems like just as much work :)

Here is play mode.

Code: [Select]
00 08
01 08
02 96
03 96
04 00
05 00
06 00
07 00
08 03
09 03
0a 05
0b 05
0c 0f
0d 0f
0e 04
0f 04
10 00
11 00
12 00
13 00
14 00
15 00
16 00
17 00
18 00
19 00
1a 00
1b 00
1c 00
1d 00
1e 00
1f 00
20 06
21 06
22 02
23 02
24 00
25 00
26 00
27 00
28 00
29 00
2a 00
2b 00
2c 00
2d 00
2e 00
2f 00
30 00
31 00
32 10
33 10
34 00
35 00
36 00
37 00
38 00
39 00
3a 1b
3b 1b
3c 00
3d 00
3e 33
3f 33
40 00
41 00
42 00
43 00
44 00
45 00
46 00
47 00
48 01
49 01
4a 00
4b 00
4c 00
4d 00
4e 00
4f 00
50 00
51 00
52 00
53 00
54 07
55 07
56 00
57 00
58 00
59 00
5a 00
5b 00
5c 00
5d 00
5e 00
5f 00
60 0b
61 0b
62 0b
63 0b
64 00
65 00
66 3f
67 3f
68 2e
69 2e
6a 10
6b 10
6c ff
6d ff
6e 88
6f 88
70 ff
71 ff
72 00
73 00
74 d5
75 d5
76 f4
77 f4
78 f1
79 f1
7a f0
7b f0
7c 00
7d 00
7e 00
7f 00
80 75
81 75
82 2a
83 2a
84 a1
85 a1
86 95
87 95
88 6d
89 6d
8a 08
8b 08
8c 16
8d 16
8e bd
8f bd
90 46
91 46
92 ea
93 ea
94 9c
95 9c
96 24
97 24
98 6d
99 6d
9a 08
9b 08
9c ca
9d ca
9e db
9f db
a0 00
a1 00
a2 00
a3 00
a4 00
a5 00
a6 00
a7 00
a8 5a
a9 5a
aa 00
ab 00
ac bd
ad bd
ae 00
af 00
b0 01
b1 01
b2 08
b3 08
b4 08
b5 08
b6 00
b7 00
b8 0b
b9 0b
ba 70
bb 70
bc 00
bd 00
be 01
bf 01
c0 04
c1 04
c2 05
c3 05
c4 0d
c5 0d
c6 70
c7 70
c8 10
c9 10
ca 00
cb 00
cc 00
cd 00
ce 00
cf 00
d0 00
d1 00
d2 00
d3 00
d4 00
d5 00
d6 00
d7 00
d8 00
d9 00
da 00
db 00
dc 00
dd 00
de 00
df 00
e0 02
e1 02
e2 00
e3 00
e4 07
e5 07
e6 01
e7 01
e8 01
e9 01
ea 00
eb 00
ec 00
ed 00
ee 00
ef 00
f0 00
f1 00
f2 00
f3 00
f4 00
f5 00
f6 00
f7 00
f8 00
f9 00
fa 00
fb 00
fc 00
fd 00
fe 00
ff 00
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 11:32:23 PM
0x3900 is Mic boost for sure... when I turn it down external mic gets underpowered and internal mic is quieter.

0x3300 is input volume... I threw it on the first volume slider and it *somewhat* works.. mic gets quieter/louder but I never set up what it was putting in the register so its hit or miss.

0x3F00 is AV volume
0x3B00 is speaker amp volume its set to 1b for some reason...


I think I'll have to figure out the PTP.. .this is getting tedious. Canon functions always reset the registers so getting any setting to stay is pure luck.

The stuff from the 7k0r PDF pg107 on is helping, its mostly the same. There appear to be order/timing specific things to get the IC to do what you want and canon FW is screwing that up most of the time.
Title: Re: 600D Audio Controls?
Post by: scrax on July 08, 2012, 11:37:08 PM
I've installed this: http://magiclantern.wikia.com/wiki/Remote_control_with_PTP_and_Python not sure if can help but then trying it I've run out of battery.
If you can use it please post some reports to how to replicate and I'll try to help for what I can but I think that a part from testing I can't go long...
Title: Re: 600D Audio Controls?
Post by: 1% on July 08, 2012, 11:51:00 PM
If I can call audio writes and reads from PTP I can try some things in the doc/canon + functions and then see what it does... Also it will be easier reading specific registers without having to dump all of them, turn off the camera, etc.

 Wish it was like javascript console.. you just call functions and they run.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 09, 2012, 12:15:33 AM
Sounds very promising - so most important registers are almost known.

When does Canon overwrite the settings? When you change mode (like, press REC, go to play mode), or continuously?
Title: Re: 600D Audio Controls?
Post by: 1% on July 09, 2012, 01:27:03 AM
Seems continuously and whenever an action is performed. I.e I unmute headphone and its muted right away. When I set msleep to 4000 I can't get headphone to work, when its  2000 I could catch it and one file would play through headphones. As soon as you pause / play it goes through the speaker.

It only sets what it knows to set though since you still hear click when you press rec. 

PTP will kinda prevent using the headphones... guess I'll have to figure out how to send audio to the speaker instead. Will get a little more clear when you can read/write to the IC without having to turn the camera off/on/recompile, etc.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 09, 2012, 11:02:55 AM
So, this means we should block Canon audio task somehow. With ak4646 cameras, this is done by overriding sounddev_task with a custom one.
Title: Re: 600D Audio Controls?
Post by: scrax on July 09, 2012, 02:35:09 PM
When not recording I can only get the meters to come on for a second when first enabling audio and then they fall. Maybe one of the other settings is set? Or do you need headphone to be on too for output volume?
So, this means we should block Canon audio task somehow. With ak4646 cameras, this is done by overriding sounddev_task with a custom one.

This maybe is why when I tested the audio trigger feat. to have it working was need to remove this block for 600D in audio.c:1518

#ifndef CONFIG_600D
TASK_OVERRIDE( sounddev_task, my_sounddev_task );
#endif

It worked only before enter video mode. All my last test were done without headphone connected.
I'll try 1% functions and report back.

added audio test menu from Tragic Lantern, now I don't know how to go on, will try to restore ML menu in play mode to start the function when playing back a video...

first tests:
So far enabling filter 1 or 2 will lower rec volume seems, not tested headphone yet.
Disable audio Ic will stop it also for canon menu...
and it will not record audio or play it back anymore till restart.
more test going on...
NOTE: I've removed the comment to TASK_OVERRIDE...

During recording if I press mute AV meter will go down and audio will be not recorded anymore till the next record, then audio comes back like usual.
pressin unmute AV will not bring it back during record or after.
Title: Re: 600D Audio Controls?
Post by: scrax on July 09, 2012, 06:17:39 PM
I have the impression that on start the chip is monitoring audio even in photo mode, just with TASK_OVERRIDE active. I've not tried yet.
filter will stay set till a rec is started, then they will turn back to normal and can be reset during rec.
I have no clue if there is something else that is changing them or if TASK_OVERRIDE is not fully working...
Title: Re: 600D Audio Controls?
Post by: 1% on July 09, 2012, 06:35:11 PM
I set the 2 first volumes up... there is just no latitude. Values being placed in those addresses aren't right. That is why I enabled the sound override task. I can try to disable it... maybe it will be more interesting.

When you mute av it does:     audio_ic_write( 0x693e );

None of the other commands write to 0x69 which I think is volume control enable/disable or something along those lines.

I have to put in a few more today like the mic power/unpower, reboot ic, enable IC, etc. Also was going to put delays to get to play mode... but I can just enable ML menu to show up? That would be sweet. After that I'll try some functions from the 7k0r sheet.

I can get the ext speaker to pop (like headphone) but I think only when something gets crashed/changed. It did it in record and stop but its hard to reproduce.
Title: Re: 600D Audio Controls?
Post by: 1% on July 09, 2012, 08:11:58 PM
I think reboot doesn't work but you can power mic amp whenever now and get left working at least. How do I enable ML menu in play mode?
Title: Re: 600D Audio Controls?
Post by: scrax on July 09, 2012, 08:56:18 PM
I think reboot doesn't work but you can power mic amp whenever now and get left working at least. How do I enable ML menu in play mode?
Here what is missing in menu.c:

Code: [Select]
// this should work on most cameras
int handle_ml_menu_erase(struct event * event)
{
    if (dofpreview) return 1; // don't open menu when DOF preview is locked
   
    if (event->param == BGMT_TRASH)
    {
        if (gui_menu_shown() || gui_state == GUISTATE_IDLE)
        {
            give_semaphore( gui_sem );
            return 0;
        }
        //~ else bmp_printf(FONT_LARGE, 100, 100, "%d ", gui_state);
    }

#ifndef CONFIG_5D2
    if (event->param == BGMT_MENU && PLAY_MODE)
    {
        give_semaphore( gui_sem );
        return 0;
    }
#endif
   
    return 1;
}
but basically it will change to menu mode, so it's not so usable.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 09, 2012, 09:00:50 PM
You can disable piggyback_canon_menu and close_canon_menu (simply comment out their contents), then alter the button handler to accept the delete key in play mode too.
Title: Re: 600D Audio Controls?
Post by: scrax on July 09, 2012, 09:39:39 PM
done, testing again.

Filter 1 is increasing volume of the speaker audio in play
Filter 2 is decreasing volume of the speaker audio in play
Unpower Speaker will shut down audio when playing
power speaker then can bring back audio on speaker but at a lower volume, then filter 1 will increase it a bit.
Not yet added last 1% functions...
Title: Re: 600D Audio Controls?
Post by: 1% on July 09, 2012, 09:56:27 PM
I have to set the play mode up but I think i can find mic select. When I just start the amp up its only on 1 channel. after record it is on both.

*

The play filters mostly ser eq's and volumes.  The HPF from the 7k0r menus seem to work. Also rec/play toggles affect things.

Title: Re: 600D Audio Controls?
Post by: scrax on July 09, 2012, 11:06:26 PM
I've enabled the TASK_OVERRIDE from your source and I can see the meter at start up., now looking in the 7k0r menu. but first will add the menu in play.

here my diff:
Code: [Select]
diff -r 853866588ab9 Makefile.inc
--- a/Makefile.inc Mon Jul 09 14:28:44 2012 -0500
+++ b/Makefile.inc Mon Jul 09 23:13:35 2012 +0200
@@ -172,6 +172,7 @@
  -D__ARM__ \
  -I$(PLATFORM_INC) \
  -I$(SRC_DIR) \
+ -mlong-calls \
 
 ifeq ($(CONFIG_PYMITE),y)
 CFLAGS += $(PYMITE_CFLAGS)
diff -r 853866588ab9 src/audio.c
--- a/src/audio.c Mon Jul 09 14:28:44 2012 -0500
+++ b/src/audio.c Mon Jul 09 23:13:35 2012 +0200
@@ -1518,11 +1518,11 @@
         }
 }
 
-#ifndef CONFIG_600D
+//#ifndef CONFIG_600D
 //#ifndef CONFIG_500D
 
-//TASK_OVERRIDE( sounddev_task, my_sounddev_task );
-#endif
+TASK_OVERRIDE( sounddev_task, my_sounddev_task );
+//#endif
 
 #if 0
 /** Replace the audio level task with our own.
diff -r 853866588ab9 src/menu.c
--- a/src/menu.c Mon Jul 09 14:28:44 2012 -0500
+++ b/src/menu.c Mon Jul 09 23:13:35 2012 +0200
@@ -2121,7 +2121,7 @@
 
 void piggyback_canon_menu()
 {
-#ifdef GUIMODE_ML_MENU
+/*#ifdef GUIMODE_ML_MENU
     #ifdef CONFIG_500D
     if (is_movie_mode()) return; // doesn'tworkstation
     #endif
@@ -2132,12 +2132,12 @@
     int new_gui_mode = GUIMODE_ML_MENU;
     if (new_gui_mode) task_create("menu_redraw_flood", 0x1c, 0, menu_redraw_flood, 0);
     if (new_gui_mode != CURRENT_DIALOG_MAYBE) { SetGUIRequestMode(new_gui_mode); msleep(200); }
-#endif
+#endif*/
 }
 
 void close_canon_menu()
 {
-#ifdef GUIMODE_ML_MENU
+/*#ifdef GUIMODE_ML_MENU
     #ifdef CONFIG_500D
     if (is_movie_mode()) return; // doesn'tworkstation
     #endif
@@ -2146,7 +2146,7 @@
     if (gui_state == GUISTATE_MENUDISP) return;
     SetGUIRequestMode(0);
     msleep(100);
-#endif
+#endif*/
 }
 
 static void menu_open()
@@ -2486,6 +2486,14 @@
         //~ else bmp_printf(FONT_LARGE, 100, 100, "%d ", gui_state);
     }
 
+#ifndef CONFIG_5D2
+    if (event->param == BGMT_MENU && PLAY_MODE)
+    {
+        give_semaphore( gui_sem );
+        return 0;
+    }
+#endif
+   
     return 1;
 }
 

Now during play a video:
Audio test... menu
Reboot Audio IC : during play audio goes away
Unmute AV, Unmute AV2 : not working
Disable / Enable Audio IC : works
Power/Unpower speaker: works
Play Filters 1 and 2 : works
Unset play filter: not working

7k0r menu:
Rec Start/Stop Block on/off : works in rec
RecVolSet: will droop volume too low, rec start will recover.
Play Vol Set also wil drop down volume when in play but no so much as in rec.

in audio menu
Analog gain seem to work only from 23 to 32 dB
Title: Re: 600D Audio Controls?
Post by: 1% on July 10, 2012, 12:12:40 AM
Analog gain is mic input gain. L-gain is mic boost. Values are wrong.. I dunno what it was being set to originally. The db's don't correspond to anything.

I want to make a big chart of all of these regs from 7k0r and what values I find from canon. Some of  the registers are actually binary so depending on what bit is flipped some shit happens.

Once we have a full list it will make more sense what has to be done to control things. I'll mess with the play mode, I think you can get headphone to work if you unmute it right before you press play. If you do it while playing it will do nothing or just shut the speaker off. I found this out when I was originally doing msleep and unmute from the don't click me menu. The timing has to be right so canon doesn't change it back. With power up mic, audio remote shot can probably happen already.
Title: Re: 600D Audio Controls?
Post by: 1% on July 10, 2012, 01:37:56 AM
Docs for very similar lapis chip... may shed some light


http://us.generation-nt.com/patch-v3-sound-soc-codecs-add-lapis-semiconductor-ml26124-help-205578541.html



http://git.alsa-project.org/?p=alsa-kernel.git;a=blob;f=sound/soc/codecs/ml26124.c;h=22cb5bf59273dcbfde850dd6243a138cbdce003f;hb=HEAD

Registers are very similar as you can see:

http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.h;hb=HEAD

The C file will show how to do stuff.


*It uses the other set of registers... ie. this ic is

#define ML26124_PW_MIC_IN_VOL      0x32
#define ML26124_PW_MIC_BOST_VOL      0x38

We use 33 and 39... but I think either address works for setting. Will have to test.... does this mean audio is done for us?

The odd registers are used. Making a list with values I've seen. I stink at bit operations so its a little hard.

i.e. SOC_ENUM_SINGLE(ML26124_SAI_TRANS_CTL, 6, 3, ml26124_companding);

That is put companding in CTL with offset of 6 and bitmask of 3 but what is a bitmask of 3?, and how can it be at offset of 6?
Code: [Select]
0000xxx ?
000xxx0 ?

Also shit like this:

snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0);
Title: Re: 600D Audio Controls?
Post by: scrax on July 10, 2012, 07:03:12 PM
I can just confirm that actually just enabling TASK_OVERRIDE in audio.c also for 600D on unified will make audio meter work at first start before recording. And so also audio trigger can work but probably only if movie mode isn't used.
maybe restarting the chip when this function is activated could help in having it always usable...
Title: Re: 600D Audio Controls?
Post by: 1% on July 10, 2012, 07:48:31 PM
I'm going to keep trying, going to put register names in the functions. Here is a list, not 100% complete but getting much much closer. Some registers control more than 1 "thing", depending on which bits you flip.

Going in audio.h
Code: [Select]
/* Clock Control Register */
#define ML_SMPLING_RATE 0x0100 /* Sampling Rate */
#define ML_PLLNL 0x0300 /* PLL NL */
#define ML_PLLNH 0x0500 /* PLL NH */
#define ML_PLLML 0x0700 /* PLL ML */
#define ML_PLLMH 0x0900 /* MLL MH */
#define ML_PLLDIV 0x0b00 /* PLL DIV */
#define ML_CLK_EN 0x0d00 /*MCLKEN + PLLEN +PLLOE */ /* Clock Enable */
#define ML_CLK_CTL 0x0f00 /* CLK Input/Output Control */

/* System Control Register */
#define ML_SW_RST 0x1100 /* Software RESET */
#define ML_REC_PLYBAK_RUN 0x1300 /* Record/Playback Run */
#define ML_MIC_TIM 0x1500 /* Mic Input/Output control */

/* Power Mnagement Register */
#define ML_PW_REF_PW_MNG 0x2100 /* MICBIAS */ /* Reference Power Management */
#define ML_PW_IN_PW_MNG 0x2300 /* ADC "Capture" + PGA */ /* Input Power Management */
#define ML_PW_DAC_PW_MNG 0x2500 /*DAC Power Switch? Playback */ /* DAC Power Management */
#define ML_PW_SPAMP_PW_MNG 0x2700 /* SP-AMP Power Management */
#define ML_PW_LOUT_PW_MNG 0x2900 /* Line Control Switch? */ /* LINEOUT Power Management */
#define ML_PW_ZCCMP_PW_MNG 0x2f00 /* ZC Switch */ /* AC-CMP Power Management */


/* Analog Reference Control Register */
#define ML_PW_MICBIAS_VOL 0x3100 /* MICBIAS Voltage Control */

/* Input/Output Amplifier Control Register */
#define ML_PW_MIC_IN_VOL 0x3300 /* MIC Input Volume */
#define ML_PW_MIC_BOST_VOL 0x3900 /* Mic Boost Volume */
#define ML_PW_SPK_AMP_VOL 0x3b00 /* Speaker AMP Volume */
#define ML_PW_AMP_VOL_FUNC 0x4900 /* AMP Volume Control Function Enable */
#define ML_PW_AMP_VOL_FADE 0x4b00 /* Amplifier Volume Fader Control */


/* Analog Path Control Register */
#define ML_SPK_AMP_OUT 0x5500 /* DAC Switch + Line in loopback Switch + PGA Switch */ /* Speaker AMP Output Control */
#define ML_MIC_IF_CTL 0x5b00 /* Mic IF Control */
#define ML_MIC_SELECT 0xe900 /* Mic IF Control */

/* Audio Interface Control Register */
#define ML_SAI_TRANS_CTL 0x6100 /* SAI-Trans Control */
#define ML_SAI_RCV_CTL 0x6300 /* SAI-Receive Control */
#define ML_SAI_MODE_SEL 0x6500 /* SAI Mode select */

/* DSP Control Register */
#define ML_FILTER_EN 0x6700 /* Filter Func Enable */ /*DC High Pass Filter Switch+ Noise High Pass Filter Switch + EQ Band0/1/2/3/4 Switch  V: '01' '00' */
#define ML_DVOL_CTL 0x6900 /* Volume Control Func Enable */ /* Play Limiter + Capture Limiter + Digital Volume Fade Switch +Digital Switch */
#define ML_MIXER_VOL_CTL 0x6b00 /* Mixer & Volume Control*/
#define ML_RECORD_DIG_VOL 0x6d00 /* Capture/Record Digital Volume */
#define ML_PLBAK_DIG_VOL 0x7100 /* Playback Digital Volume */
#define ML_DIGI_BOOST_VOL 0x7300 /* Digital Boost Volume */
#define ML_EQ_GAIN_BRAND0 0x7500 /* EQ Band0 Volume */
#define ML_EQ_GAIN_BRAND1 0x7700 /* EQ Band1 Volume */
#define ML_EQ_GAIN_BRAND2 0x7900 /* EQ Band2 Volume */
#define ML_EQ_GAIN_BRAND3 0x7b00 /* EQ Band3 Volume */
#define ML_EQ_GAIN_BRAND4 0x7d00 /* EQ Band4 Volume */
#define ML_HPF2_CUTOFF         0x7f00 /* HPF2 CutOff*/
#define ML_EQBRAND0_F0L 0x8100 /* EQ Band0 Coef0L */
#define ML_EQBRAND0_F0H 0x8300
#define ML_EQBRAND0_F1L 0x8500
#define ML_EQBRAND0_F1H 0x8700
#define ML_EQBRAND1_F0L 0x8900
#define ML_EQBRAND1_F0H 0x8b00
#define ML_EQBRAND1_F1L 0x8d00
#define ML_EQBRAND1_F1H 0x8f00
#define ML_EQBRAND2_F0L 0x9100
#define ML_EQBRAND2_F0H 0x9300
#define ML_EQBRAND2_F1L 0x9500
#define ML_EQBRAND2_F1H 0x9700
#define ML_EQBRAND3_F0L 0x9900
#define ML_EQBRAND3_F0H 0x9b00
#define ML_EQBRAND3_F1L 0x9d00
#define ML_EQBRAND3_F1H 0x9f00
#define ML_EQBRAND4_F0L 0xa100
#define ML_EQBRAND4_F0H 0xa300
#define ML_EQBRAND4_F1L 0xa500
#define ML_EQBRAND4_F1H 0xa700

/* ALC Control Register */
#define ML_ALC_MODE 0xb100 /* ALC Mode */
#define ML_ALC_ATTACK_TIM 0xb300 /* ALC Attack Time */
#define ML_ALC_DECAY_TIM 0xb500 /* ALC Decay Time */
#define ML_ALC_HOLD_TIM 0xb700 /* ALC Hold Time */
#define ML_ALC_TARGET_LEV 0xb900 /* ALC Target Level */
#define ML_ALC_MAXMIN_GAIN 0xbb00 /* ALC Min/Max Input Volume/Gain 2 sets of bits */
#define ML_NOIS_GATE_THRSH 0xbd00 /* Noise Gate Threshold */
#define ML_ALC_ZERO_TIMOUT 0xbf00 /* ALC ZeroCross TimeOut */

/* Playback Limiter Control Register */
#define ML_PL_ATTACKTIME 0xc100 /* PL Attack Time */
#define ML_PL_DECAYTIME 0xc300 /* PL Decay Time */
#define ML_PL_TARGETTIME 0xc500 /* PL Target Level */
#define ML_PL_MAXMIN_GAIN 0xc700 /* Playback Limiter Min/max Input Volume/Gain 2 sets */
#define ML_PLYBAK_BOST_VOL 0xc900 /* Playback Boost Volume */
#define ML_PL_0CROSS_TIMOUT 0xcb00 /* PL ZeroCross TimeOut */


/* Undocumented Canon Registers */
#define ML_NODOC_E5  0xe500 /* While playing? Val:'06' '07' */


Task override may be flipping things because while all of the magic lantern registers are wrong they still modify the real ones. I can disable the override and still power up the mic amp and get audio. Only on 1 channel until I start recording. Want to get the old registers out asap. This audio IC works fairly differently than the other one(s). Much of audio.c has to be different.. I see why this was a huge problem having no camera to test on.

With ML menu in play mode... I can unmute AV and listen through headphones at will.. wheel even adjust volume but there is not much latitude.

*http://fossies.org/dox/alsa-driver-1.0.25/soc_8h.html#a0d99352bf179ad390d7b697377b36e9a
Title: Re: 600D Audio Controls?
Post by: 1% on July 11, 2012, 03:18:25 AM
Ok, trying to figure out the volume scales.... maybe someone knows math :)

Code: [Select]
DECLARE_TLV_DB_SCALE(name, min, step, mute) \

#define SOC_SINGLE_TLV (   xname,
  reg,
  shift,
  max,
  invert,
  tlv_array
)

static const DECLARE_TLV_DB_SCALE(digital_tlv, -7150, 50, 0);
SOC_SINGLE_TLV("Capture Digital Volume", ML26124_RECORD_DIG_VOL, 0,
0xff, 1, digital_tlv),
SOC_SINGLE_TLV("Playback Digital Volume", ML26124_PLBAK_DIG_VOL, 0,
0xff, 1, digital_tlv),


How do I do gain to db?  I can't figure out how DECLARE_TLV_DB_SCALE arrives at db value. Can't find it in the alsa sources.


Title: Re: 600D Audio Controls?
Post by: a1ex on July 11, 2012, 09:28:32 AM
ML has built-in functions for this... audio_level_to_db ;)
Title: Re: 600D Audio Controls?
Post by: funkysound on July 11, 2012, 04:20:53 PM
I don´t understand a word ... but it sounds to me that you are on the right way to realize audio on the 600d.  :)
Title: Re: 600D Audio Controls?
Post by: 1% on July 11, 2012, 05:09:37 PM
Everything has its own scale...

static const DECLARE_TLV_DB_SCALE(alclvl, -2250, 150, 0);
static const DECLARE_TLV_DB_SCALE(mingain, -1200, 600, 0);
static const DECLARE_TLV_DB_SCALE(maxgain, -675, 600, 0);
static const DECLARE_TLV_DB_SCALE(boost_vol, -1200, 75, 0);
static const DECLARE_TLV_DB_SCALE(ngth, -7650, 150, 0);

Input switching is somewhat working too... I can isolate the internal mic but for some reason not the external.


Audio for 600D already "works", just what ML does is different than what this chip needs. All old register addresses are wrong.  We can also set sampling rate and other stuff like that. May be possible to record higher bit rate with crappier audio, etc. The IC is basically fully controllable.

I think task override is not 100%. I think the 2 tasks are fighting still.   Wanted to look for it in the firmware: I tried to dump rom0 but the function keeps saying its undeclared no matter what I do. 

Also I wonder if monitoring is possible because this IC has 2 modes... play and rec. Hopefully it will  set output to both record and feed headphone/speaker. I think they turn on OK just no signal is being fed to them. Hopefully canon didn't cheap out with this IC but there is no real spec so I can't tell.  Maybe I should talk with the alsa guy who wrote the driver.

Title: Re: 600D Audio Controls?
Post by: Micah McDowell on July 11, 2012, 11:30:33 PM
Good to see that you smart guys are working on this....

I just purchased a T3i today, unfortunately not knowing that headphone audio monitoring was not yet available. I use it all the time on the T2i and it always works flawlessly. I'm greatly looking forward to it being enabled on the T3i.

Donated to the project; keep up the good work!
Title: Re: 600D Audio Controls?
Post by: 1% on July 12, 2012, 05:12:51 AM
Some good news.. mic select is working... also there is mic type. I think those will be easiest to implement.

Still no monitoring :(

ML21624 supports it... ML21621, its not mentioned in the crappy crappy datasheet.
Title: Re: 600D Audio Controls?
Post by: bart on July 12, 2012, 12:17:38 PM
great work!
Title: Re: 600D Audio Controls?
Post by: nanomad on July 13, 2012, 07:49:04 PM
The 1100D port will probably re-use your work. Great job!  ::)
Title: Re: 600D Audio Controls?
Post by: 1% on July 14, 2012, 11:20:10 PM
I've set up some of the analog volumes and implemented the mic in/type controls.

Volumes get reset when you hit rec or play so its best to use them after recording is started or with the mic amp powered at stop. Figured out some of the bit setting. Still a bunch is missing.
Title: Re: 600D Audio Controls?
Post by: 1% on July 16, 2012, 12:45:26 AM
Audio remote shot works if you power up the mic from debug first. Going to work on getting that to happen automatically.

Threshold while in photo mode is for some reason much higher.
Title: Re: 600D Audio Controls?
Post by: 1% on July 17, 2012, 12:57:45 AM
The big stumbling block on audio monitoring is how to turn

Code: [Select]
static const struct snd_soc_dapm_widget ml26124_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("MCLKEN", ML26124_CLK_EN, 0, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("PLLEN", ML26124_CLK_EN, 1, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("PLLOE", ML26124_CLK_EN, 2, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("MICBIAS", ML26124_PW_REF_PW_MNG, 2, 0, NULL, 0),
SND_SOC_DAPM_MIXER("Output Mixer", SND_SOC_NOPM, 0, 0,
   &ml26124_output_mixer_controls[0],
   ARRAY_SIZE(ml26124_output_mixer_controls)),
SND_SOC_DAPM_DAC("DAC", "Playback", ML26124_PW_DAC_PW_MNG, 1, 0),
SND_SOC_DAPM_ADC("ADC", "Capture", ML26124_PW_IN_PW_MNG, 1, 0),
SND_SOC_DAPM_PGA("PGA", ML26124_PW_IN_PW_MNG, 3, 0, NULL, 0),
SND_SOC_DAPM_MUX("Input Mux", SND_SOC_NOPM, 0, 0,
  &ml26124_input_mux_controls),
SND_SOC_DAPM_SWITCH("Line Out Enable", SND_SOC_NOPM, 0, 0,
     &ml26124_line_control),
SND_SOC_DAPM_INPUT("MDIN"),
SND_SOC_DAPM_INPUT("MIN"),
SND_SOC_DAPM_INPUT("LIN"),
SND_SOC_DAPM_OUTPUT("SPOUT"),
SND_SOC_DAPM_OUTPUT("LOUT"),
};

static const struct snd_soc_dapm_route ml26124_intercon[] = {
/* Supply */
{"DAC", NULL, "MCLKEN"},
{"ADC", NULL, "MCLKEN"},
{"DAC", NULL, "PLLEN"},
{"ADC", NULL, "PLLEN"},
{"DAC", NULL, "PLLOE"},
{"ADC", NULL, "PLLOE"},

/* output mixer */
{"Output Mixer", "DAC Switch", "DAC"},
{"Output Mixer", "Line in loopback Switch", "LIN"},

/* outputs */
{"LOUT", NULL, "Output Mixer"},
{"SPOUT", NULL, "Output Mixer"},
{"Line Out Enable", NULL, "LOUT"},

/* input */
{"ADC", NULL, "Input Mux"},
{"Input Mux", "Analog MIC SingleEnded in", "PGA"},
{"Input Mux", "Analog MIC Differential in", "PGA"},
{"PGA", NULL, "MIN"},
};

 into register commands. There is no DAPM unless you're using ALSA on something that can run it. It won't be in the firmware.

The only hints form the alsa dev list were:

Code: [Select]
Let me discuss about intercon settings.

Anticipated routes are like below.
Analog MIC(single ended) -> PGA -> ADC -> SAI
Analog MIC(differential) -> PGA -> ADC -> SAI
Digital MIC -> SAI
SAI -> DAC -> SPOUT
SAI -> DAC -> LOUT
LINEIN -> SPOUT
Title: Re: 600D Audio Controls?
Post by: 1% on July 17, 2012, 05:13:36 AM
Powered on the dac and headphone amp... hear hissing and it mutes when you tap the microphone. Can also turn on both channels of IC and move the stereo mic from right to left and back.
Title: Re: 600D Audio Controls?
Post by: miyake on July 23, 2012, 05:42:44 PM
@1%

Did you write document which is clear thing?
I just want to help you mapping(confirm) register value and Alsa driver's value.
But I don't know which one is clearly understanding.

I created a wikia account and let me know which part is confirmed in source code.
I wil write to our understanding to wikia.
Title: Re: 600D Audio Controls?
Post by: miyake on July 23, 2012, 08:36:53 PM
I'm not perfect understanding.
But now I can use ptp on my win 7 x64.

Let me confirm what you need:
Collect a memory value for each modes(normal,recording, play, palying)


First testing .
Quote
DAC (digital->analog) (550D and 600D, bcoz handled by tx19a I think)
StopASIFDMADAC=
0xC05000B0 <- 0
0XC092020C <- 0
-

normal:
<conn> m 0xC05000B0 16
c05000b0  24 00 00 00 00 00 00 00  07 00 00 00 00 00 00 00  |$...............|

recording:
<conn> m 0xC05000B0 16
c05000b0  24 00 00 00 00 00 00 00  07 00 00 00 00 00 00 00  |$...............|

play mode but not play:
<conn> m 0xC05000B0 16
c05000b0  24 00 00 00 00 00 00 00  07 00 00 00 00 00 00 00  |$...............|

playing :
<conn> m 0xC05000B0 16
c05000b0  27 00 00 00 00 00 00 00  07 00 00 00 00 00 00 00  |'...............|


Are these correct understanding? Is it a helpful for you?

Good night
Title: Re: 600D Audio Controls?
Post by: 1% on July 24, 2012, 06:14:13 AM
That is a canon function... you want audio_ic_write or read for direct communication. When I looked at that function in firmware it basically does a bunch of IC writes and leaves things muted till you actually play a file. Also sets up buffers for playing/writing, etc.

I can already turn the dac on and hear stuff... I just can't send it through mixer, etc.

The registers in audio.h are pretty much right.. just their values are not all known and there are a few extra in canon firmware I'm going to have to find.

In the alsa file the registers are even, in camera they are odd but the same thing. We have same value in the even registers but for some reason it doesn't change.

audio_ic_write( ML_PW_SPAMP_PW_MNG | 0xff ); // power speaker amp FF, BF no difference: is amp power 1f is speaker bf is headphone or "AV"
audio_ic_write( ML_PW_LOUT_PW_MNG | 0xff ); // Line out PM to all ON ... I think this is line out amp: same deal?

audio_ic_write( ML_PW_DAC_PW_MNG | 0x02 ); // power up dac  : Dac comes on but I don't think audio is being amplified at all, very very quiet.


Problem is IC has modes play and rec so I think we have to skip canon and just control it directly.  I tried to make a hybrid register setting between rec and play but it didn't make a difference.
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 10:56:40 AM
Just wrote :
http://magiclantern.wikia.com/wiki/600D/Audio#Alsa_driver_analyzing

for easy to understanding.
I will check your debug.c

And I found this on ml26124.h
Code: [Select]
        /* Record/Playback Running Control Register */
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
         snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, 0x2, 0x2);
        else
         snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, 0x1, 0x1);

It this a something help to understanding rec/play mode handling?
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 02:51:24 PM
I'm really confusing... Sorry for can't help you.

In alsa driver  I fond
Code: [Select]
#define DVOL_CTL_DVMUTE_ON       BIT(4) /* Digital volume MUTE On */
#define DVOL_CTL_DVMUTE_OFF      0      /* Digital volume MUTE Off */

static int ml26124_mute(struct snd_soc_dai *dai, int mute)
{
        struct snd_soc_codec *codec = dai->codec;

        if (mute)
         snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4),
         DVOL_CTL_DVMUTE_ON);
        else
         snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4),
         DVOL_CTL_DVMUTE_OFF);
        return 0;
}

So I think , we only to set this bit to 1 when we need to mute like this.
Code: [Select]
audio_ic_write( ML_DVOL_CTL | 0x10000);
But your xmuteav() is a lot of audio_ic_write(). and in your xmuteav() had this:
Code: [Select]
audio_ic_write ( 0x6908 ); // Set Dvol Stuff to "Play"
This means
Code: [Select]
audio_ic_write( ML_DVOL_CTL | 0x1000);
I found matching item for this in alsa driver
Code: [Select]
SOC_SINGLE("Digital Volume Fade Switch", ML26124_DVOL_CTL, 3, 1, 0),
You descrived "Set Dvol Stuff to "Play"" but it means Fade Switch will switching to ON.

How did you know those register values in debug.c?
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 03:53:45 PM

In the alsa file the registers are even, in camera they are odd but the same thing. We have same value in the even registers but for some reason it doesn't change.

audio_ic_write( ML_PW_SPAMP_PW_MNG | 0xff ); // power speaker amp FF, BF no difference: is amp power 1f is speaker bf is headphone or "AV"
audio_ic_write( ML_PW_LOUT_PW_MNG | 0xff ); // Line out PM to all ON ... I think this is line out amp: same deal?

audio_ic_write( ML_PW_DAC_PW_MNG | 0x02 ); // power up dac  : Dac comes on but I don't think audio is being amplified at all, very very quiet.


These have no maximum value definition in alsa driver. So I guess it's READ ONLY register.
Title: Re: 600D Audio Controls?
Post by: 1% on July 24, 2012, 04:06:04 PM
Dvol control has lots of switches and yes a mute... I made a mute/unmute and it seemed to work but camera would stop recording when sound stopped flowing to the buffer.

I got most of the functions from http://magiclantern.wikia.com/wiki/600D/Audio they came from the firmware.

As far as I know audio IC write can only write one byte. So you cannot write 0x1000 because you're writing 00 to register 0x10 which is probably 0x11 or "software reset".

I was way more confused when I first started... and I don't know how right I have the bits.


Code: [Select]

DVol -0x69
11111111
   xSOC_SINGLE("Play Limiter", ML26124_DVOL_CTL, 0, 1, 0),
      x SOC_SINGLE("Capture Limiter", ML26124_DVOL_CTL, 1, 1, 0),
    x   SOC_SINGLE("Digital Volume Fade Switch", ML26124_DVOL_CTL, 3, 1, 0),
   x    SOC_SINGLE("Digital Switch", ML26124_DVOL_CTL, 4, 1, 0),
0001 0000 - Digital Switch (mute?)
0000 x000 - Digital Fade
0000 00x0 - Capture Limiter
0000 000x - Play Limiter

0011 1110 - 2c Rec - value of dvol in rec
0000 1000 -08 Play 
0010 1110 2e          - that ASIFMDAC function sets this too
0011 1110 then 3e  - then sets this
0011 1110 Mute AV 


So if you look at that, the switches are all there but I don't know if my bits are moved over by 1 or in the right location.
Of course no SOC single function in the camera so can only switch bits manually. I found some values by looking at what value the camera was writing and then converting to bits. Combined with the alsa driver you can then figure out what gets switched on and it mostly corresponds.

So with this information I make up my own value and see what it does. 0x13 is rec/play. In rec it is 11 and in play it is 12.... so I change that to registers and try to turn on both so I write 13 to experiment so (0x1313)

and etc, etc,

>>>>

Cannot be read only... camera sets it... no max value because its a power control register.
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 04:25:04 PM
Oh sorry, 0x10000 is binary. not HEX....
Title: Re: 600D Audio Controls?
Post by: coutts on July 24, 2012, 04:33:38 PM
I may be able to help with this, i worked with the 500d audio chip a lot last year. Is there a factory documentation for the audio chip? This is what I used when working on the 500d as it tells you exactly what registers to modify for certain features.

Here's some tips:
Code: [Select]
static inline void
audio_ic_set_mgain(
                                   unsigned             mgain
                                   )
{
        unsigned sig1 = audio_ic_read( AUDIO_IC_SIG1 ); // Read the value of register 'Signal Select 1', store it in sig1.
                                                                                                        // We will use this later when we set individual bits on/off for
                                                                                                        // different gain values.
    unsigned sig2 = audio_ic_read( AUDIO_IC_SIG2 ); // Read the value of register 'Signal Select 2', store it in sig2.
   
       
    // Setting the bits for each possible gain setting in the 500d, individually so it's easy to understand.
        //              - 24 hours ago I didn't even understand how to configure the audio chip, so I think this is pretty good
        //                for my first implemenation :)
        //
        // Basically, different gain settings use different combinations of the MGAIN0, MGAIN1, MGAIN2, and MGAIN3 bits being set/cleared.
        // Here's a reference table for the settings, taken from the pdf linked from line 201 above:
        //
        //---------------------------------------------------------
        // MGAIN3  |  MGAIN2  |  MGAIN1  |  MGAIN0 ||  Gain Value
        //---------------------------------------------------------
        //    0    |     0    |    0     |    0    ||     0 dB
        //    0    |     0    |    0     |    1    ||   +20 dB (default setting)
        //    0    |     0    |    1     |    0    ||   +26 dB
        //    0    |     0    |    1     |    1    ||   +32 dB
        //    0    |     1    |    0     |    0    ||   +10 dB
        //    0    |     1    |    0     |    1    ||   +17 dB
        //    0    |     1    |    1     |    0    ||   +23 dB
        //    0    |     1    |    1     |    1    ||   +29 dB
        //    1    |     0    |    0     |    0    ||    +3 dB
        //    1    |     0    |    0     |    1    ||    +6 dB
        //---------------------------------------------------------
        //
        // So my switch statement below looks at the value of the mgain variable (which is changed by the gain setting in the ML menu),
        // and sets the correct combination of bits accordingly.
        //
        // &= ~(1 << x) means clear bit x
        // |= 1 << x means set bit x
        //
        // That should be enough to bring anybody up to speed on things.
        // -Coutts
    switch (mgain)
    {
        case 0: // 0 dB
            sig1 &= ~(1 << 0); //clear bit1 [MGAIN0] in register 'Signal Select 1'
            sig1 &= ~(1 << 1); //clear bit2 [MGAIN2]    "
            sig1 &= ~(1 << 3); //clear bit3 [MGAIN3]    "
            sig2 &= ~(1 << 5); //clear bit4 [MGAIN1] in register 'Signal Select 2'
            break;
           
        case 1: // 3 dB
            sig1 &= ~(1 << 0); //clear MGAIN0
            sig1 &= ~(1 << 1); //clear MGAIN2
            sig1 |= 1 << 3;        //set MGAIN3
            sig2 &= ~(1 << 5); //clear MGAIN1
            break;

more here:
https://bitbucket.org/hudson/magic-lantern/src/77f7db1f8a6e/platform/500D.111/audio.c.500d_under_construction.c
Title: Re: 600D Audio Controls?
Post by: 1% on July 24, 2012, 04:43:55 PM
Different chip... no MGAIN or any of that: completely 100% at odds with old audio.c

No documentation except for 7k0r programming guide and alsa driver for the next IC model up. When I tried to get info out of the company they cried about NDA with vendors because audio ICs are TOP SECRET.

Who made the IC in the 500D?

Title: Re: 600D Audio Controls?
Post by: coutts on July 24, 2012, 04:46:45 PM
For 500d:
http://www.asahi-kasei.co.jp/akm/en/product/ak4636/ak4636_f01e.pdf

I didn't so much mean to follow the MGAIN stuff, moreso look at how I set individual bits for the MGAIN registers. Thinking of things in binary may make it easier to understand.
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 04:55:10 PM
I just looking lapis-semiconductor web site in Japanese lang.
And checking technical question form.
But it for customer?only,, because it need a "describe product name" and "plan for volume production"....
I guess they are not give us the document. maybe,
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 05:22:37 PM
Cannot be read only... camera sets it... no max value because its a power control register.


I see, Read only is just my guess. forget this.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 24, 2012, 05:41:49 PM
ML26121.pdf (http://www.datasheetarchive.com/ML26121*-datasheet.html) :)

credits goto Coutts

@miyake-san: can you convert this to a format that we can read? (jpeg pages, for example) None of my PDF readers (including Adobe reader) open this correctly.
Title: Re: 600D Audio Controls?
Post by: miyake on July 24, 2012, 06:04:22 PM
I found 2 PDFs.
1st one is korean, and only 4 pages.

2nd one is 78K0R/Kx3

Already 1% had a English document?

If you don't have , I'll try to transrate this document to wikia with my poor English.
Title: Re: 600D Audio Controls?
Post by: 1% on July 24, 2012, 08:45:59 PM
Yea, I already got the english 7k0r guide, the other one looks the same but its a little bigger. The datasheet is more of a product announcement.

If you find more than in the english version, let me know but from a cursory look its the same.

English version is U19514EJ1V0AN00.pdf ... just type it into google.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:08:31 AM
normal(not recording,standby)
Code: [Select]
ML_SMPLING_RATE 08
ML_PLLNL 96
ML_PLLNH 00
ML_PLLML 00
ML_PLLMH 03
ML_PLLDIV 05
ML_CLK_EN 0f
ML_CLK_CTL 04
ML_SW_RST 00
ML_REC_PLYBAK_RUN 11
ML_MIC_TIM 12
ML_PW_REF_PW_MNG 06
ML_PW_IN_PW_MNG 0a
ML_PW_DAC_PW_MNG 00
ML_PW_SPAMP_PW_MNG 00
ML_PW_LOUT_PW_MNG 00
ML_PW_ZCCMP_PW_MNG 02
ML_PW_MICBIAS_VOL 02
ML_PW_MIC_IN_VOL 3f
ML_PW_MIC_BOST_VOL 10
ML_PW_SPK_AMP_VOL 1b
ML_PW_AMP_VOL_FUNC 01
ML_PW_AMP_VOL_FADE 00
ML_SPK_AMP_OUT 00
ML_MIC_IF_CTL 00
ML_MIC_SELECT 01
ML_SAI_TRANS_CTL 0b
ML_SAI_RCV_CTL 0b
ML_SAI_MODE_SEL 00
ML_FILTER_EN 0f
ML_DVOL_CTL 2e
ML_MIXER_VOL_CTL 10
ML_RECORD_DIG_VOL ff
ML_PLBAK_DIG_VOL ff
ML_DIGI_BOOST_VOL 00
ML_EQ_GAIN_BRAND0 dd
ML_EQ_GAIN_BRAND1 dd
ML_EQ_GAIN_BRAND2 e7
ML_EQ_GAIN_BRAND3 e7
ML_EQ_GAIN_BRAND4 e7
ML_HPF2_CUTOFF 04
ML_EQBRAND0_F0L 0d
ML_EQBRAND0_F0H db
ML_EQBRAND0_F1L 0c
ML_EQBRAND0_F1H 1b
ML_EQBRAND1_F0L 6d
ML_EQBRAND1_F0H 08
ML_EQBRAND1_F1L 41
ML_EQBRAND1_F1H ed
ML_EQBRAND2_F0L 00
ML_EQBRAND2_F0H 00
ML_EQBRAND2_F1L 00
ML_EQBRAND2_F1H 00
ML_EQBRAND3_F0L 00
ML_EQBRAND3_F0H 00
ML_EQBRAND3_F1L 00
ML_EQBRAND3_F1H 00
ML_EQBRAND4_F0L 00
ML_EQBRAND4_F0H 00
ML_EQBRAND4_F1L 00
ML_EQBRAND4_F1H 00
ML_ALC_MODE 01
ML_ALC_ATTACK_TIM 08
ML_ALC_DECAY_TIM 08
ML_ALC_HOLD_TIM 00
ML_ALC_TARGET_LEV 0b
ML_ALC_MAXMIN_GAIN 70
ML_NOIS_GATE_THRSH 00
ML_ALC_ZERO_TIMOUT 01
ML_PL_ATTACKTIME 04
ML_PL_DECAYTIME 05
ML_PL_TARGETTIME 0d
ML_PL_MAXMIN_GAIN 70
ML_PLYBAK_BOST_VOL 10
ML_PL_0CROSS_TIMOUT 00
ML_NODOC_E5 06
ML_INPUT_ADC 08
ML_INPUT_ANALOG_SINGLE 08
ML_INPUT_ANALOG_DIFF 08
ML_INPUT_PGA 08
ML_SUP_DAC_MCLKEN 08
ML_SUP_ADC_MCLKEN 08
ML_SUP_DAC_PLLEN 08
ML_SUP_ADC_PLLEN 08
ML_SUP_DAC_PLLOE 08
ML_SUP_ADC_PLLOE 96
ML_OUTMIX_DACSW 00
ML_OUTMIX_LOOPSW 03
ML_OUTPUT_LOUT 00
ML_OUTPUT_SPOUT 06
ML_OUTPUT_LOUTON 00
AUDIO_IC_SIG1 0a
AUDIO_IC_SIG2 0a
AUDIO_IC_IVL 00
AUDIO_IC_IVR 00
AUDIO_IC_PM1 06
AUDIO_IC_PM3 02
AUDIO_IC_MODE3 02
AUDIO_IC_MODE4 02
AUDIO_IC_FIL1 02
AUDIO_IC_ALCVOL 00
AUDIO_IC_ALC1 00

AGC off , windocut off
diff of normal and recording
Code: [Select]
]
--- AUDIOREG-normal.TXT 2012-07-26 10:01:34.000000000 +0900
+++ AUDIOREG-recording.TXT      2012-07-26 10:02:48.000000000 +0900
@@ -16,7 +16,7 @@
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
+ML_PW_MIC_IN_VOL 37
 ML_PW_MIC_BOST_VOL 10
 ML_PW_SPK_AMP_VOL 1b
 ML_PW_AMP_VOL_FUNC 01
@@ -28,7 +28,7 @@
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
 ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
+ML_DVOL_CTL 2c
 ML_MIXER_VOL_CTL 10
 ML_RECORD_DIG_VOL ff
 ML_PLBAK_DIG_VOL ff

AGCoff and AGCon
Code: [Select]
--- AUDIOREG-normal.TXT 2012-07-26 10:01:34.000000000 +0900
+++ AUDIOREG-AGCon.TXT  2012-07-26 10:05:46.000000000 +0900
@@ -7,19 +7,19 @@
 ML_CLK_EN 0f
 ML_CLK_CTL 04
 ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
 ML_MIC_TIM 12
 ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
 ML_PW_DAC_PW_MNG 00
 ML_PW_SPAMP_PW_MNG 00
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
 ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
 ML_PW_AMP_VOL_FADE 00
 ML_SPK_AMP_OUT 00
 ML_MIC_IF_CTL 00
@@ -27,9 +27,9 @@
 ML_SAI_TRANS_CTL 0b
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
+ML_FILTER_EN 00
 ML_DVOL_CTL 2e
-ML_MIXER_VOL_CTL 10
+ML_MIXER_VOL_CTL 00
 ML_RECORD_DIG_VOL ff
 ML_PLBAK_DIG_VOL ff
 ML_DIGI_BOOST_VOL 00


volume 70% vs 100%
Code: [Select]
--- AUDIOREG-normal.TXT 2012-07-26 10:01:34.000000000 +0900
+++ AUDIOREG-volmax.TXT 2012-07-26 10:19:16.000000000 +0900
@@ -7,19 +7,19 @@
 ML_CLK_EN 0f
 ML_CLK_CTL 04
 ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
 ML_MIC_TIM 12
 ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
 ML_PW_DAC_PW_MNG 00
 ML_PW_SPAMP_PW_MNG 00
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
 ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
 ML_PW_AMP_VOL_FADE 00
 ML_SPK_AMP_OUT 00
 ML_MIC_IF_CTL 00
@@ -27,9 +27,9 @@
 ML_SAI_TRANS_CTL 0b
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
-ML_MIXER_VOL_CTL 10
+ML_FILTER_EN 00
+ML_DVOL_CTL 2c
+ML_MIXER_VOL_CTL 00
 ML_RECORD_DIG_VOL ff
 ML_PLBAK_DIG_VOL ff
 ML_DIGI_BOOST_VOL 00
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 03:37:35 AM
First log:

2nd log: Recording turn on Capture Limiter and changes mic input volume.

Others... you're losing settings when rec/play/run goes to 00.

In one log
-ML_FILTER_EN 0f
+ML_FILTER_EN 00

Turns off filters.


Code: [Select]
AUDIO_IC_SIG1 0a
AUDIO_IC_SIG2 0a
AUDIO_IC_IVL 00
AUDIO_IC_IVR 00
AUDIO_IC_PM1 06
AUDIO_IC_PM3 02
AUDIO_IC_MODE3 02
AUDIO_IC_MODE4 02
AUDIO_IC_FIL1 02
AUDIO_IC_ALCVOL 00
AUDIO_IC_ALC1 00

All copies of the real registers in random unrelated spots, does not apply.


One thing strikes me though. Do volumes actually go down from FF to 10 or something like that... ff being lowest. And
L_MIXER_VOL_CTL is it 10 or 00 when recording. Which one is mute? I may have things backwards with this.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:38:47 AM
standby vs standby(recording finish)
Code: [Select]
@@ -7,19 +7,19 @@
 ML_CLK_EN 0f
 ML_CLK_CTL 04
 ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
 ML_MIC_TIM 12
 ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
 ML_PW_DAC_PW_MNG 00
 ML_PW_SPAMP_PW_MNG 00
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
 ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
 ML_PW_AMP_VOL_FADE 00
 ML_SPK_AMP_OUT 00
 ML_MIC_IF_CTL 00
@@ -27,8 +27,8 @@
 ML_SAI_TRANS_CTL 0b
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
+ML_FILTER_EN 00
+ML_DVOL_CTL 2c
 ML_MIXER_VOL_CTL 10
 ML_RECORD_DIG_VOL ff
 ML_PLBAK_DIG_VOL ff

recording vs standby(finish recording)
Code: [Select]
--- AUDIOREG-recording.TXT      2012-07-26 10:02:48.000000000 +0900
+++ AUDIOREG-finishrecording.txt        2012-07-26 10:36:54.000000000 +0900
@@ -7,19 +7,19 @@
 ML_CLK_EN 0f
 ML_CLK_CTL 04
 ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
 ML_MIC_TIM 12
 ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
 ML_PW_DAC_PW_MNG 00
 ML_PW_SPAMP_PW_MNG 00
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 37
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
 ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
 ML_PW_AMP_VOL_FADE 00
 ML_SPK_AMP_OUT 00
 ML_MIC_IF_CTL 00
@@ -27,7 +27,7 @@
 ML_SAI_TRANS_CTL 0b
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
+ML_FILTER_EN 00
 ML_DVOL_CTL 2c
 ML_MIXER_VOL_CTL 10
 ML_RECORD_DIG_VOL ff



So I thinik , these difference make a stopping audio meter.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:43:47 AM
1% I'm restarting my camera every time.
The value is actual cannon firmware.

Another camera's register(AUDIO_SIG1) is added because , compile compatibility.
Dump definition is automatically generated by awk,sed. So never mind.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:47:34 AM
vol70% vs vol0%
Code: [Select]
--- AUDIOREG-normal.TXT 2012-07-26 10:01:34.000000000 +0900
+++ AUDIOREG-volume0.TXT        2012-07-26 10:47:46.000000000 +0900
@@ -7,19 +7,19 @@
 ML_CLK_EN 0f
 ML_CLK_CTL 04
 ML_SW_RST 00
-ML_REC_PLYBAK_RUN 11
+ML_REC_PLYBAK_RUN 00
 ML_MIC_TIM 12
 ML_PW_REF_PW_MNG 06
-ML_PW_IN_PW_MNG 0a
+ML_PW_IN_PW_MNG 00
 ML_PW_DAC_PW_MNG 00
 ML_PW_SPAMP_PW_MNG 00
 ML_PW_LOUT_PW_MNG 00
 ML_PW_ZCCMP_PW_MNG 02
 ML_PW_MICBIAS_VOL 02
-ML_PW_MIC_IN_VOL 3f
-ML_PW_MIC_BOST_VOL 10
+ML_PW_MIC_IN_VOL 10
+ML_PW_MIC_BOST_VOL 00
 ML_PW_SPK_AMP_VOL 1b
-ML_PW_AMP_VOL_FUNC 01
+ML_PW_AMP_VOL_FUNC 03
 ML_PW_AMP_VOL_FADE 00
 ML_SPK_AMP_OUT 00
 ML_MIC_IF_CTL 00
@@ -27,10 +27,10 @@
 ML_SAI_TRANS_CTL 0b
 ML_SAI_RCV_CTL 0b
 ML_SAI_MODE_SEL 00
-ML_FILTER_EN 0f
-ML_DVOL_CTL 2e
-ML_MIXER_VOL_CTL 10
-ML_RECORD_DIG_VOL ff
+ML_FILTER_EN 00
+ML_DVOL_CTL 2c
+ML_MIXER_VOL_CTL 00
+ML_RECORD_DIG_VOL 00
 ML_PLBAK_DIG_VOL ff
 ML_DIGI_BOOST_VOL 00
 ML_EQ_GAIN_BRAND0 dd
@@ -89,8 +89,8 @@
 ML_OUTPUT_LOUT 00
 ML_OUTPUT_SPOUT 06
 ML_OUTPUT_LOUTON 00
-AUDIO_IC_SIG1 0a
-AUDIO_IC_SIG2 0a
+AUDIO_IC_SIG1 00
+AUDIO_IC_SIG2 00
 AUDIO_IC_IVL 00
 AUDIO_IC_IVR 00
 AUDIO_IC_PM1 06

vol max vs vol 0
Code: [Select]
--- AUDIOREG-volmax.TXT 2012-07-26 10:19:16.000000000 +0900
+++ AUDIOREG-volume0.TXT        2012-07-26 10:47:46.000000000 +0900
@@ -30,7 +30,7 @@
 ML_FILTER_EN 00
 ML_DVOL_CTL 2c
 ML_MIXER_VOL_CTL 00
-ML_RECORD_DIG_VOL ff
+ML_RECORD_DIG_VOL 00
 ML_PLBAK_DIG_VOL ff
 ML_DIGI_BOOST_VOL 00
 ML_EQ_GAIN_BRAND0 dd
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 03:53:44 AM
So max is FF then?

That mixer is 10 but !!! when I power the amp up and leave it on one channel it is 01.. 00 is off I don't think you get sound but try some changes and see. I've done lots of things and haven't had a problem yet. Worst case you reload the "rest" register values.

Code: [Select]
Rec
13 11 - 13 12  /* Record/Playback Run */  ML_REC_PLYBAK_RUN

21 06 - 21 26 ML_PW_REF_PW_MNG /* MICBIAS */ /* Reference Power Management */
23 0a - 23 00 ML_PW_IN_PW_MNG /* ADC "Capture" + PGA */ /* Input Power Management */
25 00 - 25 02 ML_PW_DAC_PW_MNG /*DAC Power Switch? Playback */ /* DAC Power Management */
27 1f - 27 bf ML_PW_SPAMP_PW_MNG /* SP-AMP Power Management */


2f 02 - 2f 00 ML_PW_ZCCMP_PW_MNG /* ZC Switch */ /* AC-CMP Power Management */

33 3f - 33 30 ML_PW_MIC_IN_VOL /* MIC Input Volume */

39 00 - 39 30 ML_PW_MIC_BOST_VOL /* Mic Boost Volume */
3b 3f - 3b 2c ML_PW_SPK_AMP_VOL /* Speaker AMP Volume */

55 00 - 55 07 - 0111 ML_SPK_AMP_OUT /* DAC Switch + Line in loopback Switch + PGA Switch */ /* Speaker AMP Output Control */
57 01 - 57 03 unknown On/Off (play)

67 83 - 67 3f ML_FILTER_EN /* Filter Func Enable */ /*DC High Pass Fil
69 2c - 69 08 ML_DVOL_CTL /* Volume Control Func Enable */ /* Play Limiter + Capture Limiter + Digital Volume Fade Switch +Digital Switch */

6d ff - 6d f0 ML_RECORD_DIG_VOL /* Capture/Record Digital Volume */
6f cc - 6f ff Unknown Volume ?

75 dd - 75 d5 /* EQ Band0 Volume ?*/
77 dd - 77 f4 /* EQ Band1 Volume */
79 e7 - 79 f1 /* EQ Band2 Volume */
7b e7 - 7b f0 /* EQ Band3 Volume */
7d e7 - 7d 00 /* EQ Band4 Volume */

81 0d - 81 75 _Band 0 Controls
83 db - 83 2a
85 0c - 85 a1
87 1b - 87 95 _end Band 0

8d 41 - 8d 16  Band1
8f ed - 8f bd  Band1
91 00 - 91 46  start Band2
93 00 - 93 ea
95 00 - 95 9c
97 00 - 97 24 -endband 2
99 00 - 99 6d - start band 3
9b 00 - 9b 08
9d 00 - 9d ca
9f 00 - 9f db - Band 3 end

a9 00 - a9 5a Unknown from play filter

ad 00 - ad bd unknown play filter.

bb 70 - bb 00 ALC Min/max Volume

e1 01 - e1 02 Stereo Switch
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 04:00:45 AM
I need to go out from here.
1% if you interested in this things. Please clone my repo. And try yourself.


I think, AUDIOREG-normal.txt is generated just startup.
My guess is, "It's not perfect initialization to common regesters yet"
When we touch recording,vol-change makes a first initialization will work.

How do you think about this?
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 04:17:44 AM
Logger is good. We'll know when the camera changes our registers back. Some of this is in firmware too.. you need to dump and analyze with arm console.

Problem is headphones and mic never run at the same time officially.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:02:17 PM
I think, AUDIOREG-normal.txt is generated just startup.
My guess is, "It's not perfect initialization to common regesters yet"
When we touch recording,vol-change makes a first initialization will work.

My guess is correct !!!
Now 600D audio meter is not stop when finish recording!! and finished to change a volume from cannon menu
I'm rewrite a register value to startup's one  , when finished recording. then audio meter is always working.

Need more testers!Because I am setting reg under follow:
Code: [Select]
    audio_ic_write(ML_DVOL_CTL | 0x2E);
    audio_ic_write(ML_REC_PLYBAK_RUN | 0x11);
    audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);
    audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
    audio_ic_write(ML_PW_MIC_BOST_VOL | 0x10);
    audio_ic_write(ML_PW_AMP_VOL_FUNC | 0x01);
    audio_ic_write(ML_FILTER_EN | 0x0f);
    audio_ic_write(ML_MIXER_VOL_CTL | 0x10);

I guess it's volume setting is also back to this code's specific value.
But I don't know which one is it. Please help me to identify it.

Also 3 audio Property found and confirmed. I checked 0x2050001-0x205001F

https://bitbucket.org/miyake_t/magic-lantern-miyake/changeset/6c92e1942e54
My top priority is accomplished.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 25, 2012, 03:03:14 PM
This is huge progress!

At this point, audio remote shot should be fully working too.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 03:52:54 PM
@ alex

I think
Phase 1: always work audio meter
Phase 2: audio monitor


Now phase 1 is not perfect. If I found good solution. I will send a patch for this.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 04:22:31 PM
I Just push my repo.
I believe this logic is not so bad.

Then we need to find one more thing.

1: The audio register value is default(??) when 600d just launched
2: start recording or change vol, -> canon config value will write to audio IC
3: The audio switches on IC will power off when Stop recording or vol change finishd

3 is solved by my code.
But we don't know Actual audio setting in canon firmware. How can we know it?
when I understand it, I will change my reset_audio_setting() values.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 04:34:13 PM
Audio remote shot is work perfectly!    confirmed.

My wife is shouting in front of my 600D now :D
Title: Re: 600D Audio Controls?
Post by: Alia5 on July 25, 2012, 04:51:27 PM
great work!
Also i'm willing to test if needed
Title: Re: 600D Audio Controls?
Post by: juantrueno on July 25, 2012, 05:04:58 PM
Ready to test to!
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 05:23:58 PM
I had audio remote shot for a while now. You can just power the mic amp. Just nobody tried it, like everything else.


(ML_PW_IN_PW_MNG | 0x0a) < this is what does it.

(ML_REC_PLYBAK_RUN | 0x11); < rec mode is probably necessary too

You can also call powermicamp from firmware.


Try with external mic.



https://bitbucket.org/OtherOnePercent/tragic-lantern/changeset/c31c454fb9e3
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 05:28:37 PM
great work 1%!!
I can't do this without your effort.Thank you very much

Anyway, currently the volume is back to just canon default value.
So I can't check audio level before recording , it is not good for me.(Just only work for audio remote shot )

one more analyzing needed.  and I hope we can use audio monitor .


---
external mic is working fine. Just switching ext mic only!!
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 05:36:48 PM
(ML_PW_IN_PW_MNG | 0x0a) < this is what does it.
I don't know too. It's no entry in alsa driver. But this reg  value is 0x0a when a camera just startup

(ML_REC_PLYBAK_RUN | 0x11); < rec mode is probably necessary too
I see. But reason is same. I still not thing about this.

We need find best value in my reset_audio()



You can also call powermicamp from firmware.
Try with external mic.
Why you need to change this?
I think I have no problem to change audio setting in cannon menu.

Also , I don't need both int/ext mic at same time. Do you wanna use both same time?

Let me know what is your objective.
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 05:40:35 PM
Yea the monitor is a bit harder. Need to feed it through the output mixer with amplification.

Volumes do mess with input levels and everything. Need to find all real values for volumes, some in those arrays I think are invalid.

Also alc is set while recording sometimes:

ML_ALC_MAXMIN_GAIN      0xbb00

rec vs play

bb 70 - bb 00 ALC Min/max Volume

Maybe get rid of canon's volume adjustment eventually since this even happened in manual mode.
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 05:42:29 PM
External for recording and internal for remote shot?
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 05:53:53 PM
I can confirm 0a is not default value for input power managment. Camera starts with no meter... I PTP

c 0xFF06A144 0x230a
and

c 0xFF06A144 0x1311 (or 13, hehehe)

Meter works

just setting rec mode does not. have to power the amp first (or after)


*** Maybe we just cut the function to those 2 settings, why set all the other stuff it just messes with things.

Also clone to stereo if you want afterwards for internal mic:

e1=02 - recording 1 channel
e1 = 01 recording 2 channels
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 06:00:32 PM
External for recording and internal for remote shot?

??? Are you asking my sentence about "you need to use both"????

Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 06:07:19 PM
Yes, far mic to record audio.. close mic to start recording with the clapper, etc. That way we actually have a use for the internal.

:( post rate limits
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 06:09:17 PM
I can confirm 0a is not default value for input power managment. Camera starts with no meter... I PTP
c 0xFF06A144 0x230a
and
c 0xFF06A144 0x1311 (or 13, hehehe)
Meter works


hmmmm, mysterious thing. My camera is 0x230a ,, and meter is working from startup....
startup register values has a more mysterious thins.

One more thing:
You already direct set/get memory value by PTP.  But I just added audio_ic_read/write code in php-chdk.c
I'm not write a PC side yet.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 06:11:59 PM
Yes, far mic to record audio.. close mic to start recording with the clapper, etc. That way we actually have a use for the internal.

:( post rate limits

Ah, I see. but now, AUDIO_SIG1,2 is only multiplexed output, It's my understanding.
Do you know how to get audio signal level separately with int/ext?
 
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 06:16:13 PM
Yep, already called it by address to test it. Mostly works. Reading values does not though.


You are probably powering mic at start with

#define AUDIO_IC_SIG2   0x2300... old audio.c always writes here.

Those old registers are 100% incompatible with old audio.c... the meters work because they are from canon internal functions. 100% nothing to do with signal level, forget that old code.

Switching mic type and mic input puts different mic on different channel. Once you understand routing you can route internal to L, external to R or whatever and then move to external completely just before recording starts.

*Bootleg version of above already possible with 

audio_ic_write( ML_MIC_SELECT | pm3[input_source] );
   audio_ic_write( ML_MIC_IF_CTL | micbits[type_source] )

*edit

sound_dev_task is NOT present on 600D... there is a sound device task but it looks like it sets buffers only. other stuff prepares audio, sets gain, etc.
Title: Re: 600D Audio Controls?
Post by: miyake on July 25, 2012, 07:01:53 PM
@1%

done, menu inserted now. But menu handling functions are not working now.

 and Good night!
Title: Re: 600D Audio Controls?
Post by: 1% on July 25, 2012, 07:10:27 PM
Look through my source, my menus work but I did make some changes to menu.c when testing in play mode, I'm getting rid of that stuff today. Also check ifdefs around the individual parts of menu, there is more than just the main audio menu vs putting "meters" in display.
Title: Re: 600D Audio Controls?
Post by: Ash McKenzie on July 26, 2012, 12:10:44 AM
I'm happy to test!
Cheers
Title: Re: 600D Audio Controls?
Post by: johndb on July 26, 2012, 12:39:26 AM
I would be happy to test anything that you come with related to 600D audio. You have my support and thank you for your hard work :)
Title: Re: 600D Audio Controls?
Post by: 1% on July 26, 2012, 03:27:58 AM
If you feel like testing, here you go:

http://www.qfpost.com/file/d?g=FZOCi9eXH (http://www.qfpost.com/file/d?g=FZOCi9eXH)
Title: Re: 600D Audio Controls?
Post by: miyake on July 26, 2012, 07:27:16 AM
I can confirm 0a is not default value for input power managment. Camera starts with no meter... I PTP

c 0xFF06A144 0x230a
and

c 0xFF06A144 0x1311 (or 13, hehehe)

Meter works

just setting rec mode does not. have to power the amp first (or after)


*** Maybe we just cut the function to those 2 settings, why set all the other stuff it just messes with things.

Also clone to stereo if you want afterwards for internal mic:

e1=02 - recording 1 channel
e1 = 01 recording 2 channels


I just facing same issue.
When I add audio menus and some related function enabled, Audio metar woking only L.
I'm not set any audio_ic_write at just launched.
Therefore,
 1: Canons initialization is depend on some another configs.
 2: Added overwrite IC setting when finish cannon initialization.(little tricky )

Title: Re: 600D Audio Controls?
Post by: miyake on July 26, 2012, 07:40:39 AM
someone help

Current 600D audio wikia is little difficult to read
http://magiclantern.wikia.com/wiki/600D/Audio

So please help to solve like this.
Code: [Select]
600D (Oki ML26121A)                                550D (AK4646)
DisableAudioIC
2100 (ML_PW_REF_PW_MNG )                            2100
0d00 (ML_CLK_EN)                                              0d00


How to solve it.
ex:First line
Code: [Select]
2100                                                               2100

Then find 0x2100 in:
https://bitbucket.org/miyake_t/magic-lantern-miyake/src/464c27ee1aba/src/audio.h
line 161-261

Code: [Select]
#define ML_PW_REF_PW_MNG                0x2100 /* MICBIAS */ /* Reference Power Management */

Then edit wikia such as first example.

Is this a enough for explainning?
Title: Re: 600D Audio Controls?
Post by: 1% on July 26, 2012, 08:58:01 AM
Quote
Audio metar woking only L.

Set 0xe101 if you want. I have it under "clone to stereo"

mic input and input type can also move it around.. more so with external mic.

What changes audio.
*Bring up Audio Menu in canon menus
*Play mode
*Any button in play mode
*Rec start
*Rec stop
*Plug/Unplug mic (maybe)

Nothing else, I think.
Title: Re: 600D Audio Controls?
Post by: miyake on July 26, 2012, 09:07:43 AM
I didn't touch 0xE1, but now my 600D is working stereo audio meter.
working is not clone.
Title: Re: 600D Audio Controls?
Post by: 1% on July 26, 2012, 03:41:48 PM
You did turn on :

audio_ic_write(ML_NODOC_E5 | 0x06);


I need to check out all 0xeX registers.

Clone works for me after the mic is powered and everything is on one channel.
Title: Re: 600D Audio Controls?
Post by: miyake on July 26, 2012, 06:27:40 PM
1 % you are correct!
0xe506 is work for me.
I was  miss understanding.


Title: Re: 600D Audio Controls?
Post by: Kromofone on July 26, 2012, 07:28:16 PM
Hello, I've read through all of this, and I hope that this function will be available to the 600D soon!

As for now, I will also start testing all of the work, you've put in for the 600D Audio ML Functions, on my 600D! I will have results, as soon as I'm done!
Title: Re: 600D Audio Controls?
Post by: johndb on July 26, 2012, 08:16:56 PM
If you feel like testing, here you go:

http://www.qfpost.com/file/d?g=FZOCi9eXH (http://www.qfpost.com/file/d?g=FZOCi9eXH)

Where will the up-to-date build be located?
Title: Re: 600D Audio Controls?
Post by: 1% on July 26, 2012, 08:38:54 PM
I'll try to put one up whenever there is a major change.

Right now I don't think we really found anything new.
miyake wanted both channels on at start for the internal mic and so he fed it through the eq but it makes no difference either way, when recording starts it will do it automatically. If you hit clone stereo (in debug/7kor) you can enable both channels after everything is up.

Mic switching and all the volume controls activate when you turn on vol writes.

Without figuring out monitor, all its good for is audio remote shot.

I also found a sound_dev task

FF057774    sounddev_task

Does set some sort of gain, I think.
Title: Re: 600D Audio Controls?
Post by: scrax on July 26, 2012, 10:12:14 PM
I'm following 1% and miyake works and so far I have a mixed up audio.c that has code from miyake and code from 1%. Audio remote shot is working (in stereo now) at startup and also after rec. It will stop to work if canon audio menu is opened and if a video is played after record it will work again.

I'm trying to cleanup the code to understan better how it works
Title: Re: 600D Audio Controls?
Post by: 1% on July 26, 2012, 10:18:47 PM
Its pretty simple:

1. Ifdef out all writes + junk from old audio.c so it compiles + keeps camera functionality.

2. Switch registers around
Miyake set it up so its constantly powering up audio when not recording and loading default-ish settings that turn the mic amp on and set an imput volume.

I set remote shot to power the audio if audio is disabled (it should work all the time) See if it still records the sound with audio disabled... I didn't test that.
Title: Re: 600D Audio Controls?
Post by: scrax on July 26, 2012, 10:31:18 PM
I've understood what is working so far, your changes and miyake's ones.
But all the thing you put in audio.h are more difficult to understand so far for me, I'll make more specific question later if I find problems, diggin the code.

But also is this working on 1100D for example, because I used nanomad suggestion "define OKI_IC" instead of CONFIGURE_600D.

Just one question so far to be sure about what I suppose.

From original audio menu what is working?
from my tests nothing is doing anything, just when changing input source sometime it enables audio monitor if went off for some reason.

from you menu input is working? I'm compiling it now...

EDIT: I've made a new auodioki.c file for audio on 600D only it has only the ML code used so far plus code from 1% and miyake, I'm not compiling anymore audio.c for the 600D so it's less unified but this is just to have a more clear view of the specific 600D code. Until ML audio code don't change it will be easy to port back with ifdef when mature.
I'll commit it after some more cleaning of my fork.
Title: Re: 600D Audio Controls?
Post by: 1% on July 27, 2012, 12:14:32 AM
Input and volume works only if you enable "vol writes". Not all settings are valid.

Quote
But also is this working on 1100D for example, because I used nanomad suggestion "define OKI_IC" instead of CONFIGURE_600D.

Not sure, I think he has some sort of 3rd IC or a slightly different AK one. Define OKI IC didn't go far enough and stuff was still being written to the registers, ironically powering meters. Somebody made a bug report and alex took the changes out.

Quote
From original audio menu what is working?

Nothing, the ICs operate differently. Have to make new menus. Headphone and meters work but headphone sound leaves much to be desired. Headphone doesn't work at startup, you have to toggle it. If you power the mic amp, feed a strong source like an MP3 player into the camera then power dac you can hear sound faintly, especially when messing with the volumes.

Remote shot works. You can isolate the external mic or only put it on one channel and then move that channel from L->R and back. Also can get external and internal going at the same time.

At least we're further along and actually making some constructive stuff.
Title: Re: 600D Audio Controls?
Post by: scrax on July 27, 2012, 12:18:43 AM
1% edited my post while you where writing...

Thanks, now i've a more clear idea on what's going on. preparing audioki.c helped me understand more what we have so far.

EDIT: posted my audioki.c on the fork
Title: Re: 600D Audio Controls?
Post by: miyake on July 27, 2012, 05:56:02 AM
go go scrax!
My English might be poor. So all of my understanding is in my code.

Also just write this
http://magiclantern.wikia.com/wiki/File:Audioicworking.png
Title: Re: 600D Audio Controls?
Post by: nanomad on July 27, 2012, 04:40:51 PM
The 1100D has a fourth AudioIC. Registers do not match with 600D , 550D or 500D  >:(
I'm waiting for some photos of the IC to start hacking the code but this is a really low priority issue (We got audio meters and trigger but I need to disable AGC if i want trigger to work reliably)
Title: Re: 600D Audio Controls?
Post by: scrax on July 28, 2012, 02:49:58 AM
FIxed my fork for audioki.c to work, all thing related to 600D audio is there, I've made some submenu for 1% test code because it was too long to be all visible on screen.
Are mic volume working' i see no differeces in the meters...
Title: Re: 600D Audio Controls?
Post by: 1% on July 28, 2012, 03:10:37 AM
Try changing while its playing/recording. Stop and Rec and Play reset things, sometimes it catches, sometimes not. I know input and boost work on analog. Digital volumes don't have as much lattitude. Also would be good to see what all real volume values are. I know the canon slider adds volume -> boost-> gain depending on how high you set it.

There is one volume I have to tweak when I try the monitor. I lose the meters but I hear the output better. Either way, volume is not practical/finished yet, that is why I put On/off for setting it.
Title: Re: 600D Audio Controls?
Post by: miyake on July 28, 2012, 03:42:55 AM
patches with current my code

-audioki.c has no handling when vol change finished , added handler code in this patch
 *also start recording.
-reset->override (fucntion name change)
-now reset audio had input select function


I think some configration task will need to add in override_audio_setting().  or audio_configure() directory.
If you add configration override code in audio_configure(), You need to change to call audio_configure() at startup/volchange/finish recording.



Code: [Select]
diff -r 4fdf51b053f0 src/audioki.c
--- a/src/audioki.c     Sat Jul 28 02:37:01 2012 +0200
+++ b/src/audioki.c     Sat Jul 28 10:59:12 2012 +0900
@@ -1169,45 +1169,34 @@
 }

 void
-reset_audio_setting(int phase){
+override_audio_setting(int phase){

        //These audio_ic_write are setting back to startup time.
        //Because, the canon firmware will switching off the audio switchs I guess,it's for power save
     switch(phase){
-               case 0:
-                       //for startup
-                       audio_ic_write(ML_PW_ZCCMP_PW_MNG | 0x02);
-                       audio_ic_write(ML_MIC_TIM | 0x12);
-                       audio_ic_write(ML_EQ_GAIN_BRAND0 | 0xdd);
-                       audio_ic_write(ML_EQ_GAIN_BRAND1 | 0xdd);
-                       audio_ic_write(ML_HPF2_CUTOFF | 0x04);
-                       audio_ic_write(ML_EQBRAND0_F0L | 0x0d);
-                       audio_ic_write(ML_EQBRAND0_F0H | 0xdb);
-                       audio_ic_write(ML_EQBRAND0_F1L | 0x0c);
-                       audio_ic_write(ML_EQBRAND0_F1H | 0x1b);
-                       audio_ic_write(ML_EQBRAND1_F0L | 0x6d);
-                       audio_ic_write(ML_EQBRAND1_F0H | 0x08);
-                       audio_ic_write(ML_EQBRAND1_F1L | 0x41);
-                       audio_ic_write(ML_EQBRAND1_F1H | 0xed);
-                       audio_ic_write(ML_NODOC_E5 | 0x06);
-
-               case 1:
-
-                       audio_ic_write(ML_REC_PLYBAK_RUN | 0x11); //
-                       audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);   //DAC(0010) and PGA(1000) power on
-
-                       audio_ic_write(ML_DVOL_CTL | 0x2E);        //All(Play,Capture,DigitalVolFade,DigitalVol) switched on
-                       audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
-                       audio_ic_write(ML_PW_MIC_BOST_VOL | 0x10);
-                       audio_ic_write(ML_PW_AMP_VOL_FUNC | 0x01);
-                       audio_ic_write(ML_FILTER_EN | 0x0f);       //All filter on
-                       audio_ic_write(ML_MIXER_VOL_CTL | 0x10);
-                       break;
+    case 0:   //Phase 0 for camera powerON->standby
+        audio_ic_write(ML_NODOC_E5 | 0x02); //Duplicate L to R
+
+    case 1: //Phase 1 for finish recording->standy & change vol setting->standby
+        audio_ic_write(ML_REC_PLYBAK_RUN | 0x11); //
+        audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);   //DAC(0010) and PGA(1000) power on
+        audio_ic_write(ML_DVOL_CTL | 0x2E);        //All(Play,Capture,DigitalVolFade,DigitalVol) switched on
+        audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
+        audio_ic_write(ML_FILTER_EN | 0x0f);       //All filter on
+
+        int inputsource = get_input_source();
+        if(inputsource == 0){ //int/int
+            audio_ic_write(ML_MIC_SELECT | 0x01);
+            audio_ic_write(ML_NODOC_E5 | 0x02); //Duplicate L to R
+        }else if(inputsource == 2){
+            audio_ic_write(ML_MIC_SELECT | 0x02);
+            audio_ic_write(ML_NODOC_E5 | 0x00);
+        }
     }
 }


-struct msg_queue * reset_audio_q = NULL;
+struct msg_queue * override_audio_q = NULL;
 short gIs_UnInitialized = 0;
 //#endif

@@ -1229,15 +1218,14 @@
         #else*/
 //miyake code #ifdef CONFIG_600D
        int msg;
-       int err = msg_queue_receive(reset_audio_q, (struct event**)&msg, 500);
+       int err = msg_queue_receive(override_audio_q, (struct event**)&msg, 500);
        if (!err){
-               reset_audio_setting(1);
+               override_audio_setting(1);
        }

        if(gIs_UnInitialized < 3){
                msleep(500);
-               reset_audio_setting(0);
-               //              disp_logoutput("reset audio");
+               override_audio_setting(0);
                gIs_UnInitialized++;
        }

@@ -2283,11 +2271,14 @@
         case 0:
             // Movie recording stopped;  (fallthrough)
 #ifdef CONFIG_600D
-                       reset_audio_setting(1);
+                       override_audio_setting(1);
 #endif
                case 2:
             // Movie recording started
             give_semaphore( gain.sem );
+#ifdef CONFIG_600D
+            override_audio_setting(1);
+#endif
             break;
         case 1:
             // Movie recording about to start?
@@ -2815,10 +2806,14 @@

 PROP_HANDLER( PROP_AUDIO_VOL_CHANGE_600D )
 {
-    /* Cannot overwrite audio config here!
-        Cannon firmware is overwrite after finishing here.
-
+    /* Cannot override audio config here!
+        Cannon firmware is override after finishing here.
         */
+    if(!override_audio_q)
+    override_audio_q = (struct msg_queue *) msg_queue_create("override_audio_q", 1);
+
+    msg_queue_post(override_audio_q, 1);
+
 }

 PROP_HANDLER( PROP_PLAYMODE_LAUNCH_600D )
@@ -2831,4 +2826,4 @@



-#endif
\ No newline at end of file
+#endif
Title: Re: 600D Audio Controls?
Post by: miyake on July 28, 2012, 05:04:47 AM
In our changing, it will be perfectly override current Canon settings.
So I think we need to add "Audio setting override ON/OFF" menu item.

If so, we can vol/Eq/input/etc. settings at camera startup.


How do you think?
Title: Re: 600D Audio Controls?
Post by: 1% on July 28, 2012, 05:18:10 AM
I think its a good solution.
Title: Re: 600D Audio Controls?
Post by: miyake on July 28, 2012, 06:41:39 AM
added override menu. incl prev. diff

And sometime get stack ML when I override audio config at startup.
Need more tune.



Code: [Select]
diff -r 4fdf51b053f0 src/audioki.c
--- a/src/audioki.c     Sat Jul 28 02:37:01 2012 +0200
+++ b/src/audioki.c     Sat Jul 28 13:52:53 2012 +0900
@@ -56,6 +56,7 @@


 // Set defaults
+CONFIG_INT( "audio.override_audio",      cfg_override_audio,          0 );
 CONFIG_INT( "audio.mgain",      mgain,          4 );
 CONFIG_INT( "audio.dgain.l",    dgain_l,        0 );
 CONFIG_INT( "audio.dgain.r",    dgain_r,        0 );
@@ -1169,45 +1170,36 @@
 }

 void
-reset_audio_setting(int phase){
+override_audio_setting(int phase){
+
+    if(cfg_override_audio == 0) return;

        //These audio_ic_write are setting back to startup time.
        //Because, the canon firmware will switching off the audio switchs I guess,it's for power save
     switch(phase){
-               case 0:
-                       //for startup
-                       audio_ic_write(ML_PW_ZCCMP_PW_MNG | 0x02);
-                       audio_ic_write(ML_MIC_TIM | 0x12);
-                       audio_ic_write(ML_EQ_GAIN_BRAND0 | 0xdd);
-                       audio_ic_write(ML_EQ_GAIN_BRAND1 | 0xdd);
-                       audio_ic_write(ML_HPF2_CUTOFF | 0x04);
-                       audio_ic_write(ML_EQBRAND0_F0L | 0x0d);
-                       audio_ic_write(ML_EQBRAND0_F0H | 0xdb);
-                       audio_ic_write(ML_EQBRAND0_F1L | 0x0c);
-                       audio_ic_write(ML_EQBRAND0_F1H | 0x1b);
-                       audio_ic_write(ML_EQBRAND1_F0L | 0x6d);
-                       audio_ic_write(ML_EQBRAND1_F0H | 0x08);
-                       audio_ic_write(ML_EQBRAND1_F1L | 0x41);
-                       audio_ic_write(ML_EQBRAND1_F1H | 0xed);
-                       audio_ic_write(ML_NODOC_E5 | 0x06);
-
-               case 1:
-
-                       audio_ic_write(ML_REC_PLYBAK_RUN | 0x11); //
-                       audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);   //DAC(0010) and PGA(1000) power on
-
-                       audio_ic_write(ML_DVOL_CTL | 0x2E);        //All(Play,Capture,DigitalVolFade,DigitalVol) switched on
-                       audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
-                       audio_ic_write(ML_PW_MIC_BOST_VOL | 0x10);
-                       audio_ic_write(ML_PW_AMP_VOL_FUNC | 0x01);
-                       audio_ic_write(ML_FILTER_EN | 0x0f);       //All filter on
-                       audio_ic_write(ML_MIXER_VOL_CTL | 0x10);
-                       break;
+    case 0:   //Phase 0 for camera powerON->standby
+        audio_ic_write(ML_NODOC_E5 | 0x02); //Duplicate L to R
+
+    case 1: //Phase 1 for finish recording->standy & change vol setting->standby
+        audio_ic_write(ML_REC_PLYBAK_RUN | 0x11); //
+        audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);   //DAC(0010) and PGA(1000) power on
+        audio_ic_write(ML_DVOL_CTL | 0x2E);        //All(Play,Capture,DigitalVolFade,DigitalVol) switched on
+        audio_ic_write(ML_PW_MIC_IN_VOL | 0x3f);
+        audio_ic_write(ML_FILTER_EN | 0x0f);       //All filter on
+
+        int inputsource = get_input_source();
+        if(inputsource == 0){ //int/int
+            audio_ic_write(ML_MIC_SELECT | 0x01);
+            audio_ic_write(ML_NODOC_E5 | 0x02); //Duplicate L to R
+        }else if(inputsource == 2){
+            audio_ic_write(ML_MIC_SELECT | 0x02);
+            audio_ic_write(ML_NODOC_E5 | 0x00);
+        }
     }
 }


-struct msg_queue * reset_audio_q = NULL;
+struct msg_queue * override_audio_q = NULL;
 short gIs_UnInitialized = 0;
 //#endif

@@ -1229,15 +1221,14 @@
         #else*/
 //miyake code #ifdef CONFIG_600D
        int msg;
-       int err = msg_queue_receive(reset_audio_q, (struct event**)&msg, 500);
+       int err = msg_queue_receive(override_audio_q, (struct event**)&msg, 500);
        if (!err){
-               reset_audio_setting(1);
+               override_audio_setting(1);
        }

        if(gIs_UnInitialized < 3){
-               msleep(500);
-               reset_audio_setting(0);
-               //              disp_logoutput("reset audio");
+               msleep(700);
+        if(gIs_UnInitialized == 2) override_audio_setting(0);
                gIs_UnInitialized++;
        }

@@ -1670,6 +1661,26 @@
  }
  */

+char onoff[2][4];
+static void override_audio_display( void * priv, int x, int y, int selected )
+{
+    memset(&onoff[0],'\0',4);
+    strcpy(&onoff[0],"OFF");
+    memset(&onoff[1],'\0',4);
+    strcpy(&onoff[1],"ON");
+    bmp_printf(
+               selected ? MENU_FONT_SEL : MENU_FONT,
+               x, y,
+               "Override Setting : %s",
+               onoff[cfg_override_audio]
+               );
+}
+static void override_audio_toggle( void * priv, int delta )
+{
+    menu_numeric_toggle(priv, 1, 0, 1);
+    override_audio_setting(0);
+}
+
 int get_mic_type()
 {
     int type_source;
@@ -1758,6 +1769,7 @@

                   "error"))))))))))))));
 }
+
 static void mic_in_display( void * priv, int x, int y, int selected )
 {
     bmp_printf(
@@ -1937,6 +1949,14 @@
 static struct menu_entry audio_menus[] = {

        {
+        .name        = "Override audio",
+        .priv           = &cfg_override_audio,
+        .select         = override_audio_toggle,
+        .select_reverse = override_audio_toggle,
+        .display        = override_audio_display,
+        .help = "override ",
+    },
+       {
         .name        = "Analog Gains",
         .select        = menu_open_submenu,
         .help = "Volumes for Mic and Amp.",
@@ -2283,11 +2303,14 @@
         case 0:
             // Movie recording stopped;  (fallthrough)
 #ifdef CONFIG_600D
-                       reset_audio_setting(1);
+                       override_audio_setting(1);
 #endif
                case 2:
             // Movie recording started
             give_semaphore( gain.sem );
+#ifdef CONFIG_600D
+            override_audio_setting(1);
+#endif
             break;
         case 1:
             // Movie recording about to start?
@@ -2815,10 +2838,14 @@

 PROP_HANDLER( PROP_AUDIO_VOL_CHANGE_600D )
 {
-    /* Cannot overwrite audio config here!
-        Cannon firmware is overwrite after finishing here.
-
+    /* Cannot override audio config here!
+        Cannon firmware is override after finishing here.
         */
+    if(!override_audio_q)
+    override_audio_q = (struct msg_queue *) msg_queue_create("override_audio_q", 1);
+
+    msg_queue_post(override_audio_q, 1);
+
 }

 PROP_HANDLER( PROP_PLAYMODE_LAUNCH_600D )
@@ -2831,4 +2858,4 @@



-#endif
\ No newline at end of file
+#endif
Title: Re: 600D Audio Controls?
Post by: vk2 on July 28, 2012, 01:14:49 PM
I would be happy to test anything that you come with related to 600D, and thank you for your hard work
Title: Re: 600D Audio Controls?
Post by: miyake on July 28, 2012, 03:53:14 PM
scrax, I send a pull request to you.

This patch is solved stacking on startup issue maybe. Please test it.

And mic_in is sometime confusing, So I cleanup variable names. and function name.

--
TODO:
 -add each audio configration (vol,boost,amp vol,and so on), in final part in audio_configure()
Then we can perfectly override audio configs.
Title: Re: 600D Audio Controls?
Post by: miyake on July 28, 2012, 05:24:13 PM
scrax:
Just added overwrite mic_vol/mic_boost/amp_vol.
and working fine!!!
pull it.


1%:
your code has mic_type. What is it? I guess it means mic_input_select. right?
Title: Re: 600D Audio Controls?
Post by: scrax on July 28, 2012, 08:35:59 PM
working Will try tonigh
Added it on my fork, looks like it's working so far. Now time for more test...
Title: Re: 600D Audio Controls?
Post by: 1% on July 28, 2012, 10:19:34 PM
Per the ALSA driver there are 3 types of mics. In practice this moved L or R around.

I.e. if you have R only on the external selected, you can move it to L with mic type.
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 01:10:01 AM
Just remember it!
Thank you.

Code: [Select]
/* Input mux */
static const char * const ml26124_input_select[] = {"Analog MIC in",
     "Digital MIC in"};

static const struct soc_enum ml26124_insel_enum +   SOC_ENUM_SINGLE(ML26124_MIC_IF_CTL, 0, 1, ml26124_inpu\
t_select);

Alsa has only 2 entry which is "Analog MIC in" and "Digital MIC in".
Can you understand what mean is these mics?
Title: Re: 600D Audio Controls?
Post by: 1% on July 29, 2012, 02:07:23 AM
There are a few different registers for mic select and mic type.


static const char * const ml26124_input_select[] = {"Analog MIC SingleEnded in",
            "Digital MIC in", "Analog MIC Differential in"};

static const struct soc_enum ml26124_insel_enum =
   SOC_ENUM_SINGLE(ML26124_MIC_IF_CTL, 0, 3, ml26124_input_select);


I think one analog is internal, one is external and one is "digital" so output from the mixer maybe?

Do you have an older version of the driver?
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 02:11:52 AM
Just mearged analog gains to single menu.

----

1%
I saw a alsa driver website which is you let me konw.
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 02:25:54 AM
Per the ALSA driver there are 3 types of mics. In practice this moved L or R around.

I.e. if you have R only on the external selected, you can move it to L with mic type.


hmmm, I'm tested 6entry of mic type, but it's not move LR around.

I found LR or only  L,R is
Code: [Select]
/* Undocumented Canon Registers */
#define ML_NODOC_E5  0xe500 /* While playing? Val:'06' '07' */
#define ML_NODOC_E5_INLR 0x0002
#define ML_NODOC_E5_INL  0x0003
#define ML_NODOC_E5_INR  0x0004
But these are not routing , just ON/OFF for LR. I guess
Title: Re: 600D Audio Controls?
Post by: 1% on July 29, 2012, 02:47:19 AM
http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.c;hb=HEAD
http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.h;hb=HEAD


Those are the latest. I probably sent the wrong version. Try both with internal and external plugged in. Sometimes a mic type doesn't work for internal but then works when external is plugged in an vice versa.

Everything works in combination.

Also you're putting stuff through the EQ and setting stereo by default. That changes things too. If you put internal mic on L/R you can't move it around anymore because its on both channels. We should make a chart of input/type and whether external is plugged in.

Also

#define ML_MIC_TIM         0x1500 /* Mic Input/Output control */

says input/OUTPUT for mic but its always 12 for us so I wonder what other settings do.

Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 05:16:09 AM
http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.c;hb=HEAD
http://git.alsa-project.org/?p=alsa-kernel.git;a=blob_plain;f=sound/soc/codecs/ml26124.h;hb=HEAD


Those are the latest. I probably sent the wrong version. Try both with internal and external plugged in. Sometimes a mic type doesn't work for internal but then works when external is plugged in an vice versa.

Everything works in combination.

Also you're putting stuff through the EQ and setting stereo by default. That changes things too. If you put internal mic on L/R you can't move it around anymore because its on both channels. We should make a chart of input/type and whether external is plugged in.

Also

#define ML_MIC_TIM         0x1500 /* Mic Input/Output control */

says input/OUTPUT for mic but its always 12 for us so I wonder what other settings do.


Thankyou, I just added mic differential in. and tried to ML_MIC_TIM by PTP .But I cant find any difference from 00-3f..
You said , stereo/mono things, I'm still not clearly understand it. How to change stereo/mono setting? Do you already know it?
Title: Re: 600D Audio Controls?
Post by: 1% on July 29, 2012, 08:35:11 AM
The E registers I think.
Title: Re: 600D Audio Controls?
Post by: scrax on July 29, 2012, 10:25:22 AM
I have something strange, when setting volumes value ML will start to keep changing value like if arrow button is still pressed when it's not.
To stop it pressing q will go to ML menu and it will change quickly each menu still thinking that an arrow is pressed, pressing arrow in other direction once stops it.


EDIT: update to miyake latest, in Mic Type option I need to press twice SET for changing from Analog Mic differential to the next type.

EDIT2: Found the problem and fixed, how many mic type are we supposed to have? from what I understand we have 7 mictype:
Code: [Select]
int mictype[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07 }; 
and we can chose 4 of them from the menu:
Code: [Select]
static void mic_type_toggle( void * priv, int delta )
{
    //   menu_quinternary_toggle(priv, 1);
    menu_numeric_toggle(priv, 1, 0, 3);
    audio_configure( 1 );
}


I've changed this to have a name for each type:
Code: [Select]
static void mic_type_display( void * priv, int x, int y, int selected )
{
    bmp_printf(
               selected ? MENU_FONT_SEL : MENU_FONT,
               x, y,
               "Mic Type  : %s",
               (cfg_mic_type == 0 ? "Analog Mic SingleEmb" :
                (cfg_mic_type == 1 ? "Digital Mic" :
(cfg_mic_type == 2 ? "Analog Mic Differential" :
  "Another Type?")))
               );
    check_sound_recording_warning(x, y);
    //        menu_draw_icon(x, y, input_choice == 4 ? MNI_AUTO : MNI_ON, 0);
}

Digital Mic and "Another Type?" are not working with internal mic

EDIT3: Just found out that after a beep audio meter are not working. I was making screenshot to the audio menu with meter on and the beep killed audio.
switching override off and on worked to restart all.

here the screenshot:
(https://www.magiclantern.fm/forum/proxy.php?request=http%3A%2F%2Fimages2.wikia.nocookie.net%2Fmagiclantern%2Fimages%2Fthumb%2Ff%2Ffd%2FVRAM1.png%2F320px-VRAM1.png&hash=8a5c1326a38d90d65fbca0b111146018) (http://magiclantern.wikia.com/wiki/File:VRAM1.png)

EDIT4: I've added all the mictype selectable and so far: Digital Mic, mictype 03 and mictype 07 are not showing audio bar moving, other type (00, 02, 04, 06) show stereo audiobars.
Title: Re: 600D Audio Controls?
Post by: Alia5 on July 29, 2012, 02:42:05 PM
 tested with the source of scrax

when i tried to change my input source the camera went crazy... magic lantern menu scrolled from left to right extremely fast and camera didn't respond to any button...

anyone else expirienced this? o.O
Title: Re: 600D Audio Controls?
Post by: scrax on July 29, 2012, 02:55:22 PM
tested with the source of scrax

when i tried to change my input source the camera went crazy... magic lantern menu scrolled from left to right extremely fast and camera didn't respond to any button...

anyone else expirienced this? o.O
yes I had it before last changes, try again.
I stopped it going to the opposite direction, not sure what is
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 03:23:25 PM
Actually mic type is only 3. It's described in alsa driver(ml26124.c).
see this.
Code: [Select]
static const char * const ml26124_input_select[]
But we need to discover which register value is those types.


Also, Input select is not working fine. When I discover this reg, I can actually select inputs. So I think more combination register needed.

Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 03:35:06 PM
scrax:

please add this patch to your repo.

PTP patch by g3gg
http://www.magiclantern.fm/forum/index.php?topic=1512.0
Title: Re: 600D Audio Controls?
Post by: scrax on July 29, 2012, 04:26:07 PM
added it right now, I can't use it so far..
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 04:48:53 PM
Thanks!
It's very easy, I'm start using PTP from 4days ago.
Title: Re: 600D Audio Controls?
Post by: 1% on July 29, 2012, 05:22:04 PM
Just call audio IC write by address with PTP thats the easiest.


Quote
Also, Input select is not working fine. When I discover this reg, I can actually select inputs. So I think more combination register needed.



Yea, can't isolate internal mic when external is plugged in. So there is definitely more that goes into it.

Also take a register dump after the beep and we'll see what got flipped.
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 06:59:32 PM
Yhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!!!!!!!!!
Now I just facing Lint Rext on 600D!

But I don't know how to do this.
Anyway, current commited my repo and manually config by hand will take effect.
It's biggest hint for this!



dump when Lint/Rext
Code: [Select]
ML_SMPLING_RATE 08
ML_PLLNL 96
ML_PLLNH 00
ML_PLLML 00
ML_PLLMH 03
ML_PLLDIV 05
ML_CLK_EN 0f
ML_CLK_CTL 04
ML_SW_RST 00
ML_REC_PLYBAK_RUN 11
ML_MIC_TIM 12
ML_PW_REF_PW_MNG 06
ML_PW_IN_PW_MNG 0a
ML_PW_DAC_PW_MNG 00
ML_PW_SPAMP_PW_MNG 00
ML_PW_LOUT_PW_MNG 00
ML_PW_ZCCMP_PW_MNG 02
ML_PW_MICBIAS_VOL 02
ML_PW_MIC_IN_VOL 3f
ML_PW_MIC_BOST_VOL 30
ML_PW_SPK_AMP_VOL 1b
ML_PW_AMP_VOL_FUNC 00
ML_PW_AMP_VOL_FADE 00
ML_SPK_AMP_OUT 00
ML_MIC_IF_CTL 00
ML_MIC_SELECT 01
ML_SAI_TRANS_CTL 0b
ML_SAI_RCV_CTL 0b
ML_SAI_MODE_SEL 00
ML_FILTER_EN 83
ML_DVOL_CTL 2c
ML_MIXER_VOL_CTL 10
ML_RECORD_DIG_VOL ff
ML_PLBAK_DIG_VOL ff
ML_DIGI_BOOST_VOL 00
ML_EQ_GAIN_BRAND0 dd
ML_EQ_GAIN_BRAND1 dd
ML_EQ_GAIN_BRAND2 e7
ML_EQ_GAIN_BRAND3 e7
ML_EQ_GAIN_BRAND4 e7
ML_HPF2_CUTOFF 00
ML_EQBRAND0_F0L 0d
ML_EQBRAND0_F0H db
ML_EQBRAND0_F1L 0c
ML_EQBRAND0_F1H 1b
ML_EQBRAND1_F0L 6d
ML_EQBRAND1_F0H 08
ML_EQBRAND1_F1L 41
ML_EQBRAND1_F1H ed
ML_EQBRAND2_F0L 00
ML_EQBRAND2_F0H 00
ML_EQBRAND2_F1L 00
ML_EQBRAND2_F1H 00
ML_EQBRAND3_F0L 00
ML_EQBRAND3_F0H 00
ML_EQBRAND3_F1L 00
ML_EQBRAND3_F1H 00
ML_EQBRAND4_F0L 00
ML_EQBRAND4_F0H 00
ML_EQBRAND4_F1L 00
ML_EQBRAND4_F1H 00
ML_ALC_MODE 01
ML_ALC_ATTACK_TIM 08
ML_ALC_DECAY_TIM 08
ML_ALC_HOLD_TIM 00
ML_ALC_TARGET_LEV 0b
ML_ALC_MAXMIN_GAIN 70
ML_NOIS_GATE_THRSH 00
ML_ALC_ZERO_TIMOUT 01
ML_PL_ATTACKTIME 04
ML_PL_DECAYTIME 05
ML_PL_TARGETTIME 0d
ML_PL_MAXMIN_GAIN 70
ML_PLYBAK_BOST_VOL 10
ML_PL_0CROSS_TIMOUT 00
ML_NODOC_E1 01
ML_NODOC_E3 00
ML_NODOC_E5 07
Title: Re: 600D Audio Controls?
Post by: scrax on July 29, 2012, 07:20:14 PM
merged in your last commits, now need to go to work, good job! :)
Title: Re: 600D Audio Controls?
Post by: miyake on July 29, 2012, 07:22:12 PM
now need to sleep. Already finished Sunday. hmmm.
Good night.
Title: Re: 600D Audio Controls?
Post by: 1% on July 29, 2012, 08:28:48 PM
Yea, I could get Lint/Rext a while ago. And ext L/R and Ext/R but never int L/R while external is plugged in.


You have problems moving the mic because of E1/E5 and setting that on startup.  I got external and internal on 1 channel together and external separate and intL ExtR plus ext R. I should make a better video but you can see a little in this one. 




Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 04:12:04 AM
1%
Oh,no! Why you didn't share this video.....

I just understood convination of routing. may be , I will try to write it soon.
Title: Re: 600D Audio Controls?
Post by: 1% on July 30, 2012, 04:17:15 AM
You were the inspiration. I made it in the morning after I saw the other vid.
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 04:42:01 AM
ah, I see.

Now I including mic type in "input select" part. But it's really mysterious.

intLR: working int/ext both on LR channel
LintRext: working fine
extLR:  stop working.....

I need more time to finding best combinations.

It's just quick report. BTW, It's monday today, I need to go work .

scrax and 1%:
If you have a time,  please find best combination for those inputs. I will push current my codes.
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 04:46:58 AM
Current scrax's repo is supported audio_reg_dump_600D on "dont click me".
Also added E1 and E3 entry in .h

So you can find combination with differential from working dump and problem dump.
Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 06:18:47 AM
I've started to check the numbers in audioki.h and found something.
probably you already saw it too but i've added some numbers with commento on when they are set from canon.

I'm showing always E1 E3 E5 and E7
E1 and E5 change  when external mic is connected (E5 also after play or entering audio menu)
E1 is 01 with internal mic, 02 with external
E5 is 03 when "resetted", in rec or canon menu 06 with internal mic, 07 with external mic
E3 is always 0
E7 is always 1
Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 07:40:59 AM
but never int L/R while external is plugged in.
maybe found out why, I've added to set E1 to 2 when intLR mic is selected, and it works until rec starts, then it will be reverted to 1 probably by canon, but changing input and going back to int LR will reset it to 2 and record from internal mic with external connected.
So E1 need to be set after rec start depending on what mic input is selected in ML menu.
I can do it only manually so far.
I found how to force it but not yet usable:
Code: [Select]
static void
enable_recording(
                 int                    mode
                 )
{
switch( mode )
{
        case 0:
            // Movie recording stopped;  (fallthrough)
override_audio_setting(1);
case 2:
            // Movie recording started
            give_semaphore( gain.sem );
            override_audio_setting(1);
/*
//this force rec whith internal mic always also with external mic plugged
audio_ic_write(ML_NODOC_E1 | ML_NODOC_E1_REC_INT); // 02 test
audio_ic_write(ML_NODOC_E5 | ML_NODOC_E5_REC_INT); // 06 test
*/
           break;
        case 1:
            // Movie recording about to start?
            break;
        default:
            // Uh?
            break;
}
}
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 01:49:28 PM
Oh great.
Now I understand E1 and E5 meaning.
E5= L-ch input source.
E1= R-ch input source.

So now
LRint:    both int/ext input
Lint Rext:  working perfect with current my repo.(previously not working when move from LRint)
LRext: not working....no sound.

I will try to test more. 

One more thing , It's time to change E1 and E5 names .


Anyway, my english may be poor So please solve if you find strange english.
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 02:26:43 PM
 Yea!!! working intLR/intLextR/extLR!!!!!!!!!!!!!!!!!!!!

https://bitbucket.org/miyake_t/magic-lantern-for-600d-miyake/changeset/ffadbedb1f81c1ea147c5e96fd05f7c4bd203c48
Title: Re: 600D Audio Controls?
Post by: coutts on July 30, 2012, 02:48:36 PM
I emailed LAPIS, they are going to send me a datasheet for the ML26121A :)

Waiting for a reply but I will keep you updated.
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 03:44:43 PM
-startup override OK!
-start recording override OK!
-stop recording override get hang , need more code  for it.(now override disabled)

May be functions a improved now!!!!!!  Sounds good.

https://bitbucket.org/miyake_t/magic-lantern-for-600d-miyake/changeset/540ba53676cbe026347a64cf6fd718b52e7ad013
Title: Re: 600D Audio Controls?
Post by: Michael Zöller on July 30, 2012, 04:30:20 PM
Really great work you are doing here!  :D
Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 05:09:51 PM
Oh great.
Now I understand E1 and E5 meaning.
E5= L-ch input source.
E1= R-ch input source.

I'm not sure about this, to me looks like E1 is for internal (02) or external (01) mic in
E5 from canon is set only to 6 or 7 we instead use it to 2 or 3 don't know why

I've not yet understood well mictypes so far, will try to make more test...
Title: Re: 600D Audio Controls?
Post by: funkysound on July 30, 2012, 05:15:45 PM
Really great work you are doing here! ????????????
Yeah, I´m very impressed too - just great work so far and I can´t wait to use the final solution!!! You´ll get it done!
I will donate again the moment I have it in may hands - or better in my 600d  :)
Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 05:55:21 PM
about e5, i'm not sure if it is like this, someone can confirm it?
 
02 duplicate L to R
03 only L
04 only R
----
06 duplicate internal mic?
07 duplicate external mic?

and about e1, looks similar to e9
Quote
#define ML_MIC_SELECT              0xe900 /* Mic IF Control */
#define ML_MIC_SELECT_INTMIC   0x0001 /* Internal Mic */
#define ML_MIC_SELECT_EXTMIC   0x0002 /* External Mic*/
#define ML_MIC_SELECT_BOTH   0x0003 /* Both Mics */
01 external input
02 internal input

maybe there is a 03 value here also, how e9 were found?
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 06:14:35 PM
I guess those are mixer control.

E5,E1 is collect L,R different. E9 is collect LR together.
Actually, normal firmware is using only using E9.

and
E5 2,3,4 is confirmed me. But I dont know how to use it.Not good for us.
6,7 is input select for L-ch. I confirmed.

I think current
So first you need to check my code and those inputs are working fine.(But volume menu is not fine....changing automatically)

Anyway, you don't believe current define entry.

Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 06:19:39 PM
that makes more sense to me now. But I see canon firmware is also using e7, isn't?
(I have the scrolling problem sometimes too in volume control.)

 will update fork soon.
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 06:28:38 PM
Current input select is not smart , but working code is important. It's good for our first step.
So we need find more smart combinations for it.
But it's not so bad for using now.

scrolling issue:
comment out this.
Code: [Select]
        .edit_mode = EM_MANY_VALUES,
Title: Re: 600D Audio Controls?
Post by: scrax on July 30, 2012, 06:34:35 PM
scrolling issue:
comment out this.
Code: [Select]
        .edit_mode = EM_MANY_VALUES,

Is not enought I have them still if increased after pressing Q
Title: Re: 600D Audio Controls?
Post by: miyake on July 30, 2012, 06:37:56 PM
miyake's monology

Recently, I spend a lot of time for this coding. and my magiclantern friends are living in Europa and US areas.
So start sleeping is late.  Current my life like a everyday jet lag.

I want to more real time communicate with yours.  If I have a time and money, I want to trip Europa. Because I never go to Europa areas.

If I go to europa, Does someone take me to a great place or great restaurant?(lol


Already 1:30am in Japan. I need goto bed.
Good night.

P.S. I'm sorry for this off-topic.
Title: Re: 600D Audio Controls?
Post by: Michael Zöller on July 30, 2012, 10:27:40 PM
miyake, if you come to Germany, you are free to stay at my home for a night or two, we'd even have enough space for you and your wife.
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 02:43:26 AM
Quote
Current my life like a everyday jet lag.

2 years going so far. Always jet lag.


Maybe other E registers that never change are the same thing for output? I have a full week of work so I've been waiting to see what you guys come up with. :)
Title: Re: 600D Audio Controls?
Post by: coutts on July 31, 2012, 03:31:02 AM
Success! I asked kindly and was awarded a full spec data sheet for the ML26121A. Register map included :) hope this helps!

http://db.tt/lYtYhsBf
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 04:01:15 AM
@Michael Zöller
Thank you for your offer ;D

@coutts
ohhhhhh.Geat!!
I will check it
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 04:52:29 AM
I just clearly understanding registers. Time will tell correct codes.
But I think it's really huge functions. What functions does users needed ?
For example we can control Equalizer now!


scrax:
E1 and E9 is correct register for R,L ch input mixer control (lllllllol
I will check and solve audioki.h first.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 31, 2012, 08:18:58 AM
IMO, the most important features are:

* Analog gain (most important, and separate L/R control is GREAT) - of course, with AGC off
* Digital gain set to zero (for cleanest audio)
* Input source (internal mic, external mic, or combinations like Left internal, right external, differential)
* Audio monitoring (when you plug the A/V cable, keep audio signal on the A/V jack, but keep the image on main display)

Sure, it may be nice to have equalizer presets, but as long as you have the cleanest raw signal (without digital gain / filters), you can apply any filter in post.

Big up for Coutts - the datasheet is very well written.
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 08:25:11 AM
I see. clean-est audio is better for almost users. I understand it.

Anyway, what is L int R bal?
what is difference of "ext R" and "ext Balanced" ??
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 11:01:29 AM
Just cleanup all old registers in ki.[ch]
I have no camera now, So I'm not tested yet.
Title: Re: 600D Audio Controls?
Post by: Michael Zöller on July 31, 2012, 01:00:06 PM
See "Input Source" in the manual. Balanced requires a special adapter cable but enables us to remove unwanted interferences occuring with long cable runs.
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 01:27:23 PM
I already translated user guide to Japanese.
But only that part is not understanding.
I'm not professional video shooter and photographer , So I can't understand it .

I know balance cable and balanced-microphone.  So if we want to connect unbalance such as stereo pin plugs, We need to convert balance-unbalance converter.

So this function don't need to balance-unbalance converter. Is this a correct understanding?
We need to just only convert a connector.
right?
Title: Re: 600D Audio Controls?
Post by: Michael Zöller on July 31, 2012, 03:57:23 PM
I have not used the feature with my 5d yet, so take this with a grain of salt. Balanced means that even for a mono signal you use three instead of two strands inside the cable.

One strand for ground. The actual signal is sent through two strands but will be inverted in one of them. If an external signal interferes (for example a cellphone next to the cable), the interference can be removed because on the other end (the balanced IN, for example the camera) the inverted signal gets inverted once more the two signals are then subtracted from each other, resulting in the final signal having twice the amplitude and all external interference removed. See this picture:

http://www.delamar.de/wp-content/uploads/2010/07/symmetrisch_vs_unsymmetrisch.jpg

I don't know how it is done internally in ML, whether the chip does the inverting and summing or it is done in software. But it sure is a great feature for people using long cables.
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 04:16:41 PM
LR balance volume control implemented/

https://bitbucket.org/miyake_t/magic-lantern-for-600d-miyake/changeset/38172b06408c0d3b971cf6d95c3eb04f9ed26b24

@Michael
Thank you for explainning!!
I'm now coding. I will read your post after finish this coding. :)

@scrax
I'm added ifdef for recently added codes. YOU DONT DLETE IFDEFS.
Those are really easy codes. So keep ifdefs for porting audio.c.
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 04:36:01 PM
Props! How did you get them to cough it up. Now I get to see how wrong/right I was.  8)

I see why there are 2 registers, one is for reading, on is for writing.

If we leave audio off in canon but use canon functions to keep up file writing, etc we can probably manually control the whole thing without canon interference. What do you think, too much work?

Balanced is not really all that... I got the same performance by recording "stereo" and inverting the "silient" channel on a different camera. Just use an XLR interface like the juiicedlink, beachtek, etc.

*Was right there was a Rec/Playback mode but also there is a monitor mode... I'm rushing to try that.... Today is my only day off till sunday and I find all this cool new stuff.  I don't know if I should :) or :(
Title: Re: 600D Audio Controls?
Post by: a1ex on July 31, 2012, 04:40:33 PM
Slightly offtopic: I also have some 600D audio code for you to try:
http://bitbucket.org/hudson/magic-lantern/changeset/47a4d87bb535

It should add a menu from which you can select test tones (sine, square, random noise, stuff like that).
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 05:24:05 PM
 @1%
Props! How did you get them to cough it up. Now I get to see how wrong/right I was.  8)
I see why there are 2 registers, one is for reading, on is for writing.

I'm generated Hook entry by sed/awk around already known register.
functions are also generated, then the function will be display "hooked regaddr="

Finally, I'm push any switches on cameras ;) ;) ;)

If we leave audio off in canon but use canon functions to keep up file writing, etc we can probably manually control the whole thing without canon interference. What do you think, too much work?
I already thinking this issue.
My guess is:
stop recording -> canon firm will write powersave config to ic
                             |->current code overwrite audio value
Cannon firm has confirm the value was wrote or not.
so we had Dead lock or crash

So I think I need to watch  RECPLAY_STATE  to 00. Then write our override config.
I want to confirm all functions working first. I think it's not biggest problem. I guess I can solve it.

Balanced is not really all that... I got the same performance by recording "stereo" and inverting the "silient" channel on a different camera. Just use an XLR interface like the juiicedlink, beachtek, etc.

*Was right there was a Rec/Playback mode but also there is a monitor mode... I'm rushing to try that.... Today is my only day off till sunday and I find all this cool new stuff.  I don't know if I should :) or :(

I never use audio moniter from 600D. Because I had a JuicedLInk ;D
Need to more research for monitor.

Anyway, I will try to make a all of functions like other models.

@@@@alex
Thankyou !
I guess   scrax will add it. :D :D :D :D
help me to add that code scrax.
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 05:31:01 PM
fifth finger ache.(emacs sick)
Title: Re: 600D Audio Controls?
Post by: miyake on July 31, 2012, 06:09:39 PM
Just added filter logics. But something wrong.

https://bitbucket.org/miyake_t/magic-lantern-for-600d-miyake/changeset/4603194a0165fee7dcc6aac23b6c6e7a754967dd


Giving up today.

Need to take a bath, because wife got angry. :D :D :D
Good night!


ADDED1:
L and R digital volume had a -8 to 8(multiplex of 0.35 dB) . 0 is not balance controlled.
Currentry %d is not indicate minus mark. and font is red.
Does someone know this reason?
My brain is over heated today.
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 06:46:49 PM
I updated the registers for read/write... Does audio remote shot enable audio... because I get meters if I use it with audio disabled... hence I think we can record with audio disabled if tell the MVR to write the data and then just control IC manually to do what we want. Then nothing will set gain or f with our settings. You can't set rec/play to 00 because then then I think the IC will not work correctly.

Quote
I never use audio moniter from 600D. Because I had a JuicedLInk ;D
Need to more research for monitor.

Mine doesn't have an output so I can only put 2 XLR in and then an aux in. You need the A/V cable that came in the box and an RCA to headphone plug adapter.


Quote
Anyway, I will try to make a all of functions like other models.

Why? We have so many other functions we can implement. I don't think the other IC has as many features but I didn't really go into the AK data sheet. We can make a full EQ among other things. Adjust the noise floor and highpass too, etc.


Quote
Does someone know this reason?

Does masked_audio_ic_write work correctly? I never used it. Did you use it before today?
Title: Re: 600D Audio Controls?
Post by: klangdrang on July 31, 2012, 07:10:21 PM
Hey guys,
thanks for the great work you are doing. Monitoring the sound from 600d is the last option which leads to the perfect cam.
I have one question: I read this topic and all pages and I saw that you gays made a big step forward. But I cant get if you have already a stable monitoring solution. I saw some videos with the audio-menu enabled in the 600d, so is it also possible for me to enable it? What do I have to do? I don't need the other Audio stuff right now (although it would be great to have it later), but monitoring sound would be great right now, because i am starting filming in two weeks.
Where can I donat?  :)
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 07:21:27 PM
You have to look at miyake's code base, scrax's and mine and combine into one thing. I'm going to do that. I tried just enabling monitor mode after dac and amp but it didn't work... I'll have to set all the registers correctly in one shot and then it will probably work... I just need time to read the whole data sheet and make more informed attempts.
Title: Re: 600D Audio Controls?
Post by: klangdrang on July 31, 2012, 07:28:44 PM
Thanks for the quick answer.
Unfortunately I do not have the skills to combine the code or to convert the code to a finished firmware.
I don't wanted to stress you, of course you are doing this stuff in your free time and it needs time...
So good luck!
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 07:30:28 PM
No worries, just donate to ML fund, we'll have this working as soon as possible. We want to use it just as much as you do.
Title: Re: 600D Audio Controls?
Post by: johndb on July 31, 2012, 07:57:37 PM
I agree with 1% in that we should not "dumb down" the audio functions to match the capabilities of the previous camera models. The current 600D audio function set would provide a basis for next-gen camera audio functions with modern audio processors. I have been following this thread closely and am very impressed with the work that you're doing. Thank you!!
Title: Re: 600D Audio Controls?
Post by: scrax on July 31, 2012, 08:28:10 PM
I'm back now at home, and will go on on merging last changes fro miyake, a1ex and 1%.
for first I think we could match the option on other model, but if we can have more option, better.
Title: Re: 600D Audio Controls?
Post by: a1ex on July 31, 2012, 08:32:56 PM
If you can get separate analog gain for left and right channels, go for it ;)

Digital postprocessing is less important IMO.
Title: Re: 600D Audio Controls?
Post by: funkysound on July 31, 2012, 09:14:59 PM
I agree with 1% in that we should not "dumb down" the audio functions to match the capabilities of the previous camera models. The current 600D audio function set would provide a basis for next-gen camera audio functions with modern audio processors. I have been following this thread closely and am very impressed with the work that you're doing. Thank you!!
I just love to read this thread too and realize how hard you all work on this matter... it´s a kind of thriller for people like me, desperately waiting for audio control ... thanks!
Title: Re: 600D Audio Controls?
Post by: scrax on July 31, 2012, 10:55:28 PM
merged back 600D code to audio.c,
Title: Re: 600D Audio Controls?
Post by: 1% on July 31, 2012, 11:17:02 PM
Monitor is working at full volume now.... only tested internal mic.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 03:30:43 AM
1%:
I'm ported masked_audio_ic_write from linux. I found perfectly same functions.
But not tested yet.

hmm, English is difficult.
"audio monitering ON/OFF" and "Output volume" and another ML default  menu item and related func() is not implemented.
I think that we need to implement those menu and func() first.
Next step, we will make a smart/clean patch to main repo. Because ,  A lot of end users can't get it when we porting to audio.c and main repo.

Reason:
 - implement many functions need a lot of time.
 - many functions implemented = difference is bigger from main repo  ==> porting is more difficult

I'm really scary for porting to audio.c. I think most hardest part is porting audioki.c to audio.c patch.
We need smart ifdef usage and less ifNdef is much better for reading the codes.

@scrax
Thankyou,
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 03:39:56 AM
Monitor is working at full volume now.... only tested internal mic.

Oh!! just found it.

What plan do you have to make a porting code?
Current code is not perfectly compatible another cameras.

Then I think we need clean/straight hand patch is better for making a most clean/smart patch, I think.

How do you think?


Title: Re: 600D Audio Controls?
Post by: scrax on August 01, 2012, 03:45:13 AM
I've made a lot of merging lately, now most of 1% code is in my fork with miyake's also.
I've added more value in audio.h and also the read registers like 1% did for audio6.h.
take a look,menu is a bit messy right now...
Title: Re: 600D Audio Controls?
Post by: 1% on August 01, 2012, 04:23:10 AM
I think we should just add audio_something.h and C and leave audio.c the way it is. That way less ifdefs and we're not bound by the stuff in audio.c Also, our work won't have any affect on the other cameras.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 04:32:25 AM
I've made a lot of merging lately, now most of 1% code is in my fork with miyake's also.
I've added more value in audio.h and also the read registers like 1% did for audio6.h.
take a look,menu is a bit messy right now...

Ah just finished reading your marge. It's not so bad!.
I will try to modify, more clean ifdef usage.
And let me remind you that is you do not use ifNdef *... (How can I say ) minimum use is better...*.
Human brain is poor. sometime miss reading a lot of combinations of ifdef/ifNdefs.

Already audio.c had a 500D entry.  We will add 600D ifdefs. It's a really hard to read codes, I guess.
It means Alex had a difficult to manage audio.[ch] . 
I think , we need to think about this too.
Title: Re: 600D Audio Controls?
Post by: 1% on August 01, 2012, 04:35:41 AM
Did anyone else try the function generator? It beeps fine but when I play a tone it plays it and then gives me an error 70 in memory something.


MVR.h already exists in all of the platform folders. Alex never said we HAD to keep everything in audio.c
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 04:39:10 AM
I think we should just add audio_something.h and C and leave audio.c the way it is. That way less ifdefs and we're not bound by the stuff in audio.c Also, our work won't have any affect on the other cameras.

1%:
I agree. It's one of answer for it. But now, scrax's porting is not so bad.I will try to maintenance it.
Finally, We judge , which method will we use to main repo.
OK?

One more thing.
You added a lot of unused defines and functions. It means , a lot of memoy needed.

So I think , If you simply comment out those functions(for future use)  or define ifdef CONFIG_600D_AUDIO_NEWFEATURE.
Then another user do not define CONFIG_600D_AUDIO_NEWFEATURE. don't need memory for it.
How about this? I can't understand which your function is used or not.

Title: Re: 600D Audio Controls?
Post by: 1% on August 01, 2012, 04:43:05 AM
I don't think we'll need the debug functions anymore. We can cut out the read registers if necessary, especially if we don't end up using them. I still have over 900k free.
Title: Re: 600D Audio Controls?
Post by: scrax on August 01, 2012, 04:45:21 AM
I had no errors with beep generator.

For me we can have ifdef in audio.h and an oki.c in 600d folder for our code if we can keep there only 600D part without duplicate common code from audio.c (instead of what i did for audioki.c)

I've just tested and meters works also with audio disabled, and seems that canon don't override anymore IC setting, like 1% was supposing.

so i've removed the check for the 600D and all things works with audio disable so far, not tested a lot. but fork is updated.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 05:24:03 AM
scrax

I understood that you are ported a little old my codes. some codes are not available :D

Will solve it.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 06:08:16 AM
Now 1hour thinking how to marge current codes......................................
......
....
...
..ajfdsalfjdksalfjdskalfjsdkajflsdoeiwtgiosanvo

We need to think usage of repos........  Currently, need more extra work in this systems.......
 
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 07:41:30 AM
1% please remove your debug code from audio.c first.
I think most your code is not production level.
Also 30 percent of my code is already implemented your debug functions(gain boost filter input select..).

It's not good to import your debug code to audio.c
debug is must put audioki.c.

So now, It's really confused, and I can't write code current repo.
Because I need a lot of  cleanup works.

It must merge production code only in audio.ch , I think.

How do you think?  Do I start my repo for creating after things?


P.S. audio.h is correct succeeded.
Title: Re: 600D Audio Controls?
Post by: 1% on August 01, 2012, 01:38:07 PM
Yea, now I can fix the volumes and mic selection values... there was only a few things in audio.c, most of it was in debug.c. If you look I restored the old audio.c so there is nothing in there. Everything is in audio6. We have new volumes like headphone and boost2 to add and values can be converted to db, etc. All of that stuff was written before we had a datasheet and is guesswork.

Now our reversing can be implemented into useful features and production code, etc.  But your frustration is why I think its a bad idea to keep everything in audio.c. Even if we have to copy the meters to okiaudio or audio_whatever its still better than 1 million ifdefs. Also T3 has different audio and will need its own audio.c and probably some of the new cameras too. Its one change to dryos.h to add a new .c/h file.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 03:26:17 PM
Thank you for your understanding.

1, why I need to import our code to audio.c
  I think, It's for Alex. If we add clear code in audio.c, he is only need to manage single files. Also we can get Alex's code tweak.
 
2, why I got frustration
 Now I'm main worker for 600D audio. But the repo is not mine ,  scrax's work is really good and provided a good platform to us at that time. But now, he can't understand all of codes when he marge our codes.(too much codes are confusing to him)
 The codes are back to old one . and deleted duplicate functions are revival.

So I think, we need to move my repo. I'm almost finished porting audioki.c to my repo.

Then, If you write a production code ,you fork my repo. and make a  pull request to me.
And, tragic-lantern will going for your debugging.

It's my concern. How about it?

P.S. Now my code is , agc on/off,  controlled from menu . and HighPass filter bug is solved.
Title: Re: 600D Audio Controls?
Post by: scrax on August 01, 2012, 04:11:44 PM
Not sure if it could be of some help but I give you and 1% write permission on the 600Dplus fork.

In my opinion both option are good, what I think is that some code is "universal" like the audio meter and need to stay in audio.c for all the camera, other thing like audio for 600D are so camera specific that can be moved in platform.
also is audio.h has 600D registers like now, audioki.c can be used without changes in dryos.h, only the Makefile needs to be edited.

About Volume control.
Miyake's one is strange because at 7-8 I have more volume than at 11, same at 12-13 vs 15-16. But I like how analog, digital and boost are combined in one simple option.
1% submenu are more complete but slower to set and understand, and also why are they showing auto int/ext?
they need some cleanup to be usable, change the value shown, etc.
If we can have a Volume option that can go from 0 to what is max with set and play and with Q open a sub menu with all the single volume options , analog and digital it would be the best of both.




Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 05:43:53 PM
check up my repo
https://bitbucket.org/miyake_t/magic-lantern-miyake

really a lot of time need to merge.

A little bit more ifdefs. But it's not so bad, I think.


----
1%
config val to dB value is not implemented. Because Dryos has no %f. only %d. So we can not understand the difference of 1 and 1.5. So I used integer value.
Title: Re: 600D Audio Controls?
Post by: scrax on August 01, 2012, 05:46:15 PM
check up my repo
https://bitbucket.org/miyake_t/magic-lantern-miyake

really a lot of time need to merge.

A little bit more ifdefs. But it's not so bad, I think.
trying to merge now.
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 05:55:02 PM
forget everything! just copy is easy
Title: Re: 600D Audio Controls?
Post by: miyake on August 01, 2012, 06:33:06 PM
Ah, just remember that current my repo had a movieAF testing.
I think new repo is better for porting back to main repository.
I will do that.



hg clone https://miyake_t@bitbucket.org/miyake_t/magic-lantern600daudio
Title: Re: 600D Audio Controls?
Post by: scrax on August 01, 2012, 07:20:47 PM
yes, af give me problems, thanks
Title: Re: 600D Audio Controls?
Post by: 1% on August 02, 2012, 03:54:23 AM
Hehe, keeping the AF (almost done pulling functions so hopefully I can help you with what the numbers mean). Meters could stay in audio.c but we don't need all of the other registers in audio.h. For simplicities sake I was going to copy them into the platform file and forgo audio.c/h completely... Its honestly a few kb of text, even if its duped it won't make a difference on compile. The compiler will just ignore it. Alex is really good, I don't think he will have a problem maintaining 2 files vs one.

Quote
also why are they showing auto int/ext?

I never set the last option. Auto int/ext is basically none. I have to get rid of that and now that I have the datasheet and the right values I can.

Quote
Miyake's one is strange because at 7-8 I have more volume than at 11, same at 12-13 vs 15-16.

I have to compare what was done to the datasheet. If you look over that you'll see what values are supposed to mean what dB value. I've just had this whole week taken up... just got home now, left at 6am so thats like 13+ hours of stuff.

Also have to figure out if audio gets written to the video files when sound is off. We could theoretically leave sound off in canon and have our own on/off (has to work without crashing the MVR). Rec/Play/Run also has an auto mode that is supposed to do something, that may help.

We're much much further along than even a couple of days ago.
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 04:36:22 AM
-Af func will keep my MagicLanter-miyake repo.

-Now we have merged audio.c and audioki.c So I think, Alex judge which one he want to use.

-AutoInt/Ext is actually not set audio input in our codes. so cannon firmware will set correct value, I think.

-analog gain is mic vol and mic boost combination. Just simply added analog gain framework. I don't know it has bug or not.The framework is important and and It's easy to solve bug when we already using a framework.  So please find bug , and solve it.

---my concern
-we need to start using issue tracker?
 -current functions are almost implemented which is in menus.(basic funcs)
 -Just writing framework, and I know that It has a lot of bugs yet.
    - reg value combination when we  change config from menu.
 -test volunteer offer using autoexec.bin must not be start before Aug, 13 . It means a ML2.3 is out to public.

-why we need to stabilization now and only implemented basic funcs?
  -The difference of main repo is really big. I think alex can't(or hard to understand) handle a lot of codes. I think , we push current basic funcs now. and then If we found extra funcs and implemented. I will push again. The difference is a little. easy to undestand it.
  -We need to merge work when main repo is updated.  So I hope basic funcs will be import to main repo when we finish solving a bugs. it's easy to maintain code difference.
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 08:33:21 AM

Also have to figure out if audio gets written to the video files when sound is off. We could theoretically leave sound off in canon and have our own on/off (has to work without crashing the MVR). Rec/Play/Run also has an auto mode that is supposed to do something, that may help.


 :)

I'm testing with miyake's code, removed check for audio enabled and I can record, change audio and filter when in rec. Not tested changing input or monitor mode. It gives some pop and clips when audio starts rec (we probably need to wake up the ic more "gently") or when changing some volume values.

So I think too that if your idea is correct we can force with ML audio off when Audio Override is On and manage audioIC with ML.

False report, I was supposing it was off in canon manu, instead it was on, when off audio is not recorded...

note: rec digital gain is "inverted" value go down when pressing right arrow. (fixed)



If don't rember wrong Alex told me audio.c is is still code from Trammel, maybe it's time to update it for the various audio IC there are around considering future ports also...
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 08:53:19 AM
600D audio current status.
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 09:13:51 AM
Quote
So I think too that if your idea is correct we can force with ML audio off when Audio Override is On and manage audioIC with ML.
ah, I think so. So we need mute menu? now "override off" is do the all register off.
So we can mute when recording.But re-override is not working now. (I found just now).


Quote
note: rec digital gain is "inverted" value go down when pressing right arrow.
Solved it.

Quote
If don't rember wrong Alex told me audio.c is is still code from Trammel, maybe it's time to update it for the various audio IC there are around considering future ports also...
Really? It's time to talk architecture with Alex.
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 09:26:00 AM
I was wrong, when audio in canon menu is off , also if enabled with ML it's not recorded, so there will need more test.

found another little typo in

audio_filters_toggle( void * priv, int delta )
{
    menu_numeric_toggle(priv, 1, 0, 1);
    audio_ic_set_filters();
}

it has
 priv, -1,0, 1);  in yours
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 09:42:08 AM
ah, I think so. So we need mute menu? now "override off" is do the all register off.
So we can mute when recording.But re-override is not working now. (I found just now).


I don't know if with override off was working with code from 1% maybe?
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 10:15:12 AM
I don't know if with override off was working with code from 1% maybe?

No, It's my code. which 1%'s function are you talking?
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 10:17:28 AM
it has
 priv, -1,0, 1);  in yours

?? which line??
toggle's delta is 1
toggle_reverse's delta is -1

are correct, I believe
Title: Re: 600D Audio Controls?
Post by: 1% on August 02, 2012, 01:58:03 PM
I figured audio would not be recorded even though meters work with audio off, it would only make sense.  My plan was to call the canon functions that tell the MVR to write sound to the file when rec is pressed. I'll have to test all of that but doesn't seem that difficult. Then we are free of canon and the ALC and I think lose some overhead from canon sound processes running.
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 02:32:36 PM
Oh no.
I was miss taken writing English.
I want to say that we do not start testing with autoexex.bin until August 13.
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 03:43:22 PM
No, It's my code. which 1%'s function are you talking?
I suppose this:


Code: [Select]
extern void power_mic_only()
{
audio_ic_write(ML_PW_IN_PW_MNG | 0x0a);
audio_ic_write(ML_REC_RECPLAY_STATE | 0x11);
if (volwrites ==1 )   
{   // If we're controlling volume set it.
audio_configure( 1 );
}
    else { // If we're not we need this

audio_ic_write( ML_PW_MIC_IN_VOL | 0x3f ); // Mic was too quiet, had to tap it.
// audio_ic_write(ML_PW_MIC_BOST_VOL | 0x10); // Some boost too
// audio_ic_write(ML_MIXER_VOL_CTL | 0x10);
// audio_ic_write(ML_DVOL_CTL | 0x2e);
// audio_ic_write(ML_PW_AMP_VOL_FUNC | 0x01);
audio_ic_write(ML_FILTER_EN | 0x03); // Noise Filter and High Pass
// audio_ic_write(0xe101);
// audio_ic_write(ML_NODOC_E5 | 0x06); // Don't need EQs
}
}
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 03:46:01 PM
?? which line??
toggle's delta is 1
toggle_reverse's delta is -1

are correct, I believe

posted the wrong one before:

 
Code: [Select]
static void audio_hpf2config_toggle( void * priv, int delta )
 {
-    menu_numeric_toggle(priv, -1, 0, 7);
+    menu_numeric_toggle(priv, 1, 0, 7);
     audio_ic_set_filters();
 }

line 1709


also added the AGC value display line 369:


Code: [Select]
#endif
         }
-#ifndef CONFIG_600D
         if (gui_menu_shown() && alc_enable)
         {
-                int dgain_x1000 = audio_cmd_to_gain_x1000(audio_ic_read(AUDIO_IC_ALCVOL));
+#ifdef CONFIG_600D
+            int dgain_x1000 = audio_cmd_to_gain_x1000(audio_ic_read(ML_ALC_TARGET_LEV-0x100));
+#else
+            int dgain_x1000 = audio_cmd_to_gain_x1000(audio_ic_read(AUDIO_IC_ALCVOL));
+#endif
                 bmp_printf(FONT_MED, 10, 410, "AGC:%s%d.%03d dB", dgain_x1000 < 0 ? "-" : " ", ABS(dgain_x1000) / 1000, ABS(dgain_x1000) % 1000);
         }
-#endif
Title: Re: 600D Audio Controls?
Post by: coutts on August 02, 2012, 03:55:24 PM
so, did that register map help you guys out?  :)
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 04:37:33 PM
@coutts
Yes yes! Thank you

Scrax
Today I'm away from my home.
Will pull your request when I go back to home.
Thank you.
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 05:51:51 PM
@miyake
going to play mode and back will bring back on audio override after switching them off.

Yeah, I've managed to make them come back after swithcing audio overrideoff.
I've made a audio_ic_on function that will revert audio ic off settings:

static void
audio_ic_on(){
    audio_ic_write(ML_MIC_BOOST_VOL1 | 0x03); // max boost1
    audio_ic_write(ML_MIC_BOOST_VOL2 | 0x00); // boos2 combo
    audio_ic_write(ML_MIC_IN_VOL | ML_MIC_IN_VOL_8); // max vol
    audio_ic_write(ML_PW_ZCCMP_PW_MNG | 0x01); //power on
   
    audio_ic_write(ML_RECPLAY_STATE | ML_RECPLAY_STATE_MON);
    audio_ic_write(ML_MIC_IN_VOL | ML_MIC_IN_VOL_8);
    audio_ic_write(ML_HPF2_CUTOFF | ML_HPF2_CUTOFF_FREQ200);
    audio_ic_write(ML_FILTER_EN | ML_FILTER_EN_HPF_BOTH);
    audio_ic_write(ML_MIXER_VOL_CTL | ML_MIXER_VOL_CTL_RCH_USE_LR);
    audio_ic_write(ML_REC_LR_BAL_VOL | 0x00);
}

Try to see if it's good, on my fork it works, will push it now.
Also pushed a fix for digital gain icon going reverse and enabled audio remote shoot for 600D

i've not tested audio monitoring because can't find the cable right now...
Title: Re: 600D Audio Controls?
Post by: scrax on August 02, 2012, 06:45:50 PM
so, did that register map help you guys out?  :)
thank's coutts I'm starting to understand a lot more now :)
Title: Re: 600D Audio Controls?
Post by: miyake on August 02, 2012, 09:44:12 PM
Just merged scrax's code. will check it.
Title: Re: 600D Audio Controls?
Post by: g3gg0 on August 02, 2012, 10:23:41 PM
really exhaustive configuration possibilities :)
good work!
Title: Re: 600D Audio Controls?
Post by: miyake on August 03, 2012, 05:16:52 AM
@scrax
Quote
going to play mode and back will bring back on audio override after switching them off.
I'm sorry for my poor English . I can't find any problems. Do you want to tell me this sentence has problem was gone??


Quote
Yeah, I've managed to make them come back after swithcing audio overrideoff.
I've made a audio_ic_on function that will revert audio ic off settings:
Works perfectoly!!!

Quote
i've not tested audio monitoring because can't find the cable right now...

me too


Anyway, It has no problem now, I think.  great work scrax!!
Do you know any other problems?

Title: Re: 600D Audio Controls?
Post by: juantrueno on August 03, 2012, 06:10:00 AM
Thanks to all who are working on this project!
i'm ready to test!
Thanks again!
Title: Re: 600D Audio Controls?
Post by: miyake on August 03, 2012, 11:04:28 AM
Hook-able point video memo.
Title: Re: 600D Audio Controls?
Post by: scrax on August 03, 2012, 01:42:04 PM
Anyway, It has no problem now, I think.  great work scrax!!
Do you know any other problems?
I can't hear differences in the audio recorded with wind filter on or off. But visually I see changes in meters.
So it's not a problem yet but something to investigate.

The first sentence was written before adding audio_ic_on to the code, so don't mind it.
Title: Re: 600D Audio Controls?
Post by: miyake on August 03, 2012, 02:11:02 PM
I see

So we need to check
 -High pass filter
 -Ext balanced(I guess, your patch broken it.)
 -monitor
 -auto int/ext (But just added codes, check my repo)

One more thing, I'm logged on my repo(already deleted) which is debugging function. It's like a console printf().
It's very useful for me.So you can copy/past it , if you want.
https://bitbucket.org/miyake_t/magic-lantern600daudio/changeset/1fecaf1b1fff62b39d4b30c4669ecbd68d8b1eba
Title: Re: 600D Audio Controls?
Post by: johndb on August 03, 2012, 02:18:05 PM
I am looking forward to testing the new 600D audio when you you are that stage. It would appear that you are very close to having it completed to the point that it would be ready for testing. Thank you all for your hard work. I'm taking a road trip through the west coast of Canada and the US in two weeks and I sure would like the enhanced ML audio.
Title: Re: 600D Audio Controls?
Post by: miyake on August 03, 2012, 02:56:12 PM
@johndb
envy you. Is it a summer holiday or vacation?

@scrax
Added compatibility issue solving codes. pull it.
and I found Canon AV cable. But I have no connector conversion equipment.

Today, I'm coding ML with drinking Japanese SHOCHU(kind of SAKE). It's really delicious.
I'm waiting to yours coming to Japan.
Title: Re: 600D Audio Controls?
Post by: johndb on August 03, 2012, 03:42:56 PM
@johndb
envy you. Is it a summer holiday or vacation?

Yes, I'm taking a vacation. I'll be in San Francisco during the America's Cup Sailing Race and will be shooting some footage and stills.

Today, I'm coding ML with drinking Japanese SHOCHU(kind of SAKE). It's really delicious.
I'm waiting to yours coming to Japan.

Enjoy your SHOCHU! You deserve it. @scrax, @1%, and @coutts and everyone else that worked on this project deserves some too  :)
Title: Re: 600D Audio Controls?
Post by: obiyan19 on August 03, 2012, 04:41:28 PM
hi,

just a new here, from france. I am in admiration for all the job done here. congrats to all ! If you need another tester on 600d, i am here.  :D
Title: Re: 600D Audio Controls?
Post by: scrax on August 03, 2012, 08:08:13 PM
Audio mointoring seems not working, I found the cable too. plugged in in a tv an i can hear audio from what recorded but not with audio monitoring on. Will try 1% code too to see if there it works
Title: Re: 600D Audio Controls?
Post by: miyake on August 04, 2012, 04:36:58 AM
(lol
The code is nothinkg .
Will try to add framework asap.
We need to add IC configration by PDF P38
Title: Re: 600D Audio Controls?
Post by: miyake on August 04, 2012, 05:00:41 AM
Just added framework. Let's discover what reg value is answer.

audio_ic_lineout_*
Title: Re: 600D Audio Controls?
Post by: miyake on August 04, 2012, 07:11:16 AM
Override succeed when we plugged in the USB-RCA cable.

difficult...
 -can't use PTP because USB port is already plugged-in
Title: Re: 600D Audio Controls?
Post by: miyake on August 04, 2012, 12:27:10 PM
Audio mointoring seems not working, I found the cable too. plugged in in a tv an i can hear audio from what recorded but not with audio monitoring on. Will try 1% code too to see if there it works

If you know 1%'s code is working, you can get regdump from working situation.
Then simply diff ,
Then we can understand what reg we needed.

Anyway, I will away today.
Title: Re: 600D Audio Controls?
Post by: miyake on August 04, 2012, 04:03:15 PM
Just working headphone monitoring.   1%'s code is very helpful Thankyou 1%.
I will check more combination for another settings. And will cleanup codes.

Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 05:53:19 AM
@scrax
I learned balance things. balance is equal to differential . so I reverted EXT balance input.
I'm not sure PDF p70 relation is need or not.  Need testing.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 06:38:49 AM
Good
I've finished merge with your code, and now need to sleep, later will try it more.
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 02:48:10 PM
@All
Do you know what is most reasonable USB-3.5pin cable?(MagicLantern supported one)
If you know good item , please let me know the URL.
Suscom is a little expensive for me.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 05:37:18 PM
@miyake, take a look at my audio.h, I've added a lot of register setting, and fixed some names and values.

for example analog gain were updated some days ago link (https://bitbucket.org/600Dplus/magic-lantern600daudio/changeset/04e786e4730ca8c85f608394010bc3262d6e89b1)
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 05:50:16 PM
Checked it. But I think those new items are not used in this time.(some item never used)
never used item is also need a memory. So I think , we need to add CONFIG_600D_AUDIO_OPTIONAL. And I will try to chose those item.
So please make a pull request to me.
(I want to see pull request behavior )
 
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 05:55:18 PM
 :-\???
Is "define" entry only for use in compiler???
Don't need memory ? I guess.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 06:04:33 PM
Right, I'm adding all I can understand from the datasheet, for now just to have all things ready if needed. When the basic audio set is done we can remove from audio.h all registers not used and put a CONFIG_600D_AUDIO_OPTIONAL for them.

(done pull request)
not sure about this (line 768):
-    "ML_HP_AMP_OUT_CTL",
+   "ML_HP_AMP_OUT",

and if we need definitions for spkr or headphones volume value.

:-\???
Is "define" entry only for use in compiler???
Don't need memory ? I guess.

I think that to, if understood right your question.
All things not defined will be not in the compiled code (so no space filled for nothing)


About the differential mic, is this the same as balanced?
I can't understand well the differences from cold connection, hot or both.
Maybe just a link to more info will be great.
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 06:39:04 PM
If a lot of definitions don't need a memory, it's not so bad in this audio.h.
Good work.

Differential mic issue.
I understand from Japanese web site.
So I guess you can google with this word "balanced unbaranced audio differential" on your mother langage.
(Does your mother language English?)

see:
http://en.wikipedia.org/wiki/Balanced_audio

HOT and COLD described in spec sheet. It's not related in balance issue. IC chip mic port has two(Plus/Minus) port.
Audio guys say + is HOT - is COLD.
So I rename HOT and COLD.  I don't know clearly, that is HOT plug is actually connected INTernal mic.
I can't confirmed yet. So name was changed to HOT/COLD.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 06:59:49 PM
I've fixed the merge and pull request, pulling it again.
that ML_HP_AMP_OUT_CTL was your addition, was thinking I removed it, so now it's back.

English is not my mother language too, it's Italian


EDIT: I can't keep monitor on when headphone connected anymore, is it the same for you?
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 07:29:41 PM
Ah, I see.
If HP_AMP_OUT only, I can't understand this define has a volume value or control switch. So I added _CTL.

Ciao!

Embeded LCD will black out when we connect RCA-USB.
I was thinking, Special USB cable has some pins disabled. So LCD ON/OFF will not occur.
But I have no Special USB-3.5pin cables.
Is this a my miss-understanding? Someone let me know who is using a  USB-3.5minipin on 550D or 60D or 5D2.

P.S. lost URL, but some YouTube is using USB-RCA audio monitor with HDMI monitor. So basically LCD is black out, I guess.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 07:44:49 PM
I'm using the canon cable usb to rca red white and yellow, and it worked with monitor on since this commit:
Revision: 4362
Changeset: 310cba4fa53da76b7376468458267b79b2e651b3 [310cba4fa53d]
Parents: 4361
Date: 04 agosto 2012 05:21:29 GMT+02:00
Branch: unified

save miss

then I did a merge and after that merge don't works anymore.
but I can't figure out why...
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 07:49:37 PM
there is something strange, now also some commits that were working don't works anymore for headphone monitor ...

Ok maybe is this one the last one working:
Revision: 4360
Changeset: 2bfc031eddf2967b6c0a06a452041ad578cadff5 [2bfc031eddf2]
Parents: 4357
Date: 04 agosto 2012 04:51:32 GMT+02:00
Branch: unified

add monitoring framework
with the next one "missed framework . solved it/" I can't no more keep camera display on...
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 08:11:47 PM
Headphone monitor is working when:
 - headphone is connected(Connected message shown)
 -On/Off toggled.

So If your LCD is displayed. first trigger is not do it.
Then, "microphone_connected" is false. Then, audio monitor is not working.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 08:15:42 PM
Headphone monitor is working when:
 - headphone is connected(Connected message shown)
 -On/Off toggled.

So If your LCD is displayed. first trigger is not do it.
Then, "microphone_connected" is false. Then, audio monitor is not working.

can you post me a PM with your autoexec.bin?
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 08:18:45 PM
Will read more original codes. I need sleep.
Good night.

P.S. If we finish this audio things. I want to eat delicious pizza and beer with you  ;)
Title: Re: 600D Audio Controls?
Post by: miyake on August 05, 2012, 08:21:46 PM
can you post me a PM with your autoexec.bin?

Sent your gmail check it. But It's same as yours. I guess.
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 09:06:44 PM
        audio_monitoring_update();
 is what makes it work. but need more work so far..
Title: Re: 600D Audio Controls?
Post by: scrax on August 05, 2012, 09:53:20 PM
partially solved, now it works when changing it on and off, but not when cable is connected, so you have to toggle the option with the screen off...

pushing it
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 04:59:20 AM
It would be nice to have headphones working at start-up.  I wonder why that is not working, its going to be important for shoots. I'm testing the functions now. Need a little tuning and some more options but much more usable now.
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 05:10:40 AM
@scrax
Quote
audio_monitoring_update();
 is what makes it work. but need more work so far..
My ifdef miss. solved it. it for other cameras.

analog_gain():
MIC_IN_VOL is agree. but mic boost need to discussion.
1: a lot of if need a CPU instruction for comparing the values. switch is only 1 CPU instruction. So changed it.
2: My understanding from spec sheet.
    V2=0 V1=0    0db
    V2=0 V1=1    +9.75db
But your code is


Just understand 2nd issue. (lol It's really mysterious values. Thankyou for your correction.

Quote
solved, now it works

What's point you let me know?

1%:
I think. If headphone not connected. The camera will be mic-in through the Speaker. So I think, that only working on Headphone connected. How do you think?
or Do you know any other problems?
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 05:13:16 AM
Yes it's starting to be usable, I have a lot of pops with audio monitoring at start of rec, and also if changing some option like wind filter.

If they are not connected they will not work, maybe calling
        audio_monitoring_update();
in the right place will work
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 05:18:24 AM
@scraxMy ifdef miss. solved it. it for other cameras.

analog_gain():
MIC_IN_VOL is agree. but mic boost need to discussion.
1: a lot of if need a CPU instruction for comparing the values. switch is only 1 CPU instruction. So changed it.
2: My understanding from spec sheet.
    V2=0 V1=0    0db
    V2=0 V1=1    +9.75db
But your code is


Just understand 2nd issue. (lol It's really mysterious values. Thankyou for your correction.
 
What's point you let me know?
good miyake, I've added the if because was an easy way for me to show what I was thinking about it, I was about to ask you to make it better , this is a new lesson for me. :)
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 05:18:42 AM
1% and scrax;

Sorry for my miss coding. Just understand and solved it now.(LCD black out issue)


MSG added
hmm,  We are now calling audio_monitoring_update(). But LCD is balck out.
Is this a same on your side?

MSG added2
I'm added audio_monitoring_update() when headphone connected. But this function is something wrong on 600D.
How do you think? Is this a timing issue?
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 05:23:31 AM
np, I've had similar problem yesterday  :P
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 05:40:15 AM
Quote
The camera will be mic-in through the Speaker.

Monitor through speaker could be an option. My main issue is the blacked out lcd at startup. I've never had LCD unless I start camera with headphones unplugged. This is bad for battery changes, etc.


L/R input and output separate controls maybe? The digital gains didn't seem to do anything but I need to test more and read the code. And need to figure out a quicker way for audio on/off because going to the canon menu is a bit of work.
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 05:53:20 AM
moving around         audio_monitoring_update();
I can get back LCD after starting up with the cable connected after going in LV or pressing PLAY, pulling the changes (https://bitbucket.org/600Dplus/magic-lantern600daudio/changeset/28627fefa29af0e57f0fe8bc29f96e24d7035e0f)


L/R input and output separate controls maybe? The digital gains didn't seem to do anything but I need to test more and read the code. And need to figure out a quicker way for audio on/off because going to the canon menu is a bit of work.
digital gain is working but not as expected, i have the same high volume from -12 thru 0 to  -129, -133, -137, -139...
to disable it on canon menu from ML maybe is possible like with FPS.

I think that if there is a way to record audio with ic off in canon menu also pops will be reduced (because of less fighting with canon setting up ic before us).
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 06:12:19 AM
hmm, LCD behavior is something strange when startup and not connected HeadPhone.
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 06:25:16 AM
now I can startup with LCD and headphonr connected, your fix and ny dirty attemp seems working...
only little issue is that it takes more to show the screen at start

To me looks like that so far digital gain and wind filter needs more test and optimization
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 06:34:22 AM
line 2284 has no ifdefs. So I suggest to move this to top of meter_task().
It already has ifdefs .
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 06:36:58 AM
Wind filter is highpass and dc offset? I used to be able to tell the difference when I hit those 2 on, now I can't.

Quote
I think that if there is a way to record audio with ic off in canon menu also pops will be reduced

Its pretty possible, just need to find the right property to change or function to call in firmware. Somewhat related to limit bypass conceptually. Need control over the MVR.

Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 06:40:51 AM
hmm. not working on my side. ..  LCD is always black out

(llllllllllllllllllllllol
Sorry! my HPmonitoring menu was off.................I'm a little bit tired.

Now working fine.
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 07:08:56 AM
line 2284 has no ifdefs. So I suggest to move this to top of meter_task().
It already has ifdefs .
I've put it there because was the first place where I find it worked (supposing that it will work also on other camera), but probably you can find a better place for it. I can't understand where you mean to move itlooking at your code now
Understood, I've tried it there but it was not working before because was missing some code you added.
Now it's really faster than before! :D
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 07:13:28 AM
Wind filter is highpass and dc offset? I used to be able to tell the difference when I hit those 2 on, now I can't.

yes. I can't tell the difference anymore too, but not done a lot of test
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 07:38:14 AM
Quote
yes. I can't tell the difference anymore too, but not done a lot of test

my regdump analyzing, I found Canon firm is not touch DC filter. Is it a reason for not touching?
They only touch HPF2 filter on/off only.
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 03:32:36 PM
It seems like more of a noise floor so they always leave it on. When I had it off the meters were always showing activity and up much higher than normal.  They always use ALC too, at higher volumes for some reason.
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 03:51:10 PM
1%
 I confirmed too. So we need to always off this option? I think user can choose setting values. So I think it has no problem when remaining this option.

Remained our TODO:
 -check High pass filter
 -Ext balanced
 -currently not working with Beep(Disable it?)
 -monitor    OK
 -auto int/ext (But just added codes, check my repo)  Confirmed just now.
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 04:03:24 PM
It seems like more of a noise floor so they always leave it on. When I had it off the meters were always showing activity and up much higher than normal.  They always use ALC too, at higher volumes for some reason.

hmm, in my 600D's noise floor is (dc filter)
on > off
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 05:21:38 PM
Confirmed High pass filter


HPF2 filter out function can not be strongly effected , but working.

I used wave from generator.
http://www.ne.jp/asahi/fa/efu/soft/wg/wg.html
Download:http://www.ne.jp/asahi/fa/efu/soft/wg/down_wg.html
Checked 400Hz

Remained our TODO:
 -check High pass filter
 -Ext balanced
 -currently not working with Beep(Disable it?)
 -monitor    OK
 -auto int/ext (But just added codes, check my repo)  Confirmed just now.
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 06:32:54 PM
Quote
So I think it has no problem when remaining this option.

Yea, we should keep it switchable but it will mostly be on unless you need some really quiet sounds.
Title: Re: 600D Audio Controls?
Post by: miyake on August 06, 2012, 07:32:18 PM
scrax, 1% :

I think, It's time to collect volunteer to test/finding the answer for External balanced.
Of course 2.3 is not published yet. So closed test is best in this time.

-2.3 ready
-have 600D
-have balanced mic and XLR to 3.5pin converter.
-have audio experience
-->provide version can't select input. input is "Lint Rbalance1, Lint Rbarance2, ,....." we will check which reg combination is correct.

How do you think? any ideas for testing balance input? or The best thing is we need to wait until 13?
Title: Re: 600D Audio Controls?
Post by: Kromofone on August 06, 2012, 07:43:10 PM
When 2.3 comes out on 13th, I could get to some sound and audio feature testing of the ''ML 600D audio version beta'', if you could provide me with the 600D version of ML then! As I am also a DJ & producer and make high quality stuff (an audiophile, in a matter of speaking), I am very strict, when it comes to sound and quality of it, so it's an advantage for me and possibly Magic Lantern Audio/you.
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 08:02:19 PM
scrax, 1% :

I think, It's time to collect volunteer to test/finding the answer for External balanced.
Of course 2.3 is not published yet. So closed test is best in this time.

-2.3 ready
-have 600D
-have balanced mic and XLR to 3.5pin converter.
-have audio experience
-->provide version can't select input. input is "Lint Rbalance1, Lint Rbarance2, ,....." we will check which reg combination is correct.

How do you think? any ideas for testing balance input? or The best thing is we need to wait until 13?

I'm thinking that a balanced in-600D only autoexec.bin will be ok, so only 600D user with already the 2.3 zip can test it.
But waiting other opinions from the team

right now I'm looking into digital gain to find out why it's changing strange...


Remained our TODO:
-check High pass filter
 -Ext balanced
 -currently not working with Beep(Disable it?)
-monitor    OK
-auto int/ext (But just added codes, check my repo)  Confirmed just now.
 -digital gain fluctuations (checking now)
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 08:21:51 PM
The beeps still give me error 70 but after I press half-shutter the camera comes back. I've never experienced this before. I'd say throw em in the debug... there is space there now.

Before we test we should implement more stuff unless you want to do it concurrently so they're testing the old stuff too.

Quote
balanced mics

Does balance even work the same way? I think we're just switching the polarity of the mics. "Balanced" audio is a joke anyway without a real interface/preamp. Iif you're doing long runs you should be using better gear than 1 long XLR to stereo.

Long runs increase resistance and cause signal loss regardless if you invert the phase of an empty channel to try to cancel out cable noise.

Title: Re: 600D Audio Controls?
Post by: a1ex on August 06, 2012, 09:14:52 PM
The beeps should be OK with 34bff9544599 or newer. The long beep attempts to allocate 1 MB of RAM or so, and the default error handler for AllocateMemory was ERR70. That changeset replaces it with custom error handling code from ML (and in the case of test tones, it will just allocate RAM for a smaller beep).
Title: Re: 600D Audio Controls?
Post by: 1% on August 06, 2012, 09:21:46 PM
I'm using exmem + allocate memory and its not so much the beeps proper as it is the play tone. Its probably related to something I did as I didn't have the problem in g3gg0's longer recording autoexec.

From some testing:

1. Volumes are overwritten as soon as recording starts with  external mic.
2. External mic needs gain+boost up way higher and still seems too quiet. Should be 2 settings?
3. Record button may be setting AGC/ALC and changing what we set up.

* Headphones working at startup now.
Title: Re: 600D Audio Controls?
Post by: scrax on August 06, 2012, 10:56:27 PM
dgain is not working like i'm expecting evenafter some test and mods, i'll push the code for you to check it.
i feel too that canon is making something to our settings because i can't keep analog an digital volume settings when switching on and off audio override.
Title: Re: 600D Audio Controls?
Post by: 1% on August 07, 2012, 12:22:02 AM
Code: [Select]
FF04E1EC: 'mvrChangeAckCBR : Video - Mode=%d, Type=%d, Rate=%d, GOP=%d' FF04E0FC
FF04E308: 'mvrChangeAckCBR : Sound Off' FF04E23C
FF04E324: 'mvrChangeAckCBR : MOVIE_SOUND_RECORD(%d)' FF04E25C
FF04E350: 'mvrChangeAckCBR : Sound Manual(C=%d,R=%d,B=%d)' FF04E284
FF04E380: 'mvrChangeAckCBR : Sound On(C=%d,R=%d,B=%d)' FF04E2AC
FF04E3AC: 'mvrChangeAckCBR : Sound Auto(C=%d,R=%d,B=%d)' FF04E2D4
FF04E3DC: 'mvrChangeAckCBR : MOVIE_REC_VOLUME(L:%d R:%d)' FF04E2EC
FF04E678: 'mvrChangeAckCBR : WindCut Off' FF04E418
FF04E698: 'mvrChangeAckCBR : WindCut On' FF04E434
FF04E6B8: 'mvrChangeAckCBR : PROP_WIND_CUT(%d)'


FF057A60: '[SND] _SoundDeviceTask:%1X'


We should see what some of this stuff does... I think sound dev task might be setting the digital gains, it didn't have audio_ic_writes but changed some other things with parameters.
Title: Re: 600D Audio Controls?
Post by: miyake on August 07, 2012, 05:00:55 AM
@scrax
You already understood codes. So you do not use your fork. Use my repo directory.
Added you to my repo.
Then, we never revert codes.(hg will advice reverted or not when we push codes)
Title: Re: 600D Audio Controls?
Post by: miyake on August 07, 2012, 07:28:57 AM
Now I just added framework for re-override when beep finished in 600D audio.
past problem
 -disable overridden audio after finishing beep

(still regdump diff is including source codes.)

test it please.
Title: Re: 600D Audio Controls?
Post by: miyake on August 07, 2012, 07:57:57 AM
Remained our TODO:
-check High pass filter
 -Ext balanced
 -currently not working with Beep(Disable it?) (double check please
-monitor    OK
-auto int/ext (But just added codes, check my repo)  Confirmed just now.
-digital gain fluctuations (checking now) check OK

I think, analog gain and digital gain are not same width on each gain settings.
It will be confusing to end users , I guess. And Digital gain values distance are little bit big. If we shoot car race, sound is really big. So we need to use digital gain. But the values distance is big now. So I think end user can't set best value for it.

Just remember it, So I didn't use db values.
What do you think?




Title: Re: 600D Audio Controls?
Post by: miyake on August 07, 2012, 08:10:39 AM
Does balance even work the same way? I think we're just switching the polarity of the mics. "Balanced" audio is a joke anyway without a real interface/preamp. Iif you're doing long runs you should be using better gear than 1 long XLR to stereo.

1%
sorry for my poor English, I can't understand these sentence.
my understanding
 -lapis chip support differential in.
 -If we can convert XLR's HOT and COLD to stereo LR, lapis chip can handle to those HOT/COLD phase like a balanced audio amp.
 -We can use long XLR cable and short XLR2stereo cable, and it will provide a low cable noise. such as real balanced audio.

Is this a miss understanding ?
Title: Re: 600D Audio Controls?
Post by: scrax on August 07, 2012, 10:15:24 AM
Remained our TODO:
-check High pass filter
 -Ext balanced
 -currently not working with Beep(Disable it?) (double check please
-monitor    OK
-auto int/ext (But just added codes, check my repo)  Confirmed just now.
-digital gain fluctuations (checking now) check OK

I think, analog gain and digital gain are not same width on each gain settings.
It will be confusing to end users , I guess. And Digital gain values distance are little bit big. If we shoot car race, sound is really big. So we need to use digital gain. But the values distance is big now. So I think end user can't set best value for it.

Just remember it, So I didn't use db values.
What do you think?

digital gain can have a lot more value, but if you uncomment the part I've commented and try it you will see that when set to 0x70, or 0x71 it is not low, I hear a lot of noise, and also at -35dB there is a strange volume change.
maybe i made some mistake
Title: Re: 600D Audio Controls?
Post by: miyake on August 07, 2012, 10:30:05 AM
Ah, OK i see. I will check it.

MSG added
Checked all (0xff-0x70) for recdgain.
Valid is 0xff to (0xff- 127). It's really loud after 128.
And my old code is mask value is miss taken. Correct mask is 0x7f but I was set 0x70. So it's strange.

Will try to solve the codes.

MSG added 2
Newest code added. Which one do you like?
Title: Re: 600D Audio Controls?
Post by: scrax on August 07, 2012, 11:12:49 PM
Miyake,
Volumes control are fine now, i've just made some little changes to help string in menu (not yet finished),

Remained our TODO:
-monitor   Now internal speaker is enabled when monitor is on and no usb-cable connected, this will make a lot of larsen effect with internal mic selected and medium rec volumes, so sadly it's not useful, if you know how to revert to only headphones monitor I think it's better
-Ext balanced (for now we can keep this last I think)
-check High pass filter
-currently not working with Beep(Disable it?) confirmed fworking now for me too
-auto int/ext Confirmed for mee too.
-digital gain fluctuations Confirmed too.

what is maybe possible to (try TO) ADD
from DSP
-3 band notch filter and audio enhancemnet for microphone at recording?
-5 band notch filter/equalizer (Notch/EQ)?
-Loudness
other
-playback limiter (ALC?)

I'm checking in the pdf if we are making all the right changes, or if we can improve something.
I've noticed less pops than before, but not tested a lot with the last code so far.

For example
VMIDCON Reference Power p42 and p58
Quote
VMIDCON[1:0]
These bits control power ON and OFF of the VMID generation circuit. Power up time can be reduced by using high speed power up mode. VMID generation circuit should be changed to normal mode after power up is completed.
Code: [Select]
VMIDCON[1:0]        Description
     00                     VMID generation circuit power off
     01                     VMID generation circuit power on high speed power up mode
     10                     VMID generation circuit power on normal mode
     11                     Write prohibit*
* Normal operation is not guarantied at this setting.

Are we using 01?

and also on p43 there is something about pop noise to investigate more maybe, i'm still reading...:
It is easy to generate pop noise when speker amplifier is power up or down, therefore, the LSI provides two method (functions) to reduce pop noise.
First of all, powerup pop noise can be reduced by the following sequence. When power up speaker amplifire, pre-amplifier power on first, then output amplifier on.These are controled by SPCON bits of Speaker Amplifier Power Management Register. For example, when power is on, write SPCON bits 00h?13h?1Fh in order. When the power down, power off pop noise can be redused by output amplifier off first.
Secondaly, pop noise can be reduced by setting speaker amplifier volume to mute and then execute powerup or powerdown. Amplefier Volume Control Enable Register is provided for this purpose and it has volume mute function and fade function. To write AVMUTE bit to “1”, speaker amplifier volume becomes mute setting by compulsion. In this case, if AVFADE bit is set to “1” also, the fader function becomes on and then, volume change process(mute transition) is executed with fader function.
Title: Re: 600D Audio Controls?
Post by: miyake on August 08, 2012, 03:24:26 AM
Good to hear monitor speaker issue. My first considering, current code will enable speaker when we disconnect headphones. But I don't know why that is SPK is not enabled. cleanup was correct work for us. So I will add SPK disable code today.

I think extra codes (notch filter and so on) will add after finishing current basic codes. Now I re-confirm lapis chip is really noisy. Alex is also said to us a , "The best thing is we can get cleanest audio. If you want to effect audio, you should do post.".  I', strongly agree.
I guess, If we implement those extra functions, but almost user doesn't use it. Because lapis chip is noisy.
One more thing. As I told you ,currently too much difference with main repo. it's really hard to understand merge.
We added more codes, Alex need a much time to understand it.
So we add basic function first. Then add extra code after finishing merge.

will check your codes.


---
Remained our TODO:
-monitor   Now internal speaker is enabled when monitor is on and no usb-cable connected, this will make a lot of larsen effect with internal mic selected and medium rec volumes, so sadly it's not useful, if you know how to revert to only headphones monitor I think it's better
-Ext balanced (for now we can keep this last I think)
-pop noise reduction
-check High pass filter
-currently not working with Beep(Disable it?) confirmed fworking now for me too
-auto int/ext Confirmed for mee too.
-digital gain fluctuations Confirmed too.
-Delete debug code when we finish editting
Title: Re: 600D Audio Controls?
Post by: 1% on August 08, 2012, 03:59:21 AM
Quote
-If we can convert XLR's HOT and COLD to stereo LR, lapis chip can handle to those HOT/COLD phase like a balanced audio amp.

This is what I asked. I don't think it really works that way on the other IC (AK). Balanced audio on those stereo cables involved recording 1 channel and then combining it with inverted second channel to make "balanced" audio. If its really putting + on L and - on R then it might work depending on how good ground is. I only have a preamp, I can build a cable but don't see a point when the preamp is 10x better and takes 2 mics.

Quote
Now I re-confirm lapis chip is really noisy

Noisy or just fighting with canon audio? I get pretty decent sound at rest, before I start recording. I'll have to see what happens with latest changes.

Quote
My first considering, current code will enable speaker when we disconnect headphones.

I think you have to set the speaker as an option. It shouldn't be used with internal mic... only with a further away external mic otherwise feedback is pretty likely. Also, monitor was coming on with audio disabled which isn't good when you're recording without sound and audio IC is using power anyway.

Quote
If you want to effect audio, you should do post.

While this is 100% true some things might be helpful to be done in camera. The filters are already pretty decent and the EQs may help you cut something you don't want to remove in post later or will be unable to once its mixed with everything else. Noise that is never written is better than trying to filter it on your only copy. The reverse could also be true and the digital effects could be really bad, we haven't tried yet.

Quote
and also on p43 there is something about pop noise to investigate more maybe, i'm still reading...:

This is why I set the monitor the way I did. If you don't follow the order you get sudden changes and pops or other weird effects. All this is in the data sheet. You don't get pops in canon audio because thats how they do it. If you look at the original functions  they use the orders in the datasheet and sometimes mute things when changing power, etc.
Title: Re: 600D Audio Controls?
Post by: miyake on August 08, 2012, 04:38:14 AM
Quote
This is what I asked. I don't think it really works that way on the other IC (AK). Balanced audio on those stereo cables involved recording 1 channel and then combining it with inverted second channel to make "balanced" audio. If its really putting + on L and - on R then it might work depending on how good ground is. I only have a preamp, I can build a cable but don't see a point when the preamp is 10x better and takes 2 mics.

I see. And I checked block diagram in PDF. baranced and un-baranced is different cable connection with mic and chip-pins.So I think , we can't input + on L and - on R..

Quote
Noisy or just fighting with canon audio? I get pretty decent sound at rest, before I start recording. I'll have to see what happens with latest changes.
I mean hiss noise.

Quote
I think you have to set the speaker as an option. It shouldn't be used with internal mic... only with a further away external mic otherwise feedback is pretty likely. Also, monitor was coming on with audio disabled which isn't good when you're recording without sound and audio IC is using power anyway.
I also think so too. Basically disable speaker while we using HP monitor.
Anyway, current code doesn't disable speaker . But actually disabled speaker. <= I think this is strange thing.
Might be my poor English is reason for this miss communication ....

Quote
While this is 100% true some things might be helpful to be done in camera. The filters are already pretty decent and the EQs may help you cut something you don't want to remove in post later or will be unable to once its mixed with everything else. Noise that is never written is better than trying to filter it on your only copy. The reverse could also be true and the digital effects could be really bad, we haven't tried yet.
I see.  But You need to add this function in this time? Can you accept to add this function after finishing basic function?
And it has a lot of settings , did you think menu layout?
Title: Re: 600D Audio Controls?
Post by: miyake on August 08, 2012, 04:58:47 AM
scrax:

I can't reproduce SPK issue......
If you still have problems, check audio_ic_set_lineout_onoff().
> if(audio_monitoring){
had a lot of regsiter values setting.but
>    }else{
has few things.
So you need to try to add under follows in }else{ field.
 -head phone amp off on ML_PW_REF_PW_MNG   
or
 -Digi->Ana(DAC) off on ML_PW_DAC_PW_MNG
or
 -Speaker off on ML_PW_SPAMP_PW_MNG

MSG added
Added mute on/off functions. But the mute on/off make a pop noise(lol.  How can I do that.......................
The reason of pop noise is RECPLAY state to AUTOREC bit on.   But it need a 0.5-1.5secs for switching on. So If we completely disable pop noise, we need to add msleep(1500) before mute_off() . But it's too long. So I added 500 now. for testing.
Title: Re: 600D Audio Controls?
Post by: 1% on August 08, 2012, 05:05:21 AM
Quote
Can you accept to add this function after finishing basic function?

Yea, without the basics done we're kinda stuck.

Quote
I mean hiss noise.

You get hiss no matter what, I've gotten hiss on $1000 mics. The way you set in volume + boost may have something to do with it. You're always boosting the highest input volume setting when they really go together. If you look at the block diagram it goes input->PGA->boost->ADC. There should be the option to set them interdependently. You might want X input volume with X boost and it might sound better than really high input volume and no boost. It think boost is power or analog gain, need to research what it actually does. Input volume may just be PGA sensitivity? Its a tough call, they don't go into much detail here.
Title: Re: 600D Audio Controls?
Post by: miyake on August 08, 2012, 05:41:02 AM
1%:
I already have a JuicedLink preamp and RODE video mics. So basically understood those how-to.
My miss understanding is
 a lot of hiss noise = we can't hope a lot of things by lapis chip.

We can use another function(Eq, limitter, and so on) with no-boost and small volumes. And input big volume source.
right?

Anyway, you also have HP monitor and SPK power on issue?
Title: Re: 600D Audio Controls?
Post by: 1% on August 08, 2012, 06:49:46 AM
I'll check it. But another thing to test: is the monitor audio we hear the same as what is being recorded.
Title: Re: 600D Audio Controls?
Post by: miyake on August 08, 2012, 09:16:53 AM
Started to use issue tracker
https://bitbucket.org/miyake_t/magic-lantern600daudio/issues?status=new&status=open
Title: Re: 600D Audio Controls?
Post by: scrax on August 09, 2012, 12:15:40 AM
some things are getting solved. but i have problems in recoding video, strange hangs with battery pull needed.
Title: Re: 600D Audio Controls?
Post by: 1% on August 09, 2012, 12:57:31 AM
DC on/off is switched, I think.
Title: Re: 600D Audio Controls?
Post by: miyake on August 09, 2012, 03:01:28 AM
some things are getting solved. but i have problems in recoding video, strange hangs with battery pull needed.

I guess, same as
https://bitbucket.org/miyake_t/magic-lantern600daudio/changeset/dda0a1ddd6587c71a097141bc5f7f5f33d5f247e

Will try to solve it.
Title: Re: 600D Audio Controls?
Post by: miyake on August 09, 2012, 03:28:25 AM
I guess, same as
https://bitbucket.org/miyake_t/magic-lantern600daudio/changeset/dda0a1ddd6587c71a097141bc5f7f5f33d5f247e

Will try to solve it.


Solved. And If you found issues, please write to issue tracker.
Title: Re: 600D Audio Controls?
Post by: miyake on August 10, 2012, 04:02:48 AM
To 600D-audio early testers: souce code is already opened. If you find a problems, please let me know the detail. on my issue tracker.
https://bitbucket.org/miyake_t/magic-lantern600daudio/issues?status=new&status=open

and source is here:
https://bitbucket.org/miyake_t/magic-lantern600daudio
Title: Re: 600D Audio Controls?
Post by: Ash McKenzie on August 10, 2012, 05:05:46 AM
Anychance of a precomplied autoexec.bin I'm super keen to test and i have balanced mics but I don't know how to complie
Title: Re: 600D Audio Controls?
Post by: miyake on August 10, 2012, 05:20:06 AM
Maybe, we can publish 600D audio autoexec.bin after 2.3 is out by free(13rd). (We need to confirm core team)

One more thing , 600D's lapis-chip has no differential in capability.(chip is supported but internal mic connection is different.)
Disabled balanced now.
Title: Re: 600D Audio Controls?
Post by: johndb on August 10, 2012, 05:24:33 AM
I am very keen on testing the 600D audio as well. I also cannot compile and would prefer the Autoexec.bin.

Thanks for all your hard work.
Title: Re: 600D Audio Controls?
Post by: 1% on August 10, 2012, 08:15:12 AM
Wait the 3 days, trust. Its still not perfect with canon messing up our volumes and such.
Title: Re: 600D Audio Controls?
Post by: juantrueno on August 11, 2012, 06:57:53 AM
This is great! Thanks to all developers, contributors and any one who worked on this project.  Fixing audio on 600D is a great step.
Personally is huge for me and my work!

Thanks again
Title: Re: 600D Audio Controls?
Post by: miyake on August 12, 2012, 04:35:02 PM
Now I'm confirming the release thing of 600D audio beta autoexec.bin to core team through Alex.
If I got replay, I will act up to core team decision.
Title: Re: 600D Audio Controls?
Post by: ilguercio on August 12, 2012, 04:38:42 PM
Nice to know we have some skilled developers apart from A1ex :D
Title: Re: 600D Audio Controls?
Post by: scrax on August 12, 2012, 04:43:45 PM
I have already asked, and it will be released as 600D only bin with explicit text for .identify it as a test only release
Title: Re: 600D Audio Controls?
Post by: miyake on August 12, 2012, 05:24:06 PM
Ah, I see Thanks for your confirming.
Then I will add to NotifyBox() and it will show "600D audio test release" on startup.
 
MSG added
pushed.
Title: Re: 600D Audio Controls?
Post by: scrax on August 12, 2012, 09:51:06 PM
@miyake
I had a lot of other works in those days so only now I have little time for pulling from your fork to test last stuff, some day ago I've added a boost only menu to test the differences using it with lower value than 35dB for analog gain (like 1% suggested).
I'll be at work tomorrow, and be back at this time. Maybe will post in some hour if found something strange.

EDIT: I've tested it and it's good, added more notify info to be sure that it can't be misinterpreted as an official stable build
and pushed on my fork, but since to compile I had to revert back -mlong-calls I don't know if is better that you merge it.

Another question miyake, since b4rt (happy birthday, by the way) made me notice this, a 600D only build (a part from size) could be confused with an unified build and maybe some one will try to load it on another camera and since it will not works people will think tha ML is faulty.
Maybe it's better if we release a unified build that will refuse to load on other camera (i'm looking for MAGIC OFF function, my idea is to force it with another message like: ONLY for 600D - AUDIO TEST release)
done
Title: Re: 600D Audio Controls?
Post by: scrax on August 13, 2012, 03:30:05 AM
Ok, i've pushed the "unified for 600D only" test release, so only 600D user can test audio function and on other camera it will show that is not intended for other camera.

@ miyake
If you can compile without -mlong-calls I think that after 2.3 release you can open a new post asking for testers where to post the autoexec.bin


@testers
Please check:
- if value are right for each option(vol, gain, effect...)
- if all works as expected
- try to figure out the settings  to have the best audio
- audio monitoring
- change modes
- audio trigger
- DC filter


Little menu description of things different from audio menu on other camera:

Override Settings: When On ML controls audio, when Off Canon control audio
Analog gain+boost: raise the volume gain to the max an the use mic boost to 30dB more
Analog mic boost: boost mic volume in +5dB step (same boost used before)
Digital Gain: set global and L/R digital gain
Wind Filter: enable DC filter and HP filter, HP filter frequency

and keep in mind that there is a start-up lag due to the test build message, stable build will be faster at boot.
Title: Re: 600D Audio Controls?
Post by: Kromofone on August 13, 2012, 03:36:32 AM
Count me in for the testing, just paste the link here for the new ''600D ML2.3'' topic, when v2.3 is out!
Title: Re: 600D Audio Controls?
Post by: miyake on August 13, 2012, 06:34:42 AM
@ miyake
If you can compile without -mlong-calls I think that after 2.3 release you can open a new post asking for testers where to post the autoexec.bin

64bit arm gcc need a mlong-calls. main repo doesn't use it. So I moved to 32bit dev environment now. So I don't need mlong-calls.

Anyway, I can't follow your work. Where you push something?

MSG added
Ah, I see. you pushed your repo.  And what do you think how to use it on testers? I can't find autoexec.bin anywhare.

MSG added2
Why you pushed your repo? You can directory push my repo.  I can't understand it's reason. You make a merge work to me.
And, I can make autoexec.bin when I do "make 600D". So we don't need limitation code for another cameras. we also manage those limitation codes until  merge to  main repos.
One more , your order is  checkout your repo and compile it and finally release autoexec.bin , right?
Let me know your considerations.


MSG added3
scrax: Sorry for my confusing, merge is easy way, on bitbucket web functions. Made a pull request myself and accept it.
I can ready to make it.
Title: Re: 600D Audio Controls?
Post by: moftangiu on August 13, 2012, 11:12:02 AM
Count me in for testing guys.

And thank you for your work, making our life easier:)
Title: Re: 600D Audio Controls?
Post by: scrax on August 13, 2012, 11:32:03 AM
Good,
since a1ex is away, we have to compile the test release by ourself.
I have a 64 bit system so I need to use -mlong-calls, but without that it will be smaller. So better to use your dev. env.


need to run to work, se you later
Title: Re: 600D Audio Controls?
Post by: miyake on August 13, 2012, 11:35:09 AM
VMware ESX is great!

Anyway, I think a start-up splash screen is a little bit un-readable , I'm tunning now.
I will show you by you tube. check it.
Title: Re: 600D Audio Controls?
Post by: miyake on August 13, 2012, 11:44:18 AM

How about it?
Title: Re: 600D Audio Controls?
Post by: SDX on August 13, 2012, 06:02:00 PM
First of, good job guys!

Here are my first investigations: it works!

But it's very unstable. I had to remove the battery quite often.

Sometimes I got some noise on the right output (might also be left, maybe i confused the outputs) and the screen turned black. (My right ear still hurts).  I can not exactly say when that happens, but it does while I changed some settings. Also, it happens (every time) when I start up the camera with the headset connected. When that happens, the battery needs to be removed (a few times). Changing the mode via the mode dial seems to help, too.

Sometimes the audiometers show sound, but I can't hear it through the headset. When I go into the menu and change the Output Volume setting to something random, it suddenly works.

The Audio Remote Shoot works well as long the headset works fine.

Also, I noticed that the camera, especially when the noise-on-headset-and-screen-turns-black error occurs, gets hot.

There also is an error in the menu. When I try to change the input source, it loops through the different modes. Looks like scroll-wheel-right event is being triggered for some reason.


I used a external mic (røde stero videomic pro) with a totally standard headset.
It's indeed still not usable for other than testing, but it looks very promising - again: keep up our good work guys!
PS: my ear still hurts - an our after having performed the tests.
Title: Re: 600D Audio Controls?
Post by: 1% on August 13, 2012, 06:40:01 PM
I've yet to experience these freezes... I did the same thing to myself with headset in the begining...
Title: Re: 600D Audio Controls?
Post by: johndb on August 13, 2012, 06:46:46 PM
Where can I download the 600D Audio test Autoexec.bin?
Title: Re: 600D Audio Controls?
Post by: 1% on August 13, 2012, 07:35:30 PM
I have a bin for exfat on my repo now. I can't find the other one either.

https://bitbucket.org/OtherOnePercent/tragic-lantern/downloads
Title: Re: 600D Audio Controls?
Post by: Anton2707 on August 13, 2012, 09:13:36 PM
this version work headphone monitor?
Title: Re: 600D Audio Controls?
Post by: 1% on August 13, 2012, 09:30:59 PM
Yes, that was solved.
Title: Re: 600D Audio Controls?
Post by: scrax on August 13, 2012, 09:49:43 PM
First of, good job guys!

Here are my first investigations: it works!

But it's very unstable. I had to remove the battery quite often.

Sometimes I got some noise on the right output (might also be left, maybe i confused the outputs) and the screen turned black. (My right ear still hurts).  I can not exactly say when that happens, but it does while I changed some settings. Also, it happens (every time) when I start up the camera with the headset connected. When that happens, the battery needs to be removed (a few times). Changing the mode via the mode dial seems to help, too.

Sometimes the audiometers show sound, but I can't hear it through the headset. When I go into the menu and change the Output Volume setting to something random, it suddenly works.

The Audio Remote Shoot works well as long the headset works fine.

Also, I noticed that the camera, especially when the noise-on-headset-and-screen-turns-black error occurs, gets hot.

There also is an error in the menu. When I try to change the input source, it loops through the different modes. Looks like scroll-wheel-right event is being triggered for some reason.


I used a external mic (røde stero videomic pro) with a totally standard headset.
It's indeed still not usable for other than testing, but it looks very promising - again: keep up our good work guys!
PS: my ear still hurts - an our after having performed the tests.

what are you using? it's not yet released...
have you compiled it by yourself?
Title: Re: 600D Audio Controls?
Post by: scrax on August 13, 2012, 09:51:32 PM
Where can I download the 600D Audio test Autoexec.bin?
It will be posted in a few hours
posted here (http://www.magiclantern.fm/forum/index.php?topic=2032.0)
waiting approval (question of few minutes i belive)
Title: Re: 600D Audio Controls?
Post by: SDX on August 13, 2012, 10:58:35 PM
Oh, I'm sorry, i forgot to mention that. I got it from 600Dplus. I could not wait, so i tried to compile it myself - but ended up using the autoexec.bin found there, too.

I'm really sorry, I totally forgot to mention that.
Looking forward for the more "official" release  :)

Title: 600D Audio Controls? You can test them now!
Post by: scrax on August 13, 2012, 11:21:12 PM
@SDX i've pm you.

I think that this topic now can be closed maybe.

The test build is posted here: http://www.magiclantern.fm/forum/index.php?topic=2032.0
Title: Re: 600D Audio Controls?
Post by: nanomad on August 14, 2012, 10:04:05 AM
Temporary locking topic, please provide feedback at http://www.magiclantern.fm/forum/index.php?topic=2032.0
This topic should be used for development only and will be re-opened in 1h
Title: Re: 600D Audio Controls?
Post by: miyake on August 16, 2012, 05:59:48 AM
I'm now investigating gain and boost values.
See this.
http://chirari.ddo.jp/ml/?p=934#more-934 (http://chirari.ddo.jp/ml/?p=934#more-934)

Now confusing what is best method to change a volume with gain and boost values........